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).
@ojw28 can you take a look?
This is not currently possible, but it's easy for us to add support. Marking as an enhancement.
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.
I would like to help, even if its a small PR. is there more than what I said ?
This is implemented in the commit referenced above.