This commit is contained in:
Bnyro 2022-07-17 12:19:55 +02:00
parent a705b29b95
commit 803e1546e1
2 changed files with 23 additions and 17 deletions

View File

@ -1222,9 +1222,8 @@ class PlayerFragment : Fragment() {
val captionLanguage = subtitlesNamesList[index]
val captionLanguageCode = subtitleCodesList[index]
// update the icon
// update the icon of the captions button
playerBinding.captions.setImageResource(R.drawable.ic_caption)
playerBinding.captions.setColorFilter(Color.WHITE)
// select the new caption preference
trackSelector.buildUponParameters()
@ -1236,7 +1235,6 @@ class PlayerFragment : Fragment() {
} else {
// none selected
playerBinding.captions.setImageResource(R.drawable.ic_caption_outlined)
playerBinding.captions.setColorFilter(Color.GRAY)
// disable captions
trackSelector.buildUponParameters()
@ -1416,8 +1414,7 @@ class PlayerFragment : Fragment() {
// hide the close image button
playerBinding.closeImageButton.visibility =
if (isLocked &&
!Globals.isFullScreen &&
autoRotationEnabled
!(Globals.isFullScreen && !autoRotationEnabled)
) View.VISIBLE else View.GONE
// disable double tap to seek when the player is locked
@ -1569,10 +1566,22 @@ class PlayerFragment : Fragment() {
// set portrait mode
unsetFullscreen()
with(binding.playerMotionLayout) {
getConstraintSet(R.id.start).constrainHeight(R.id.player, -1)
enableTransition(R.id.yt_transition, false)
}
binding.linLayout.visibility = View.GONE
Globals.isFullScreen = false
} else {
// enable exoPlayer controls again
exoPlayerView.useController = true
with(binding.playerMotionLayout) {
getConstraintSet(R.id.start).constrainHeight(R.id.player, 0)
enableTransition(R.id.yt_transition, true)
}
binding.linLayout.visibility = View.VISIBLE
}
}
@ -1581,7 +1590,7 @@ class PlayerFragment : Fragment() {
binding.playerScrollView.getHitRect(bounds)
if (SDK_INT >= Build.VERSION_CODES.O &&
exoPlayer.isPlaying && (binding.playerScrollView.getLocalVisibleRect(bounds) || Globals.isFullScreen)
(binding.playerScrollView.getLocalVisibleRect(bounds) || Globals.isFullScreen)
) {
activity?.enterPictureInPictureMode(updatePipParams())
}

View File

@ -32,15 +32,15 @@
<ImageView
android:id="@+id/close_imageButton"
style="@style/PlayerControlTop"
android:layout_marginEnd="-10dp"
android:src="@drawable/ic_close"
app:tint="@android:color/white" />
<ImageView
android:id="@+id/lock_player"
style="@style/PlayerControlTop"
android:layout_marginStart="-5dp"
android:scaleX=".9"
android:scaleY=".9"
android:scaleX=".8"
android:scaleY=".8"
android:src="@drawable/ic_unlocked" />
</LinearLayout>
@ -99,7 +99,7 @@
android:id="@+id/captions"
style="@style/PlayerControlTop"
android:src="@drawable/ic_caption_outlined"
app:tint="@android:color/darker_gray" />
app:tint="@android:color/white" />
<ImageButton
android:id="@+id/repeat_toggle"
@ -121,16 +121,14 @@
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="bottom"
android:layout_marginTop="@dimen/exo_styled_bottom_bar_margin_top"
android:layout_marginTop="10dp"
android:orientation="vertical">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingStart="@dimen/exo_styled_bottom_bar_time_padding"
android:paddingLeft="@dimen/exo_styled_bottom_bar_time_padding"
android:paddingEnd="@dimen/exo_styled_bottom_bar_time_padding"
android:paddingRight="@dimen/exo_styled_bottom_bar_time_padding">
android:paddingStart="10dp"
android:paddingEnd="15dp" >
<LinearLayout
android:id="@id/exo_time"
@ -187,7 +185,6 @@
<ImageButton
android:id="@+id/fullscreen"
style="@style/PlayerControlBottom"
android:layout_marginEnd="5dp"
android:src="@drawable/ic_fullscreen"
app:tint="@android:color/white" />
@ -226,7 +223,7 @@
android:background="@android:color/transparent"
android:clipToPadding="false"
android:gravity="center"
android:padding="@dimen/exo_styled_controls_padding">
android:padding="20dp">
<ImageButton
android:id="@id/exo_play_pause"