Show custom sleep timer dialog via callback

This commit is contained in:
Ensar Sarajčić 2023-10-05 13:10:18 +02:00
parent 21a6196896
commit c33664b9e7

View File

@ -105,7 +105,7 @@ class MainActivity : ComponentActivity() {
DialogMember {
SleepTimerRadioDialog(
alertDialogState = this,
customAlertDialogState = sleepTimerCustomDialogState
onCustomValueSelected = sleepTimerCustomDialogState::show
)
}
}
@ -287,7 +287,7 @@ class MainActivity : ComponentActivity() {
@Composable
private fun SleepTimerRadioDialog(
alertDialogState: AlertDialogState,
customAlertDialogState: AlertDialogState
onCustomValueSelected: () -> Unit
) {
val items = ArrayList(listOf(10, 30, 60, 5 * 60, 10 * 60, 30 * 60).map {
RadioItem(it, secondsToString(it))
@ -306,7 +306,7 @@ class MainActivity : ComponentActivity() {
selectedItemId = preferences.lastSleepTimerSeconds,
callback = {
if (it as Int == -1) {
customAlertDialogState.show()
onCustomValueSelected()
} else if (it > 0) {
pickedSleepTimer(it)
}