diff options
author | Andrei Stingaceanu <stg@google.com> | 2015-10-20 19:11:23 +0100 |
---|---|---|
committer | Andrei Stingaceanu <stg@google.com> | 2015-10-21 15:42:00 +0100 |
commit | 2aaeefec92ad70d9797b98caed4b554b982421c8 (patch) | |
tree | 023ba491563bfb3659cab6760c86f4481cc7011f /core | |
parent | 5e4863205ee459cd8813f45e91b2e67c603d38ef (diff) | |
download | frameworks_base-2aaeefec92ad70d9797b98caed4b554b982421c8.zip frameworks_base-2aaeefec92ad70d9797b98caed4b554b982421c8.tar.gz frameworks_base-2aaeefec92ad70d9797b98caed4b554b982421c8.tar.bz2 |
Fix toolbar flickering in ExtractedMode when longpressing.
onPreDraw starts an action mode in extract mode only which
does not consider the type of motion event and since extracted
mode never gets the focus event it never hides so it does not
need to show again.
Stop starting an action mode onPreDraw in extracted mode and
let the onTouchEvent handle starting the mode.
Also re-enabled dragging and dropping for ExtractedMode (most
of the issues were caused by starting the action mode
onPreDraw).
Bug: 25102276
Change-Id: I90d8e9f42f395b6b529e4d023ba6939e0dfb147f
Diffstat (limited to 'core')
-rw-r--r-- | core/java/android/widget/Editor.java | 20 | ||||
-rw-r--r-- | core/java/android/widget/TextView.java | 18 |
2 files changed, 14 insertions, 24 deletions
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java index 5b042c6..b0dcbb8 100644 --- a/core/java/android/widget/Editor.java +++ b/core/java/android/widget/Editor.java @@ -16,12 +16,6 @@ package android.widget; -import java.text.BreakIterator; -import java.util.Arrays; -import java.util.Comparator; -import java.util.HashMap; -import java.util.List; - import android.R; import android.annotation.Nullable; import android.app.PendingIntent; @@ -112,6 +106,12 @@ import com.android.internal.util.GrowingArrayUtils; import com.android.internal.util.Preconditions; import com.android.internal.widget.EditableInputConnection; +import java.text.BreakIterator; +import java.util.Arrays; +import java.util.Comparator; +import java.util.HashMap; +import java.util.List; + /** * Helper class used by TextView to handle editable text views. @@ -1004,8 +1004,7 @@ public class Editor { } if (!handled && mTextActionMode != null) { - // TODO: Fix dragging in extracted mode. - if (touchPositionIsInSelection() && !mTextView.isInExtractedMode()) { + if (touchPositionIsInSelection()) { // Start a drag final int start = mTextView.getSelectionStart(); final int end = mTextView.getSelectionEnd(); @@ -4860,9 +4859,8 @@ public class Editor { mEndHandle.showAtLocation(endOffset); // No longer the first dragging motion, reset. - if (!(mTextView.isInExtractedMode())) { - startSelectionActionMode(); - } + startSelectionActionMode(); + mDragAcceleratorActive = false; mStartOffset = -1; mSwitchedLines = false; diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index a1462c4..ca842bd 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -16,6 +16,8 @@ package android.widget; +import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1; + import android.R; import android.annotation.ColorInt; import android.annotation.DrawableRes; @@ -115,14 +117,14 @@ import android.view.KeyCharacterMap; import android.view.KeyEvent; import android.view.MotionEvent; import android.view.View; -import android.view.ViewParent; -import android.view.ViewStructure; import android.view.ViewConfiguration; import android.view.ViewDebug; import android.view.ViewGroup.LayoutParams; +import android.view.ViewHierarchyEncoder; +import android.view.ViewParent; import android.view.ViewRootImpl; +import android.view.ViewStructure; import android.view.ViewTreeObserver; -import android.view.ViewHierarchyEncoder; import android.view.accessibility.AccessibilityEvent; import android.view.accessibility.AccessibilityManager; import android.view.accessibility.AccessibilityNodeInfo; @@ -149,8 +151,6 @@ import java.lang.ref.WeakReference; import java.util.ArrayList; import java.util.Locale; -import static android.os.Build.VERSION_CODES.JELLY_BEAN_MR1; - /** * Displays text to the user and optionally allows them to edit it. A TextView * is a complete text editor, however the basic class is configured to not @@ -5243,14 +5243,6 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener mEditor.mCreatedWithASelection = false; } - // Phone specific code (there is no ExtractEditText on tablets). - // ExtractEditText does not call onFocus when it is displayed, and mHasSelectionOnFocus can - // not be set. Do the test here instead. - if (isInExtractedMode() && hasSelection() && mEditor != null - && mEditor.mTextActionMode == null && isShown() && hasWindowFocus()) { - mEditor.startSelectionActionMode(); - } - unregisterForPreDraw(); return true; |