diff options
author | Adam Powell <adamp@google.com> | 2010-10-12 15:00:30 -0700 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2010-10-12 15:00:30 -0700 |
commit | fb6431c0298747d240fcdc025575e5f46db95132 (patch) | |
tree | b6de0ede6bc771af60c88149c84d446e12c86491 /core/java | |
parent | e22eb863dc4419dcaf329e9e28e3dc1f71f82902 (diff) | |
parent | 8c8293bc4dc1930d5b6a74e3abfe955a433af725 (diff) | |
download | frameworks_base-fb6431c0298747d240fcdc025575e5f46db95132.zip frameworks_base-fb6431c0298747d240fcdc025575e5f46db95132.tar.gz frameworks_base-fb6431c0298747d240fcdc025575e5f46db95132.tar.bz2 |
Merge "Fix bug 3064135 - do not allow text handles on TextViews in sub windows." into gingerbread
Diffstat (limited to 'core/java')
-rw-r--r-- | core/java/android/widget/TextView.java | 14 |
1 files changed, 12 insertions, 2 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java index 5be52c4..6dcf4e6 100644 --- a/core/java/android/widget/TextView.java +++ b/core/java/android/widget/TextView.java @@ -92,6 +92,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; @@ -6852,8 +6853,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(); } @@ -6861,7 +6871,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(); } |