1
0
mirror of https://github.com/TeamNewPipe/NewPipe synced 2025-01-10 01:10:33 +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 RecyclerView itemsList;
private ItemTouchHelper itemTouchHelper; private ItemTouchHelper itemTouchHelper;
private RelativeLayout playerOverlays;
private boolean queueVisible; private boolean queueVisible;
private MainPlayer.PlayerType playerType = MainPlayer.PlayerType.VIDEO; private MainPlayer.PlayerType playerType = MainPlayer.PlayerType.VIDEO;
@ -305,6 +307,8 @@ public class VideoPlayerImpl extends VideoPlayer
this.itemsListCloseButton = view.findViewById(R.id.playQueueClose); this.itemsListCloseButton = view.findViewById(R.id.playQueueClose);
this.itemsList = view.findViewById(R.id.playQueue); this.itemsList = view.findViewById(R.id.playQueue);
this.playerOverlays = view.findViewById(R.id.player_overlays);
closingOverlayView = view.findViewById(R.id.closingOverlay); closingOverlayView = view.findViewById(R.id.closingOverlay);
titleTextView.setSelected(true); titleTextView.setSelected(true);
@ -481,6 +485,16 @@ public class VideoPlayerImpl extends VideoPlayer
return windowInsets; 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) { public boolean onKeyDown(final int keyCode) {

View File

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

View File

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