mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-04-22 23:29:10 +00:00
Merge 9e3d989d80
into a745c92e05
This commit is contained in:
commit
f134d6963e
3 changed files with 27 additions and 0 deletions
|
@ -211,6 +211,9 @@ class KeyboardActionListenerImpl(private val latinIME: LatinIME, private val inp
|
|||
return true
|
||||
}
|
||||
}
|
||||
|
||||
latinIME.hapticCursorFeedback()
|
||||
|
||||
if (inputLogic.moveCursorByAndReturnIfInsideComposingWord(moveSteps)) {
|
||||
// no need to finish input and restart suggestions if we're still in the word
|
||||
// this is a noticeable performance improvement
|
||||
|
|
|
@ -8,6 +8,7 @@ package helium314.keyboard.latin;
|
|||
|
||||
import android.content.Context;
|
||||
import android.media.AudioManager;
|
||||
import android.os.Build;
|
||||
import android.os.Vibrator;
|
||||
import android.view.HapticFeedbackConstants;
|
||||
import android.view.View;
|
||||
|
@ -107,6 +108,23 @@ public final class AudioAndHapticFeedbackManager {
|
|||
}
|
||||
}
|
||||
|
||||
public void performHapticCursorFeedback(final View viewToPerformHapticFeedbackOn) {
|
||||
if (!mSettingsValues.mVibrateOn) {
|
||||
return;
|
||||
}
|
||||
if (viewToPerformHapticFeedbackOn != null) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O_MR1) {
|
||||
viewToPerformHapticFeedbackOn.performHapticFeedback(
|
||||
HapticFeedbackConstants.TEXT_HANDLE_MOVE,
|
||||
HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
}else {
|
||||
viewToPerformHapticFeedbackOn.performHapticFeedback(
|
||||
HapticFeedbackConstants.CLOCK_TICK,
|
||||
HapticFeedbackConstants.FLAG_IGNORE_GLOBAL_SETTING);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void onSettingsChanged(final SettingsValues settingsValues) {
|
||||
mSettingsValues = settingsValues;
|
||||
mSoundOn = reevaluateIfSoundIsOn();
|
||||
|
|
|
@ -1799,6 +1799,12 @@ public class LatinIME extends InputMethodService implements
|
|||
}
|
||||
}
|
||||
|
||||
public void hapticCursorFeedback() {
|
||||
final MainKeyboardView keyboardView = mKeyboardSwitcher.getMainKeyboardView();
|
||||
final AudioAndHapticFeedbackManager feedbackManager = AudioAndHapticFeedbackManager.getInstance();
|
||||
feedbackManager.performHapticCursorFeedback(keyboardView);
|
||||
}
|
||||
|
||||
public void hapticAndAudioFeedback(final int code, final int repeatCount) {
|
||||
final MainKeyboardView keyboardView = mKeyboardSwitcher.getMainKeyboardView();
|
||||
if (keyboardView != null && keyboardView.isInDraggingFinger()) {
|
||||
|
|
Loading…
Add table
Reference in a new issue