|
|
@@ -1,8 +1,8 @@
|
|
|
package io.legado.app.ui.book.read.sheet
|
|
|
|
|
|
import androidx.compose.foundation.layout.Arrangement
|
|
|
+import androidx.compose.foundation.layout.Box
|
|
|
import androidx.compose.foundation.layout.Column
|
|
|
-import androidx.compose.foundation.layout.FlowRow
|
|
|
import androidx.compose.foundation.layout.Row
|
|
|
import androidx.compose.foundation.layout.Spacer
|
|
|
import androidx.compose.foundation.layout.fillMaxWidth
|
|
|
@@ -22,6 +22,10 @@ import androidx.compose.material.icons.filled.VisibilityOff
|
|
|
import androidx.compose.material3.MaterialTheme
|
|
|
import androidx.compose.material3.Text
|
|
|
import androidx.compose.runtime.Composable
|
|
|
+import androidx.compose.runtime.getValue
|
|
|
+import androidx.compose.runtime.mutableStateOf
|
|
|
+import androidx.compose.runtime.remember
|
|
|
+import androidx.compose.runtime.setValue
|
|
|
import androidx.compose.ui.Alignment
|
|
|
import androidx.compose.ui.Modifier
|
|
|
import androidx.compose.ui.res.stringResource
|
|
|
@@ -31,6 +35,8 @@ import io.legado.app.domain.model.PlaybackTimer
|
|
|
import io.legado.app.ui.book.read.ReadBookIntent
|
|
|
import io.legado.app.ui.book.read.ReadBookUiState
|
|
|
import io.legado.app.ui.widget.components.button.series.MediumTonalButton
|
|
|
+import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenu
|
|
|
+import io.legado.app.ui.widget.components.menuItem.RoundDropdownMenuItem
|
|
|
import io.legado.app.ui.widget.components.settingItem.TinySliderSettingItem
|
|
|
import io.legado.app.ui.widget.components.settingItem.TinySwitchSettingItem
|
|
|
|
|
|
@@ -47,6 +53,7 @@ fun ReadAloudContent(
|
|
|
) {
|
|
|
val timerMinute = state.readAloudTtsTimer
|
|
|
val ttsSpeechRate = state.readAloudTtsSpeechRate
|
|
|
+ var timerMenuExpanded by remember { mutableStateOf(false) }
|
|
|
|
|
|
Column(
|
|
|
modifier = modifier.fillMaxWidth(),
|
|
|
@@ -102,21 +109,6 @@ fun ReadAloudContent(
|
|
|
|
|
|
Spacer(Modifier.height(8.dp))
|
|
|
|
|
|
- FlowRow(
|
|
|
- modifier = Modifier.fillMaxWidth(),
|
|
|
- horizontalArrangement = Arrangement.spacedBy(6.dp, Alignment.CenterHorizontally),
|
|
|
- verticalArrangement = Arrangement.spacedBy(6.dp),
|
|
|
- ) {
|
|
|
- listOf(0, 5, 10, 15, 30, 60, 90).forEach { minute ->
|
|
|
- MediumTonalButton(
|
|
|
- onClick = { onIntent(ReadBookIntent.SetReadAloudTtsTimer(minute)) },
|
|
|
- text = stringResource(R.string.timer_m, minute),
|
|
|
- )
|
|
|
- }
|
|
|
- }
|
|
|
-
|
|
|
- Spacer(Modifier.height(8.dp))
|
|
|
-
|
|
|
Row(
|
|
|
modifier = Modifier.fillMaxWidth(),
|
|
|
horizontalArrangement = Arrangement.spacedBy(8.dp),
|
|
|
@@ -126,12 +118,28 @@ fun ReadAloudContent(
|
|
|
text = stringResource(R.string.previous_chapter),
|
|
|
modifier = Modifier.weight(1f),
|
|
|
)
|
|
|
- MediumTonalButton(
|
|
|
- onClick = { onIntent(ReadBookIntent.SaveReadAloudTtsTimer(timerMinute)) },
|
|
|
- icon = Icons.Default.Alarm,
|
|
|
- contentDescription = stringResource(R.string.save_tts_timer),
|
|
|
- modifier = Modifier.weight(1f),
|
|
|
- )
|
|
|
+ Box(modifier = Modifier.weight(1f), contentAlignment = Alignment.Center) {
|
|
|
+ MediumTonalButton(
|
|
|
+ onClick = { timerMenuExpanded = true },
|
|
|
+ icon = Icons.Default.Alarm,
|
|
|
+ contentDescription = stringResource(R.string.timer_m, timerMinute),
|
|
|
+ )
|
|
|
+ RoundDropdownMenu(
|
|
|
+ expanded = timerMenuExpanded,
|
|
|
+ onDismissRequest = { timerMenuExpanded = false },
|
|
|
+ ) {
|
|
|
+ listOf(0, 5, 10, 15, 30, 60, 90).forEach { minute ->
|
|
|
+ RoundDropdownMenuItem(
|
|
|
+ text = stringResource(R.string.timer_m, minute),
|
|
|
+ isSelected = minute == timerMinute,
|
|
|
+ onClick = {
|
|
|
+ onIntent(ReadBookIntent.SetReadAloudTtsTimer(minute))
|
|
|
+ timerMenuExpanded = false
|
|
|
+ },
|
|
|
+ )
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
MediumTonalButton(
|
|
|
onClick = { onIntent(ReadBookIntent.ReadAloudNextChapter) },
|
|
|
text = stringResource(R.string.next_chapter),
|