Merge pull request #740 from Bnyro/master

player layout fixes
This commit is contained in:
Bnyro 2022-07-09 22:30:43 +02:00 committed by GitHub
commit ea144b1d4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 49 additions and 56 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,87 +106,94 @@
</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:id="@id/exo_time" android:layout_width="match_parent"
android:layout_width="wrap_content"
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"
android:paddingRight="@dimen/exo_styled_bottom_bar_time_padding"> android:paddingRight="@dimen/exo_styled_bottom_bar_time_padding">
<TextView <LinearLayout
android:id="@id/exo_position" android:id="@id/exo_time"
style="@style/ExoStyledControls.TimeText.Position" /> android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginLeft="5dp">
<TextView style="@style/ExoStyledControls.TimeText.Separator" /> <TextView
android:id="@id/exo_position"
style="@style/ExoStyledControls.TimeText.Position" />
<TextView <TextView style="@style/ExoStyledControls.TimeText.Separator" />
android:id="@id/exo_duration"
style="@style/ExoStyledControls.TimeText.Duration" /> <TextView
android:id="@id/exo_duration"
style="@style/ExoStyledControls.TimeText.Duration" />
</LinearLayout>
<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"
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_gravity="center"
android:textSize="16sp" /> android:ellipsize="end"
android:maxLines="1"
android:textColor="@android:color/white" />
<ImageView <ImageView
android:layout_width="15dp" android:layout_width="15dp"
android:layout_height="15dp" android:layout_height="15dp"
android:layout_gravity="center" android:layout_gravity="center"
android:layout_marginTop="2dp"
android:layout_marginStart="3dp" android:layout_marginStart="3dp"
android:layout_marginTop="2dp"
android:src="@drawable/ic_arrow_right" /> android:src="@drawable/ic_arrow_right" />
</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>
@ -211,18 +218,6 @@
</LinearLayout> </LinearLayout>
</FrameLayout>
<LinearLayout
android:id="@id/exo_minimal_controls"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_marginBottom="@dimen/exo_styled_minimal_controls_margin_bottom"
android:gravity="center_vertical"
android:layoutDirection="ltr"
android:orientation="horizontal">
</LinearLayout> </LinearLayout>
<LinearLayout <LinearLayout