Skip to content

Commit

Permalink
osfans#524 增加开关
Browse files Browse the repository at this point in the history
  • Loading branch information
tumuyan committed Sep 14, 2021
1 parent 16e72a2 commit 950ff77
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 @@ -287,6 +287,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 @@ -300,6 +301,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 @@ -1309,8 +1309,13 @@ public void onPickCandidate(int i) {
}
} else if (i == -4) onKey(KeyEvent.KEYCODE_PAGE_UP, 0);
else if (i == -5) onKey(KeyEvent.KEYCODE_PAGE_DOWN, 0);
else // if (Rime.selectCandidate(i))
{
else if (getPrefs().getOther().getClickCandidateAndCommit() || i > 9) {
if (Rime.selectCandidate(i)) {
commitText();
}
} else if (i == 9) {
handleKey(KeyEvent.KEYCODE_0, 0);
} else {
handleKey(KeyEvent.KEYCODE_1 + i, 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 @@ -155,4 +155,5 @@
<string name="about__used_libraries">我们使用的库</string>
<string name="about__used_library_dialog_title">同文输入法 | 开源软件库</string>
<string name="other__selection_sense_title">用Ctrl+Left/Right快速移动光标</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 @@ -156,4 +156,5 @@
<string name="about__used_libraries">我們使用的庫</string>
<string name="about__used_library_dialog_title">同文輸入法 | 開源軟體庫</string>
<string name="other__selection_sense_title">使用Ctrl+Left / Ctrl+Right快速移動遊標</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 @@ -156,4 +156,5 @@
<string name="about__used_libraries">Open Source Libraries We Use</string>
<string name="about__used_library_dialog_title">Trime | Open Source Libraries</string>
<string name="other__selection_sense_title">Uset Ctrl+Left/Right to move the cursor</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 950ff77

Please sign in to comment.