mirror of
https://github.com/SimpleMobileTools/Simple-Flashlight.git
synced 2025-02-16 20:00:40 +01:00
Show custom sleep timer dialog via callback
This commit is contained in:
parent
21a6196896
commit
c33664b9e7
@ -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)
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user