diff --git a/java/res/values/strings-crash-reporting.xml b/java/res/values/strings-crash-reporting.xml
new file mode 100644
index 000000000..3e0552a23
--- /dev/null
+++ b/java/res/values/strings-crash-reporting.xml
@@ -0,0 +1,8 @@
+
+
+ FUTO Keyboard has crashed! Please send a report to help us fix this.
+ Crash Reporter
+
+ Send Report
+ Ignore
+
\ No newline at end of file
diff --git a/java/res/values/strings-uix.xml b/java/res/values/strings-uix.xml
new file mode 100644
index 000000000..9bf7e0b3b
--- /dev/null
+++ b/java/res/values/strings-uix.xml
@@ -0,0 +1,13 @@
+
+
+ Voice Input
+ Theme Switcher
+
+ AMOLED Dark Purple
+ AOSP Material Dark
+ Voice Input Theme
+
+ Dynamic System
+ Dynamic Light
+ Dynamic Dark
+
\ No newline at end of file
diff --git a/java/src/org/futo/inputmethod/latin/CrashLoggingApplication.kt b/java/src/org/futo/inputmethod/latin/CrashLoggingApplication.kt
index e727d1b88..b2cc7db05 100644
--- a/java/src/org/futo/inputmethod/latin/CrashLoggingApplication.kt
+++ b/java/src/org/futo/inputmethod/latin/CrashLoggingApplication.kt
@@ -17,10 +17,10 @@ class CrashLoggingApplication : Application() {
reportFormat = StringFormat.JSON
dialog {
- text = "FUTO Keyboard has crashed! Please send a report to help us fix this."
- title = "Crash"
- positiveButtonText = "Send Report"
- negativeButtonText = "Ignore"
+ text = getString(R.string.crashed_text)
+ title = getString(R.string.crashed_title)
+ positiveButtonText = getString(R.string.crash_report_accept)
+ negativeButtonText = getString(R.string.crash_report_reject)
resTheme = android.R.style.Theme_DeviceDefault_Dialog
}
diff --git a/java/src/org/futo/inputmethod/latin/uix/Action.kt b/java/src/org/futo/inputmethod/latin/uix/Action.kt
index 19dfcc312..5819bbc46 100644
--- a/java/src/org/futo/inputmethod/latin/uix/Action.kt
+++ b/java/src/org/futo/inputmethod/latin/uix/Action.kt
@@ -2,6 +2,7 @@ package org.futo.inputmethod.latin.uix
import android.content.Context
import androidx.annotation.DrawableRes
+import androidx.annotation.StringRes
import androidx.compose.material3.ColorScheme
import androidx.compose.runtime.Composable
import androidx.lifecycle.LifecycleCoroutineScope
@@ -52,7 +53,7 @@ interface PersistentActionState {
data class Action(
@DrawableRes val icon: Int,
- val name: String, // TODO: @StringRes Int
+ @StringRes val name: Int,
val windowImpl: ((KeyboardManagerForAction, PersistentActionState?) -> ActionWindow)?,
val simplePressImpl: ((KeyboardManagerForAction, PersistentActionState?) -> Unit)?,
val persistentState: ((KeyboardManagerForAction) -> PersistentActionState)? = null,
diff --git a/java/src/org/futo/inputmethod/latin/uix/ActionBar.kt b/java/src/org/futo/inputmethod/latin/uix/ActionBar.kt
index aa7f361f1..8f815df71 100644
--- a/java/src/org/futo/inputmethod/latin/uix/ActionBar.kt
+++ b/java/src/org/futo/inputmethod/latin/uix/ActionBar.kt
@@ -44,6 +44,7 @@ import androidx.compose.ui.graphics.drawscope.scale
import androidx.compose.ui.graphics.drawscope.translate
import androidx.compose.ui.platform.LocalContext
import androidx.compose.ui.res.painterResource
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.text.AnnotatedString
import androidx.compose.ui.text.ExperimentalTextApi
import androidx.compose.ui.text.TextStyle
@@ -279,7 +280,7 @@ fun ActionItem(action: Action, onSelect: (Action) -> Unit) {
) {
Icon(
painter = painterResource(id = action.icon),
- contentDescription = action.name
+ contentDescription = stringResource(action.name)
)
}
}
@@ -293,7 +294,7 @@ fun ActionItemSmall(action: Action, onSelect: (Action) -> Unit) {
.fillMaxHeight()) {
Icon(
painter = painterResource(id = action.icon),
- contentDescription = action.name
+ contentDescription = stringResource(action.name)
)
}
}
diff --git a/java/src/org/futo/inputmethod/latin/uix/actions/ThemeAction.kt b/java/src/org/futo/inputmethod/latin/uix/actions/ThemeAction.kt
index 8638ff877..f0d1c3faf 100644
--- a/java/src/org/futo/inputmethod/latin/uix/actions/ThemeAction.kt
+++ b/java/src/org/futo/inputmethod/latin/uix/actions/ThemeAction.kt
@@ -8,6 +8,7 @@ import androidx.compose.material3.Text
import androidx.compose.runtime.Composable
import androidx.compose.ui.Modifier
import androidx.compose.ui.platform.LocalContext
+import androidx.compose.ui.res.stringResource
import androidx.compose.ui.unit.dp
import org.futo.inputmethod.latin.R
import org.futo.inputmethod.latin.uix.Action
@@ -18,13 +19,13 @@ import org.futo.inputmethod.latin.uix.theme.ThemeOptions
val ThemeAction = Action(
icon = R.drawable.eye,
- name = "Theme Switcher",
+ name = R.string.theme_switcher_action_title,
simplePressImpl = null,
windowImpl = { manager, _ ->
object : ActionWindow {
@Composable
override fun windowName(): String {
- return "Theme Switcher"
+ return stringResource(R.string.theme_switcher_action_title)
}
@Composable
@@ -45,7 +46,7 @@ val ThemeAction = Action(
themeOption
)
}) {
- Text(themeOption.name)
+ Text(stringResource(themeOption.name))
}
}
}
diff --git a/java/src/org/futo/inputmethod/latin/uix/actions/VoiceInputAction.kt b/java/src/org/futo/inputmethod/latin/uix/actions/VoiceInputAction.kt
index 41b314fc6..ce1380822 100644
--- a/java/src/org/futo/inputmethod/latin/uix/actions/VoiceInputAction.kt
+++ b/java/src/org/futo/inputmethod/latin/uix/actions/VoiceInputAction.kt
@@ -12,6 +12,7 @@ import androidx.compose.runtime.mutableStateOf
import androidx.compose.runtime.remember
import androidx.compose.ui.Alignment
import androidx.compose.ui.Modifier
+import androidx.compose.ui.res.stringResource
import org.futo.inputmethod.latin.R
import org.futo.inputmethod.latin.uix.Action
import org.futo.inputmethod.latin.uix.ActionInputTransaction
@@ -26,7 +27,7 @@ import org.futo.voiceinput.shared.whisper.ModelManager
val SystemVoiceInputAction = Action(
icon = R.drawable.mic_fill,
- name = "Voice Input",
+ name = R.string.voice_input_action_title,
simplePressImpl = { it, _ ->
it.triggerSystemVoiceInput()
},
@@ -45,7 +46,7 @@ class VoiceInputPersistentState(val manager: KeyboardManagerForAction) : Persist
}
val VoiceInputAction = Action(
icon = R.drawable.mic_fill,
- name = "Voice Input",
+ name = R.string.voice_input_action_title,
simplePressImpl = null,
persistentState = { VoiceInputPersistentState(it) },
@@ -79,19 +80,21 @@ val VoiceInputAction = Action(
@Composable
override fun windowName(): String {
- return "Voice Input"
+ return stringResource(R.string.voice_input_action_title)
}
@Composable
override fun WindowContents() {
- Box(modifier = Modifier.fillMaxSize().clickable(
- enabled = true,
- onClickLabel = null,
- onClick = { recognizerView.finish() },
- role = null,
- indication = null,
- interactionSource = remember { MutableInteractionSource() }
- )) {
+ Box(modifier = Modifier
+ .fillMaxSize()
+ .clickable(
+ enabled = true,
+ onClickLabel = null,
+ onClick = { recognizerView.finish() },
+ role = null,
+ indication = null,
+ interactionSource = remember { MutableInteractionSource() }
+ )) {
Box(modifier = Modifier.align(Alignment.Center)) {
recognizerView.Content()
}
diff --git a/java/src/org/futo/inputmethod/latin/uix/theme/ThemeOptions.kt b/java/src/org/futo/inputmethod/latin/uix/theme/ThemeOptions.kt
index b2915a36f..29f472304 100644
--- a/java/src/org/futo/inputmethod/latin/uix/theme/ThemeOptions.kt
+++ b/java/src/org/futo/inputmethod/latin/uix/theme/ThemeOptions.kt
@@ -1,6 +1,7 @@
package org.futo.inputmethod.latin.uix.theme
import android.content.Context
+import androidx.annotation.StringRes
import androidx.compose.material3.ColorScheme
import org.futo.inputmethod.latin.uix.theme.presets.AMOLEDDarkPurple
import org.futo.inputmethod.latin.uix.theme.presets.ClassicMaterialDark
@@ -12,7 +13,7 @@ import org.futo.inputmethod.latin.uix.theme.presets.VoiceInputTheme
data class ThemeOption(
val dynamic: Boolean,
val key: String,
- val name: String, // TODO: @StringRes Int
+ @StringRes val name: Int,
val available: (Context) -> Boolean,
val obtainColors: (Context) -> ColorScheme,
)
diff --git a/java/src/org/futo/inputmethod/latin/uix/theme/presets/AMOLEDDarkPurple.kt b/java/src/org/futo/inputmethod/latin/uix/theme/presets/AMOLEDDarkPurple.kt
index 9d31063a5..e25366345 100644
--- a/java/src/org/futo/inputmethod/latin/uix/theme/presets/AMOLEDDarkPurple.kt
+++ b/java/src/org/futo/inputmethod/latin/uix/theme/presets/AMOLEDDarkPurple.kt
@@ -2,6 +2,7 @@ package org.futo.inputmethod.latin.uix.theme.presets
import androidx.compose.material3.darkColorScheme
import androidx.compose.ui.graphics.Color
+import org.futo.inputmethod.latin.R
import org.futo.inputmethod.latin.uix.theme.ThemeOption
private val md_theme_dark_primary = Color(0xFFD0BCFF)
@@ -67,6 +68,11 @@ private val colorScheme = darkColorScheme(
scrim = md_theme_dark_scrim,
)
-val AMOLEDDarkPurple = ThemeOption(false, "AMOLEDDarkPurple", "AMOLED Dark Purple", { true }) {
+val AMOLEDDarkPurple = ThemeOption(
+ dynamic = false,
+ key = "AMOLEDDarkPurple",
+ name = R.string.amoled_dark_theme_name,
+ available = { true }
+) {
colorScheme
}
\ No newline at end of file
diff --git a/java/src/org/futo/inputmethod/latin/uix/theme/presets/ClassicMaterialDark.kt b/java/src/org/futo/inputmethod/latin/uix/theme/presets/ClassicMaterialDark.kt
index 3f76ce5fd..1d58b07e6 100644
--- a/java/src/org/futo/inputmethod/latin/uix/theme/presets/ClassicMaterialDark.kt
+++ b/java/src/org/futo/inputmethod/latin/uix/theme/presets/ClassicMaterialDark.kt
@@ -18,6 +18,7 @@ import androidx.compose.ui.Modifier
import androidx.compose.ui.graphics.Color
import androidx.compose.ui.tooling.preview.Preview
import androidx.compose.ui.unit.dp
+import org.futo.inputmethod.latin.R
import org.futo.inputmethod.latin.uix.theme.ThemeOption
@@ -84,7 +85,12 @@ private val colorScheme = darkColorScheme(
scrim = md_theme_dark_scrim,
)
-val ClassicMaterialDark = ThemeOption(false, "ClassicMaterialDark", "AOSP Material Dark", { true }) {
+val ClassicMaterialDark = ThemeOption(
+ dynamic = false,
+ key = "ClassicMaterialDark",
+ name = R.string.classic_material_dark_theme_name,
+ available = { true }
+) {
colorScheme
}
diff --git a/java/src/org/futo/inputmethod/latin/uix/theme/presets/DynamicThemes.kt b/java/src/org/futo/inputmethod/latin/uix/theme/presets/DynamicThemes.kt
index 7bf154857..cbfdc767b 100644
--- a/java/src/org/futo/inputmethod/latin/uix/theme/presets/DynamicThemes.kt
+++ b/java/src/org/futo/inputmethod/latin/uix/theme/presets/DynamicThemes.kt
@@ -6,12 +6,13 @@ import android.content.res.Configuration
import android.os.Build
import androidx.compose.material3.dynamicDarkColorScheme
import androidx.compose.material3.dynamicLightColorScheme
+import org.futo.inputmethod.latin.R
import org.futo.inputmethod.latin.uix.theme.ThemeOption
val DynamicSystemTheme = ThemeOption(
dynamic = true,
key = "DynamicSystem",
- name = "Dynamic System",
+ name = R.string.dynamic_system_theme_name,
available = { Build.VERSION.SDK_INT >= Build.VERSION_CODES.S },
obtainColors = {
val uiModeManager = it.getSystemService(Context.UI_MODE_SERVICE) as UiModeManager
@@ -34,7 +35,7 @@ val DynamicSystemTheme = ThemeOption(
val DynamicDarkTheme = ThemeOption(
dynamic = true,
key = "DynamicDark",
- name = "Dynamic Dark",
+ name = R.string.dynamic_dark_theme_name,
available = { Build.VERSION.SDK_INT >= Build.VERSION_CODES.S },
obtainColors = {
dynamicDarkColorScheme(it)
@@ -44,7 +45,7 @@ val DynamicDarkTheme = ThemeOption(
val DynamicLightTheme = ThemeOption(
dynamic = true,
key = "DynamicLight",
- name = "Dynamic Light",
+ name = R.string.dynamic_light_theme_name,
available = { Build.VERSION.SDK_INT >= Build.VERSION_CODES.S },
obtainColors = {
dynamicLightColorScheme(it)
diff --git a/java/src/org/futo/inputmethod/latin/uix/theme/presets/VoiceInputTheme.kt b/java/src/org/futo/inputmethod/latin/uix/theme/presets/VoiceInputTheme.kt
index a8bb43173..2a50805c6 100644
--- a/java/src/org/futo/inputmethod/latin/uix/theme/presets/VoiceInputTheme.kt
+++ b/java/src/org/futo/inputmethod/latin/uix/theme/presets/VoiceInputTheme.kt
@@ -1,8 +1,14 @@
package org.futo.inputmethod.latin.uix.theme.presets
+import org.futo.inputmethod.latin.R
import org.futo.inputmethod.latin.uix.theme.DarkColorScheme
import org.futo.inputmethod.latin.uix.theme.ThemeOption
-val VoiceInputTheme = ThemeOption(false, "VoiceInputTheme", "Voice Input Theme", { true }) {
+val VoiceInputTheme = ThemeOption(
+ dynamic = false,
+ key = "VoiceInputTheme",
+ name = R.string.voice_input_theme_name,
+ available = { true }
+) {
DarkColorScheme
}
\ No newline at end of file