Tweak the video autoplay control UI. Set show_timeout to 1s to video autoplay control UI.

This commit is contained in:
Alex Ning 2021-08-26 20:27:19 +08:00
parent 79a7e0f6f6
commit e8386b0c4a
6 changed files with 73 additions and 43 deletions

View File

@ -0,0 +1,11 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid
android:color="#40000000" />
<corners
android:topLeftRadius="16dp"
android:topRightRadius="16dp" />
</shape>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="oval" >
<size android:width="16dp" android:height="16dp"/>
<solid
android:color="#40000000" />
</shape>

View File

@ -6,17 +6,16 @@
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="bottom"
android:orientation="vertical"
android:background="#80000000">
android:orientation="vertical">
<ImageView
android:id="@+id/mute_exo_playback_control_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
android:padding="8dp"
android:layout_toStartOf="@id/fullscreen_exo_playback_control_view"
android:src="@drawable/ic_mute_white_rounded_24dp"
android:background="?actionBarItemBackground"
android:background="@drawable/exo_player_control_button_circular_background"
android:clickable="true"
android:focusable="true"
android:visibility="gone"
@ -30,10 +29,10 @@
android:id="@+id/fullscreen_exo_playback_control_view"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
android:padding="8dp"
android:layout_alignParentEnd="true"
android:src="@drawable/ic_fullscreen_white_rounded_24dp"
android:background="?actionBarItemBackground"
android:background="@drawable/exo_player_control_button_circular_background"
android:clickable="true"
android:focusable="true"
app:layout_constraintTop_toTopOf="parent"
@ -53,60 +52,71 @@
<ImageView android:id="@id/exo_play"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
android:padding="8dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_play_arrow_white_rounded_24dp"
android:background="?actionBarItemBackground"
android:background="@drawable/exo_player_control_button_circular_background"
android:clickable="true"
android:focusable="true" />
<ImageView android:id="@id/exo_pause"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="16dp"
android:padding="8dp"
android:layout_centerInParent="true"
android:src="@drawable/ic_pause_white_rounded_24dp"
android:background="?actionBarItemBackground"
android:background="@drawable/exo_player_control_button_circular_background"
android:clickable="true"
android:focusable="true" />
</FrameLayout>
<TextView
android:id="@id/exo_position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:layout_marginStart="16dp"
android:textColor="#FFFFFF"
android:textSize="?attr/font_default"
android:textStyle="bold"
android:fontFamily="?attr/font_family"
app:layout_constraintBottom_toTopOf="@id/exo_progress"
app:layout_constraintStart_toStartOf="parent" />
<TextView android:id="@id/exo_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:layout_marginEnd="16dp"
android:textColor="#FFFFFF"
android:textSize="?attr/font_default"
android:textStyle="bold"
android:fontFamily="?attr/font_family"
app:layout_constraintBottom_toTopOf="@id/exo_progress"
app:layout_constraintEnd_toEndOf="parent" />
<com.google.android.exoplayer2.ui.DefaultTimeBar
android:id="@id/exo_progress"
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="24dp"
android:layout_marginBottom="8dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
android:layout_height="wrap_content"
android:paddingTop="16dp"
android:background="@drawable/background_autoplay"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:bar_height="2dp" />
app:layout_constraintEnd_toEndOf="parent">
<TextView
android:id="@id/exo_position"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:layout_marginStart="16dp"
android:textColor="#FFFFFF"
android:textSize="?attr/font_default"
android:textStyle="bold"
android:fontFamily="?attr/font_family"
app:layout_constraintBottom_toTopOf="@id/exo_progress"
app:layout_constraintStart_toStartOf="parent" />
<TextView android:id="@id/exo_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:includeFontPadding="false"
android:layout_marginEnd="16dp"
android:textColor="#FFFFFF"
android:textSize="?attr/font_default"
android:textStyle="bold"
android:fontFamily="?attr/font_family"
app:layout_constraintBottom_toTopOf="@id/exo_progress"
app:layout_constraintEnd_toEndOf="parent" />
<com.google.android.exoplayer2.ui.DefaultTimeBar
android:id="@id/exo_progress"
android:layout_width="match_parent"
android:layout_height="24dp"
android:layout_marginBottom="8dp"
android:layout_marginStart="8dp"
android:layout_marginEnd="8dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:bar_height="2dp" />
</androidx.constraintlayout.widget.ConstraintLayout>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -29,6 +29,7 @@
android:id="@+id/player_view_item_post_card_2_video_autoplay"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:show_timeout="1000"
app:controller_layout_id="@layout/exo_autoplay_playback_control_view" />
<pl.droidsonroids.gif.GifImageView

View File

@ -213,6 +213,7 @@
android:id="@+id/player_view_item_post_detail_video_autoplay"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:show_timeout="1000"
app:controller_layout_id="@layout/exo_autoplay_playback_control_view" />
<pl.droidsonroids.gif.GifImageView

View File

@ -206,6 +206,7 @@
android:id="@+id/player_view_item_post_video_type_autoplay"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:show_timeout="1000"
app:controller_layout_id="@layout/exo_autoplay_playback_control_view" />
<pl.droidsonroids.gif.GifImageView