summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Adam Powell <adamp@google.com> 2010-10-13 23:34:54 -0700
committer Android Git Automerger <android-git-automerger@android.com> 2010-10-13 23:34:54 -0700
commita8b6dad8e5c23f6ade3ccc6010a8915a41d6fbf9 (patch)
tree085fe5cf4860f5e0c6e890d9fd49a41178ce32b7
parentd0c37cfea0848bbc66d152df4cbcde3eb5b4b736 (diff)
parent4af1de39ab36cbff08075e654db516526ff9038d (diff)
am 4af1de39: am fb6431c0: Merge "Fix bug 3064135 - do not allow text handles on TextViews in sub windows." into gingerbread
Merge commit '4af1de39ab36cbff08075e654db516526ff9038d' * commit '4af1de39ab36cbff08075e654db516526ff9038d': Fix bug 3064135 - do not allow text handles on TextViews in sub windows.
-rw-r--r--core/java/android/widget/TextView.java14
1 files changed, 12 insertions, 2 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index fccf1550245e..09a19cd327ac 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -98,6 +98,7 @@ import android.view.MenuItem;
import android.view.MotionEvent;
import android.view.View;
import android.view.ViewDebug;
+import android.view.ViewGroup;
import android.view.ViewGroup.LayoutParams;
import android.view.ViewParent;
import android.view.ViewRoot;
@@ -6946,8 +6947,17 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
}
private void prepareCursorControllers() {
+ boolean windowSupportsHandles = false;
+
+ ViewGroup.LayoutParams params = getRootView().getLayoutParams();
+ if (params instanceof WindowManager.LayoutParams) {
+ WindowManager.LayoutParams windowParams = (WindowManager.LayoutParams) params;
+ windowSupportsHandles = windowParams.type < WindowManager.LayoutParams.FIRST_SUB_WINDOW
+ || windowParams.type > WindowManager.LayoutParams.LAST_SUB_WINDOW;
+ }
+
// TODO Add an extra android:cursorController flag to disable the controller?
- if (mCursorVisible && mLayout != null) {
+ if (windowSupportsHandles && mCursorVisible && mLayout != null) {
if (mInsertionPointCursorController == null) {
mInsertionPointCursorController = new InsertionPointCursorController();
}
@@ -6955,7 +6965,7 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
mInsertionPointCursorController = null;
}
- if (textCanBeSelected() && mLayout != null) {
+ if (windowSupportsHandles && textCanBeSelected() && mLayout != null) {
if (mSelectionModifierCursorController == null) {
mSelectionModifierCursorController = new SelectionModifierCursorController();
}