pip fixes

This commit is contained in:
reduplicated 2023-04-11 18:04:24 +02:00
parent 4449347593
commit bdb45b69d3
3 changed files with 968 additions and 952 deletions

View file

@ -184,7 +184,7 @@ abstract class AbstractPlayerFragment(
isInPIPMode = isInPictureInPictureMode isInPIPMode = isInPictureInPictureMode
if (isInPictureInPictureMode) { if (isInPictureInPictureMode) {
// Hide the full-screen UI (controls, etc.) while in picture-in-picture mode. // Hide the full-screen UI (controls, etc.) while in picture-in-picture mode.
player_holder?.alpha = 0f piphide?.isVisible = false
pipReceiver = object : BroadcastReceiver() { pipReceiver = object : BroadcastReceiver() {
override fun onReceive( override fun onReceive(
context: Context, context: Context,
@ -212,7 +212,7 @@ abstract class AbstractPlayerFragment(
updateIsPlaying(Pair(isPlayingValue, isPlayingValue)) updateIsPlaying(Pair(isPlayingValue, isPlayingValue))
} else { } else {
// Restore the full-screen UI. // Restore the full-screen UI.
player_holder?.alpha = 1f piphide?.isVisible = true
exitedPipMode() exitedPipMode()
pipReceiver?.let { pipReceiver?.let {
activity?.unregisterReceiver(it) activity?.unregisterReceiver(it)

File diff suppressed because it is too large Load diff

View file

@ -9,8 +9,9 @@
android:tag="television" android:tag="television"
tools:orientation="vertical"> tools:orientation="vertical">
<FrameLayout <FrameLayout
android:id="@+id/subtitle_holder" android:id="@+id/piphide"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent"> android:layout_height="match_parent">
@ -19,359 +20,365 @@
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="match_parent"
android:background="@drawable/player_gradient_tv" /> android:background="@drawable/player_gradient_tv" />
</FrameLayout> <!--
<!-- <LinearLayout android:layout_width="match_parent"
<LinearLayout android:layout_width="match_parent" android:layout_height="wrap_content"
android:layout_height="wrap_content" android:gravity="end"
android:gravity="end" android:id="@+id/video_lock_holder"
android:id="@+id/video_lock_holder" >
>
<FrameLayout
android:layout_margin="5dp"
android:layout_width="match_parent"
android:layout_height="wrap_content"
tools:ignore="UselessParent">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_margin="20dp"
android:id="@+id/video_locked_img"
android:layout_gravity="end|center_vertical"
android:src="@drawable/video_locked">
</ImageView>
<ImageView
android:id="@+id/video_lock"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_gravity="end|center_vertical"
android:focusable="true"
android:clickable="true"
android:background="@drawable/video_tap_button_always_white">
</ImageView>
</FrameLayout>
</LinearLayout>
-->
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/player_video_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<FrameLayout <FrameLayout
android:layout_margin="5dp" android:id="@+id/player_top_holder"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/player_video_title"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
tools:ignore="UselessParent"> android:layout_marginStart="80dp"
<ImageView android:layout_marginTop="20dp"
android:layout_width="30dp" android:layout_marginEnd="32dp"
android:layout_height="30dp" android:gravity="end"
android:layout_margin="20dp" android:textColor="@color/white"
android:id="@+id/video_locked_img" android:textSize="16sp"
android:layout_gravity="end|center_vertical" android:textStyle="bold"
android:src="@drawable/video_locked"> tools:text="Hello world" />
</ImageView>
<ImageView <TextView
android:id="@+id/video_lock" android:id="@+id/player_video_title_rez"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="80dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="32dp"
android:gravity="end"
android:textColor="@color/white"
android:textSize="16sp"
tools:text="1920x1080" />
<!-- Removed as it has no use anymore-->
<!--<androidx.mediarouter.app.MediaRouteButton
android:id="@+id/player_media_route_button"
android:layout_width="70dp" android:layout_width="70dp"
android:layout_height="70dp" android:layout_height="70dp"
android:layout_gravity="end|center_vertical" android:layout_gravity="end"
android:focusable="true" android:layout_margin="5dp"
android:clickable="true" android:mediaRouteTypes="user"
android:background="@drawable/video_tap_button_always_white"> android:visibility="visible"
</ImageView> app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />-->
<FrameLayout
android:id="@+id/player_go_back_holder"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_margin="5dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:layout_width="30dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:contentDescription="@string/go_back_img_des"
android:src="@drawable/ic_baseline_arrow_back_24"
app:tint="@android:color/white" />
<ImageView
android:id="@+id/player_go_back"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_gravity="center"
android:background="@drawable/video_tap_button_always_white"
android:clickable="true"
android:contentDescription="@string/go_back_img_des"
android:focusable="true" />
</FrameLayout>
</FrameLayout> </FrameLayout>
</LinearLayout> <!--use for thinner app:trackThickness="3dp" com.google.android.material.progressindicator.CircularProgressIndicator-->
--> <ProgressBar
android:id="@+id/player_buffering"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/player_video_holder"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:padding="16dp">
<FrameLayout
android:id="@+id/player_top_holder"
android:layout_width="match_parent"
android:layout_height="match_parent">
<TextView
android:id="@+id/player_video_title"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="80dp"
android:layout_marginTop="20dp"
android:layout_marginEnd="32dp"
android:gravity="end"
android:textColor="@color/white"
android:textSize="16sp"
android:textStyle="bold"
tools:text="Hello world" />
<TextView
android:id="@+id/player_video_title_rez"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="80dp"
android:layout_marginTop="40dp"
android:layout_marginEnd="32dp"
android:gravity="end"
android:textColor="@color/white"
android:textSize="16sp"
tools:text="1920x1080" />
<!-- Removed as it has no use anymore-->
<!--<androidx.mediarouter.app.MediaRouteButton
android:id="@+id/player_media_route_button"
android:layout_width="70dp"
android:layout_height="70dp"
android:layout_gravity="end"
android:layout_margin="5dp"
android:mediaRouteTypes="user"
android:visibility="visible"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent" />-->
<FrameLayout
android:id="@+id/player_go_back_holder"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_margin="5dp" android:layout_gravity="center"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent">
<ImageView android:clickable="false"
android:layout_width="30dp" android:focusable="false"
android:layout_height="30dp" android:focusableInTouchMode="false"
android:layout_gravity="center"
android:contentDescription="@string/go_back_img_des"
android:src="@drawable/ic_baseline_arrow_back_24"
app:tint="@android:color/white" />
<ImageView android:indeterminate="true"
android:id="@+id/player_go_back" android:visibility="gone"
android:layout_width="70dp" app:layout_constraintBottom_toBottomOf="parent"
android:layout_height="70dp" app:layout_constraintLeft_toLeftOf="parent"
android:layout_gravity="center" app:layout_constraintRight_toRightOf="parent"
android:background="@drawable/video_tap_button_always_white" app:layout_constraintTop_toTopOf="parent"
android:clickable="true" tools:visibility="visible" />
android:contentDescription="@string/go_back_img_des"
android:focusable="true" />
</FrameLayout>
</FrameLayout>
<!--use for thinner app:trackThickness="3dp" com.google.android.material.progressindicator.CircularProgressIndicator-->
<ProgressBar
android:id="@+id/player_buffering"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:clickable="false"
android:focusable="false"
android:focusableInTouchMode="false"
android:indeterminate="true"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
tools:visibility="visible" />
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginBottom="20dp"
android:gravity="center"
android:orientation="horizontal"
android:paddingTop="4dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<ImageButton
android:id="@id/exo_prev"
style="@style/ExoMediaButton.Previous"
android:tintMode="src_in"
app:tint="?attr/colorPrimaryDark"
tools:ignore="ContentDescription" />
<ImageButton
android:id="@id/exo_repeat_toggle"
style="@style/ExoMediaButton"
android:tintMode="src_in"
app:tint="?attr/colorPrimaryDark"
tools:ignore="ContentDescription" />
<ImageButton
android:id="@id/exo_next"
style="@style/ExoMediaButton.Next"
android:tintMode="src_in"
app:tint="?attr/colorPrimaryDark"
tools:ignore="ContentDescription" />
<ImageButton
android:id="@id/exo_vr"
style="@style/ExoMediaButton.VR"
android:tintMode="src_in"
app:tint="?attr/colorPrimaryDark"
tools:ignore="ContentDescription" />
<ImageButton
android:id="@id/exo_play"
android:layout_width="0dp"
android:layout_height="0dp"
android:tintMode="src_in"
app:tint="?attr/colorPrimaryDark"
tools:ignore="ContentDescription" />
<ImageButton
android:id="@id/exo_pause"
android:layout_width="0dp"
android:layout_height="0dp"
android:tintMode="src_in"
app:tint="?attr/colorPrimaryDark"
tools:ignore="ContentDescription" />
</LinearLayout>
<LinearLayout
android:id="@+id/bottom_player_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="64dp"
android:layout_marginEnd="64dp"
android:layout_marginBottom="10dp"
android:gravity="center_vertical"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<LinearLayout <LinearLayout
android:id="@+id/player_video_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layoutDirection="ltr" android:layout_gravity="bottom"
android:orientation="horizontal"> android:layout_marginBottom="20dp"
android:gravity="center"
android:orientation="horizontal"
android:paddingTop="4dp"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent">
<ImageView <ImageButton
android:id="@+id/player_pause_play" android:id="@id/exo_prev"
android:layout_width="30dp" style="@style/ExoMediaButton.Previous"
android:layout_height="30dp" android:tintMode="src_in"
android:layout_gravity="center" app:tint="?attr/colorPrimaryDark"
android:layout_marginStart="20dp"
android:background="@drawable/video_tap_button"
android:focusable="true"
android:focusableInTouchMode="true"
android:nextFocusUp="@id/player_go_back"
android:nextFocusDown="@id/player_lock"
android:src="@drawable/netflix_pause"
app:tint="@color/player_button_tv"
tools:ignore="ContentDescription" /> tools:ignore="ContentDescription" />
<TextView
android:id="@id/exo_position" <ImageButton
android:layout_width="wrap_content" android:id="@id/exo_repeat_toggle"
android:layout_height="wrap_content" style="@style/ExoMediaButton"
android:layout_gravity="center" android:tintMode="src_in"
android:gravity="end" app:tint="?attr/colorPrimaryDark"
android:includeFontPadding="false" tools:ignore="ContentDescription" />
android:minWidth="50dp"
android:paddingLeft="4dp"
android:paddingRight="4dp" <ImageButton
android:textColor="@android:color/white" android:id="@id/exo_next"
android:textSize="14sp" style="@style/ExoMediaButton.Next"
android:textStyle="normal" android:tintMode="src_in"
tools:text="15:30" /> app:tint="?attr/colorPrimaryDark"
<!--app:buffered_color="@color/videoCache"--> tools:ignore="ContentDescription" />
<com.google.android.exoplayer2.ui.DefaultTimeBar
android:id="@id/exo_progress" <ImageButton
android:id="@id/exo_vr"
style="@style/ExoMediaButton.VR"
android:tintMode="src_in"
app:tint="?attr/colorPrimaryDark"
tools:ignore="ContentDescription" />
<ImageButton
android:id="@id/exo_play"
android:layout_width="0dp" android:layout_width="0dp"
android:layout_height="30dp" android:layout_height="0dp"
android:layout_gravity="center" android:tintMode="src_in"
android:layout_weight="1" app:tint="?attr/colorPrimaryDark"
android:focusable="false" tools:ignore="ContentDescription" />
android:focusableInTouchMode="false"
app:bar_height="2dp"
app:played_color="?attr/colorPrimary"
app:scrubber_color="?attr/colorPrimary"
app:scrubber_dragged_size="26dp"
app:scrubber_enabled_size="24dp"
app:unplayed_color="@color/videoProgress" />
<!-- exo_duration-->
<TextView
android:id="@id/exo_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginEnd="20dp"
android:includeFontPadding="false"
android:minWidth="50dp"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:textColor="@android:color/white"
android:textSize="14sp"
android:textStyle="normal"
tools:text="23:20" />
<ImageButton
android:id="@id/exo_pause"
android:layout_width="0dp"
android:layout_height="0dp"
android:tintMode="src_in"
app:tint="?attr/colorPrimaryDark"
tools:ignore="ContentDescription" />
</LinearLayout> </LinearLayout>
<HorizontalScrollView <LinearLayout
android:layout_width="wrap_content" android:id="@+id/bottom_player_bar"
android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center"> android:layout_marginStart="64dp"
android:layout_marginEnd="64dp"
android:layout_marginBottom="10dp"
android:gravity="center_vertical"
android:orientation="vertical"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toStartOf="parent">
<LinearLayout <LinearLayout
android:id="@+id/player_lock_holder" android:id="@+id/player_video_bar"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="match_parent" android:layout_height="wrap_content"
android:layoutDirection="ltr"
android:orientation="horizontal"> android:orientation="horizontal">
<com.google.android.material.button.MaterialButton <ImageView
android:id="@+id/player_resize_btt" android:id="@+id/player_pause_play"
style="@style/VideoButtonTV" android:layout_width="30dp"
android:nextFocusLeft="@id/player_lock" android:layout_height="30dp"
android:nextFocusRight="@id/player_speed_btt" android:layout_gravity="center"
android:nextFocusUp="@id/player_pause_play" android:layout_marginStart="20dp"
android:text="@string/video_aspect_ratio_resize" android:background="@drawable/video_tap_button"
app:icon="@drawable/ic_baseline_aspect_ratio_24" /> android:focusable="true"
android:focusableInTouchMode="true"
android:nextFocusUp="@id/player_go_back"
android:nextFocusDown="@id/player_lock"
<com.google.android.material.button.MaterialButton android:src="@drawable/netflix_pause"
android:id="@+id/player_speed_btt" app:tint="@color/player_button_tv"
style="@style/VideoButtonTV" tools:ignore="ContentDescription" />
android:nextFocusLeft="@id/player_resize_btt"
android:nextFocusRight="@id/player_subtitle_offset_btt"
android:nextFocusUp="@id/player_pause_play"
app:icon="@drawable/ic_baseline_speed_24"
tools:text="Speed" />
<com.google.android.material.button.MaterialButton <TextView
android:id="@+id/player_subtitle_offset_btt" android:id="@id/exo_position"
style="@style/VideoButtonTV" android:layout_width="wrap_content"
android:nextFocusLeft="@id/player_speed_btt" android:layout_height="wrap_content"
android:nextFocusRight="@id/player_sources_btt" android:layout_gravity="center"
android:text="@string/subtitle_offset" android:gravity="end"
android:includeFontPadding="false"
android:minWidth="50dp"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:textColor="@android:color/white"
android:textSize="14sp"
android:textStyle="normal"
tools:text="15:30" />
<!--app:buffered_color="@color/videoCache"-->
<com.google.android.exoplayer2.ui.DefaultTimeBar
android:id="@id/exo_progress"
android:layout_width="0dp"
android:layout_height="30dp"
android:layout_gravity="center"
android:layout_weight="1"
android:focusable="false"
android:focusableInTouchMode="false"
app:bar_height="2dp"
app:played_color="?attr/colorPrimary"
app:scrubber_color="?attr/colorPrimary"
app:scrubber_dragged_size="26dp"
app:scrubber_enabled_size="24dp"
app:unplayed_color="@color/videoProgress" />
android:visibility="gone" <!-- exo_duration-->
app:icon="@drawable/ic_outline_subtitles_24" <TextView
tools:visibility="visible" /> android:id="@id/exo_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginEnd="20dp"
android:includeFontPadding="false"
android:minWidth="50dp"
android:paddingLeft="4dp"
android:paddingRight="4dp"
android:textColor="@android:color/white"
android:textSize="14sp"
android:textStyle="normal"
tools:text="23:20" />
<com.google.android.material.button.MaterialButton
android:id="@+id/player_sources_btt"
style="@style/VideoButtonTV"
android:nextFocusLeft="@id/player_subtitle_offset_btt"
android:nextFocusRight="@id/player_tracks_btt"
android:nextFocusUp="@id/player_pause_play"
android:text="@string/video_source"
app:icon="@drawable/ic_baseline_playlist_play_24" />
<com.google.android.material.button.MaterialButton
android:id="@+id/player_tracks_btt"
style="@style/VideoButtonTV"
android:nextFocusLeft="@id/player_sources_btt"
android:nextFocusRight="@id/player_skip_op"
android:nextFocusUp="@id/player_pause_play"
android:text="@string/tracks"
app:icon="@drawable/ic_baseline_playlist_play_24" />
<com.google.android.material.button.MaterialButton
android:id="@+id/player_skip_op"
style="@style/VideoButtonTV"
android:nextFocusLeft="@id/player_sources_btt"
android:nextFocusRight="@id/player_skip_episode"
android:nextFocusUp="@id/player_pause_play"
android:text="@string/video_skip_op"
app:icon="@drawable/ic_baseline_fast_forward_24" />
<com.google.android.material.button.MaterialButton
android:id="@+id/player_skip_episode"
style="@style/VideoButtonTV"
android:nextFocusLeft="@id/player_skip_op"
android:nextFocusRight="@id/player_lock"
android:nextFocusUp="@id/player_pause_play"
android:text="@string/next_episode"
app:icon="@drawable/ic_baseline_skip_next_24" />
</LinearLayout> </LinearLayout>
</HorizontalScrollView>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<HorizontalScrollView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center">
<LinearLayout
android:id="@+id/player_lock_holder"
android:layout_width="wrap_content"
android:layout_height="match_parent"
android:orientation="horizontal">
<com.google.android.material.button.MaterialButton
android:id="@+id/player_resize_btt"
style="@style/VideoButtonTV"
android:nextFocusLeft="@id/player_lock"
android:nextFocusRight="@id/player_speed_btt"
android:nextFocusUp="@id/player_pause_play"
android:text="@string/video_aspect_ratio_resize"
app:icon="@drawable/ic_baseline_aspect_ratio_24" />
<com.google.android.material.button.MaterialButton
android:id="@+id/player_speed_btt"
style="@style/VideoButtonTV"
android:nextFocusLeft="@id/player_resize_btt"
android:nextFocusRight="@id/player_subtitle_offset_btt"
android:nextFocusUp="@id/player_pause_play"
app:icon="@drawable/ic_baseline_speed_24"
tools:text="Speed" />
<com.google.android.material.button.MaterialButton
android:id="@+id/player_subtitle_offset_btt"
style="@style/VideoButtonTV"
android:nextFocusLeft="@id/player_speed_btt"
android:nextFocusRight="@id/player_sources_btt"
android:text="@string/subtitle_offset"
android:visibility="gone"
app:icon="@drawable/ic_outline_subtitles_24"
tools:visibility="visible" />
<com.google.android.material.button.MaterialButton
android:id="@+id/player_sources_btt"
style="@style/VideoButtonTV"
android:nextFocusLeft="@id/player_subtitle_offset_btt"
android:nextFocusRight="@id/player_tracks_btt"
android:nextFocusUp="@id/player_pause_play"
android:text="@string/video_source"
app:icon="@drawable/ic_baseline_playlist_play_24" />
<com.google.android.material.button.MaterialButton
android:id="@+id/player_tracks_btt"
style="@style/VideoButtonTV"
android:nextFocusLeft="@id/player_sources_btt"
android:nextFocusRight="@id/player_skip_op"
android:nextFocusUp="@id/player_pause_play"
android:text="@string/tracks"
app:icon="@drawable/ic_baseline_playlist_play_24" />
<com.google.android.material.button.MaterialButton
android:id="@+id/player_skip_op"
style="@style/VideoButtonTV"
android:nextFocusLeft="@id/player_sources_btt"
android:nextFocusRight="@id/player_skip_episode"
android:nextFocusUp="@id/player_pause_play"
android:text="@string/video_skip_op"
app:icon="@drawable/ic_baseline_fast_forward_24" />
<com.google.android.material.button.MaterialButton
android:id="@+id/player_skip_episode"
style="@style/VideoButtonTV"
android:nextFocusLeft="@id/player_skip_op"
android:nextFocusRight="@id/player_lock"
android:nextFocusUp="@id/player_pause_play"
android:text="@string/next_episode"
app:icon="@drawable/ic_baseline_skip_next_24" />
</LinearLayout>
</HorizontalScrollView>
</LinearLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
</FrameLayout>
<FrameLayout
android:id="@+id/subtitle_holder"
android:layout_width="match_parent"
android:layout_height="match_parent">
</FrameLayout>
</FrameLayout> </FrameLayout>