summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndrei Stingaceanu <stg@google.com>2015-06-24 09:16:34 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2015-06-24 09:16:36 +0000
commit2e5615467e40856e758631cea542da804de01a7d (patch)
tree4d0ef65f7def13d8d6926b521e2bf32eaffa657c
parent9ce8a9da407161dc6a17d100364b2e19c753765d (diff)
parent838307275214cb9b51dff15a401013420aa4376a (diff)
downloadframeworks_base-2e5615467e40856e758631cea542da804de01a7d.zip
frameworks_base-2e5615467e40856e758631cea542da804de01a7d.tar.gz
frameworks_base-2e5615467e40856e758631cea542da804de01a7d.tar.bz2
Merge "Floating toolbar shown after rotation in extract mode" into mnc-dev
-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: