rename "text" to "content" in alert dialog

This commit is contained in:
Helium314 2025-02-24 18:43:12 +01:00
parent b7aadac07c
commit 875a98d3f4
23 changed files with 38 additions and 41 deletions

View file

@ -136,7 +136,7 @@ fun MissingDictionaryDialog(onDismissRequest: () -> Unit, locale: Locale) {
cancelButtonText = stringResource(R.string.dialog_close),
onConfirmed = { prefs.edit { putBoolean(Settings.PREF_DONT_SHOW_MISSING_DICTIONARY_DIALOG, true) } },
confirmButtonText = stringResource(R.string.no_dictionary_dont_show_again_button),
text = { Text(annotatedString) }
content = { Text(annotatedString) }
)
}

View file

@ -124,7 +124,7 @@ class SettingsActivity : AppCompatActivity(), SharedPreferences.OnSharedPreferen
intent.setType("application/zip")
crashFilePicker.launch(intent)
},
text = { Text("Crash report files found") },
content = { Text("Crash report files found") },
)
}
}

View file

@ -54,7 +54,7 @@ fun ColorPickerDialog(
onDismissRequest = onDismissRequest,
onConfirmed = { onConfirmed(controller.selectedColor.value.toArgb()) },
title = { Text(title) },
text = {
content = {
Column {
Row {
Surface(

View file

@ -100,7 +100,7 @@ fun ColorThemePickerDialog(
neutralButtonText = stringResource(R.string.load),
onNeutral = { showLoadDialog = true },
title = { Text(setting.title) },
text = {
content = {
CompositionLocalProvider(
LocalTextStyle provides MaterialTheme.typography.bodyLarge
) {
@ -219,7 +219,7 @@ private fun ColorItemRow(onDismissRequest: () -> Unit, item: String, isSelected:
if (showDialog)
ConfirmationDialog(
onDismissRequest = { showDialog = false },
text = { Text(stringResource(R.string.delete_confirmation, item)) },
content = { Text(stringResource(R.string.delete_confirmation, item)) },
onConfirmed = {
showDialog = false
prefs.edit().remove(Settings.PREF_USER_COLORS_PREFIX + item)

View file

@ -17,7 +17,7 @@ fun ConfirmationDialog(
onConfirmed: () -> Unit,
modifier: Modifier = Modifier,
title: @Composable (() -> Unit)? = null,
text: @Composable (() -> Unit)? = null,
content: @Composable (() -> Unit)? = null,
confirmButtonText: String = stringResource(android.R.string.ok),
cancelButtonText: String = stringResource(android.R.string.cancel),
neutralButtonText: String? = null,
@ -32,7 +32,7 @@ fun ConfirmationDialog(
onNeutral = onNeutral,
modifier = modifier,
title = title,
text = text,
content = content,
)
}
@ -44,6 +44,6 @@ private fun PreviewConfirmDialog() {
onConfirmed = {},
neutralButtonText = "hi",
confirmButtonText = "I don't care",
text = { Text(stringResource(R.string.disable_personalized_dicts_message)) }
content = { Text(stringResource(R.string.disable_personalized_dicts_message)) }
)
}

View file

@ -78,7 +78,7 @@ fun CustomizeIconsDialog(
neutralButtonText = if (prefs.contains(prefKey)) stringResource(R.string.button_default) else null,
onNeutral = { showDeletePrefConfirmDialog = true },
title = { Text(stringResource(R.string.customize_icons)) },
text = {
content = {
LazyColumn(state = state) {
items(iconsAndNames, key = { it.second }) { (iconName, displayName) ->
Row(
@ -132,7 +132,7 @@ fun CustomizeIconsDialog(
reloadItem(iconName)
},
title = { Text(showIconDialog!!.second) },
text = {
content = {
LazyVerticalGrid(
columns = GridCells.Adaptive(minSize = 64.dp),
state = gridState
@ -170,7 +170,7 @@ fun CustomizeIconsDialog(
prefs.edit().remove(prefKey).apply()
KeyboardIconsSet.instance.loadIcons(ctx)
},
text = { Text(stringResource(R.string.customize_icons_reset_message)) }
content = { Text(stringResource(R.string.customize_icons_reset_message)) }
)
}
}

View file

@ -50,7 +50,7 @@ fun DictionaryDialog(
confirmButtonText = null,
cancelButtonText = stringResource(R.string.dialog_close),
title = { Text(locale.localizedDisplayName(ctx)) },
text = {
content = {
val state = rememberScrollState()
Column(Modifier.verticalScroll(state)) {
if (hasInternal) {
@ -81,7 +81,7 @@ fun DictionaryDialog(
ConfirmationDialog(
onDismissRequest = { showDeleteDialog = false },
onConfirmed = { it.delete() },
text = { Text(stringResource(R.string.remove_dictionary_message, type ?: ""))}
content = { Text(stringResource(R.string.remove_dictionary_message, type ?: ""))}
)
}
val dictString = createDictionaryTextAnnotated(locale)

View file

@ -12,7 +12,7 @@ fun InfoDialog(
) {
ThreeButtonAlertDialog(
onDismissRequest = onDismissRequest,
text = { Text(message) },
content = { Text(message) },
cancelButtonText = stringResource(android.R.string.ok),
onConfirmed = { },
confirmButtonText = null

View file

@ -86,7 +86,7 @@ fun LayoutPickerDialog(
neutralButtonText = stringResource(R.string.button_load_custom),
onNeutral = { picker.launch(layoutIntent) },
title = { Text(setting.title) },
text = {
content = {
CompositionLocalProvider(
LocalTextStyle provides MaterialTheme.typography.bodyLarge
) {
@ -197,7 +197,7 @@ private fun LayoutItemRow(
ConfirmationDialog(
onDismissRequest = { showDeleteDialog = false },
title = { Text(stringResource(R.string.delete_layout, LayoutUtilsCustom.getDisplayName(layoutName))) },
text = { if (inUse) Text(stringResource(R.string.layout_in_use)) },
content = { if (inUse) Text(stringResource(R.string.layout_in_use)) },
confirmButtonText = stringResource(R.string.delete),
onConfirmed = {
showDeleteDialog = false

View file

@ -53,7 +53,7 @@ fun <T: Any> ListPickerDialog(
checkOk = { selected != null },
modifier = modifier,
title = title,
text = {
content = {
CompositionLocalProvider(
LocalTextStyle provides MaterialTheme.typography.bodyLarge
) {

View file

@ -45,7 +45,7 @@ fun <T: Any> MultiListPickerDialog(
confirmButtonText = stringResource(android.R.string.ok),
modifier = modifier,
title = title,
text = {
content = {
CompositionLocalProvider(
LocalTextStyle provides MaterialTheme.typography.bodyLarge
) {

View file

@ -69,7 +69,7 @@ fun NewDictionaryDialog(
val newDictBroadcast = Intent(DictionaryPackConstants.NEW_DICTIONARY_INTENT_ACTION)
ctx.sendBroadcast(newDictBroadcast)
},
text = {
content = {
Column {
Text(info)
DropDownField(

View file

@ -56,7 +56,7 @@ fun <T: Any> ReorderDialog(
neutralButtonText = neutralButtonText,
modifier = modifier,
title = title,
text = {
content = {
LazyColumn(
state = listState,
verticalArrangement = Arrangement.spacedBy(4.dp),

View file

@ -40,7 +40,7 @@ fun SliderDialog(
onConfirmed = { onDone(sliderPosition) },
modifier = modifier,
title = title,
text = {
content = {
CompositionLocalProvider(
LocalTextStyle provides MaterialTheme.typography.bodyLarge
) {

View file

@ -106,7 +106,7 @@ fun SubtypeDialog(
SubtypeSettings.removeEnabledSubtype(ctx, subtype)
},
title = { Text(SubtypeLocaleUtils.getSubtypeDisplayNameInSystemLocale(subtype)) },
text = {
content = {
Column(
modifier = Modifier.verticalScroll(scrollState),
verticalArrangement = Arrangement.spacedBy(8.dp),
@ -351,7 +351,7 @@ private fun MainLayoutRow(
onDismissRequest = { showLayoutDeleteDialog = false },
confirmButtonText = stringResource(R.string.delete),
title = { Text(stringResource(R.string.delete_layout, LayoutUtilsCustom.getDisplayName(it))) },
text = { if (others) Text(stringResource(R.string.layout_in_use)) },
content = { if (others) Text(stringResource(R.string.layout_in_use)) },
onConfirmed = {
if (it == currentSubtype.mainLayoutName())
setCurrentSubtype(currentSubtype.withoutLayout(LayoutType.MAIN))
@ -393,7 +393,7 @@ private fun MainLayoutRow(
ConfirmationDialog(
onDismissRequest = { showAddLayoutDialog = false },
title = { Text(stringResource(R.string.button_title_add_custom_layout)) },
text = { Text(annotated) },
content = { Text(annotated) },
onConfirmed = { showLayoutEditDialog = "new layout" to "" },
neutralButtonText = stringResource(R.string.button_load_custom),
onNeutral = {

View file

@ -65,7 +65,7 @@ fun TextInputDialog(
onNeutral = { onDismissRequest(); onNeutral() },
modifier = modifier,
title = title,
text = {
content = {
OutlinedTextField(
value = value,
onValueChange = { value = it },

View file

@ -34,7 +34,7 @@ fun ThreeButtonAlertDialog(
onConfirmed: () -> Unit,
modifier: Modifier = Modifier,
title: @Composable (() -> Unit)? = null,
text: @Composable (() -> Unit)? = null,
content: @Composable (() -> Unit)? = null,
onNeutral: () -> Unit = { },
checkOk: () -> Boolean = { true },
confirmButtonText: String? = stringResource(android.R.string.ok),
@ -69,10 +69,10 @@ fun ThreeButtonAlertDialog(
}
}
}
text?.let {
content?.let {
CompositionLocalProvider(LocalTextStyle provides MaterialTheme.typography.bodyMedium) {
Box(Modifier.weight(weight = 1f, fill = false).padding(bottom = if (reducePadding) 2.dp else 8.dp)) {
text()
content()
}
}
}
@ -102,7 +102,7 @@ private fun Preview() {
ThreeButtonAlertDialog(
onDismissRequest = {},
onConfirmed = { },
text = { Text("hello") },
content = { Text("hello") },
title = { Text("title") },
neutralButtonText = "Default"
)

View file

@ -53,7 +53,7 @@ fun ToolbarKeysCustomizer(
neutralButtonText = if (readCustomKeyCodes(prefs).isNotEmpty()) stringResource(R.string.button_default) else null,
onNeutral = { showDeletePrefConfirmDialog = true },
title = { Text(stringResource(R.string.customize_toolbar_key_codes)) },
text = {
content = {
LazyColumn(
verticalArrangement = Arrangement.spacedBy(4.dp)
) {
@ -82,7 +82,7 @@ fun ToolbarKeysCustomizer(
onDismissRequest()
prefs.edit().remove(key).apply()
},
text = { Text(stringResource(R.string.customize_toolbar_key_code_reset_message)) }
content = { Text(stringResource(R.string.customize_toolbar_key_code_reset_message)) }
)
}
@ -113,7 +113,7 @@ private fun ToolbarKeyCustomizer(
writeCustomKeyCodes(prefs, keys)
},
title = { Text(key.name.lowercase().getStringResourceOrName("", ctx)) },
text = {
content = {
Column {
Row(verticalAlignment = Alignment.CenterVertically) {
Text(stringResource(R.string.key_code), Modifier.weight(0.5f))

View file

@ -181,7 +181,7 @@ fun BackupRestorePreference(setting: Setting) {
ConfirmationDialog(
onDismissRequest = { showDialog = false },
title = { Text(stringResource(R.string.backup_restore_title)) },
text = { Text(stringResource(R.string.backup_restore_message)) },
content = { Text(stringResource(R.string.backup_restore_message)) },
confirmButtonText = stringResource(R.string.button_backup),
neutralButtonText = stringResource(R.string.button_restore),
onNeutral = {

View file

@ -85,7 +85,7 @@ fun LoadGestureLibPreference(setting: Setting) {
launcher.launch(intent)
},
title = { Text(stringResource(R.string.load_gesture_library)) },
text = { Text(stringResource(R.string.load_gesture_library_message, abi)) },
content = { Text(stringResource(R.string.load_gesture_library_message, abi)) },
neutralButtonText = if (libFile.exists()) stringResource(R.string.load_gesture_library_button_delete) else null,
onNeutral = {
libFile.delete()
@ -100,7 +100,7 @@ fun LoadGestureLibPreference(setting: Setting) {
File(tempFilePath!!).delete()
tempFilePath = null
},
text = { Text(stringResource(R.string.checksum_mismatch_message, abi)) },
content = { Text(stringResource(R.string.checksum_mismatch_message, abi)) },
onConfirmed = {
val tempFile = File(tempFilePath!!)
renameToLibFileAndRestart(tempFile, ChecksumCalculator.checksum(tempFile.inputStream()) ?: "")

View file

@ -97,7 +97,7 @@ fun DictionaryScreen(
dictPicker.launch(intent)
},
title = { Text(stringResource(R.string.add_new_dictionary_title)) },
text = {
content = {
// addDictString contains "%s" since we didn't supply a formatArg
val addDictString = stringResource(R.string.add_dictionary)
val annotated = buildAnnotatedString {

View file

@ -110,7 +110,7 @@ fun PersonalDictionaryScreen(
)
}
},
text = {
content = {
Column(
verticalArrangement = Arrangement.spacedBy(8.dp)
) {

View file

@ -25,11 +25,9 @@ import helium314.keyboard.latin.R
import helium314.keyboard.latin.permissions.PermissionsUtil
import helium314.keyboard.latin.settings.Defaults
import helium314.keyboard.latin.settings.Settings
import helium314.keyboard.latin.settings.UserDictionaryListFragment
import helium314.keyboard.latin.utils.Log
import helium314.keyboard.latin.utils.getActivity
import helium314.keyboard.latin.utils.prefs
import helium314.keyboard.latin.utils.switchTo
import helium314.keyboard.settings.SettingsContainer
import helium314.keyboard.settings.preferences.ListPreference
import helium314.keyboard.settings.SettingsWithoutKey
@ -38,7 +36,6 @@ import helium314.keyboard.settings.preferences.Preference
import helium314.keyboard.settings.SearchSettingsScreen
import helium314.keyboard.settings.SettingsActivity
import helium314.keyboard.settings.SettingsDestination
import helium314.keyboard.settings.SettingsNavHost
import helium314.keyboard.settings.preferences.SwitchPreference
import helium314.keyboard.settings.Theme
import helium314.keyboard.settings.dialogs.ConfirmationDialog
@ -166,7 +163,7 @@ fun createCorrectionSettings(context: Context) = listOf(
onConfirmed = {
prefs.edit().putBoolean(setting.key, false).apply()
},
text = { Text(stringResource(R.string.disable_personalized_dicts_message)) }
content = { Text(stringResource(R.string.disable_personalized_dicts_message)) }
)
}