com.actionbarsherlock.view
Class ActionMode

java.lang.Object
  extended by com.actionbarsherlock.view.ActionMode
Direct Known Subclasses:
ActionBarImpl.ActionModeImpl, StandaloneActionMode

public abstract class ActionMode
extends Object

Represents a contextual mode of the user interface. Action modes can be used for modal interactions with content and replace parts of the normal UI until finished. Examples of good action modes include selection modes, search, content editing, etc.


Nested Class Summary
static interface ActionMode.Callback
          Callback interface for action modes.
 
Constructor Summary
ActionMode()
           
 
Method Summary
abstract  void finish()
          Finish and close this action mode.
abstract  android.view.View getCustomView()
          Returns the current custom view for this action mode.
abstract  Menu getMenu()
          Returns the menu of actions that this action mode presents.
abstract  MenuInflater getMenuInflater()
          Returns a MenuInflater with the ActionMode's context.
abstract  CharSequence getSubtitle()
          Returns the current subtitle of this action mode.
 Object getTag()
          Retrieve the tag object associated with this ActionMode.
abstract  CharSequence getTitle()
          Returns the current title of this action mode.
abstract  void invalidate()
          Invalidate the action mode and refresh menu content.
 boolean isUiFocusable()
          Returns whether the UI presenting this action mode can take focus or not.
abstract  void setCustomView(android.view.View view)
          Set a custom view for this action mode.
abstract  void setSubtitle(CharSequence subtitle)
          Set the subtitle of the action mode.
abstract  void setSubtitle(int resId)
          Set the subtitle of the action mode.
 void setTag(Object tag)
          Set a tag object associated with this ActionMode.
abstract  void setTitle(CharSequence title)
          Set the title of the action mode.
abstract  void setTitle(int resId)
          Set the title of the action mode.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ActionMode

public ActionMode()
Method Detail

setTag

public void setTag(Object tag)
Set a tag object associated with this ActionMode.

Like the tag available to views, this allows applications to associate arbitrary data with an ActionMode for later reference.

Parameters:
tag - Tag to associate with this ActionMode
See Also:
getTag()

getTag

public Object getTag()
Retrieve the tag object associated with this ActionMode.

Like the tag available to views, this allows applications to associate arbitrary data with an ActionMode for later reference.

Returns:
Tag associated with this ActionMode
See Also:
setTag(Object)

setTitle

public abstract void setTitle(CharSequence title)
Set the title of the action mode. This method will have no visible effect if a custom view has been set.

Parameters:
title - Title string to set
See Also:
setTitle(int), setCustomView(View)

setTitle

public abstract void setTitle(int resId)
Set the title of the action mode. This method will have no visible effect if a custom view has been set.

Parameters:
resId - Resource ID of a string to set as the title
See Also:
setTitle(CharSequence), setCustomView(View)

setSubtitle

public abstract void setSubtitle(CharSequence subtitle)
Set the subtitle of the action mode. This method will have no visible effect if a custom view has been set.

Parameters:
subtitle - Subtitle string to set
See Also:
setSubtitle(int), setCustomView(View)

setSubtitle

public abstract void setSubtitle(int resId)
Set the subtitle of the action mode. This method will have no visible effect if a custom view has been set.

Parameters:
resId - Resource ID of a string to set as the subtitle
See Also:
setSubtitle(CharSequence), setCustomView(View)

setCustomView

public abstract void setCustomView(android.view.View view)
Set a custom view for this action mode. The custom view will take the place of the title and subtitle. Useful for things like search boxes.

Parameters:
view - Custom view to use in place of the title/subtitle.
See Also:
setTitle(CharSequence), setSubtitle(CharSequence)

invalidate

public abstract void invalidate()
Invalidate the action mode and refresh menu content. The mode's ActionMode.Callback will have its ActionMode.Callback.onPrepareActionMode(ActionMode, Menu) method called. If it returns true the menu will be scanned for updated content and any relevant changes will be reflected to the user.


finish

public abstract void finish()
Finish and close this action mode. The action mode's ActionMode.Callback will have its ActionMode.Callback.onDestroyActionMode(ActionMode) method called.


getMenu

public abstract Menu getMenu()
Returns the menu of actions that this action mode presents.

Returns:
The action mode's menu.

getTitle

public abstract CharSequence getTitle()
Returns the current title of this action mode.

Returns:
Title text

getSubtitle

public abstract CharSequence getSubtitle()
Returns the current subtitle of this action mode.

Returns:
Subtitle text

getCustomView

public abstract android.view.View getCustomView()
Returns the current custom view for this action mode.

Returns:
The current custom view

getMenuInflater

public abstract MenuInflater getMenuInflater()
Returns a MenuInflater with the ActionMode's context.


isUiFocusable

public boolean isUiFocusable()
Returns whether the UI presenting this action mode can take focus or not. This is used by internal components within the framework that would otherwise present an action mode UI that requires focus, such as an EditText as a custom view.

Returns:
true if the UI used to show this action mode can take focus


Copyright © 2012-2013. All Rights Reserved.