From 46450e3cf7f2ac0d963ad11d2588e842b9e3bc0f Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 19 Jun 2022 13:39:41 +0200 Subject: [PATCH] pip fix and cleanup --- .../libretube/fragments/PlayerFragment.kt | 20 +++++++------------ app/src/main/res/drawable/ic_play.xml | 10 +++++----- app/src/main/res/drawable/ic_play_filled.xml | 10 ++++++++++ app/src/main/res/xml/player_settings.xml | 2 +- 4 files changed, 23 insertions(+), 19 deletions(-) create mode 100644 app/src/main/res/drawable/ic_play_filled.xml diff --git a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt index 65891c22e..7f0e7e74d 100644 --- a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt @@ -191,19 +191,12 @@ class PlayerFragment : Fragment() { val mainMotionLayout = mainActivity.findViewById(R.id.mainMotionLayout) if (currentId == eId) { - view.findViewById(R.id.exo_play_pause).visibility = View.GONE - view.findViewById(R.id.quality_select).visibility = View.GONE - view.findViewById(R.id.close_imageButton).visibility = View.GONE - view.findViewById(R.id.quality_text).visibility = View.GONE - view.findViewById(R.id.aspect_ratio_button).visibility = View.GONE + exoPlayerView.hideController() + exoPlayerView.useController = false mainMotionLayout.progress = 1.toFloat() } else if (currentId == sId) { - view.findViewById(R.id.exo_play_pause).visibility = View.VISIBLE - view.findViewById(R.id.quality_select).visibility = View.VISIBLE - view.findViewById(R.id.close_imageButton).visibility = View.VISIBLE - view.findViewById(R.id.quality_text).visibility = View.VISIBLE - view.findViewById(R.id.aspect_ratio_button) - .visibility = View.VISIBLE + exoPlayerView.showController() + exoPlayerView.useController = true mainMotionLayout.progress = 0.toFloat() } } @@ -1028,12 +1021,12 @@ class PlayerFragment : Fragment() { super.onPictureInPictureModeChanged(isInPictureInPictureMode) if (isInPictureInPictureMode) { exoPlayerView.hideController() + exoPlayerView.useController = false with(motionLayout) { getConstraintSet(R.id.start).constrainHeight(R.id.player, -1) enableTransition(R.id.yt_transition, false) } view?.findViewById(R.id.main_container)?.isClickable = true - view?.findViewById(R.id.linLayout)?.visibility = View.GONE view?.findViewById(R.id.top_bar)?.visibility = View.GONE val mainActivity = activity as MainActivity mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT @@ -1043,8 +1036,9 @@ class PlayerFragment : Fragment() { getConstraintSet(R.id.start).constrainHeight(R.id.player, 0) enableTransition(R.id.yt_transition, true) } + exoPlayerView.showController() + exoPlayerView.useController = true view?.findViewById(R.id.main_container)?.isClickable = false - view?.findViewById(R.id.linLayout)?.visibility = View.VISIBLE view?.findViewById(R.id.top_bar)?.visibility = View.VISIBLE } } diff --git a/app/src/main/res/drawable/ic_play.xml b/app/src/main/res/drawable/ic_play.xml index b8e69d225..6e5745be5 100644 --- a/app/src/main/res/drawable/ic_play.xml +++ b/app/src/main/res/drawable/ic_play.xml @@ -1,10 +1,10 @@ + android:tint="?android:attr/colorControlNormal" + android:viewportWidth="24" + android:viewportHeight="24"> + android:fillColor="@android:color/white" + android:pathData="M8,5v14l11,-7z" /> diff --git a/app/src/main/res/drawable/ic_play_filled.xml b/app/src/main/res/drawable/ic_play_filled.xml new file mode 100644 index 000000000..b8e69d225 --- /dev/null +++ b/app/src/main/res/drawable/ic_play_filled.xml @@ -0,0 +1,10 @@ + + + diff --git a/app/src/main/res/xml/player_settings.xml b/app/src/main/res/xml/player_settings.xml index 477897df2..2e4d84b27 100644 --- a/app/src/main/res/xml/player_settings.xml +++ b/app/src/main/res/xml/player_settings.xml @@ -54,7 +54,7 @@ app:title="@string/buffering_goal" />