Now player's overlays are aware of insets

This commit is contained in:
Avently 2020-10-01 03:10:51 +03:00
parent dd726fac02
commit 26a8bd147b
3 changed files with 222 additions and 196 deletions

View file

@ -172,6 +172,8 @@ public class VideoPlayerImpl extends VideoPlayer
private RecyclerView itemsList;
private ItemTouchHelper itemTouchHelper;
private RelativeLayout playerOverlays;
private boolean queueVisible;
private MainPlayer.PlayerType playerType = MainPlayer.PlayerType.VIDEO;
@ -305,6 +307,8 @@ public class VideoPlayerImpl extends VideoPlayer
this.itemsListCloseButton = view.findViewById(R.id.playQueueClose);
this.itemsList = view.findViewById(R.id.playQueue);
this.playerOverlays = view.findViewById(R.id.player_overlays);
closingOverlayView = view.findViewById(R.id.closingOverlay);
titleTextView.setSelected(true);
@ -481,6 +485,16 @@ public class VideoPlayerImpl extends VideoPlayer
return windowInsets;
});
}
// PlaybackControlRoot already consumed window insets but we should pass them to
// player_overlays too. Without it they will be off-centered
getControlsRoot().addOnLayoutChangeListener((v, left, top, right, bottom,
oldLeft, oldTop, oldRight, oldBottom) ->
playerOverlays.setPadding(
v.getPaddingLeft(),
v.getPaddingTop(),
v.getPaddingRight(),
v.getPaddingBottom()));
}
public boolean onKeyDown(final int keyCode) {