fix fullscreen chapter layout

This commit is contained in:
Bnyro 2022-07-09 22:30:02 +02:00
parent d134677fc8
commit 782076ebb4
2 changed files with 34 additions and 38 deletions

View File

@ -350,7 +350,6 @@ class PlayerFragment : Fragment() {
"ratio" -> { "ratio" -> {
val videoSize = exoPlayer.videoSize val videoSize = exoPlayer.videoSize
// probably a youtube shorts video // probably a youtube shorts video
Log.e(TAG, videoSize.height.toString() + " " + videoSize.width.toString())
if (videoSize.height > videoSize.width) ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT if (videoSize.height > videoSize.width) ActivityInfo.SCREEN_ORIENTATION_USER_PORTRAIT
// a video with normal aspect ratio // a video with normal aspect ratio
else ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE else ActivityInfo.SCREEN_ORIENTATION_USER_LANDSCAPE
@ -989,7 +988,6 @@ class PlayerFragment : Fragment() {
// check whether the chapter start is greater than the current player position // check whether the chapter start is greater than the current player position
if (it.start!! * 1000 >= currentPosition) chapterName = it.title if (it.start!! * 1000 >= currentPosition) chapterName = it.title
} }
Log.e(TAG, chapterName.toString())
// change the chapter name textView text to the chapterName // change the chapter name textView text to the chapterName
if (chapterName != null && chapterName != playerBinding.chapterName.text) { if (chapterName != null && chapterName != playerBinding.chapterName.text) {
playerBinding.chapterName.text = chapterName playerBinding.chapterName.text = chapterName

View File

@ -106,20 +106,18 @@
</LinearLayout> </LinearLayout>
<FrameLayout <LinearLayout
android:id="@id/exo_bottom_bar" android:id="@id/exo_bottom_bar"
android:layout_width="match_parent" android:layout_width="match_parent"
android:layout_height="@dimen/exo_styled_bottom_bar_height" android:layout_height="wrap_content"
android:layout_gravity="bottom" android:layout_gravity="bottom"
android:layout_marginTop="@dimen/exo_styled_bottom_bar_margin_top" android:layout_marginTop="@dimen/exo_styled_bottom_bar_margin_top"
android:layoutDirection="ltr"> android:orientation="vertical">
<LinearLayout <LinearLayout
android:layout_width="wrap_content" android:layout_width="match_parent"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_gravity="center_vertical|start" android:layout_marginBottom="-10dp"
android:layout_marginBottom="10dp"
android:layoutDirection="ltr"
android:paddingStart="@dimen/exo_styled_bottom_bar_time_padding" android:paddingStart="@dimen/exo_styled_bottom_bar_time_padding"
android:paddingLeft="@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:paddingEnd="@dimen/exo_styled_bottom_bar_time_padding"
@ -128,7 +126,9 @@
<LinearLayout <LinearLayout
android:id="@id/exo_time" android:id="@id/exo_time"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content"> android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp">
<TextView <TextView
android:id="@id/exo_position" android:id="@id/exo_position"
@ -144,10 +144,12 @@
<LinearLayout <LinearLayout
android:id="@+id/chapterLL" android:id="@+id/chapterLL"
android:layout_width="wrap_content" android:layout_width="0dp"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginStart="20dp" android:layout_gravity="center"
android:visibility="gone" > android:layout_marginStart="12dp"
android:layout_weight="1"
android:visibility="invisible">
<TextView <TextView
android:id="@+id/chapter_name" android:id="@+id/chapter_name"
@ -156,8 +158,7 @@
android:layout_gravity="center" android:layout_gravity="center"
android:ellipsize="end" android:ellipsize="end"
android:maxLines="1" android:maxLines="1"
android:textColor="@android:color/white" android:textColor="@android:color/white" />
android:textSize="14sp" />
<ImageView <ImageView
android:layout_width="15dp" android:layout_width="15dp"
@ -169,33 +170,30 @@
</LinearLayout> </LinearLayout>
</LinearLayout> <LinearLayout
android:id="@id/exo_basic_controls"
android:layout_width="wrap_content"
android:layout_height="wrap_content">
<LinearLayout <ImageButton
android:id="@id/exo_basic_controls" android:id="@id/exo_repeat_toggle"
android:layout_width="wrap_content" style="@style/ExoStyledControls.Button.Bottom.RepeatToggle" />
android:layout_height="wrap_content"
android:layout_gravity="center_vertical|end"
android:layout_marginBottom="10dp"
android:layoutDirection="ltr">
<ImageButton <ImageButton
android:id="@id/exo_repeat_toggle" android:id="@id/exo_subtitle"
style="@style/ExoStyledControls.Button.Bottom.RepeatToggle" /> style="@style/ExoStyledControls.Button.Bottom.CC" />
<ImageButton <ImageButton
android:id="@id/exo_subtitle" android:id="@id/exo_settings"
style="@style/ExoStyledControls.Button.Bottom.CC" /> style="@style/ExoStyledControls.Button.Bottom.Settings" />
<ImageButton <ImageButton
android:id="@id/exo_settings" android:id="@+id/fullscreen"
style="@style/ExoStyledControls.Button.Bottom.Settings" /> style="@style/ExoStyledControls.Button.Bottom.FullScreen"
android:src="@drawable/ic_fullscreen"
app:tint="@android:color/white" />
<ImageButton </LinearLayout>
android:id="@+id/fullscreen"
style="@style/ExoStyledControls.Button.Bottom.FullScreen"
android:src="@drawable/ic_fullscreen"
app:tint="@android:color/white" />
</LinearLayout> </LinearLayout>
@ -220,7 +218,7 @@
</LinearLayout> </LinearLayout>
</FrameLayout> </LinearLayout>
<LinearLayout <LinearLayout
android:id="@id/exo_center_controls" android:id="@id/exo_center_controls"