mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-05-14 14:02:44 +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.os.Message;
|
||||||
import android.preference.PreferenceManager;
|
import android.preference.PreferenceManager;
|
||||||
import android.text.InputType;
|
import android.text.InputType;
|
||||||
|
import android.text.TextUtils;
|
||||||
import android.util.Log;
|
import android.util.Log;
|
||||||
import android.util.PrintWriterPrinter;
|
import android.util.PrintWriterPrinter;
|
||||||
import android.util.Printer;
|
import android.util.Printer;
|
||||||
|
@ -1355,17 +1356,10 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMovePointer(int steps) {
|
public void onMovePointer(int steps) {
|
||||||
if (steps < 0) {
|
for (; steps < 0; steps++)
|
||||||
int availableCharacters = getCurrentInputConnection().getTextBeforeCursor(64, 0).length();
|
mInputLogic.sendDownUpKeyEvent(KeyEvent.KEYCODE_DPAD_LEFT);
|
||||||
steps = availableCharacters < -steps ? -availableCharacters : steps;
|
for (; steps > 0; steps--)
|
||||||
}
|
mInputLogic.sendDownUpKeyEvent(KeyEvent.KEYCODE_DPAD_RIGHT);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1377,6 +1371,7 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
mInputLogic.mConnection.setSelection(start, end);
|
mInputLogic.mConnection.setSelection(start, end);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onUpWithDeletePointerActive() {
|
public void onUpWithDeletePointerActive() {
|
||||||
if (mInputLogic.mConnection.hasSelection()) {
|
if (mInputLogic.mConnection.hasSelection()) {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue