From bb07bf0df6e2a68be5704ad32e5c8f3618aaaba0 Mon Sep 17 00:00:00 2001 From: GilesMunn Date: Sun, 19 Jun 2022 14:14:49 +0100 Subject: [PATCH] Merged changes --- .../libretube/fragments/PlayerFragment.kt | 22 ++++++------------- 1 file changed, 7 insertions(+), 15 deletions(-) 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 fc5f44e5d..d53c00426 100644 --- a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt @@ -73,7 +73,6 @@ import com.google.android.exoplayer2.source.MediaSource import com.google.android.exoplayer2.source.MergingMediaSource import com.google.android.exoplayer2.source.ProgressiveMediaSource import com.google.android.exoplayer2.ui.AspectRatioFrameLayout -import com.google.android.exoplayer2.ui.DefaultTimeBar import com.google.android.exoplayer2.ui.PlayerNotificationManager import com.google.android.exoplayer2.ui.StyledPlayerView import com.google.android.exoplayer2.upstream.DataSource @@ -192,21 +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 - view.findViewById(R.id.exo_progress).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.exo_progress).visibility = View.VISIBLE - view.findViewById(R.id.aspect_ratio_button) - .visibility = View.VISIBLE + exoPlayerView.showController() + exoPlayerView.useController = true mainMotionLayout.progress = 0.toFloat() } } @@ -1031,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 @@ -1046,6 +1036,8 @@ 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