1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-01-09 17:00:32 +00:00

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) {

View File

@ -530,6 +530,11 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/player_overlays"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -548,7 +553,6 @@
tools:visibility="visible" />
</LinearLayout>
<RelativeLayout
android:id="@+id/loading_panel"
android:layout_width="match_parent"
@ -643,6 +647,8 @@
tools:visibility="visible" />
</RelativeLayout>
</RelativeLayout>
<TextView
android:id="@+id/resizing_indicator"
android:layout_width="wrap_content"

View File

@ -526,6 +526,11 @@
</RelativeLayout>
<RelativeLayout
android:id="@+id/player_overlays"
android:layout_width="match_parent"
android:layout_height="match_parent">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
@ -544,7 +549,6 @@
tools:visibility="visible" />
</LinearLayout>
<RelativeLayout
android:id="@+id/loading_panel"
android:layout_width="match_parent"
@ -639,6 +643,8 @@
tools:visibility="visible" />
</RelativeLayout>
</RelativeLayout>
<TextView
android:id="@+id/resizing_indicator"
android:layout_width="wrap_content"