[修复] 听书界面按钮状态显示错误与优化 #398
This commit is contained in:
@@ -538,7 +538,19 @@ class AudioPlayActivity :
|
|||||||
binding.cdTimer.setCardBackgroundColor(colorSurfaceContainer)
|
binding.cdTimer.setCardBackgroundColor(colorSurfaceContainer)
|
||||||
binding.cdSpeed.setCardBackgroundColor(colorSurfaceContainer)
|
binding.cdSpeed.setCardBackgroundColor(colorSurfaceContainer)
|
||||||
|
|
||||||
val stateList = ColorStateList.valueOf(colorOnSurface)
|
val states = arrayOf(
|
||||||
|
intArrayOf(android.R.attr.state_enabled, android.R.attr.state_checked),
|
||||||
|
intArrayOf(android.R.attr.state_enabled, -android.R.attr.state_checked),
|
||||||
|
intArrayOf(-android.R.attr.state_enabled)
|
||||||
|
)
|
||||||
|
|
||||||
|
val colors = intArrayOf(
|
||||||
|
colorSurface,
|
||||||
|
colorOnSurface,
|
||||||
|
colorOnSurface.copy(alpha = 0.3f)
|
||||||
|
)
|
||||||
|
|
||||||
|
val stateList = ColorStateList(states, colors)
|
||||||
listOf(
|
listOf(
|
||||||
binding.ivSkipNext, binding.ivSkipPrevious, binding.ivPlayMode, binding.ivTimer,
|
binding.ivSkipNext, binding.ivSkipPrevious, binding.ivPlayMode, binding.ivTimer,
|
||||||
binding.ivChapter, binding.ivFastForward, binding.btnReset, binding.fabPlayStop
|
binding.ivChapter, binding.ivFastForward, binding.btnReset, binding.fabPlayStop
|
||||||
|
|||||||
@@ -40,9 +40,10 @@
|
|||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="0dp"
|
android:layout_height="0dp"
|
||||||
app:cardElevation="16dp"
|
app:cardElevation="16dp"
|
||||||
android:layout_marginHorizontal="44dp"
|
android:layout_marginHorizontal="32dp"
|
||||||
|
android:layout_marginBottom="16dp"
|
||||||
app:layout_constraintDimensionRatio="1:1"
|
app:layout_constraintDimensionRatio="1:1"
|
||||||
app:layout_constraintBottom_toTopOf="@+id/tv_title"
|
app:layout_constraintBottom_toTopOf="@+id/ll_title"
|
||||||
app:layout_constraintEnd_toEndOf="parent"
|
app:layout_constraintEnd_toEndOf="parent"
|
||||||
app:layout_constraintStart_toStartOf="parent"
|
app:layout_constraintStart_toStartOf="parent"
|
||||||
app:layout_constraintTop_toBottomOf="@+id/title_bar"
|
app:layout_constraintTop_toBottomOf="@+id/title_bar"
|
||||||
@@ -122,39 +123,50 @@
|
|||||||
tools:ignore="SmallSp" />
|
tools:ignore="SmallSp" />
|
||||||
</com.google.android.material.card.MaterialCardView>
|
</com.google.android.material.card.MaterialCardView>
|
||||||
|
|
||||||
|
<LinearLayout
|
||||||
<TextView
|
android:id="@+id/ll_title"
|
||||||
android:id="@+id/tv_title"
|
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:gravity="center"
|
android:orientation="vertical"
|
||||||
android:scrollbars="none"
|
android:layout_marginHorizontal="28dp"
|
||||||
android:layout_marginBottom="4dp"
|
app:layout_constraintTop_toBottomOf="@+id/cd_cover"
|
||||||
android:textSize="24sp"
|
app:layout_constraintBottom_toTopOf="@+id/player_progress">
|
||||||
android:textStyle="bold"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/tv_sub_title"
|
<TextView
|
||||||
tools:text="@string/text" />
|
android:id="@+id/tv_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:layout_marginBottom="4dp"
|
||||||
|
android:gravity="center"
|
||||||
|
android:scrollbars="none"
|
||||||
|
android:textSize="20sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/tv_sub_title"
|
||||||
|
tools:text="@string/text" />
|
||||||
|
|
||||||
|
<TextView
|
||||||
|
android:id="@+id/tv_sub_title"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="wrap_content"
|
||||||
|
android:gravity="center"
|
||||||
|
android:scrollbars="none"
|
||||||
|
android:textColor="?attr/colorOnSurfaceVariant"
|
||||||
|
android:textSize="14sp"
|
||||||
|
android:textStyle="bold"
|
||||||
|
app:layout_constraintBottom_toTopOf="@+id/player_progress"
|
||||||
|
tools:text="@string/text" />
|
||||||
|
|
||||||
|
</LinearLayout>
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
|
||||||
android:id="@+id/tv_sub_title"
|
|
||||||
android:layout_width="match_parent"
|
|
||||||
android:layout_height="wrap_content"
|
|
||||||
android:layout_marginTop="4dp"
|
|
||||||
android:layout_marginBottom="16dp"
|
|
||||||
android:gravity="center"
|
|
||||||
android:scrollbars="none"
|
|
||||||
android:textColor="?attr/colorOnSurfaceVariant"
|
|
||||||
android:textSize="17sp"
|
|
||||||
android:textStyle="bold"
|
|
||||||
app:layout_constraintBottom_toTopOf="@+id/player_progress"
|
|
||||||
tools:text="@string/text" />
|
|
||||||
|
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_dur_time"
|
android:id="@+id/tv_dur_time"
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginStart="28dp"
|
android:layout_marginStart="32dp"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
android:text="@string/text"
|
android:text="@string/text"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
@@ -168,22 +180,22 @@
|
|||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_gravity="center_vertical"
|
android:layout_gravity="center_vertical"
|
||||||
android:layout_marginHorizontal="14dp"
|
android:layout_marginHorizontal="16dp"
|
||||||
android:value="0"
|
android:value="0"
|
||||||
android:valueFrom="0"
|
android:valueFrom="0"
|
||||||
android:valueTo="100000"
|
android:valueTo="100000"
|
||||||
app:tickColorInactive="@android:color/transparent"
|
app:tickColorInactive="@android:color/transparent"
|
||||||
app:layout_constraintBottom_toTopOf="@id/tv_all_time"
|
app:layout_constraintBottom_toTopOf="@id/tv_all_time"
|
||||||
app:thumbElevation="0dp"
|
app:thumbElevation="0dp"
|
||||||
app:thumbHeight="20dp"
|
app:thumbHeight="12dp"
|
||||||
app:thumbWidth="4dp"
|
app:thumbWidth="4dp"
|
||||||
app:trackHeight="5dp" />
|
app:trackHeight="2dp" />
|
||||||
|
|
||||||
<TextView
|
<TextView
|
||||||
android:id="@+id/tv_all_time"
|
android:id="@+id/tv_all_time"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:layout_marginEnd="28dp"
|
android:layout_marginEnd="32dp"
|
||||||
android:layout_marginBottom="8dp"
|
android:layout_marginBottom="8dp"
|
||||||
android:text="@string/text"
|
android:text="@string/text"
|
||||||
android:textStyle="bold"
|
android:textStyle="bold"
|
||||||
@@ -205,7 +217,7 @@
|
|||||||
<View
|
<View
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_weight="1" />
|
android:layout_weight="2" />
|
||||||
|
|
||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/iv_skip_previous"
|
android:id="@+id/iv_skip_previous"
|
||||||
@@ -231,9 +243,9 @@
|
|||||||
<com.google.android.material.button.MaterialButton
|
<com.google.android.material.button.MaterialButton
|
||||||
android:id="@+id/fab_play_stop"
|
android:id="@+id/fab_play_stop"
|
||||||
style="@style/Widget.Material3Expressive.Button.IconButton"
|
style="@style/Widget.Material3Expressive.Button.IconButton"
|
||||||
android:layout_width="90dp"
|
android:layout_width="80dp"
|
||||||
android:contentDescription="@string/audio_play"
|
android:contentDescription="@string/audio_play"
|
||||||
android:layout_height="90dp"
|
android:layout_height="80dp"
|
||||||
app:backgroundTint="?attr/colorSecondaryContainer"
|
app:backgroundTint="?attr/colorSecondaryContainer"
|
||||||
app:icon="@drawable/play_anim"
|
app:icon="@drawable/play_anim"
|
||||||
app:iconGravity="textStart"
|
app:iconGravity="textStart"
|
||||||
@@ -279,7 +291,7 @@
|
|||||||
<View
|
<View
|
||||||
android:layout_width="0dp"
|
android:layout_width="0dp"
|
||||||
android:layout_height="1dp"
|
android:layout_height="1dp"
|
||||||
android:layout_weight="1" />
|
android:layout_weight="2" />
|
||||||
|
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user