Skip to content

Commit

Permalink
#524 增加开关
Browse files Browse the repository at this point in the history
  • Loading branch information
tumuyan committed Oct 11, 2021
1 parent 2893c46 commit 82a1abd
Show file tree
Hide file tree
Showing 6 changed files with 18 additions and 2 deletions.
4 changes: 4 additions & 0 deletions app/src/main/java/com/osfans/trime/ime/core/Preferences.kt
Original file line number Diff line number Diff line change
Expand Up @@ -292,6 +292,7 @@ class Preferences(
const val SHOW_STATUS_BAR_ICON = "other__show_status_bar_icon"
const val DESTROY_ON_QUIT = "other__destroy_on_quit"
const val SELECTION_SENSE = "other__selection_sense"
const val CLICK_CANDIDATE_AND_COMMIT = "other__click_candidate_and_commit"
const val CLIPBOARD_COMPARE_RULES = "other__clipboard_compare"
const val CLIPBOARD_OUTPUT_RULES = "other__clipboard_output"
const val CLIPBOARD_MANAGER_RULES = "other__clipboard_manager"
Expand All @@ -305,6 +306,9 @@ class Preferences(
var selectionSense: Boolean
get() = prefs.getPref(SELECTION_SENSE, true)
set(v) = prefs.setPref(SELECTION_SENSE, v)
var clickCandidateAndCommit: Boolean
get() = prefs.getPref(CLICK_CANDIDATE_AND_COMMIT, true)
set(v) = prefs.setPref(CLICK_CANDIDATE_AND_COMMIT, v)
var showStatusBarIcon: Boolean = false
get() = prefs.getPref(SHOW_STATUS_BAR_ICON, false)
private set
Expand Down
9 changes: 7 additions & 2 deletions app/src/main/java/com/osfans/trime/ime/core/Trime.java
Original file line number Diff line number Diff line change
Expand Up @@ -1257,8 +1257,13 @@ public void onCandidatePressed(int index) {
}
} else if (index == -4) onKey(KeyEvent.KEYCODE_PAGE_UP, 0);
else if (index == -5) onKey(KeyEvent.KEYCODE_PAGE_DOWN, 0);
else // if (Rime.selectCandidate(index))
{
else if (getPrefs().getOther().getClickCandidateAndCommit() || index > 9) {
if (Rime.selectCandidate(index)) {
commitText();
}
} else if (index == 9) {
handleKey(KeyEvent.KEYCODE_0, 0);
} else {
handleKey(KeyEvent.KEYCODE_1 + index, 0);
}
}
Expand Down
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rCN/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -157,4 +157,5 @@
<string name="other__selection_sense_title">用 Ctrl+Left/Right 快速移动光标</string>
<string name="pref__system_default">系统默认</string>
<string name="keyboard__key_swipe_travel_title">触发滑动手势的最短距离</string>
<string name="other__click_candidate_and_commit">点击候选词时直接上屏</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values-zh-rTW/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,5 @@
<string name="other__selection_sense_title">使用 Ctrl+Left / Ctrl+Right 快速移動遊標</string>
<string name="pref__system_default">系統預設</string>
<string name="keyboard__key_swipe_travel_title">觸發滑動手勢的最短距離</string>
<string name="other__click_candidate_and_commit">點擊候選詞時直接上屏</string>
</resources>
1 change: 1 addition & 0 deletions app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -158,4 +158,5 @@
<string name="other__selection_sense_title">Uset Ctrl+Left/Right to move the cursor</string>
<string name="pref__system_default">System Default</string>
<string name="keyboard__key_swipe_travel_title">Min travel for gesture</string>
<string name="other__click_candidate_and_commit">Click candidate and commit directly</string>
</resources>
4 changes: 4 additions & 0 deletions app/src/main/res/xml/other_preference.xml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@
app:iconSpaceReserved="false"
android:title="@string/other__selection_sense_title" />

<SwitchPreferenceCompat android:key="other__click_candidate_and_commit"
app:iconSpaceReserved="false"
android:title="@string/other__click_candidate_and_commit" />

<ListPreference
android:defaultValue="100"
app:iconSpaceReserved="false"
Expand Down

0 comments on commit 82a1abd

Please sign in to comment.