summaryrefslogtreecommitdiffstats
path: root/core
diff options
context:
space:
mode:
authorAndrei Stingaceanu <stg@google.com>2015-06-19 16:44:37 +0100
committerAndrei Stingaceanu <stg@google.com>2015-06-22 12:42:06 +0100
commitb1891b3fc9d07ef766978f0a39c382b217a529e0 (patch)
tree94ae6e4a8696657b55e4aa95996bed09b4f55ced /core
parent8228e4247c320632ba1e401259eceae7aa2738d1 (diff)
downloadframeworks_base-b1891b3fc9d07ef766978f0a39c382b217a529e0.zip
frameworks_base-b1891b3fc9d07ef766978f0a39c382b217a529e0.tar.gz
frameworks_base-b1891b3fc9d07ef766978f0a39c382b217a529e0.tar.bz2
Fix selection by double tap in Extracted mode
Select with double tap in extracted mode has suffered a regression recently: flickers and it does not correctly select. Found this fix after a lot of trials. Bug: 20128047 Change-Id: I1bbe8c11982d37e5409bac2b648a31b0ca1f0bbc
Diffstat (limited to 'core')
-rw-r--r--core/java/android/inputmethodservice/ExtractEditText.java8
-rw-r--r--core/java/android/widget/Editor.java14
-rw-r--r--core/java/android/widget/TextView.java9
3 files changed, 25 insertions, 6 deletions
diff --git a/core/java/android/inputmethodservice/ExtractEditText.java b/core/java/android/inputmethodservice/ExtractEditText.java
index f965f54..8bc2876 100644
--- a/core/java/android/inputmethodservice/ExtractEditText.java
+++ b/core/java/android/inputmethodservice/ExtractEditText.java
@@ -165,6 +165,14 @@ public class ExtractEditText extends EditText {
}
/**
+ * @hide
+ */
+ @Override
+ public boolean isInExtractedMode() {
+ return true;
+ }
+
+ /**
* {@inheritDoc}
* @hide
*/
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index 9ca59f1..e050bda 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -623,7 +623,7 @@ public class Editor {
// One is the true focus lost where suggestions pop-up (if any) should be dismissed, and the
// other is an side effect of showing the suggestions pop-up itself. We use isShowingUp()
// to distinguish one from the other.
- if (mSuggestionsPopupWindow != null && ((mTextView instanceof ExtractEditText) ||
+ if (mSuggestionsPopupWindow != null && ((mTextView.isInExtractedMode()) ||
!mSuggestionsPopupWindow.isShowingUp())) {
// Should be done before hide insertion point controller since it triggers a show of it
mSuggestionsPopupWindow.hide();
@@ -640,7 +640,7 @@ public class Editor {
mTextView.removeAdjacentSuggestionSpans(end);
if (mTextView.isTextEditable() && mTextView.isSuggestionsEnabled() &&
- !(mTextView instanceof ExtractEditText)) {
+ !(mTextView.isInExtractedMode())) {
if (mSpellChecker == null && createSpellChecker) {
mSpellChecker = new SpellChecker(mTextView);
}
@@ -1063,7 +1063,7 @@ public class Editor {
// ExtractEditText clears focus, which gives focus to the ExtractEditText.
// This special case ensure that we keep current selection in that case.
// It would be better to know why the DecorView does not have focus at that time.
- if (((mTextView instanceof ExtractEditText) || mSelectionMoved) &&
+ if (((mTextView.isInExtractedMode()) || mSelectionMoved) &&
selStart >= 0 && selEnd >= 0) {
/*
* Someone intentionally set the selection, so let them
@@ -1099,7 +1099,7 @@ public class Editor {
// Don't leave us in the middle of a batch edit.
mTextView.onEndBatchEdit();
- if (mTextView instanceof ExtractEditText) {
+ if (mTextView.isInExtractedMode()) {
// terminateTextSelectionMode removes selection, which we want to keep when
// ExtractEditText goes out of focus.
final int selStart = mTextView.getSelectionStart();
@@ -1825,7 +1825,7 @@ public class Editor {
}
private boolean extractedTextModeWillBeStarted() {
- if (!(mTextView instanceof ExtractEditText)) {
+ if (!(mTextView.isInExtractedMode())) {
final InputMethodManager imm = InputMethodManager.peekInstance();
return imm != null && imm.isFullscreenMode();
}
@@ -4657,7 +4657,9 @@ public class Editor {
mEndHandle.showAtLocation(endOffset);
// No longer the first dragging motion, reset.
- startSelectionActionMode();
+ if (!(mTextView.isInExtractedMode())) {
+ startSelectionActionMode();
+ }
mDragAcceleratorActive = false;
mStartOffset = -1;
mSwitchedLines = false;
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index c538dc2..f733eab 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -8637,6 +8637,15 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
/**
+ * @return true if this TextView is specialized for showing and interacting with the extracted
+ * text in a full-screen input method.
+ * @hide
+ */
+ public boolean isInExtractedMode() {
+ return false;
+ }
+
+ /**
* This is a temporary method. Future versions may support multi-locale text.
* Caveat: This method may not return the latest spell checker locale, but this should be
* acceptable and it's more important to make this method asynchronous.