Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can we override visibility of prev and next button ? #7410

Closed
Clement-Jean opened this issue May 22, 2020 · 5 comments
Closed

Can we override visibility of prev and next button ? #7410

Clement-Jean opened this issue May 22, 2020 · 5 comments
Assignees

Comments

@Clement-Jean
Copy link
Contributor

Clement-Jean commented May 22, 2020

After trying to do something like:

<ImageButton android:id="@+id/exo_prev"
             style="@style/ExoMediaButton.Previous"
             android:tint="@color/white"
             android:visibility="gone" />

I noticed that the button doesn't appear on Android studio preview but appears when I'm running the app. I then checked the source code and found that it comes from here:

  private void setButtonEnabled(boolean enabled, @Nullable View view) {
    if (view == null) {
      return;
    }
    view.setEnabled(enabled);
    view.setAlpha(enabled ? buttonAlphaEnabled : buttonAlphaDisabled);
    view.setVisibility(VISIBLE); // HERE
  }

Is there a way to override the visibility or should I do a PR (replacing VISIBLE by view.visibility) ?

EDIT:

Just to be clear, I think it should be possible to display it just under some conditions instead of displaying it automatically. In my case, I have an activity for the portrait mode (shouldn't get displayed) and another for the landscape (should get displayed).

@christosts
Copy link
Contributor

@ojw28 can you take a look?

@ojw28
Copy link
Contributor

ojw28 commented Jun 8, 2020

This is not currently possible, but it's easy for us to add support. Marking as an enhancement.

@ojw28
Copy link
Contributor

ojw28 commented Jun 8, 2020

Actually, it is possible by removing the buttons completely from the layout file (as opposed to still having the buttons but setting their visibility to gone). For your use case you'd need to use a different layout file for portrait and landscape.

We will add setter methods though, since it's a reasonable request and using them will be much simpler than doing as suggested above.

@Clement-Jean
Copy link
Contributor Author

I would like to help, even if its a small PR. is there more than what I said ?

icbaker pushed a commit that referenced this issue Jun 9, 2020
Issue: #7410
PiperOrigin-RevId: 315480798
@ojw28
Copy link
Contributor

ojw28 commented Jun 10, 2020

This is implemented in the commit referenced above.

@ojw28 ojw28 closed this as completed Jun 10, 2020
@google google locked and limited conversation to collaborators Aug 10, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants