use of android.view.inputmethod.ExtractedText in project wifikeyboard by IvanVolosyuk.
the class WiFiInputMethod method keyEnd.
private void keyEnd(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 = text.text.length();
} else {
end = text.text.toString().indexOf('\n', text.selectionEnd);
if (end == -1)
end = text.text.length();
}
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 android_frameworks_base by DirtyUnicorns.
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 speechutils by Kaljurand.
the class InputConnectionCommandEditor method selectAll.
/**
* mInputConnection.performContextMenuAction(android.R.id.selectAll) does not create a selection
*/
@Override
public Op selectAll() {
return new Op("selectAll") {
@Override
public Op run() {
Op undo = null;
mInputConnection.beginBatchEdit();
final ExtractedText et = getExtractedText();
if (et != null) {
undo = getOpSetSelection(0, et.text.length(), et.selectionStart, et.selectionEnd).run();
}
mInputConnection.endBatchEdit();
return undo;
}
};
}
use of android.view.inputmethod.ExtractedText in project speechutils by Kaljurand.
the class InputConnectionCommandEditor method moveRel.
public Op moveRel(final int numberOfChars) {
return new Op("moveRel") {
@Override
public Op run() {
Op undo = null;
mInputConnection.beginBatchEdit();
ExtractedText extractedText = getExtractedText();
if (extractedText != null) {
int pos;
if (numberOfChars < 0) {
pos = extractedText.selectionStart;
} else {
pos = extractedText.selectionEnd;
}
int newPos = pos + numberOfChars;
undo = getOpSetSelection(newPos, newPos, extractedText.selectionStart, extractedText.selectionEnd).run();
}
mInputConnection.endBatchEdit();
return undo;
}
};
}
Aggregations