Skip to content

Commit 3c946c3

Browse files
committed
Correction
1 parent 0aa7946 commit 3c946c3

File tree

5 files changed

+8
-23
lines changed

5 files changed

+8
-23
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 & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,6 @@ import org.fcitx.fcitx5.android.data.InputFeedbacks
2121
import org.fcitx.fcitx5.android.data.prefs.AppPrefs
2222
import org.fcitx.fcitx5.android.data.prefs.ManagedPreference
2323
import org.fcitx.fcitx5.android.data.theme.Theme
24-
import org.fcitx.fcitx5.android.input.cursor.CursorRange
2524
import org.fcitx.fcitx5.android.input.keyboard.CustomGestureView.GestureType
2625
import org.fcitx.fcitx5.android.input.keyboard.CustomGestureView.OnGestureListener
2726
import org.fcitx.fcitx5.android.input.popup.PopupAction
@@ -68,7 +67,7 @@ abstract class BaseKeyboard(
6867

6968
private val vivoKeypressWorkaround by prefs.advanced.vivoKeypressWorkaround
7069

71-
private val hapticFeedback by prefs.keyboard.hapticFeedback
70+
private val hapticOnRepeat by prefs.keyboard.hapticOnRepeat
7271

7372
var popupActionListener: PopupActionListener? = null
7473

@@ -159,9 +158,6 @@ abstract class BaseKeyboard(
159158
is ReturnKey -> InputFeedbacks.SoundEffect.Return
160159
else -> InputFeedbacks.SoundEffect.Standard
161160
}
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
165161
if (def is SpaceKey) {
166162
spaceKeys.add(this)
167163
swipeEnabled = spaceSwipeMoveCursor.getValue()
@@ -178,7 +174,7 @@ abstract class BaseKeyboard(
178174
val action = KeyAction.SymAction(KeySym(sym), KeyStates.Empty)
179175
repeat(count.absoluteValue) {
180176
onAction(action)
181-
vibration?.invoke(view, selection.end >= selection.start)
177+
if (hapticOnRepeat) InputFeedbacks.hapticFeedback(view)
182178
}
183179
true
184180
}
@@ -197,7 +193,7 @@ abstract class BaseKeyboard(
197193
val count = event.countX
198194
if (count != 0) {
199195
onAction(KeyAction.MoveSelectionAction(count))
200-
vibration?.invoke(view, selection.end > selection.start)
196+
if (hapticOnRepeat) InputFeedbacks.hapticFeedback(view)
201197
true
202198
} else false
203199
}
@@ -224,10 +220,10 @@ abstract class BaseKeyboard(
224220
}
225221
is KeyDef.Behavior.Repeat -> {
226222
repeatEnabled = true
227-
onRepeatListener = if (hapticFeedback && def is BackspaceKey) { view ->
223+
onRepeatListener = { view ->
228224
onAction(it.action)
229-
vibration?.invoke(view, selection.end >= selection.start)
230-
} else { _ -> onAction(it.action) }
225+
if (hapticOnRepeat) InputFeedbacks.hapticFeedback(view)
226+
}
231227
}
232228
is KeyDef.Behavior.Swipe -> {
233229
swipeEnabled = true
@@ -487,11 +483,6 @@ abstract class BaseKeyboard(
487483
return true
488484
}
489485

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

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