Fix miniplayer sometimes showing toolbar

This commit is contained in:
ByteHamster 2022-08-27 12:23:16 +02:00
parent 77104c9038
commit 6a0f646506
1 changed files with 5 additions and 0 deletions

View File

@ -239,6 +239,11 @@ public class MainActivity extends CastEnabledActivity {
public void setPlayerVisible(boolean visible) { public void setPlayerVisible(boolean visible) {
getBottomSheet().setLocked(!visible); getBottomSheet().setLocked(!visible);
if (visible) {
bottomSheetCallback.onStateChanged(null, getBottomSheet().getState()); // Update toolbar visibility
} else {
getBottomSheet().setState(BottomSheetBehavior.STATE_COLLAPSED);
}
FragmentContainerView mainView = findViewById(R.id.main_view); FragmentContainerView mainView = findViewById(R.id.main_view);
ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mainView.getLayoutParams(); ViewGroup.MarginLayoutParams params = (ViewGroup.MarginLayoutParams) mainView.getLayoutParams();
params.setMargins(0, 0, 0, visible ? (int) getResources().getDimension(R.dimen.external_player_height) : 0); params.setMargins(0, 0, 0, visible ? (int) getResources().getDimension(R.dimen.external_player_height) : 0);