Skip to content

Commit f97fbc5

Browse files
committed
Correction
1 parent 0aa7946 commit f97fbc5

File tree

5 files changed

+8
-22
lines changed

5 files changed

+8
-22
lines changed

app/src/main/java/org/fcitx/fcitx5/android/data/prefs/AppPrefs.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ class AppPrefs(private val sharedPreferences: SharedPreferences) {
8383
buttonLongPressVibrationMilliseconds = secondary
8484
}
8585

86-
val hapticFeedback = switch(R.string.haptic_feedback, "haptic_feedback", false)
86+
val hapticOnRepeat = switch(R.string.haptic_on_repeat, "haptic_on_repeat", false)
8787

8888
val buttonPressVibrationAmplitude: ManagedPreference.PInt
8989
val buttonLongPressVibrationAmplitude: ManagedPreference.PInt

app/src/main/java/org/fcitx/fcitx5/android/input/FcitxInputMethodService.kt

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,6 @@ class FcitxInputMethodService : LifecycleInputMethodService() {
126126
prefs.keyboard.expandKeypressArea,
127127
prefs.advanced.disableAnimation,
128128
prefs.advanced.ignoreSystemWindowInsets,
129-
prefs.keyboard.hapticFeedback,
130129
)
131130

132131
private fun replaceInputView(theme: Theme): InputView {
@@ -928,7 +927,6 @@ class FcitxInputMethodService : LifecycleInputMethodService() {
928927

929928
override fun onFinishInputView(finishingInput: Boolean) {
930929
Timber.d("onFinishInputView: finishingInput=$finishingInput")
931-
inputView?.updateSelection(0, 0)
932930
decorLocationUpdated = false
933931
inputDeviceMgr.onFinishInputView()
934932
currentInputConnection?.apply {

app/src/main/java/org/fcitx/fcitx5/android/input/keyboard/BaseKeyboard.kt

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ abstract class BaseKeyboard(
6868

6969
private val vivoKeypressWorkaround by prefs.advanced.vivoKeypressWorkaround
7070

71-
private val hapticFeedback by prefs.keyboard.hapticFeedback
71+
private val hapticOnRepeat by prefs.keyboard.hapticOnRepeat
7272

7373
var popupActionListener: PopupActionListener? = null
7474

@@ -159,9 +159,6 @@ abstract class BaseKeyboard(
159159
is ReturnKey -> InputFeedbacks.SoundEffect.Return
160160
else -> InputFeedbacks.SoundEffect.Standard
161161
}
162-
val vibration: ((View, Boolean) -> Unit)? = if (hapticFeedback) { view, extraConditions ->
163-
if (selection.end > 0 && selection.start > 0 && extraConditions) InputFeedbacks.hapticFeedback(view)
164-
} else null
165162
if (def is SpaceKey) {
166163
spaceKeys.add(this)
167164
swipeEnabled = spaceSwipeMoveCursor.getValue()
@@ -178,7 +175,7 @@ abstract class BaseKeyboard(
178175
val action = KeyAction.SymAction(KeySym(sym), KeyStates.Empty)
179176
repeat(count.absoluteValue) {
180177
onAction(action)
181-
vibration?.invoke(view, selection.end >= selection.start)
178+
if (hapticOnRepeat) InputFeedbacks.hapticFeedback(view)
182179
}
183180
true
184181
}
@@ -197,7 +194,7 @@ abstract class BaseKeyboard(
197194
val count = event.countX
198195
if (count != 0) {
199196
onAction(KeyAction.MoveSelectionAction(count))
200-
vibration?.invoke(view, selection.end > selection.start)
197+
if (hapticOnRepeat) InputFeedbacks.hapticFeedback(view)
201198
true
202199
} else false
203200
}
@@ -224,10 +221,10 @@ abstract class BaseKeyboard(
224221
}
225222
is KeyDef.Behavior.Repeat -> {
226223
repeatEnabled = true
227-
onRepeatListener = if (hapticFeedback && def is BackspaceKey) { view ->
224+
onRepeatListener = { view ->
228225
onAction(it.action)
229-
vibration?.invoke(view, selection.end >= selection.start)
230-
} else { _ -> onAction(it.action) }
226+
if (hapticOnRepeat) InputFeedbacks.hapticFeedback(view)
227+
}
231228
}
232229
is KeyDef.Behavior.Swipe -> {
233230
swipeEnabled = true
@@ -487,11 +484,6 @@ abstract class BaseKeyboard(
487484
return true
488485
}
489486

490-
private val selection = CursorRange()
491-
fun onSelectionUpdate(start: Int, end: Int) {
492-
selection.update(start, end)
493-
}
494-
495487
open fun onAttach() {
496488
// do nothing by default
497489
}

app/src/main/java/org/fcitx/fcitx5/android/input/keyboard/KeyboardWindow.kt

Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -159,10 +159,6 @@ class KeyboardWindow : InputWindow.SimpleInputWindow<KeyboardWindow>(), Essentia
159159
currentKeyboard?.onReturnDrawableUpdate(resourceId)
160160
}
161161

162-
override fun onSelectionUpdate(start: Int, end: Int) {
163-
currentKeyboard?.onSelectionUpdate(start, end)
164-
}
165-
166162
override fun onAttached() {
167163
currentKeyboard?.let {
168164
it.keyActionListener = keyActionListener

app/src/main/res/values/strings.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -283,5 +283,5 @@
283283
<string name="restart_fcitx_instance_confirm">Fcitx instance will be destroyed and reinitialized. Proceed?</string>
284284
<string name="ignore_system_window_insets">Ignore system WindowInsets</string>
285285
<string name="browse_user_data_dir">Browse user data directory</string>
286-
<string name="haptic_feedback">Haptic feedback on key repeat</string>
286+
<string name="haptic_on_repeat">Haptic feedback on key repeat</string>
287287
</resources>

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy