improve player control margins

This commit is contained in:
Bnyro 2022-07-03 18:13:52 +02:00
parent 94ec50fb7a
commit 64f9f58583
2 changed files with 28 additions and 15 deletions

View File

@ -269,6 +269,7 @@ class PlayerFragment : Fragment() {
playerBinding.fullscreen.setOnClickListener { playerBinding.fullscreen.setOnClickListener {
exoPlayerView.hideController() exoPlayerView.hideController()
if (!isFullScreen) { if (!isFullScreen) {
// go to fullscreen mode
with(binding.playerMotionLayout) { with(binding.playerMotionLayout) {
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)
@ -282,6 +283,7 @@ class PlayerFragment : Fragment() {
val mainActivity = activity as MainActivity val mainActivity = activity as MainActivity
mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE mainActivity.requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE
} else { } else {
// leave fullscreen mode
with(binding.playerMotionLayout) { with(binding.playerMotionLayout) {
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)
@ -1032,14 +1034,14 @@ class PlayerFragment : Fragment() {
} }
private fun lockPlayer(isLocked: Boolean) { 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.exoTopBarRight.visibility = visibility
playerBinding.exoPlayPause.visibility = visibility playerBinding.exoPlayPause.visibility = visibility
playerBinding.exoFfwdWithAmount.visibility = visibility playerBinding.exoFfwdWithAmount.visibility = visibility
playerBinding.exoRewWithAmount.visibility = visibility playerBinding.exoRewWithAmount.visibility = visibility
playerBinding.exoBottomBar.visibility = visibility playerBinding.exoBottomBar.visibility = visibility
playerBinding.exoTitle.visibility = playerBinding.closeImageButton.visibility = visibility
if (isLocked && isFullScreen) View.VISIBLE else View.INVISIBLE playerBinding.exoTitle.visibility = visibility
} }
private fun isSubscribed(button: MaterialButton, channel_id: String) { private fun isSubscribed(button: MaterialButton, channel_id: String) {

View File

@ -49,11 +49,10 @@
android:id="@+id/close_imageButton" android:id="@+id/close_imageButton"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginRight="10dp" android:layout_marginRight="5dp"
android:background="#00FFFFFF" android:background="#00FFFFFF"
android:padding="@dimen/exo_icon_padding" android:padding="@dimen/exo_icon_padding"
android:src="@drawable/ic_close" android:src="@drawable/ic_close"
android:visibility="gone"
app:tint="@android:color/white" /> app:tint="@android:color/white" />
<ImageButton <ImageButton
@ -225,7 +224,7 @@
<LinearLayout <LinearLayout
android:id="@id/exo_center_controls" android:id="@id/exo_center_controls"
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center" android:layout_gravity="center"
android:background="@android:color/transparent" android:background="@android:color/transparent"
@ -233,25 +232,37 @@
android:gravity="center" android:gravity="center"
android:padding="@dimen/exo_styled_controls_padding"> android:padding="@dimen/exo_styled_controls_padding">
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:orientation="vertical">
<Button <Button
android:id="@id/exo_rew_with_amount" android:id="@id/exo_rew_with_amount"
style="@style/ExoStyledControls.Button.Center.RewWithAmount" style="@style/ExoStyledControls.Button.Center.RewWithAmount"
android:layout_marginRight="25dp" android:layout_marginLeft="20dp"
android:scaleX="1.1" android:layout_gravity="center" />
android:scaleY="1.1" />
</LinearLayout>
<ImageButton <ImageButton
android:id="@id/exo_play_pause" android:id="@id/exo_play_pause"
style="@style/ExoStyledControls.Button.Center.PlayPause" style="@style/ExoStyledControls.Button.Center.PlayPause" />
android:scaleX="1.1"
android:scaleY="1.1" /> <LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:orientation="vertical">
<Button <Button
android:id="@id/exo_ffwd_with_amount" android:id="@id/exo_ffwd_with_amount"
style="@style/ExoStyledControls.Button.Center.FfwdWithAmount" style="@style/ExoStyledControls.Button.Center.FfwdWithAmount"
android:layout_marginLeft="25dp" android:layout_gravity="center"
android:scaleX="1.1" android:layout_marginRight="20dp" />
android:scaleY="1.1" />
</LinearLayout>
</LinearLayout> </LinearLayout>