use of android.view.inputmethod.ExtractedText in project wifikeyboard by IvanVolosyuk.
the class WiFiInputMethod method wordLeft.
private void wordLeft(InputConnection conn) {
boolean shift = pressedKeys.contains(KeyEvent.KEYCODE_SHIFT_LEFT);
ExtractedText text = conn.getExtractedText(req, 0);
if (text == null)
return;
int end = text.selectionEnd - 1;
String str = text.text.toString();
for (; end >= 0; end--) {
if (!Character.isSpace(str.charAt(end)))
break;
}
for (; end >= 0; end--) {
if (Character.isSpace(str.charAt(end)))
break;
}
end++;
int start = shift ? text.selectionStart : end;
Log.d("wifikeyboard", "start = " + start + " end = " + end);
conn.setSelection(start, end);
}
use of android.view.inputmethod.ExtractedText in project wifikeyboard by IvanVolosyuk.
the class WiFiInputMethod method wordRight.
private void wordRight(InputConnection conn) {
boolean shift = pressedKeys.contains(KeyEvent.KEYCODE_SHIFT_LEFT);
ExtractedText text = conn.getExtractedText(req, 0);
if (text == null)
return;
int end = text.selectionEnd;
String str = text.text.toString();
int len = str.length();
for (; end < len; end++) {
if (!Character.isSpace(str.charAt(end)))
break;
}
for (; end < len; end++) {
if (Character.isSpace(str.charAt(end)))
break;
}
int start = shift ? text.selectionStart : end;
Log.d("wifikeyboard", "start = " + start + " end = " + end);
conn.setSelection(start, end);
}
use of android.view.inputmethod.ExtractedText in project android_frameworks_base by ParanoidAndroid.
the class InputConnectionWrapper method getExtractedText.
public ExtractedText getExtractedText(ExtractedTextRequest request, int flags) {
ExtractedText value = null;
try {
InputContextCallback callback = InputContextCallback.getInstance();
mIInputContext.getExtractedText(request, flags, callback.mSeq, callback);
synchronized (callback) {
callback.waitForResultLocked();
if (callback.mHaveValue) {
value = callback.mExtractedText;
}
}
callback.dispose();
} catch (RemoteException e) {
return null;
}
return value;
}
use of android.view.inputmethod.ExtractedText in project chromeview by pwnall.
the class AdapterInputConnection method getExtractedText.
/**
* @see BaseInputConnection#getExtractedText(android.view.inputmethod.ExtractedTextRequest,
* int)
*/
@Override
public ExtractedText getExtractedText(ExtractedTextRequest request, int flags) {
if (DEBUG)
Log.w(TAG, "getExtractedText");
ExtractedText et = new ExtractedText();
Editable editable = getEditable();
et.text = editable.toString();
et.partialEndOffset = editable.length();
et.selectionStart = Selection.getSelectionStart(editable);
et.selectionEnd = Selection.getSelectionEnd(editable);
et.flags = mSingleLine ? ExtractedText.FLAG_SINGLE_LINE : 0;
return et;
}
use of android.view.inputmethod.ExtractedText in project wifikeyboard by IvanVolosyuk.
the class WiFiInputMethod method keyHome.
private void keyHome(InputConnection conn) {
boolean control = pressedKeys.contains(KEY_CONTROL);
boolean shift = pressedKeys.contains(KeyEvent.KEYCODE_SHIFT_LEFT);
ExtractedText text = conn.getExtractedText(req, 0);
if (text == null)
return;
int end;
if (control) {
end = 0;
} else {
end = text.text.toString().lastIndexOf('\n', text.selectionEnd - 1);
end++;
}
int start = shift ? text.selectionStart : end;
Log.d("wifikeyboard", "start = " + start + " end = " + end);
conn.setSelection(start, end);
}
Aggregations