mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-14 05:52:47 +00:00
change swipe cursor behaviour to use left/right keys
This commit is contained in:
parent
8e4c01941e
commit
48b9ac9967
1 changed files with 6 additions and 11 deletions
|
@ -36,6 +36,7 @@ import android.os.IBinder;
|
|||
import android.os.Message;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.text.InputType;
|
||||
import android.text.TextUtils;
|
||||
import android.util.Log;
|
||||
import android.util.PrintWriterPrinter;
|
||||
import android.util.Printer;
|
||||
|
@ -1355,17 +1356,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
|
||||
@Override
|
||||
public void onMovePointer(int steps) {
|
||||
if (steps < 0) {
|
||||
int availableCharacters = getCurrentInputConnection().getTextBeforeCursor(64, 0).length();
|
||||
steps = availableCharacters < -steps ? -availableCharacters : steps;
|
||||
}
|
||||
else if (steps > 0) {
|
||||
int availableCharacters = getCurrentInputConnection().getTextAfterCursor(64, 0).length();
|
||||
steps = availableCharacters < steps ? availableCharacters : steps;
|
||||
} else return;
|
||||
|
||||
int newPosition = mInputLogic.mConnection.mExpectedSelStart + steps;
|
||||
getCurrentInputConnection().setSelection(newPosition, newPosition);
|
||||
for (; steps < 0; steps++)
|
||||
mInputLogic.sendDownUpKeyEvent(KeyEvent.KEYCODE_DPAD_LEFT);
|
||||
for (; steps > 0; steps--)
|
||||
mInputLogic.sendDownUpKeyEvent(KeyEvent.KEYCODE_DPAD_RIGHT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1377,6 +1371,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
|||
mInputLogic.mConnection.setSelection(start, end);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onUpWithDeletePointerActive() {
|
||||
if (mInputLogic.mConnection.hasSelection()) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue