pull/1740/head
kunfei 3 years ago
parent 28f63d1c19
commit dab92ae44a
  1. 19
      app/src/main/java/io/legado/app/ui/book/audio/ComposeView.kt

@ -1,11 +1,16 @@
package io.legado.app.ui.book.audio
import android.view.View
import androidx.compose.foundation.layout.fillMaxWidth
import androidx.compose.foundation.layout.padding
import androidx.compose.material.Card
import androidx.compose.material.Slider
import androidx.compose.runtime.Composable
import androidx.compose.runtime.MutableState
import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Modifier
import androidx.compose.ui.unit.dp
import androidx.compose.ui.window.Dialog
import io.legado.app.model.AudioPlay
import io.legado.app.service.AudioPlayService
@ -20,10 +25,16 @@ fun TimerDialog(state: MutableState<Boolean>, parent: View) {
mutableStateOf(AudioPlayService.timeMinute)
}
Dialog(onDismissRequest = { state.value = false }) {
Slider(value = timeMinute.value.toFloat(), onValueChange = {
timeMinute.value = it.toInt()
AudioPlay.setTimer(it.toInt())
}, valueRange = 0f..180f)
Card(Modifier.fillMaxWidth()) {
Slider(
modifier = Modifier.padding(horizontal = 16.dp),
value = timeMinute.value.toFloat(), onValueChange = {
timeMinute.value = it.toInt()
AudioPlay.setTimer(it.toInt())
},
valueRange = 0f..180f
)
}
}
}
}
Loading…
Cancel
Save