diff --git a/app/src/main/java/com/osfans/trime/data/prefs/AppPrefs.kt b/app/src/main/java/com/osfans/trime/data/prefs/AppPrefs.kt index 84d067d3f9..215d8d05ed 100644 --- a/app/src/main/java/com/osfans/trime/data/prefs/AppPrefs.kt +++ b/app/src/main/java/com/osfans/trime/data/prefs/AppPrefs.kt @@ -111,10 +111,10 @@ class AppPrefs( companion object { const val SOFT_CURSOR_ENABLED = "keyboard__soft_cursor" const val POPUP_KEY_PRESS_ENABLED = "keyboard__show_key_popup" - const val SWITCHES_ENABLED = "keyboard__show_switches" + const val SHOW_SCHEMA_SWITCHES = "show_schema_switches_in_idle" + const val SHOW_ARROW_IN_SWITCHES = "show_arrow_in_switches" const val LANDSCAPE_MODE = "keyboard__landscape_mode" const val SPLIT_SPACE_PERCENT = "keyboard__split_space" - const val SWITCH_ARROW_ENABLED = "keyboard__show_switch_arrow" const val HOOK_CTRL_A = "keyboard__hook_ctrl_a" const val HOOK_CTRL_CV = "keyboard__hook_ctrl_cv" @@ -146,8 +146,8 @@ class AppPrefs( val softCursorEnabled by bool(SOFT_CURSOR_ENABLED, true) val popupKeyPressEnabled = bool(POPUP_KEY_PRESS_ENABLED, false) - val switchesEnabled = bool(SWITCHES_ENABLED, true) - val switchArrowEnabled = bool(SWITCH_ARROW_ENABLED, true) + val showSchemaSwitches = bool(SHOW_SCHEMA_SWITCHES, true) + val showArrowInSwitches = bool(SHOW_ARROW_IN_SWITCHES, true) enum class LandscapeModeOption { NEVER, diff --git a/app/src/main/java/com/osfans/trime/data/schema/SchemaManager.kt b/app/src/main/java/com/osfans/trime/data/schema/SchemaManager.kt index 4c2d399a2a..f4444fd9c7 100644 --- a/app/src/main/java/com/osfans/trime/data/schema/SchemaManager.kt +++ b/app/src/main/java/com/osfans/trime/data/schema/SchemaManager.kt @@ -5,15 +5,12 @@ package com.osfans.trime.data.schema import com.osfans.trime.core.Rime -import com.osfans.trime.data.prefs.AppPrefs import kotlinx.serialization.builtins.ListSerializer object SchemaManager { private lateinit var currentSchema: Schema var visibleSwitches: List = listOf() - private val arrow get() = AppPrefs.defaultInstance().keyboard.switchArrowEnabled - private val defaultSchema = Schema() @JvmStatic diff --git a/app/src/main/java/com/osfans/trime/ime/bar/QuickBar.kt b/app/src/main/java/com/osfans/trime/ime/bar/QuickBar.kt index bc8abe4c4a..b26e50451d 100644 --- a/app/src/main/java/com/osfans/trime/ime/bar/QuickBar.kt +++ b/app/src/main/java/com/osfans/trime/ime/bar/QuickBar.kt @@ -53,7 +53,7 @@ class QuickBar( private val prefs = AppPrefs.defaultInstance() - private val showSwitchers by prefs.keyboard.switchesEnabled + private val showSwitches by prefs.keyboard.showSchemaSwitches val themedHeight = theme.generalStyle.candidateViewHeight + theme.generalStyle.commentHeight @@ -61,7 +61,7 @@ class QuickBar( private fun evalAlwaysUiState() { val newState = when { - showSwitchers -> AlwaysUi.State.Switchers + showSwitches -> AlwaysUi.State.Switches else -> AlwaysUi.State.Empty } if (newState == alwaysUi.currentState) return @@ -211,7 +211,7 @@ class QuickBar( } override fun onRimeSchemaUpdated(schema: SchemaItem) { - if (alwaysUi.currentState == AlwaysUi.State.Switchers) { + if (alwaysUi.currentState == AlwaysUi.State.Switches) { service.lifecycleScope.launch { alwaysUi.switchesUi.setSwitches(SchemaManager.visibleSwitches) } @@ -227,7 +227,7 @@ class QuickBar( view.visibility = if (value.value) View.GONE else View.VISIBLE } } - if (alwaysUi.currentState == AlwaysUi.State.Switchers) { + if (alwaysUi.currentState == AlwaysUi.State.Switches) { service.lifecycleScope.launch { alwaysUi.switchesUi.setSwitches(SchemaManager.visibleSwitches) } diff --git a/app/src/main/java/com/osfans/trime/ime/bar/ui/AlwaysUi.kt b/app/src/main/java/com/osfans/trime/ime/bar/ui/AlwaysUi.kt index 93acd7ac4e..8efb8c4ec3 100644 --- a/app/src/main/java/com/osfans/trime/ime/bar/ui/AlwaysUi.kt +++ b/app/src/main/java/com/osfans/trime/ime/bar/ui/AlwaysUi.kt @@ -25,7 +25,7 @@ class AlwaysUi( ) : Ui { enum class State { Empty, - Switchers, + Switches, } var currentState = State.Empty @@ -55,7 +55,7 @@ class AlwaysUi( Timber.d("Switch always ui to $state") when (state) { State.Empty -> animator.displayedChild = 0 - State.Switchers -> animator.displayedChild = 1 + State.Switches -> animator.displayedChild = 1 } currentState = state } diff --git a/app/src/main/java/com/osfans/trime/ime/bar/ui/always/switches/SwitchesAdapter.kt b/app/src/main/java/com/osfans/trime/ime/bar/ui/always/switches/SwitchesAdapter.kt index 0b5b7dc8d2..1f2c89bf51 100644 --- a/app/src/main/java/com/osfans/trime/ime/bar/ui/always/switches/SwitchesAdapter.kt +++ b/app/src/main/java/com/osfans/trime/ime/bar/ui/always/switches/SwitchesAdapter.kt @@ -15,7 +15,7 @@ import com.osfans.trime.data.theme.Theme class SwitchesAdapter( private val theme: Theme, ) : BaseQuickAdapter() { - private val showArrow by AppPrefs.defaultInstance().keyboard.switchArrowEnabled + private val showArrow by AppPrefs.defaultInstance().keyboard.showArrowInSwitches inner class Holder( val ui: SwitchUi, @@ -37,13 +37,7 @@ class SwitchesAdapter( setFirstText(item.states[enabled]) val altText = if (item.options.isEmpty()) { - item.states[1 - enabled].let { - if (showArrow) { - "→ $it" - } else { - it - } - } + "${if (showArrow) "→ " else ""}${item.states[1 - enabled]}" } else { "" } diff --git a/app/src/main/res/navigation/pref_nav.xml b/app/src/main/res/navigation/pref_nav.xml index 503b90f903..3c9af29826 100644 --- a/app/src/main/res/navigation/pref_nav.xml +++ b/app/src/main/res/navigation/pref_nav.xml @@ -74,7 +74,7 @@ SPDX-License-Identifier: GPL-3.0-or-later + android:label="@string/virtual_keyboard" /> 上屏时朗读字符 长按按键的延迟时间 重复按键的重复间隔 - 在候选栏中显示状态 + 空闲时显示方案开关 按键时弹出显示字符 永不 @@ -82,7 +82,7 @@ SPDX-License-Identifier: GPL-3.0-or-later 剪贴板历史记录上限 剪贴板去重规则 剪贴板过滤规则 - 为开关显示箭头符号(→) + 方案开关显示箭头符号(→) 横屏时全屏编辑 部署完成 @@ -131,7 +131,7 @@ SPDX-License-Identifier: GPL-3.0-or-later 构建信息 连接实体键盘时,显示迷你软键盘 Telegram群组 - 候选栏 + 快捷栏 已复制 点击空格时,忽略Shift的锁定状态 点击0-9时,忽略Shift的锁定状态 @@ -148,7 +148,7 @@ SPDX-License-Identifier: GPL-3.0-or-later 应用程序崩溃了 Logcat 进程已创建 抱歉,但我们提供了日志以供调查。 - 键盘 + 虚拟键盘 关于 主题 配置 diff --git a/app/src/main/res/values-zh-rTW/strings.xml b/app/src/main/res/values-zh-rTW/strings.xml index c98d718caa..fb35a9084b 100644 --- a/app/src/main/res/values-zh-rTW/strings.xml +++ b/app/src/main/res/values-zh-rTW/strings.xml @@ -45,7 +45,7 @@ SPDX-License-Identifier: GPL-3.0-or-later 上屏時朗讀字符 長按按鍵的延遲時間 重複按鍵的重複間隔 - 在候選欄中顯示狀態 + 空閒時顯示方案開關 按鍵時彈出顯示字符 永不 @@ -85,7 +85,7 @@ SPDX-License-Identifier: GPL-3.0-or-later 預設 剪貼板去重規則 剪貼板過濾規則 - 爲開關顯示箭頭符號(→) + 方案開關顯示箭頭符號(→) 橫屏時全屏編輯 部署完成 @@ -134,7 +134,7 @@ SPDX-License-Identifier: GPL-3.0-or-later 建構資訊 連接實體鍵盤時,顯示迷你軟鍵盤 Telegram群組 - 候選欄 + 快捷欄 已複製 點擊空格時,忽略Shift的鎖定狀態 點擊0-9時,忽略Shift的鎖定狀態 @@ -155,7 +155,7 @@ SPDX-License-Identifier: GPL-3.0-or-later 主題 配置 設定儲存位置和修改同步設定等 - 鍵盤 + 虛擬鍵盤 儲存 維護 正在載入 diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 43c018f9aa..0be59f7711 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -45,7 +45,7 @@ SPDX-License-Identifier: GPL-3.0-or-later Voice on commit Long key press delay Key repeat interval - Show switches in candidate bar + Show schema switches in idle Popup on key press Never @@ -86,7 +86,7 @@ SPDX-License-Identifier: GPL-3.0-or-later Clipboard History Limit Clipboard Compare Rules Clipboard Output Rules - Show arrow for switch (→) + Add arrow (→) for schema switches Landscape fullscreen input Deploy finish @@ -136,7 +136,7 @@ SPDX-License-Identifier: GPL-3.0-or-later Build Info Show mini keyboard with real keyboard attached Telegram Group - Candidate + Quick bar Copied to clipboard! Ignore Shift locked for Space Ignore Shift locked for 0-9 @@ -154,7 +154,7 @@ SPDX-License-Identifier: GPL-3.0-or-later Jump to Bottom Toolkit Profile - Keyboard + Virtual Keyboard Theme About Storage diff --git a/app/src/main/res/xml/keyboard_preference.xml b/app/src/main/res/xml/keyboard_preference.xml index f4eba9066d..f1ecb04aa8 100644 --- a/app/src/main/res/xml/keyboard_preference.xml +++ b/app/src/main/res/xml/keyboard_preference.xml @@ -9,7 +9,7 @@ SPDX-License-Identifier: GPL-3.0-or-later + android:title="@string/virtual_keyboard"> + app:title="@string/quick_bar"> diff --git a/app/src/main/res/xml/prefs.xml b/app/src/main/res/xml/prefs.xml index a7ae214d32..21b590a84c 100644 --- a/app/src/main/res/xml/prefs.xml +++ b/app/src/main/res/xml/prefs.xml @@ -25,7 +25,7 @@ SPDX-License-Identifier: GPL-3.0-or-later app:icon="@drawable/ic_baseline_tune_24" />