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 {
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) {

View File

@ -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" />
<ImageButton
@ -225,7 +224,7 @@
<LinearLayout
android:id="@id/exo_center_controls"
android:layout_width="wrap_content"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@android:color/transparent"
@ -233,25 +232,37 @@
android:gravity="center"
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
android:id="@id/exo_rew_with_amount"
style="@style/ExoStyledControls.Button.Center.RewWithAmount"
android:layout_marginRight="25dp"
android:scaleX="1.1"
android:scaleY="1.1" />
android:layout_marginLeft="20dp"
android:layout_gravity="center" />
</LinearLayout>
<ImageButton
android:id="@id/exo_play_pause"
style="@style/ExoStyledControls.Button.Center.PlayPause"
android:scaleX="1.1"
android:scaleY="1.1" />
style="@style/ExoStyledControls.Button.Center.PlayPause" />
<LinearLayout
android:layout_width="0dp"
android:layout_weight="1"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:id="@id/exo_ffwd_with_amount"
style="@style/ExoStyledControls.Button.Center.FfwdWithAmount"
android:layout_marginLeft="25dp"
android:scaleX="1.1"
android:scaleY="1.1" />
android:layout_gravity="center"
android:layout_marginRight="20dp" />
</LinearLayout>
</LinearLayout>