Merged changes

This commit is contained in:
GilesMunn 2022-06-19 14:14:49 +01:00
parent 62233551eb
commit bb07bf0df6

View File

@ -73,7 +73,6 @@ import com.google.android.exoplayer2.source.MediaSource
import com.google.android.exoplayer2.source.MergingMediaSource import com.google.android.exoplayer2.source.MergingMediaSource
import com.google.android.exoplayer2.source.ProgressiveMediaSource import com.google.android.exoplayer2.source.ProgressiveMediaSource
import com.google.android.exoplayer2.ui.AspectRatioFrameLayout 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.PlayerNotificationManager
import com.google.android.exoplayer2.ui.StyledPlayerView import com.google.android.exoplayer2.ui.StyledPlayerView
import com.google.android.exoplayer2.upstream.DataSource import com.google.android.exoplayer2.upstream.DataSource
@ -192,21 +191,12 @@ class PlayerFragment : Fragment() {
val mainMotionLayout = val mainMotionLayout =
mainActivity.findViewById<MotionLayout>(R.id.mainMotionLayout) mainActivity.findViewById<MotionLayout>(R.id.mainMotionLayout)
if (currentId == eId) { if (currentId == eId) {
view.findViewById<ImageButton>(R.id.exo_play_pause).visibility = View.GONE exoPlayerView.hideController()
view.findViewById<ImageButton>(R.id.quality_select).visibility = View.GONE exoPlayerView.useController = false
view.findViewById<ImageButton>(R.id.close_imageButton).visibility = View.GONE
view.findViewById<TextView>(R.id.quality_text).visibility = View.GONE
view.findViewById<ImageButton>(R.id.aspect_ratio_button).visibility = View.GONE
view.findViewById<DefaultTimeBar>(R.id.exo_progress).visibility = View.GONE
mainMotionLayout.progress = 1.toFloat() mainMotionLayout.progress = 1.toFloat()
} else if (currentId == sId) { } else if (currentId == sId) {
view.findViewById<ImageButton>(R.id.exo_play_pause).visibility = View.VISIBLE exoPlayerView.showController()
view.findViewById<ImageButton>(R.id.quality_select).visibility = View.VISIBLE exoPlayerView.useController = true
view.findViewById<ImageButton>(R.id.close_imageButton).visibility = View.VISIBLE
view.findViewById<TextView>(R.id.quality_text).visibility = View.VISIBLE
view.findViewById<DefaultTimeBar>(R.id.exo_progress).visibility = View.VISIBLE
view.findViewById<ImageButton>(R.id.aspect_ratio_button)
.visibility = View.VISIBLE
mainMotionLayout.progress = 0.toFloat() mainMotionLayout.progress = 0.toFloat()
} }
} }
@ -1031,12 +1021,12 @@ class PlayerFragment : Fragment() {
super.onPictureInPictureModeChanged(isInPictureInPictureMode) super.onPictureInPictureModeChanged(isInPictureInPictureMode)
if (isInPictureInPictureMode) { if (isInPictureInPictureMode) {
exoPlayerView.hideController() exoPlayerView.hideController()
exoPlayerView.useController = false
with(motionLayout) { with(motionLayout) {
getConstraintSet(R.id.start).constrainHeight(R.id.player, -1) getConstraintSet(R.id.start).constrainHeight(R.id.player, -1)
enableTransition(R.id.yt_transition, false) enableTransition(R.id.yt_transition, false)
} }
view?.findViewById<ConstraintLayout>(R.id.main_container)?.isClickable = true view?.findViewById<ConstraintLayout>(R.id.main_container)?.isClickable = true
view?.findViewById<LinearLayout>(R.id.linLayout)?.visibility = View.GONE
view?.findViewById<FrameLayout>(R.id.top_bar)?.visibility = View.GONE view?.findViewById<FrameLayout>(R.id.top_bar)?.visibility = View.GONE
val mainActivity = activity as MainActivity val mainActivity = activity as MainActivity
mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
@ -1046,6 +1036,8 @@ class PlayerFragment : Fragment() {
getConstraintSet(R.id.start).constrainHeight(R.id.player, 0) getConstraintSet(R.id.start).constrainHeight(R.id.player, 0)
enableTransition(R.id.yt_transition, true) enableTransition(R.id.yt_transition, true)
} }
exoPlayerView.showController()
exoPlayerView.useController = true
view?.findViewById<ConstraintLayout>(R.id.main_container)?.isClickable = false view?.findViewById<ConstraintLayout>(R.id.main_container)?.isClickable = false
view?.findViewById<LinearLayout>(R.id.linLayout)?.visibility = View.VISIBLE view?.findViewById<LinearLayout>(R.id.linLayout)?.visibility = View.VISIBLE
view?.findViewById<FrameLayout>(R.id.top_bar)?.visibility = View.VISIBLE view?.findViewById<FrameLayout>(R.id.top_bar)?.visibility = View.VISIBLE