pip fix and cleanup

This commit is contained in:
Bnyro 2022-06-19 13:39:41 +02:00
parent aa1b30eee4
commit 46450e3cf7
4 changed files with 23 additions and 19 deletions

View File

@ -191,19 +191,12 @@ class PlayerFragment : Fragment() {
val mainMotionLayout =
mainActivity.findViewById<MotionLayout>(R.id.mainMotionLayout)
if (currentId == eId) {
view.findViewById<ImageButton>(R.id.exo_play_pause).visibility = View.GONE
view.findViewById<ImageButton>(R.id.quality_select).visibility = View.GONE
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
exoPlayerView.hideController()
exoPlayerView.useController = false
mainMotionLayout.progress = 1.toFloat()
} else if (currentId == sId) {
view.findViewById<ImageButton>(R.id.exo_play_pause).visibility = View.VISIBLE
view.findViewById<ImageButton>(R.id.quality_select).visibility = View.VISIBLE
view.findViewById<ImageButton>(R.id.close_imageButton).visibility = View.VISIBLE
view.findViewById<TextView>(R.id.quality_text).visibility = View.VISIBLE
view.findViewById<ImageButton>(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<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
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<ConstraintLayout>(R.id.main_container)?.isClickable = false
view?.findViewById<LinearLayout>(R.id.linLayout)?.visibility = View.VISIBLE
view?.findViewById<FrameLayout>(R.id.top_bar)?.visibility = View.VISIBLE
}
}

View File

@ -1,10 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="459"
android:viewportHeight="459"
android:tint="?android:attr/colorControlNormal">
android:tint="?android:attr/colorControlNormal"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="#FF000000"
android:pathData="M229.5,0C102.75,0 0,102.75 0,229.5S102.75,459 229.5,459S459,356.25 459,229.5S356.25,0 229.5,0zM310.29,239.65l-111.76,76.08c-3.76,2.56 -8.63,2.83 -12.65,0.7c-4.02,-2.13 -6.54,-6.3 -6.54,-10.85V153.42c0,-4.55 2.52,-8.73 6.54,-10.85c4.02,-2.13 8.89,-1.86 12.65,0.7l111.76,76.08c3.36,2.29 5.37,6.09 5.37,10.15C315.66,233.56 313.65,237.36 310.29,239.65z" />
android:fillColor="@android:color/white"
android:pathData="M8,5v14l11,-7z" />
</vector>

View File

@ -0,0 +1,10 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:viewportWidth="459"
android:viewportHeight="459"
android:tint="?android:attr/colorControlNormal">
<path
android:fillColor="#FF000000"
android:pathData="M229.5,0C102.75,0 0,102.75 0,229.5S102.75,459 229.5,459S459,356.25 459,229.5S356.25,0 229.5,0zM310.29,239.65l-111.76,76.08c-3.76,2.56 -8.63,2.83 -12.65,0.7c-4.02,-2.13 -6.54,-6.3 -6.54,-10.85V153.42c0,-4.55 2.52,-8.73 6.54,-10.85c4.02,-2.13 8.89,-1.86 12.65,0.7l111.76,76.08c3.36,2.29 5.37,6.09 5.37,10.15C315.66,233.56 313.65,237.36 310.29,239.65z" />
</vector>

View File

@ -54,7 +54,7 @@
app:title="@string/buffering_goal" />
<SwitchPreferenceCompat
android:icon="@drawable/ic_play"
android:icon="@drawable/ic_play_filled"
app:key="autoplay"
app:title="@string/player_autoplay"
android:summaryOff="@string/disabled"