mirror of
https://github.com/Helium314/HeliBoard.git
synced 2025-06-06 06:40:17 +00:00
trying to fix swipe cursor
This commit is contained in:
parent
5e2dbda4e0
commit
c3276b943b
1 changed files with 113 additions and 107 deletions
|
@ -36,7 +36,6 @@ 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;
|
||||||
|
@ -1356,10 +1355,18 @@ public class LatinIME extends InputMethodService implements KeyboardActionListen
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onMovePointer(int steps) {
|
public void onMovePointer(int steps) {
|
||||||
for (; steps < 0; steps++)
|
if (steps < 0) {
|
||||||
mInputLogic.sendDownUpKeyEvent(KeyEvent.KEYCODE_DPAD_LEFT);
|
int availableCharacters = mInputLogic.mConnection.getTextBeforeCursor(64, 0).length();
|
||||||
for (; steps > 0; steps--)
|
steps = availableCharacters < -steps ? -availableCharacters : steps;
|
||||||
mInputLogic.sendDownUpKeyEvent(KeyEvent.KEYCODE_DPAD_RIGHT);
|
}
|
||||||
|
else if (steps > 0) {
|
||||||
|
int availableCharacters = mInputLogic.mConnection.getTextAfterCursor(64, 0).length();
|
||||||
|
steps = Math.min(availableCharacters, steps);
|
||||||
|
} else
|
||||||
|
return;
|
||||||
|
|
||||||
|
int newPosition = mInputLogic.mConnection.mExpectedSelStart + steps;
|
||||||
|
mInputLogic.mConnection.setSelection(newPosition, newPosition);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -1371,12 +1378,11 @@ 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()) {
|
||||||
mInputLogic.sendDownUpKeyEvent(KeyEvent.KEYCODE_DEL);
|
mInputLogic.finishInput();
|
||||||
mInputLogic.sendDownUpKeyEvent(KeyEvent.KEYCODE_SHIFT_LEFT);
|
onCodeInput(Constants.CODE_DELETE, Constants.NOT_A_COORDINATE, Constants.NOT_A_COORDINATE, false);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue