16e34636749217654f43221885afb7a29bb5ca96aAdam Powell/* 26e34636749217654f43221885afb7a29bb5ca96aAdam Powell * Copyright (C) 2010 The Android Open Source Project 36e34636749217654f43221885afb7a29bb5ca96aAdam Powell * 46e34636749217654f43221885afb7a29bb5ca96aAdam Powell * Licensed under the Apache License, Version 2.0 (the "License"); 56e34636749217654f43221885afb7a29bb5ca96aAdam Powell * you may not use this file except in compliance with the License. 66e34636749217654f43221885afb7a29bb5ca96aAdam Powell * You may obtain a copy of the License at 76e34636749217654f43221885afb7a29bb5ca96aAdam Powell * 86e34636749217654f43221885afb7a29bb5ca96aAdam Powell * http://www.apache.org/licenses/LICENSE-2.0 96e34636749217654f43221885afb7a29bb5ca96aAdam Powell * 106e34636749217654f43221885afb7a29bb5ca96aAdam Powell * Unless required by applicable law or agreed to in writing, software 116e34636749217654f43221885afb7a29bb5ca96aAdam Powell * distributed under the License is distributed on an "AS IS" BASIS, 126e34636749217654f43221885afb7a29bb5ca96aAdam Powell * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 136e34636749217654f43221885afb7a29bb5ca96aAdam Powell * See the License for the specific language governing permissions and 146e34636749217654f43221885afb7a29bb5ca96aAdam Powell * limitations under the License. 156e34636749217654f43221885afb7a29bb5ca96aAdam Powell */ 166e34636749217654f43221885afb7a29bb5ca96aAdam Powell 176e34636749217654f43221885afb7a29bb5ca96aAdam Powellpackage android.view; 186e34636749217654f43221885afb7a29bb5ca96aAdam Powell 196e34636749217654f43221885afb7a29bb5ca96aAdam Powell 206e34636749217654f43221885afb7a29bb5ca96aAdam Powell/** 215e0959393426371dadef2c7905d5c915a1ac2dd4Scott Main * Represents a contextual mode of the user interface. Action modes can be used to provide 225e0959393426371dadef2c7905d5c915a1ac2dd4Scott Main * alternative interaction modes and replace parts of the normal UI until finished. 235e0959393426371dadef2c7905d5c915a1ac2dd4Scott Main * Examples of good action modes include text selection and contextual actions. 245e0959393426371dadef2c7905d5c915a1ac2dd4Scott Main * <div class="special reference"> 255e0959393426371dadef2c7905d5c915a1ac2dd4Scott Main * <h3>Developer Guides</h3> 265e0959393426371dadef2c7905d5c915a1ac2dd4Scott Main * <p>For information about how to provide contextual actions with {@code ActionMode}, 27ef0314b2c693c6cfa34680a784210dfb540fe36cScott Main * read the <a href="{@docRoot}guide/topics/ui/menus.html#context-menu">Menus</a> 285e0959393426371dadef2c7905d5c915a1ac2dd4Scott Main * developer guide.</p> 295e0959393426371dadef2c7905d5c915a1ac2dd4Scott Main * </div> 306e34636749217654f43221885afb7a29bb5ca96aAdam Powell */ 316e34636749217654f43221885afb7a29bb5ca96aAdam Powellpublic abstract class ActionMode { 32f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell private Object mTag; 33785c447b2bc625209706fd128ce61781c3a4183bAdam Powell private boolean mTitleOptionalHint; 34f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell 35f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell /** 36f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell * Set a tag object associated with this ActionMode. 37f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell * 38f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell * <p>Like the tag available to views, this allows applications to associate arbitrary 39f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell * data with an ActionMode for later reference. 40f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell * 41f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell * @param tag Tag to associate with this ActionMode 42f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell * 43f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell * @see #getTag() 44f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell */ 45f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell public void setTag(Object tag) { 46f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell mTag = tag; 47f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell } 48f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell 49f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell /** 50f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell * Retrieve the tag object associated with this ActionMode. 51f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell * 52f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell * <p>Like the tag available to views, this allows applications to associate arbitrary 53f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell * data with an ActionMode for later reference. 54f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell * 55f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell * @return Tag associated with this ActionMode 56f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell * 57f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell * @see #setTag(Object) 58f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell */ 59f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell public Object getTag() { 60f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell return mTag; 61f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell } 62f178737f823cf22d9a07df6f51071b7189a95e7eAdam Powell 636e34636749217654f43221885afb7a29bb5ca96aAdam Powell /** 646e34636749217654f43221885afb7a29bb5ca96aAdam Powell * Set the title of the action mode. This method will have no visible effect if 656e34636749217654f43221885afb7a29bb5ca96aAdam Powell * a custom view has been set. 666e34636749217654f43221885afb7a29bb5ca96aAdam Powell * 676e34636749217654f43221885afb7a29bb5ca96aAdam Powell * @param title Title string to set 686e34636749217654f43221885afb7a29bb5ca96aAdam Powell * 69c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell * @see #setTitle(int) 706e34636749217654f43221885afb7a29bb5ca96aAdam Powell * @see #setCustomView(View) 716e34636749217654f43221885afb7a29bb5ca96aAdam Powell */ 726e34636749217654f43221885afb7a29bb5ca96aAdam Powell public abstract void setTitle(CharSequence title); 736e34636749217654f43221885afb7a29bb5ca96aAdam Powell 746e34636749217654f43221885afb7a29bb5ca96aAdam Powell /** 75c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell * Set the title of the action mode. This method will have no visible effect if 76c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell * a custom view has been set. 77c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell * 78c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell * @param resId Resource ID of a string to set as the title 79c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell * 80c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell * @see #setTitle(CharSequence) 81c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell * @see #setCustomView(View) 82c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell */ 83c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell public abstract void setTitle(int resId); 84c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell 85c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell /** 866e34636749217654f43221885afb7a29bb5ca96aAdam Powell * Set the subtitle of the action mode. This method will have no visible effect if 876e34636749217654f43221885afb7a29bb5ca96aAdam Powell * a custom view has been set. 886e34636749217654f43221885afb7a29bb5ca96aAdam Powell * 896e34636749217654f43221885afb7a29bb5ca96aAdam Powell * @param subtitle Subtitle string to set 906e34636749217654f43221885afb7a29bb5ca96aAdam Powell * 91c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell * @see #setSubtitle(int) 926e34636749217654f43221885afb7a29bb5ca96aAdam Powell * @see #setCustomView(View) 936e34636749217654f43221885afb7a29bb5ca96aAdam Powell */ 946e34636749217654f43221885afb7a29bb5ca96aAdam Powell public abstract void setSubtitle(CharSequence subtitle); 956e34636749217654f43221885afb7a29bb5ca96aAdam Powell 966e34636749217654f43221885afb7a29bb5ca96aAdam Powell /** 97c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell * Set the subtitle of the action mode. This method will have no visible effect if 98c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell * a custom view has been set. 99c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell * 100c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell * @param resId Resource ID of a string to set as the subtitle 101c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell * 102c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell * @see #setSubtitle(CharSequence) 103c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell * @see #setCustomView(View) 104c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell */ 105c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell public abstract void setSubtitle(int resId); 106c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell 107c9ae2a24dc1fa274ca0916c91a2e9a2764ba4bb3Adam Powell /** 108b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell * Set whether or not the title/subtitle display for this action mode 109b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell * is optional. 110b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell * 111b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell * <p>In many cases the supplied title for an action mode is merely 112b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell * meant to add context and is not strictly required for the action 113b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell * mode to be useful. If the title is optional, the system may choose 114b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell * to hide the title entirely rather than truncate it due to a lack 115b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell * of available space.</p> 116b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell * 117b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell * <p>Note that this is merely a hint; the underlying implementation 118b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell * may choose to ignore this setting under some circumstances.</p> 119b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell * 120b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell * @param titleOptional true if the title only presents optional information. 121b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell */ 122b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell public void setTitleOptionalHint(boolean titleOptional) { 123785c447b2bc625209706fd128ce61781c3a4183bAdam Powell mTitleOptionalHint = titleOptional; 124785c447b2bc625209706fd128ce61781c3a4183bAdam Powell } 125785c447b2bc625209706fd128ce61781c3a4183bAdam Powell 126785c447b2bc625209706fd128ce61781c3a4183bAdam Powell /** 127785c447b2bc625209706fd128ce61781c3a4183bAdam Powell * @return true if this action mode has been given a hint to consider the 128785c447b2bc625209706fd128ce61781c3a4183bAdam Powell * title/subtitle display to be optional. 129785c447b2bc625209706fd128ce61781c3a4183bAdam Powell * 130785c447b2bc625209706fd128ce61781c3a4183bAdam Powell * @see #setTitleOptionalHint(boolean) 131785c447b2bc625209706fd128ce61781c3a4183bAdam Powell * @see #isTitleOptional() 132785c447b2bc625209706fd128ce61781c3a4183bAdam Powell */ 133785c447b2bc625209706fd128ce61781c3a4183bAdam Powell public boolean getTitleOptionalHint() { 134785c447b2bc625209706fd128ce61781c3a4183bAdam Powell return mTitleOptionalHint; 135b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell } 136b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell 137b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell /** 138b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell * @return true if this action mode considers the title and subtitle fields 139b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell * as optional. Optional titles may not be displayed to the user. 140b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell */ 141b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell public boolean isTitleOptional() { 142b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell return false; 143b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell } 144b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell 145b98a81f86ab87f1d718f329f03256111fdabd8d1Adam Powell /** 1466e34636749217654f43221885afb7a29bb5ca96aAdam Powell * Set a custom view for this action mode. The custom view will take the place of 1476e34636749217654f43221885afb7a29bb5ca96aAdam Powell * the title and subtitle. Useful for things like search boxes. 1486e34636749217654f43221885afb7a29bb5ca96aAdam Powell * 1496e34636749217654f43221885afb7a29bb5ca96aAdam Powell * @param view Custom view to use in place of the title/subtitle. 1506e34636749217654f43221885afb7a29bb5ca96aAdam Powell * 1516e34636749217654f43221885afb7a29bb5ca96aAdam Powell * @see #setTitle(CharSequence) 1526e34636749217654f43221885afb7a29bb5ca96aAdam Powell * @see #setSubtitle(CharSequence) 1536e34636749217654f43221885afb7a29bb5ca96aAdam Powell */ 1546e34636749217654f43221885afb7a29bb5ca96aAdam Powell public abstract void setCustomView(View view); 1556e34636749217654f43221885afb7a29bb5ca96aAdam Powell 1566e34636749217654f43221885afb7a29bb5ca96aAdam Powell /** 1576e34636749217654f43221885afb7a29bb5ca96aAdam Powell * Invalidate the action mode and refresh menu content. The mode's 1586e34636749217654f43221885afb7a29bb5ca96aAdam Powell * {@link ActionMode.Callback} will have its 1596e34636749217654f43221885afb7a29bb5ca96aAdam Powell * {@link Callback#onPrepareActionMode(ActionMode, Menu)} method called. 1606e34636749217654f43221885afb7a29bb5ca96aAdam Powell * If it returns true the menu will be scanned for updated content and any relevant changes 1616e34636749217654f43221885afb7a29bb5ca96aAdam Powell * will be reflected to the user. 1626e34636749217654f43221885afb7a29bb5ca96aAdam Powell */ 1636e34636749217654f43221885afb7a29bb5ca96aAdam Powell public abstract void invalidate(); 1646e34636749217654f43221885afb7a29bb5ca96aAdam Powell 1656e34636749217654f43221885afb7a29bb5ca96aAdam Powell /** 1666e34636749217654f43221885afb7a29bb5ca96aAdam Powell * Finish and close this action mode. The action mode's {@link ActionMode.Callback} will 1676e34636749217654f43221885afb7a29bb5ca96aAdam Powell * have its {@link Callback#onDestroyActionMode(ActionMode)} method called. 1686e34636749217654f43221885afb7a29bb5ca96aAdam Powell */ 1696e34636749217654f43221885afb7a29bb5ca96aAdam Powell public abstract void finish(); 1706e34636749217654f43221885afb7a29bb5ca96aAdam Powell 1716e34636749217654f43221885afb7a29bb5ca96aAdam Powell /** 1726e34636749217654f43221885afb7a29bb5ca96aAdam Powell * Returns the menu of actions that this action mode presents. 1736e34636749217654f43221885afb7a29bb5ca96aAdam Powell * @return The action mode's menu. 1746e34636749217654f43221885afb7a29bb5ca96aAdam Powell */ 1756e34636749217654f43221885afb7a29bb5ca96aAdam Powell public abstract Menu getMenu(); 1766e34636749217654f43221885afb7a29bb5ca96aAdam Powell 1776e34636749217654f43221885afb7a29bb5ca96aAdam Powell /** 1786e34636749217654f43221885afb7a29bb5ca96aAdam Powell * Returns the current title of this action mode. 1796e34636749217654f43221885afb7a29bb5ca96aAdam Powell * @return Title text 1806e34636749217654f43221885afb7a29bb5ca96aAdam Powell */ 1816e34636749217654f43221885afb7a29bb5ca96aAdam Powell public abstract CharSequence getTitle(); 1826e34636749217654f43221885afb7a29bb5ca96aAdam Powell 1836e34636749217654f43221885afb7a29bb5ca96aAdam Powell /** 1846e34636749217654f43221885afb7a29bb5ca96aAdam Powell * Returns the current subtitle of this action mode. 1856e34636749217654f43221885afb7a29bb5ca96aAdam Powell * @return Subtitle text 1866e34636749217654f43221885afb7a29bb5ca96aAdam Powell */ 1876e34636749217654f43221885afb7a29bb5ca96aAdam Powell public abstract CharSequence getSubtitle(); 1886e34636749217654f43221885afb7a29bb5ca96aAdam Powell 1896e34636749217654f43221885afb7a29bb5ca96aAdam Powell /** 1906e34636749217654f43221885afb7a29bb5ca96aAdam Powell * Returns the current custom view for this action mode. 1916e34636749217654f43221885afb7a29bb5ca96aAdam Powell * @return The current custom view 1926e34636749217654f43221885afb7a29bb5ca96aAdam Powell */ 1936e34636749217654f43221885afb7a29bb5ca96aAdam Powell public abstract View getCustomView(); 1946e34636749217654f43221885afb7a29bb5ca96aAdam Powell 1956e34636749217654f43221885afb7a29bb5ca96aAdam Powell /** 1969168f0b170c6a99371ae46e7d3f5d66c8c4c930dAdam Powell * Returns a {@link MenuInflater} with the ActionMode's context. 1979168f0b170c6a99371ae46e7d3f5d66c8c4c930dAdam Powell */ 1989168f0b170c6a99371ae46e7d3f5d66c8c4c930dAdam Powell public abstract MenuInflater getMenuInflater(); 1999168f0b170c6a99371ae46e7d3f5d66c8c4c930dAdam Powell 2009168f0b170c6a99371ae46e7d3f5d66c8c4c930dAdam Powell /** 201f8419a0299680ed580975b0fcb758990b4367db8Adam Powell * Returns whether the UI presenting this action mode can take focus or not. 202f8419a0299680ed580975b0fcb758990b4367db8Adam Powell * This is used by internal components within the framework that would otherwise 203f8419a0299680ed580975b0fcb758990b4367db8Adam Powell * present an action mode UI that requires focus, such as an EditText as a custom view. 204f8419a0299680ed580975b0fcb758990b4367db8Adam Powell * 205f8419a0299680ed580975b0fcb758990b4367db8Adam Powell * @return true if the UI used to show this action mode can take focus 206f8419a0299680ed580975b0fcb758990b4367db8Adam Powell * @hide Internal use only 207f8419a0299680ed580975b0fcb758990b4367db8Adam Powell */ 208f8419a0299680ed580975b0fcb758990b4367db8Adam Powell public boolean isUiFocusable() { 209f8419a0299680ed580975b0fcb758990b4367db8Adam Powell return true; 210f8419a0299680ed580975b0fcb758990b4367db8Adam Powell } 211f8419a0299680ed580975b0fcb758990b4367db8Adam Powell 212f8419a0299680ed580975b0fcb758990b4367db8Adam Powell /** 2136e34636749217654f43221885afb7a29bb5ca96aAdam Powell * Callback interface for action modes. Supplied to 2146e34636749217654f43221885afb7a29bb5ca96aAdam Powell * {@link View#startActionMode(Callback)}, a Callback 2156e34636749217654f43221885afb7a29bb5ca96aAdam Powell * configures and handles events raised by a user's interaction with an action mode. 2166e34636749217654f43221885afb7a29bb5ca96aAdam Powell * 2176e34636749217654f43221885afb7a29bb5ca96aAdam Powell * <p>An action mode's lifecycle is as follows: 2186e34636749217654f43221885afb7a29bb5ca96aAdam Powell * <ul> 2196e34636749217654f43221885afb7a29bb5ca96aAdam Powell * <li>{@link Callback#onCreateActionMode(ActionMode, Menu)} once on initial 2206e34636749217654f43221885afb7a29bb5ca96aAdam Powell * creation</li> 2216e34636749217654f43221885afb7a29bb5ca96aAdam Powell * <li>{@link Callback#onPrepareActionMode(ActionMode, Menu)} after creation 2226e34636749217654f43221885afb7a29bb5ca96aAdam Powell * and any time the {@link ActionMode} is invalidated</li> 2236e34636749217654f43221885afb7a29bb5ca96aAdam Powell * <li>{@link Callback#onActionItemClicked(ActionMode, MenuItem)} any time a 2246e34636749217654f43221885afb7a29bb5ca96aAdam Powell * contextual action button is clicked</li> 2256e34636749217654f43221885afb7a29bb5ca96aAdam Powell * <li>{@link Callback#onDestroyActionMode(ActionMode)} when the action mode 2266e34636749217654f43221885afb7a29bb5ca96aAdam Powell * is closed</li> 2276e34636749217654f43221885afb7a29bb5ca96aAdam Powell * </ul> 2286e34636749217654f43221885afb7a29bb5ca96aAdam Powell */ 2296e34636749217654f43221885afb7a29bb5ca96aAdam Powell public interface Callback { 2306e34636749217654f43221885afb7a29bb5ca96aAdam Powell /** 2316e34636749217654f43221885afb7a29bb5ca96aAdam Powell * Called when action mode is first created. The menu supplied will be used to 2326e34636749217654f43221885afb7a29bb5ca96aAdam Powell * generate action buttons for the action mode. 2336e34636749217654f43221885afb7a29bb5ca96aAdam Powell * 2346e34636749217654f43221885afb7a29bb5ca96aAdam Powell * @param mode ActionMode being created 2356e34636749217654f43221885afb7a29bb5ca96aAdam Powell * @param menu Menu used to populate action buttons 2366e34636749217654f43221885afb7a29bb5ca96aAdam Powell * @return true if the action mode should be created, false if entering this 2376e34636749217654f43221885afb7a29bb5ca96aAdam Powell * mode should be aborted. 2386e34636749217654f43221885afb7a29bb5ca96aAdam Powell */ 2396e34636749217654f43221885afb7a29bb5ca96aAdam Powell public boolean onCreateActionMode(ActionMode mode, Menu menu); 2406e34636749217654f43221885afb7a29bb5ca96aAdam Powell 2416e34636749217654f43221885afb7a29bb5ca96aAdam Powell /** 2426e34636749217654f43221885afb7a29bb5ca96aAdam Powell * Called to refresh an action mode's action menu whenever it is invalidated. 2436e34636749217654f43221885afb7a29bb5ca96aAdam Powell * 2446e34636749217654f43221885afb7a29bb5ca96aAdam Powell * @param mode ActionMode being prepared 2456e34636749217654f43221885afb7a29bb5ca96aAdam Powell * @param menu Menu used to populate action buttons 2466e34636749217654f43221885afb7a29bb5ca96aAdam Powell * @return true if the menu or action mode was updated, false otherwise. 2476e34636749217654f43221885afb7a29bb5ca96aAdam Powell */ 2486e34636749217654f43221885afb7a29bb5ca96aAdam Powell public boolean onPrepareActionMode(ActionMode mode, Menu menu); 2496e34636749217654f43221885afb7a29bb5ca96aAdam Powell 2506e34636749217654f43221885afb7a29bb5ca96aAdam Powell /** 2516e34636749217654f43221885afb7a29bb5ca96aAdam Powell * Called to report a user click on an action button. 2526e34636749217654f43221885afb7a29bb5ca96aAdam Powell * 2536e34636749217654f43221885afb7a29bb5ca96aAdam Powell * @param mode The current ActionMode 2546e34636749217654f43221885afb7a29bb5ca96aAdam Powell * @param item The item that was clicked 2556e34636749217654f43221885afb7a29bb5ca96aAdam Powell * @return true if this callback handled the event, false if the standard MenuItem 2566e34636749217654f43221885afb7a29bb5ca96aAdam Powell * invocation should continue. 2576e34636749217654f43221885afb7a29bb5ca96aAdam Powell */ 2586e34636749217654f43221885afb7a29bb5ca96aAdam Powell public boolean onActionItemClicked(ActionMode mode, MenuItem item); 2596e34636749217654f43221885afb7a29bb5ca96aAdam Powell 2606e34636749217654f43221885afb7a29bb5ca96aAdam Powell /** 2616e34636749217654f43221885afb7a29bb5ca96aAdam Powell * Called when an action mode is about to be exited and destroyed. 2626e34636749217654f43221885afb7a29bb5ca96aAdam Powell * 2636e34636749217654f43221885afb7a29bb5ca96aAdam Powell * @param mode The current ActionMode being destroyed 2646e34636749217654f43221885afb7a29bb5ca96aAdam Powell */ 2656e34636749217654f43221885afb7a29bb5ca96aAdam Powell public void onDestroyActionMode(ActionMode mode); 2666e34636749217654f43221885afb7a29bb5ca96aAdam Powell } 2676e34636749217654f43221885afb7a29bb5ca96aAdam Powell}