summaryrefslogtreecommitdiffstats
path: root/core/java
diff options
context:
space:
mode:
authorGilles Debunne <debunne@google.com>2011-01-27 09:48:01 -0800
committerGilles Debunne <debunne@google.com>2011-01-27 09:49:41 -0800
commitddd6f3928756c439e8a7a975a9dc51248f687b7e (patch)
tree0d4dc9e4410ff93fe2985fecec00ba65ea10cdf1 /core/java
parent63b38e31aaea5a3e75c7bbe0c9e40e8bdb78ff73 (diff)
downloadframeworks_base-ddd6f3928756c439e8a7a975a9dc51248f687b7e.zip
frameworks_base-ddd6f3928756c439e8a7a975a9dc51248f687b7e.tar.gz
frameworks_base-ddd6f3928756c439e8a7a975a9dc51248f687b7e.tar.bz2
CustomSelectionActionModeCallback can prevent selection mode from starting.
Bug 3381317 Change-Id: I9fb52077216ed56c101ed58f8897478343369528
Diffstat (limited to 'core/java')
-rw-r--r--core/java/android/widget/TextView.java8
1 files changed, 7 insertions, 1 deletions
diff --git a/core/java/android/widget/TextView.java b/core/java/android/widget/TextView.java
index 213117d..b024dcb 100644
--- a/core/java/android/widget/TextView.java
+++ b/core/java/android/widget/TextView.java
@@ -8204,6 +8204,9 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
* {@link android.R.id#selectAll}, {@link android.R.id#cut}, {@link android.R.id#copy} or
* {@link android.R.id#paste} ids as parameters.
*
+ * Returning false from {@link ActionMode.Callback#onCreateActionMode(ActionMode, Menu)} will
+ * prevent the action mode from being started.
+ *
* Action click events should be handled by the custom implementation of
* {@link ActionMode.Callback#onActionItemClicked(ActionMode, MenuItem)}.
*
@@ -8364,7 +8367,10 @@ public class TextView extends View implements ViewTreeObserver.OnPreDrawListener
styledAttributes.recycle();
if (mCustomSelectionActionModeCallback != null) {
- mCustomSelectionActionModeCallback.onCreateActionMode(mode, menu);
+ if (!mCustomSelectionActionModeCallback.onCreateActionMode(mode, menu)) {
+ // The custom mode can choose to cancel the action mode
+ return false;
+ }
}
if (menu.hasVisibleItems() || mode.getCustomView() != null) {