Skip to content

知了 Cicada · 任何会议和直播的实时字幕、同声传译、AI 会议纪要,Mac、Windows、Linux、Android 免费开源。Live subtitles, interpreting and meeting notes for any call or stream, on Mac, Windows, Linux and Android.

fix(android): the custom AI service's address and model fields open an English keyboard, so a Chinese keyboard no longer types 192。168

wquguru82afda562c83
diff --git a/android/app/src/main/kotlin/com/wquguru/cicada/AiServiceActivity.kt b/android/app/src/main/kotlin/com/wquguru/cicada/AiServiceActivity.kt
index 273ca5e..2b910c4 100644
--- a/android/app/src/main/kotlin/com/wquguru/cicada/AiServiceActivity.kt
+++ b/android/app/src/main/kotlin/com/wquguru/cicada/AiServiceActivity.kt
@@ -335,7 +335,9 @@ class AiServiceActivity : Activity() {
private fun fieldRow(label: String, current: String, hint: String, helper: String?, empty: String = L("未填"),
shown: (String) -> String = ::short, save: (String) -> Unit) =
ui.listRow(label, helper, trailing = value(if (current.isEmpty()) empty else shown(current))) {
- ui.input(this, label, current, helper = helper, hint = hint) { if (it != current) save(it) }
+ // Addresses, model ids and voice names: ASCII, no autocorrect, the URL keyboard.
+ ui.input(this, label, current, helper = helper, hint = hint,
+ type = android.text.InputType.TYPE_CLASS_TEXT or android.text.InputType.TYPE_TEXT_VARIATION_URI) { if (it != current) save(it) }
}
companion object {
diff --git a/android/app/src/main/kotlin/com/wquguru/cicada/Ui.kt b/android/app/src/main/kotlin/com/wquguru/cicada/Ui.kt
index 9acff0c..36d949e 100644
--- a/android/app/src/main/kotlin/com/wquguru/cicada/Ui.kt
+++ b/android/app/src/main/kotlin/com/wquguru/cicada/Ui.kt
@@ -532,16 +532,20 @@ class Ui(val context: Context) {
}
/// A text to type (rename): the field, 取消 and 保存. The keyboard comes up with the sheet.
- fun input(activity: Activity, title: String, initial: String, helper: String? = null, hint: String? = null, onSave: (String) -> Unit) {
+ /// `type`: an InputType for the field (an address or a model id wants the URL keyboard: a pinyin
+ /// keyboard types "192。168" and ":").
+ fun input(activity: Activity, title: String, initial: String, helper: String? = null, hint: String? = null, type: Int? = null, onSave: (String) -> Unit) {
lateinit var d: android.app.Dialog
val box = android.widget.EditText(activity).apply {
setText(initial); setSelectAllOnFocus(true); setSingleLine()
+ type?.let { inputType = it; imeHintLocales = android.os.LocaleList(java.util.Locale.US) }
this.hint = hint
setTextSize(TypedValue.COMPLEX_UNIT_SP, 16f)
background = rounded(Palette.ground, 16)
setPadding(dp(16), 0, dp(16), 0)
minHeight = dp(52)
- imeOptions = android.view.inputmethod.EditorInfo.IME_ACTION_DONE
+ imeOptions = android.view.inputmethod.EditorInfo.IME_ACTION_DONE or
+ (if (type != null) android.view.inputmethod.EditorInfo.IME_FLAG_FORCE_ASCII else 0)
setOnEditorActionListener { _, a, _ -> if (a == android.view.inputmethod.EditorInfo.IME_ACTION_DONE) { d.dismiss(); onSave(text.toString().trim()); true } else false }
}
val body = stack(0, box)
diff --git a/site/changelog.json b/site/changelog.json
index 06926d3..dd95d17 100644
--- a/site/changelog.json
+++ b/site/changelog.json
@@ -464,6 +464,14 @@
],
"title": "会议记录往下翻时,标题和“纪要 / 文字记录”留在顶上,点标题回到开头。",
"text": "大标题滚出去后,顶上出一条细条:会议名、纪要和文字记录的切换、双语 / 原文 / 译文和导出。说话人和日期跟着内容走,不占地方。"
+ },
+ {
+ "kind": "fixed",
+ "platforms": [
+ "android"
+ ],
+ "title": "Android 填自建服务的地址和模型时,中文输入法会换成英文键盘,不再打出“192。168”和全角冒号。",
+ "text": ""
}
]
},