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