mirror of
https://github.com/SimpleMobileTools/Simple-Flashlight.git
synced 2025-06-05 21:59:19 +02:00
Show custom sleep timer dialog via callback
This commit is contained in:
@ -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)
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user