Skip to content

Commit

Permalink
refactor: polish candidates window settings wording
Browse files Browse the repository at this point in the history
  • Loading branch information
WhiredPlanck committed Jan 27, 2025
1 parent 55c632f commit a513da3
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 21 deletions.
8 changes: 4 additions & 4 deletions app/src/main/java/com/osfans/trime/data/prefs/AppPrefs.kt
Original file line number Diff line number Diff line change
Expand Up @@ -188,12 +188,12 @@ class AppPrefs(
shared: SharedPreferences,
) : PreferenceDelegateOwner(shared, R.string.candidates_window) {
companion object {
const val MODE = "candidates__mode"
const val POSITION = "candidates__position"
const val MODE = "show_candidates_window"
const val POSITION = "candidates_window_position"
}

val mode = enum(R.string.candidates_mode, MODE, PopupCandidatesMode.DISABLED)
val position = enum(R.string.display_position, POSITION, PopupPosition.BOTTOM_LEFT)
val mode = enum(R.string.show_candidates_window, MODE, PopupCandidatesMode.DISABLED)
val position = enum(R.string.candidates_window_position, POSITION, PopupPosition.BOTTOM_LEFT)
}

/**
Expand Down
2 changes: 1 addition & 1 deletion app/src/main/java/com/osfans/trime/ime/bar/QuickBar.kt
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ class QuickBar(

override fun onInputContextUpdate(ctx: RimeProto.Context) {
// TODO: 临时修复状态栏与悬浮窗同时显示,后续需优化:考虑分离数据或寻找更好的实现方式
if (candidatesMode == PopupCandidatesMode.FORCE_SHOW) return
if (candidatesMode == PopupCandidatesMode.ALWAYS_SHOW) return

barStateMachine.push(
QuickBarStateMachine.TransitionEvent.CandidatesUpdated,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,6 @@ enum class PopupCandidatesMode(
) : PreferenceDelegateEnum {
SYSTEM_DEFAULT(R.string.system_default),
INPUT_DEVICE(R.string.depends_on_input_device),
FORCE_SHOW(R.string.force_show),
ALWAYS_SHOW(R.string.always_show),
DISABLED(R.string.disable),
}
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ class PreeditModule(

override fun onInputContextUpdate(ctx: RimeProto.Context) {
// TODO: 临时修复状态栏与悬浮窗同时显示,后续需优化:考虑分离数据或寻找更好的实现方式
if (candidatesMode == PopupCandidatesMode.FORCE_SHOW) return
if (candidatesMode == PopupCandidatesMode.ALWAYS_SHOW) return

ui.update(ctx.composition)
if (ctx.composition.length > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class InputDeviceManager {
}

private fun setupComposingPopupWindowCallback(isVirtual: Boolean) {
val shouldSetupWindow = !isVirtual || candidatesMode == PopupCandidatesMode.FORCE_SHOW
val shouldSetupWindow = !isVirtual || candidatesMode == PopupCandidatesMode.ALWAYS_SHOW
composingPopupWindow?.handleMessage = shouldSetupWindow
composingPopupWindow?.useVirtualKeyboard = isVirtual
// dismiss ComposingPopupWindow when entering virtual keyboard mode,
Expand Down Expand Up @@ -85,7 +85,7 @@ class InputDeviceManager {
when (candidatesMode) {
PopupCandidatesMode.SYSTEM_DEFAULT -> service.superEvaluateInputViewShown()
PopupCandidatesMode.INPUT_DEVICE -> isVirtualKeyboard
PopupCandidatesMode.FORCE_SHOW -> true
PopupCandidatesMode.ALWAYS_SHOW -> true
PopupCandidatesMode.DISABLED -> true
}
applyMode(service, useVirtualKeyboard)
Expand Down Expand Up @@ -123,7 +123,7 @@ class InputDeviceManager {
when (candidatesMode) {
PopupCandidatesMode.SYSTEM_DEFAULT -> service.superEvaluateInputViewShown()
PopupCandidatesMode.INPUT_DEVICE -> false
PopupCandidatesMode.FORCE_SHOW -> false
PopupCandidatesMode.ALWAYS_SHOW -> false
PopupCandidatesMode.DISABLED -> true
}
applyMode(service, useVirtualKeyboard)
Expand All @@ -147,7 +147,7 @@ class InputDeviceManager {
PopupCandidatesMode.SYSTEM_DEFAULT -> service.superEvaluateInputViewShown()
PopupCandidatesMode.INPUT_DEVICE ->
toolType == MotionEvent.TOOL_TYPE_FINGER || toolType == MotionEvent.TOOL_TYPE_STYLUS
PopupCandidatesMode.FORCE_SHOW -> false
PopupCandidatesMode.ALWAYS_SHOW -> false
PopupCandidatesMode.DISABLED -> true
}
applyMode(service, useVirtualKeyboard)
Expand Down
6 changes: 3 additions & 3 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -217,20 +217,20 @@ SPDX-License-Identifier: GPL-3.0-or-later
<string name="synchronization">同步</string>
<string name="profile_timing_background_sync_set_time">设置后台同步时间</string>
<string name="candidates_window">候选窗口</string>
<string name="candidates_mode">候选词显示模式</string>
<string name="show_candidates_window">显示候选词窗口</string>
<string name="general">常规</string>
<string name="preedit">预编辑码</string>
<string name="commit_text_preview">首选词预览</string>
<string name="raw_input">原始输入码</string>
<string name="composing_text_mode">在程序中显示撰写文本</string>
<string name="depends_on_input_device">根据输入设备而定</string>
<string name="force_show">强制显示</string>
<string name="always_show">始终显示</string>
<string name="follow_cursor">跟随光标</string>
<string name="bottom_left">左下</string>
<string name="bottom_right">右下</string>
<string name="top_left">左上</string>
<string name="top_right">右上</string>
<string name="display_position">显示位置</string>
<string name="candidates_window_position">候选词窗口位置</string>
<string name="deploy_failure">部署失败</string>
<string name="view_deploy_failure_log">部署失败。点此查看错误日志。</string>
</resources>
8 changes: 4 additions & 4 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -216,21 +216,21 @@ SPDX-License-Identifier: GPL-3.0-or-later
<string name="forget_this_word">忘記該詞</string>
<string name="synchronization">同步</string>
<string name="profile_timing_background_sync_set_time">設定後台同步時間</string>
<string name="candidates_window">候选窗口</string>
<string name="candidates_mode">候選詞顯示模式</string>
<string name="candidates_window">候选視窗</string>
<string name="show_candidates_window">顯示候選詞視窗</string>
<string name="general">常規</string>
<string name="preedit">預編輯碼</string>
<string name="commit_text_preview">首選詞預覽</string>
<string name="raw_input">原始輸入碼</string>
<string name="composing_text_mode">在程式中顯示撰寫文字</string>
<string name="depends_on_input_device">視輸入設備而定</string>
<string name="force_show">強制顯示</string>
<string name="always_show">始終顯示</string>
<string name="follow_cursor">跟隨游標</string>
<string name="bottom_left">左下</string>
<string name="bottom_right">右下</string>
<string name="top_left">左上</string>
<string name="top_right">右上</string>
<string name="display_position">顯示位置</string>
<string name="candidates_window_position">候選詞視窗位置</string>
<string name="deploy_failure">部署失敗</string>
<string name="view_deploy_failure_log">部署失敗。點此檢視錯誤日誌。</string>
</resources>
6 changes: 3 additions & 3 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -217,20 +217,20 @@ SPDX-License-Identifier: GPL-3.0-or-later
<string name="synchronization">Synchronization</string>
<string name="profile_timing_background_sync_set_time">Set background sync time</string>
<string name="candidates_window">Candidates Window</string>
<string name="candidates_mode">Candidates mode</string>
<string name="show_candidates_window">Show candidates window</string>
<string name="general">General</string>
<string name="preedit">Preedit</string>
<string name="commit_text_preview">Commit text preview</string>
<string name="raw_input">Raw input</string>
<string name="composing_text_mode">Show composing text in editor</string>
<string name="depends_on_input_device">Depends on input device</string>
<string name="force_show">Force show</string>
<string name="always_show">Always show</string>
<string name="follow_cursor">Follow cursor</string>
<string name="bottom_left">Bottom left</string>
<string name="bottom_right">Bottom right</string>
<string name="top_left">Top left</string>
<string name="top_right">Top right</string>
<string name="display_position">Display position</string>
<string name="candidates_window_position">Candidates window position</string>
<string name="deploy_failure">Deploy failure</string>
<string name="view_deploy_failure_log">Deploy failure. Click here to view error log.</string>
</resources>

0 comments on commit a513da3

Please sign in to comment.