summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorAndrei Stingaceanu <stg@google.com>2015-06-19 17:58:47 +0100
committerAndrei Stingaceanu <stg@google.com>2015-06-23 13:31:35 +0100
commit838307275214cb9b51dff15a401013420aa4376a (patch)
treeb7efc441d39582cfda3a4a6db5cc5a9c8ac4311c /core/java
parent2c3c66a2cf06b4d081f539a1fa01b44780cc65dc (diff)
downloadframeworks_base-838307275214cb9b51dff15a401013420aa4376a.zip
frameworks_base-838307275214cb9b51dff15a401013420aa4376a.tar.gz
frameworks_base-838307275214cb9b51dff15a401013420aa4376a.tar.bz2
Floating toolbar shown after rotation in extract mode
Do not start the floating toolbar action mode and do not show the handles if after a rotation when the extract mode will be started. This fixes an issue where onTouch after rotate duplicates the handles in extracted mode. Note: if NO_EXTRACT_UI flag is set then the toolbar, selection and handles preserve their state. Bug: 21960251 Change-Id: I1c7881bf2f40d8877fa0ce26e27a29398edc1296
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/widget/Editor.java53
1 files changed, 29 insertions, 24 deletions
diff --git a/core/java/android/widget/Editor.java b/core/java/android/widget/Editor.java
index e050bda..a916887 100644
--- a/core/java/android/widget/Editor.java
+++ b/core/java/android/widget/Editor.java
@@ -4517,34 +4517,39 @@ public class Editor {
final float eventY = event.getY();
switch (event.getActionMasked()) {
case MotionEvent.ACTION_DOWN:
+ if (extractedTextModeWillBeStarted()) {
+ // Prevent duplicating the selection handles until the mode starts.
+ hide();
+ } else {
+ // Remember finger down position, to be able to start selection from there.
+ mMinTouchOffset = mMaxTouchOffset = mTextView.getOffsetForPosition(
+ eventX, eventY);
- // Remember finger down position, to be able to start selection from there.
- mMinTouchOffset = mMaxTouchOffset = mTextView.getOffsetForPosition(
- eventX, eventY);
-
- // Double tap detection
- if (mGestureStayedInTapRegion) {
- if (mDoubleTap) {
- final float deltaX = eventX - mDownPositionX;
- final float deltaY = eventY - mDownPositionY;
- final float distanceSquared = deltaX * deltaX + deltaY * deltaY;
-
- ViewConfiguration viewConfiguration = ViewConfiguration.get(
- mTextView.getContext());
- int doubleTapSlop = viewConfiguration.getScaledDoubleTapSlop();
- boolean stayedInArea = distanceSquared < doubleTapSlop * doubleTapSlop;
-
- if (stayedInArea && isPositionOnText(eventX, eventY)) {
- selectCurrentWordAndStartDrag();
- mDiscardNextActionUp = true;
+ // Double tap detection
+ if (mGestureStayedInTapRegion) {
+ if (mDoubleTap) {
+ final float deltaX = eventX - mDownPositionX;
+ final float deltaY = eventY - mDownPositionY;
+ final float distanceSquared = deltaX * deltaX + deltaY * deltaY;
+
+ ViewConfiguration viewConfiguration = ViewConfiguration.get(
+ mTextView.getContext());
+ int doubleTapSlop = viewConfiguration.getScaledDoubleTapSlop();
+ boolean stayedInArea =
+ distanceSquared < doubleTapSlop * doubleTapSlop;
+
+ if (stayedInArea && isPositionOnText(eventX, eventY)) {
+ selectCurrentWordAndStartDrag();
+ mDiscardNextActionUp = true;
+ }
}
}
- }
- mDownPositionX = eventX;
- mDownPositionY = eventY;
- mGestureStayedInTapRegion = true;
- mHaventMovedEnoughToStartDrag = true;
+ mDownPositionX = eventX;
+ mDownPositionY = eventY;
+ mGestureStayedInTapRegion = true;
+ mHaventMovedEnoughToStartDrag = true;
+ }
break;
case MotionEvent.ACTION_POINTER_DOWN: