From 64f9f5858355df597ff838c550f7f70a2b5d4ae2 Mon Sep 17 00:00:00 2001 From: Bnyro Date: Sun, 3 Jul 2022 18:13:52 +0200 Subject: [PATCH] improve player control margins --- .../libretube/fragments/PlayerFragment.kt | 8 +++-- .../layout/exo_styled_player_control_view.xml | 35 ++++++++++++------- 2 files changed, 28 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 5b787ba2d..d7c09b415 100644 --- a/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt +++ b/app/src/main/java/com/github/libretube/fragments/PlayerFragment.kt @@ -269,6 +269,7 @@ class PlayerFragment : Fragment() { playerBinding.fullscreen.setOnClickListener { exoPlayerView.hideController() if (!isFullScreen) { + // go to fullscreen mode with(binding.playerMotionLayout) { getConstraintSet(R.id.start).constrainHeight(R.id.player, -1) enableTransition(R.id.yt_transition, false) @@ -282,6 +283,7 @@ class PlayerFragment : Fragment() { val mainActivity = activity as MainActivity mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE } else { + // leave fullscreen mode with(binding.playerMotionLayout) { getConstraintSet(R.id.start).constrainHeight(R.id.player, 0) enableTransition(R.id.yt_transition, true) @@ -1032,14 +1034,14 @@ class PlayerFragment : Fragment() { } private fun lockPlayer(isLocked: Boolean) { - val visibility = if (isLocked) View.VISIBLE else View.INVISIBLE + val visibility = if (isLocked) View.VISIBLE else View.GONE playerBinding.exoTopBarRight.visibility = visibility playerBinding.exoPlayPause.visibility = visibility playerBinding.exoFfwdWithAmount.visibility = visibility playerBinding.exoRewWithAmount.visibility = visibility playerBinding.exoBottomBar.visibility = visibility - playerBinding.exoTitle.visibility = - if (isLocked && isFullScreen) View.VISIBLE else View.INVISIBLE + playerBinding.closeImageButton.visibility = visibility + playerBinding.exoTitle.visibility = visibility } private fun isSubscribed(button: MaterialButton, channel_id: String) { diff --git a/app/src/main/res/layout/exo_styled_player_control_view.xml b/app/src/main/res/layout/exo_styled_player_control_view.xml index 4198611ec..8cc0ada44 100644 --- a/app/src/main/res/layout/exo_styled_player_control_view.xml +++ b/app/src/main/res/layout/exo_styled_player_control_view.xml @@ -49,11 +49,10 @@ android:id="@+id/close_imageButton" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginRight="10dp" + android:layout_marginRight="5dp" android:background="#00FFFFFF" android:padding="@dimen/exo_icon_padding" android:src="@drawable/ic_close" - android:visibility="gone" app:tint="@android:color/white" /> + +