use of android.view.inputmethod.ExtractedTextRequest in project android_frameworks_base by AOSPA.
the class Editor method reportExtractedText.
boolean reportExtractedText() {
final Editor.InputMethodState ims = mInputMethodState;
if (ims != null) {
final boolean contentChanged = ims.mContentChanged;
if (contentChanged || ims.mSelectionModeChanged) {
ims.mContentChanged = false;
ims.mSelectionModeChanged = false;
final ExtractedTextRequest req = ims.mExtractedTextRequest;
if (req != null) {
InputMethodManager imm = InputMethodManager.peekInstance();
if (imm != null) {
if (TextView.DEBUG_EXTRACT)
Log.v(TextView.LOG_TAG, "Retrieving extracted start=" + ims.mChangedStart + " end=" + ims.mChangedEnd + " delta=" + ims.mChangedDelta);
if (ims.mChangedStart < 0 && !contentChanged) {
ims.mChangedStart = EXTRACT_NOTHING;
}
if (extractTextInternal(req, ims.mChangedStart, ims.mChangedEnd, ims.mChangedDelta, ims.mExtractedText)) {
if (TextView.DEBUG_EXTRACT)
Log.v(TextView.LOG_TAG, "Reporting extracted start=" + ims.mExtractedText.partialStartOffset + " end=" + ims.mExtractedText.partialEndOffset + ": " + ims.mExtractedText.text);
imm.updateExtractedText(mTextView, req.token, ims.mExtractedText);
ims.mChangedStart = EXTRACT_UNKNOWN;
ims.mChangedEnd = EXTRACT_UNKNOWN;
ims.mChangedDelta = 0;
ims.mContentChanged = false;
return true;
}
}
}
}
}
return false;
}
use of android.view.inputmethod.ExtractedTextRequest in project XobotOS by xamarin.
the class TextView method reportExtractedText.
boolean reportExtractedText() {
final InputMethodState ims = mInputMethodState;
if (ims != null) {
final boolean contentChanged = ims.mContentChanged;
if (contentChanged || ims.mSelectionModeChanged) {
ims.mContentChanged = false;
ims.mSelectionModeChanged = false;
final ExtractedTextRequest req = mInputMethodState.mExtracting;
if (req != null) {
InputMethodManager imm = InputMethodManager.peekInstance();
if (imm != null) {
if (DEBUG_EXTRACT)
Log.v(LOG_TAG, "Retrieving extracted start=" + ims.mChangedStart + " end=" + ims.mChangedEnd + " delta=" + ims.mChangedDelta);
if (ims.mChangedStart < 0 && !contentChanged) {
ims.mChangedStart = EXTRACT_NOTHING;
}
if (extractTextInternal(req, ims.mChangedStart, ims.mChangedEnd, ims.mChangedDelta, ims.mTmpExtracted)) {
if (DEBUG_EXTRACT)
Log.v(LOG_TAG, "Reporting extracted start=" + ims.mTmpExtracted.partialStartOffset + " end=" + ims.mTmpExtracted.partialEndOffset + ": " + ims.mTmpExtracted.text);
imm.updateExtractedText(this, req.token, mInputMethodState.mTmpExtracted);
ims.mChangedStart = EXTRACT_UNKNOWN;
ims.mChangedEnd = EXTRACT_UNKNOWN;
ims.mChangedDelta = 0;
ims.mContentChanged = false;
return true;
}
}
}
}
}
return false;
}
use of android.view.inputmethod.ExtractedTextRequest in project android_frameworks_base by DirtyUnicorns.
the class InputMethodService method startExtractingText.
void startExtractingText(boolean inputChanged) {
final ExtractEditText eet = mExtractEditText;
if (eet != null && getCurrentInputStarted() && isFullscreenMode()) {
mExtractedToken++;
ExtractedTextRequest req = new ExtractedTextRequest();
req.token = mExtractedToken;
req.flags = InputConnection.GET_TEXT_WITH_STYLES;
req.hintMaxLines = 10;
req.hintMaxChars = 10000;
InputConnection ic = getCurrentInputConnection();
mExtractedText = ic == null ? null : ic.getExtractedText(req, InputConnection.GET_EXTRACTED_TEXT_MONITOR);
if (mExtractedText == null || ic == null) {
Log.e(TAG, "Unexpected null in startExtractingText : mExtractedText = " + mExtractedText + ", input connection = " + ic);
}
final EditorInfo ei = getCurrentInputEditorInfo();
try {
eet.startInternalChanges();
onUpdateExtractingVisibility(ei);
onUpdateExtractingViews(ei);
int inputType = ei.inputType;
if ((inputType & EditorInfo.TYPE_MASK_CLASS) == EditorInfo.TYPE_CLASS_TEXT) {
if ((inputType & EditorInfo.TYPE_TEXT_FLAG_IME_MULTI_LINE) != 0) {
inputType |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;
}
}
eet.setInputType(inputType);
eet.setHint(ei.hintText);
if (mExtractedText != null) {
eet.setEnabled(true);
eet.setExtractedText(mExtractedText);
} else {
eet.setEnabled(false);
eet.setText("");
}
} finally {
eet.finishInternalChanges();
}
if (inputChanged) {
onExtractingInputChanged(ei);
}
}
}
use of android.view.inputmethod.ExtractedTextRequest in project android_frameworks_base by crdroidandroid.
the class InputMethodService method startExtractingText.
void startExtractingText(boolean inputChanged) {
final ExtractEditText eet = mExtractEditText;
if (eet != null && getCurrentInputStarted() && isFullscreenMode()) {
mExtractedToken++;
ExtractedTextRequest req = new ExtractedTextRequest();
req.token = mExtractedToken;
req.flags = InputConnection.GET_TEXT_WITH_STYLES;
req.hintMaxLines = 10;
req.hintMaxChars = 10000;
InputConnection ic = getCurrentInputConnection();
mExtractedText = ic == null ? null : ic.getExtractedText(req, InputConnection.GET_EXTRACTED_TEXT_MONITOR);
if (mExtractedText == null || ic == null) {
Log.e(TAG, "Unexpected null in startExtractingText : mExtractedText = " + mExtractedText + ", input connection = " + ic);
}
final EditorInfo ei = getCurrentInputEditorInfo();
try {
eet.startInternalChanges();
onUpdateExtractingVisibility(ei);
onUpdateExtractingViews(ei);
int inputType = ei.inputType;
if ((inputType & EditorInfo.TYPE_MASK_CLASS) == EditorInfo.TYPE_CLASS_TEXT) {
if ((inputType & EditorInfo.TYPE_TEXT_FLAG_IME_MULTI_LINE) != 0) {
inputType |= EditorInfo.TYPE_TEXT_FLAG_MULTI_LINE;
}
}
eet.setInputType(inputType);
eet.setHint(ei.hintText);
if (mExtractedText != null) {
eet.setEnabled(true);
eet.setExtractedText(mExtractedText);
} else {
eet.setEnabled(false);
eet.setText("");
}
} finally {
eet.finishInternalChanges();
}
if (inputChanged) {
onExtractingInputChanged(ei);
}
}
}
Aggregations