mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-24 08:36:26 +00:00
fix unexpected dialog dismisses
This commit is contained in:
parent
b31d6d0051
commit
2700c3428a
9 changed files with 9 additions and 4 deletions
|
@ -121,6 +121,7 @@ fun CustomizeIconsDialog(
|
|||
},
|
||||
neutralButtonText = if (customIconNames(prefs).contains(iconName)) stringResource(R.string.button_default) else null,
|
||||
onNeutral = {
|
||||
showIconDialog = null
|
||||
runCatching {
|
||||
val icons2 = customIconNames(prefs).toMutableMap()
|
||||
icons2.remove(iconName)
|
||||
|
|
|
@ -52,7 +52,7 @@ fun <T: Any> ReorderDialog(
|
|||
ThreeButtonAlertDialog(
|
||||
onDismissRequest = onDismissRequest,
|
||||
onConfirmed = { onConfirmed(reorderableItems) },
|
||||
onNeutral = onNeutral,
|
||||
onNeutral = { onDismissRequest(); onNeutral() },
|
||||
neutralButtonText = neutralButtonText,
|
||||
modifier = modifier,
|
||||
title = title,
|
||||
|
|
|
@ -36,7 +36,7 @@ fun SliderDialog(
|
|||
ThreeButtonAlertDialog(
|
||||
onDismissRequest = onDismissRequest,
|
||||
neutralButtonText = if (showDefault) stringResource(R.string.button_default) else null,
|
||||
onNeutral = onDefault,
|
||||
onNeutral = { onDismissRequest(); onDefault() },
|
||||
onConfirmed = { onDone(sliderPosition) },
|
||||
modifier = modifier,
|
||||
title = title,
|
||||
|
|
|
@ -61,7 +61,7 @@ fun TextInputDialog(
|
|||
confirmButtonText = confirmButtonText,
|
||||
checkOk = { checkTextValid(value.text) },
|
||||
neutralButtonText = neutralButtonText,
|
||||
onNeutral = onNeutral,
|
||||
onNeutral = { onDismissRequest(); onNeutral() },
|
||||
modifier = modifier,
|
||||
title = title,
|
||||
text = {
|
||||
|
|
|
@ -74,7 +74,7 @@ fun ThreeButtonAlertDialog(
|
|||
Row {
|
||||
if (neutralButtonText != null)
|
||||
TextButton(
|
||||
onClick = { onDismissRequest(); onNeutral() }
|
||||
onClick = onNeutral
|
||||
) { Text(neutralButtonText) }
|
||||
Spacer(modifier.weight(1f))
|
||||
TextButton(onClick = onDismissRequest) { Text(cancelButtonText) }
|
||||
|
|
|
@ -114,6 +114,7 @@ private fun ToolbarKeyCustomizer(
|
|||
stringResource(R.string.button_default)
|
||||
else null,
|
||||
onNeutral = {
|
||||
onDismissRequest()
|
||||
val keys = readCustomKeyCodes(prefs).toMutableMap()
|
||||
keys.remove(key.name)
|
||||
prefs.edit().putString(Settings.PREF_TOOLBAR_CUSTOM_KEY_CODES, Json.encodeToString(keys)).apply()
|
||||
|
|
|
@ -193,6 +193,7 @@ fun BackupRestorePreference(setting: Setting) {
|
|||
confirmButtonText = stringResource(R.string.button_backup),
|
||||
neutralButtonText = stringResource(R.string.button_restore),
|
||||
onNeutral = {
|
||||
showDialog = false
|
||||
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT)
|
||||
.addCategory(Intent.CATEGORY_OPENABLE)
|
||||
.setType("application/zip")
|
||||
|
|
|
@ -63,6 +63,7 @@ fun CustomFontPreference(setting: Setting) {
|
|||
onDismissRequest = { showDialog = false },
|
||||
onConfirmed = { launcher.launch(intent) },
|
||||
onNeutral = {
|
||||
showDialog = false
|
||||
fontFile.delete()
|
||||
Settings.clearCachedTypeface()
|
||||
keyboardNeedsReload = true
|
||||
|
|
|
@ -82,6 +82,7 @@ fun LoadGestureLibPreference(setting: Setting) {
|
|||
ConfirmationDialog(
|
||||
onDismissRequest = { showDialog = false },
|
||||
onConfirmed = {
|
||||
showDialog = false
|
||||
val intent = Intent(Intent.ACTION_OPEN_DOCUMENT)
|
||||
.addCategory(Intent.CATEGORY_OPENABLE)
|
||||
.setType("application/octet-stream")
|
||||
|
|
Loading…
Add table
Reference in a new issue