com.actionbarsherlock.internal
Class ActionBarSherlockCompat

java.lang.Object
  extended by com.actionbarsherlock.ActionBarSherlock
      extended by com.actionbarsherlock.internal.ActionBarSherlockCompat
All Implemented Interfaces:
android.view.MenuItem.OnMenuItemClickListener, MenuBuilder.Callback, MenuPresenter.Callback, Window.Callback

public class ActionBarSherlockCompat
extends ActionBarSherlock
implements MenuBuilder.Callback, Window.Callback, MenuPresenter.Callback, android.view.MenuItem.OnMenuItemClickListener


Nested Class Summary
 
Nested classes/interfaces inherited from class com.actionbarsherlock.ActionBarSherlock
ActionBarSherlock.Implementation, ActionBarSherlock.OnActionModeFinishedListener, ActionBarSherlock.OnActionModeStartedListener, ActionBarSherlock.OnCreateOptionsMenuListener, ActionBarSherlock.OnCreatePanelMenuListener, ActionBarSherlock.OnMenuItemSelectedListener, ActionBarSherlock.OnOptionsItemSelectedListener, ActionBarSherlock.OnPrepareOptionsMenuListener, ActionBarSherlock.OnPreparePanelListener
 
Field Summary
protected static int DEFAULT_FEATURES
          Window features which are enabled by default.
protected  HashMap<android.view.MenuItem,MenuItemImpl> mNativeItemMap
          Map between native options items and sherlock items.
 
Fields inherited from class com.actionbarsherlock.ActionBarSherlock
FLAG_DELEGATE, mActivity, mIsDelegate, mMenuInflater, TAG
 
Constructor Summary
ActionBarSherlockCompat(android.app.Activity activity, int flags)
           
 
Method Summary
 void addContentView(android.view.View view, android.view.ViewGroup.LayoutParams params)
          Variation on ActionBarSherlock.setContentView(android.view.View, android.view.ViewGroup.LayoutParams) to add an additional content view to the screen.
static String cleanActivityName(String manifestPackage, String activityName)
           
 boolean dispatchCloseOptionsMenu()
          Notify the action bar that it should close its overflow menu if it is appropriate for the device.
 void dispatchConfigurationChanged(android.content.res.Configuration newConfig)
          Notify action bar of a configuration change event.
 boolean dispatchCreateOptionsMenu(android.view.Menu menu)
          Notify the action bar that the Activity has triggered a menu creation which should happen on the conclusion of Activity.onCreate(android.os.Bundle).
 void dispatchDestroy()
          Notify the action bar that the activity has been destroyed.
 void dispatchInvalidateOptionsMenu()
          Indicate that the menu should be recreated by calling ActionBarSherlock.OnCreateOptionsMenuListener.onCreateOptionsMenu(com.actionbarsherlock.view.Menu).
 boolean dispatchKeyEvent(android.view.KeyEvent event)
          Notify the action bar the user has created a key event.
 boolean dispatchMenuOpened(int featureId, android.view.Menu menu)
          Notify the action bar that the overflow menu has been opened.
 boolean dispatchOpenOptionsMenu()
          Notify the action bar that it should display its overflow menu if it is appropriate for the device.
 boolean dispatchOptionsItemSelected(android.view.MenuItem item)
          Notify the action bar that a native options menu item has been selected.
 void dispatchPanelClosed(int featureId, android.view.Menu menu)
          Notify the action bar that the overflow menu has been closed.
 void dispatchPause()
          Notify the action bar that the activity is pausing.
 void dispatchPostCreate(android.os.Bundle savedInstanceState)
          Notify the class that the activity has finished its creation.
 void dispatchPostResume()
          Notify the action bar that the activity has finished its resuming.
 boolean dispatchPrepareOptionsMenu(android.view.Menu menu)
          Notify the action bar that the Activity has triggered a menu preparation which usually means that the user has requested the overflow menu via a hardware menu key.
 void dispatchRestoreInstanceState(android.os.Bundle savedInstanceState)
           
 void dispatchSaveInstanceState(android.os.Bundle outState)
           
 void dispatchStop()
          Notify the action bar that the activity is stopping.
 void dispatchTitleChanged(CharSequence title, int color)
          Notify the action bar that the title has changed and the action bar should be updated to reflect the change.
 void ensureActionBar()
          Ensure that the action bar is attached.
 ActionBar getActionBar()
          Get the current action bar instance.
protected  android.content.Context getThemedContext()
           
 boolean hasFeature(int featureId)
          Query for the availability of a certain feature.
 void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing)
          Called when a menu is closing.
 boolean onMenuItemClick(android.view.MenuItem item)
           
 boolean onMenuItemSelected(int featureId, MenuItem item)
          Called when a panel's menu item has been selected by the user.
 boolean onMenuItemSelected(MenuBuilder menu, MenuItem item)
          Called when a menu item is selected.
 void onMenuModeChange(MenuBuilder menu)
          Called when the mode of the menu changes (for example, from icon to expanded).
 boolean onOpenSubMenu(MenuBuilder subMenu)
          Called when a submenu opens.
 boolean requestFeature(int featureId)
          Enable extended screen features.
 void setContentView(int layoutResId)
          Set the content of the activity inside the action bar.
 void setContentView(android.view.View view, android.view.ViewGroup.LayoutParams params)
          Set the content of the activity inside the action bar.
 void setProgress(int progress)
          Sets the progress for the progress bars in the title.
 void setProgressBarIndeterminate(boolean indeterminate)
          Sets whether the horizontal progress bar in the title should be indeterminate (the circular is always indeterminate).
 void setProgressBarIndeterminateVisibility(boolean visible)
          Sets the visibility of the indeterminate progress bar in the title.
 void setProgressBarVisibility(boolean visible)
          Sets the visibility of the progress bar in the title.
 void setSecondaryProgress(int secondaryProgress)
          Sets the secondary progress for the progress bar in the title.
 void setTitle(CharSequence title)
          Change the title associated with this activity.
 void setUiOptions(int uiOptions)
          Set extra options that will influence the UI for this window.
 void setUiOptions(int uiOptions, int mask)
          Set extra options that will influence the UI for this window.
 ActionMode startActionMode(ActionMode.Callback callback)
          Start an action mode.
 
Methods inherited from class com.actionbarsherlock.ActionBarSherlock
callbackCreateOptionsMenu, callbackOptionsItemSelected, callbackPrepareOptionsMenu, getMenuInflater, registerImplementation, setContentView, setTitle, unregisterImplementation, wrap, wrap
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

DEFAULT_FEATURES

protected static final int DEFAULT_FEATURES
Window features which are enabled by default.

See Also:
Constant Field Values

mNativeItemMap

protected HashMap<android.view.MenuItem,MenuItemImpl> mNativeItemMap
Map between native options items and sherlock items.

Constructor Detail

ActionBarSherlockCompat

public ActionBarSherlockCompat(android.app.Activity activity,
                               int flags)
Method Detail

getActionBar

public ActionBar getActionBar()
Description copied from class: ActionBarSherlock
Get the current action bar instance.

Specified by:
getActionBar in class ActionBarSherlock
Returns:
Action bar instance.

getThemedContext

protected android.content.Context getThemedContext()
Specified by:
getThemedContext in class ActionBarSherlock

setTitle

public void setTitle(CharSequence title)
Description copied from class: ActionBarSherlock
Change the title associated with this activity.

Specified by:
setTitle in class ActionBarSherlock

startActionMode

public ActionMode startActionMode(ActionMode.Callback callback)
Description copied from class: ActionBarSherlock
Start an action mode.

Specified by:
startActionMode in class ActionBarSherlock
Parameters:
callback - Callback that will manage lifecycle events for this context mode.
Returns:
The ContextMode that was started, or null if it was canceled.
See Also:
ActionMode

dispatchConfigurationChanged

public void dispatchConfigurationChanged(android.content.res.Configuration newConfig)
Description copied from class: ActionBarSherlock
Notify action bar of a configuration change event. Should be dispatched after the call to the superclass implementation.

Overrides:
dispatchConfigurationChanged in class ActionBarSherlock
Parameters:
newConfig - The new device configuration.

dispatchPostResume

public void dispatchPostResume()
Description copied from class: ActionBarSherlock
Notify the action bar that the activity has finished its resuming. This should be dispatched after the call to the superclass implementation.

Overrides:
dispatchPostResume in class ActionBarSherlock

dispatchPause

public void dispatchPause()
Description copied from class: ActionBarSherlock
Notify the action bar that the activity is pausing. This should be dispatched before the call to the superclass implementation.

Overrides:
dispatchPause in class ActionBarSherlock

dispatchStop

public void dispatchStop()
Description copied from class: ActionBarSherlock
Notify the action bar that the activity is stopping. This should be called before the superclass implementation.

Overrides:
dispatchStop in class ActionBarSherlock

dispatchInvalidateOptionsMenu

public void dispatchInvalidateOptionsMenu()
Description copied from class: ActionBarSherlock
Indicate that the menu should be recreated by calling ActionBarSherlock.OnCreateOptionsMenuListener.onCreateOptionsMenu(com.actionbarsherlock.view.Menu).

Specified by:
dispatchInvalidateOptionsMenu in class ActionBarSherlock

dispatchOpenOptionsMenu

public boolean dispatchOpenOptionsMenu()
Description copied from class: ActionBarSherlock
Notify the action bar that it should display its overflow menu if it is appropriate for the device. The implementation should conditionally call the superclass method only if this method returns false.

Overrides:
dispatchOpenOptionsMenu in class ActionBarSherlock
Returns:
true if the opening of the menu was handled internally.

dispatchCloseOptionsMenu

public boolean dispatchCloseOptionsMenu()
Description copied from class: ActionBarSherlock
Notify the action bar that it should close its overflow menu if it is appropriate for the device. This implementation should conditionally call the superclass method only if this method returns false.

Overrides:
dispatchCloseOptionsMenu in class ActionBarSherlock
Returns:
true if the closing of the menu was handled internally.

dispatchPostCreate

public void dispatchPostCreate(android.os.Bundle savedInstanceState)
Description copied from class: ActionBarSherlock
Notify the class that the activity has finished its creation. This should be called after the superclass implementation.

Overrides:
dispatchPostCreate in class ActionBarSherlock
Parameters:
savedInstanceState - If the activity is being re-initialized after previously being shut down then this Bundle contains the data it most recently supplied in Activity#onSaveInstanceState(Bundle)}. Note: Otherwise it is null.

dispatchCreateOptionsMenu

public boolean dispatchCreateOptionsMenu(android.view.Menu menu)
Description copied from class: ActionBarSherlock
Notify the action bar that the Activity has triggered a menu creation which should happen on the conclusion of Activity.onCreate(android.os.Bundle). This will be used to gain a reference to the native menu for native and overflow binding as well as to indicate when compatibility create should occur for the first time.

Specified by:
dispatchCreateOptionsMenu in class ActionBarSherlock
Parameters:
menu - Activity native menu.
Returns:
true since we always want to say that we have a native

dispatchPrepareOptionsMenu

public boolean dispatchPrepareOptionsMenu(android.view.Menu menu)
Description copied from class: ActionBarSherlock
Notify the action bar that the Activity has triggered a menu preparation which usually means that the user has requested the overflow menu via a hardware menu key. You should return the result of this method call and not call the superclass implementation.

Specified by:
dispatchPrepareOptionsMenu in class ActionBarSherlock
Parameters:
menu - Activity native menu.
Returns:
true if menu display should proceed.

dispatchOptionsItemSelected

public boolean dispatchOptionsItemSelected(android.view.MenuItem item)
Description copied from class: ActionBarSherlock
Notify the action bar that a native options menu item has been selected. The implementation should return the result of this method call.

Specified by:
dispatchOptionsItemSelected in class ActionBarSherlock
Parameters:
item - Options menu item.
Returns:
@{code true} if the selection was handled.

dispatchMenuOpened

public boolean dispatchMenuOpened(int featureId,
                                  android.view.Menu menu)
Description copied from class: ActionBarSherlock
Notify the action bar that the overflow menu has been opened. The implementation should conditionally return true if this method returns true, otherwise return the result of the superclass method.

Overrides:
dispatchMenuOpened in class ActionBarSherlock
Parameters:
featureId - Window feature which triggered the event.
menu - Activity native menu.
Returns:
true if the event was handled by this method.

dispatchPanelClosed

public void dispatchPanelClosed(int featureId,
                                android.view.Menu menu)
Description copied from class: ActionBarSherlock
Notify the action bar that the overflow menu has been closed. This method should be called before the superclass implementation.

Overrides:
dispatchPanelClosed in class ActionBarSherlock

dispatchTitleChanged

public void dispatchTitleChanged(CharSequence title,
                                 int color)
Description copied from class: ActionBarSherlock
Notify the action bar that the title has changed and the action bar should be updated to reflect the change. This should be called before the superclass implementation.

Overrides:
dispatchTitleChanged in class ActionBarSherlock
Parameters:
title - New activity title.
color - New activity color.

dispatchKeyEvent

public boolean dispatchKeyEvent(android.view.KeyEvent event)
Description copied from class: ActionBarSherlock
Notify the action bar the user has created a key event. This is used to toggle the display of the overflow action item with the menu key and to close the action mode or expanded action item with the back key.

Overrides:
dispatchKeyEvent in class ActionBarSherlock
Parameters:
event - Description of the key event.
Returns:
true if the event was handled.

dispatchDestroy

public void dispatchDestroy()
Description copied from class: ActionBarSherlock
Notify the action bar that the activity has been destroyed. This method should be called before the superclass implementation.

Overrides:
dispatchDestroy in class ActionBarSherlock

dispatchSaveInstanceState

public void dispatchSaveInstanceState(android.os.Bundle outState)
Overrides:
dispatchSaveInstanceState in class ActionBarSherlock

dispatchRestoreInstanceState

public void dispatchRestoreInstanceState(android.os.Bundle savedInstanceState)
Overrides:
dispatchRestoreInstanceState in class ActionBarSherlock

onMenuItemSelected

public boolean onMenuItemSelected(MenuBuilder menu,
                                  MenuItem item)
Description copied from interface: MenuBuilder.Callback
Called when a menu item is selected.

Specified by:
onMenuItemSelected in interface MenuBuilder.Callback
Parameters:
menu - The menu that is the parent of the item
item - The menu item that is selected
Returns:
whether the menu item selection was handled

onMenuModeChange

public void onMenuModeChange(MenuBuilder menu)
Description copied from interface: MenuBuilder.Callback
Called when the mode of the menu changes (for example, from icon to expanded).

Specified by:
onMenuModeChange in interface MenuBuilder.Callback
Parameters:
menu - the menu that has changed modes

onOpenSubMenu

public boolean onOpenSubMenu(MenuBuilder subMenu)
Description copied from interface: MenuPresenter.Callback
Called when a submenu opens. Useful for notifying the application of menu state so that it does not attempt to hide the action bar while a submenu is open or similar.

Specified by:
onOpenSubMenu in interface MenuPresenter.Callback
Parameters:
subMenu - Submenu currently being opened
Returns:
true if the Callback will handle presenting the submenu, false if the presenter should attempt to do so.

onCloseMenu

public void onCloseMenu(MenuBuilder menu,
                        boolean allMenusAreClosing)
Description copied from interface: MenuPresenter.Callback
Called when a menu is closing.

Specified by:
onCloseMenu in interface MenuPresenter.Callback

onMenuItemClick

public boolean onMenuItemClick(android.view.MenuItem item)
Specified by:
onMenuItemClick in interface android.view.MenuItem.OnMenuItemClickListener

onMenuItemSelected

public boolean onMenuItemSelected(int featureId,
                                  MenuItem item)
Description copied from interface: Window.Callback
Called when a panel's menu item has been selected by the user.

Specified by:
onMenuItemSelected in interface Window.Callback
Parameters:
featureId - The panel that the menu is in.
item - The menu item that was selected.
Returns:
boolean Return true to finish processing of selection, or false to perform the normal menu handling (calling its Runnable or sending a Message to its target Handler).

setProgressBarVisibility

public void setProgressBarVisibility(boolean visible)
Description copied from class: ActionBarSherlock
Sets the visibility of the progress bar in the title.

In order for the progress bar to be shown, the feature must be requested via #requestWindowFeature(int).

Specified by:
setProgressBarVisibility in class ActionBarSherlock
Parameters:
visible - Whether to show the progress bars in the title.

setProgressBarIndeterminateVisibility

public void setProgressBarIndeterminateVisibility(boolean visible)
Description copied from class: ActionBarSherlock
Sets the visibility of the indeterminate progress bar in the title.

In order for the progress bar to be shown, the feature must be requested via #requestWindowFeature(int).

Specified by:
setProgressBarIndeterminateVisibility in class ActionBarSherlock
Parameters:
visible - Whether to show the progress bars in the title.

setProgressBarIndeterminate

public void setProgressBarIndeterminate(boolean indeterminate)
Description copied from class: ActionBarSherlock
Sets whether the horizontal progress bar in the title should be indeterminate (the circular is always indeterminate).

In order for the progress bar to be shown, the feature must be requested via #requestWindowFeature(int).

Specified by:
setProgressBarIndeterminate in class ActionBarSherlock
Parameters:
indeterminate - Whether the horizontal progress bar should be indeterminate.

setProgress

public void setProgress(int progress)
Description copied from class: ActionBarSherlock
Sets the progress for the progress bars in the title.

In order for the progress bar to be shown, the feature must be requested via #requestWindowFeature(int).

Specified by:
setProgress in class ActionBarSherlock
Parameters:
progress - The progress for the progress bar. Valid ranges are from 0 to 10000 (both inclusive). If 10000 is given, the progress bar will be completely filled and will fade out.

setSecondaryProgress

public void setSecondaryProgress(int secondaryProgress)
Description copied from class: ActionBarSherlock
Sets the secondary progress for the progress bar in the title. This progress is drawn between the primary progress (set via ActionBarSherlock.setProgress(int) and the background. It can be ideal for media scenarios such as showing the buffering progress while the default progress shows the play progress.

In order for the progress bar to be shown, the feature must be requested via #requestWindowFeature(int).

Specified by:
setSecondaryProgress in class ActionBarSherlock
Parameters:
secondaryProgress - The secondary progress for the progress bar. Valid ranges are from 0 to 10000 (both inclusive).

hasFeature

public boolean hasFeature(int featureId)
Description copied from class: ActionBarSherlock
Query for the availability of a certain feature.

Specified by:
hasFeature in class ActionBarSherlock
Parameters:
featureId - The feature ID to check.
Returns:
true if feature is enabled, false otherwise.

requestFeature

public boolean requestFeature(int featureId)
Description copied from class: ActionBarSherlock
Enable extended screen features. This must be called before setContentView(). May be called as many times as desired as long as it is before setContentView(). If not called, no extended features will be available. You can not turn off a feature once it is requested.

Specified by:
requestFeature in class ActionBarSherlock
Parameters:
featureId - The desired features, defined as constants by Window.
Returns:
Returns true if the requested feature is supported and now enabled.

setUiOptions

public void setUiOptions(int uiOptions)
Description copied from class: ActionBarSherlock
Set extra options that will influence the UI for this window.

Specified by:
setUiOptions in class ActionBarSherlock
Parameters:
uiOptions - Flags specifying extra options for this window.

setUiOptions

public void setUiOptions(int uiOptions,
                         int mask)
Description copied from class: ActionBarSherlock
Set extra options that will influence the UI for this window. Only the bits filtered by mask will be modified.

Specified by:
setUiOptions in class ActionBarSherlock
Parameters:
uiOptions - Flags specifying extra options for this window.
mask - Flags specifying which options should be modified. Others will remain unchanged.

setContentView

public void setContentView(int layoutResId)
Description copied from class: ActionBarSherlock
Set the content of the activity inside the action bar.

Specified by:
setContentView in class ActionBarSherlock
Parameters:
layoutResId - Layout resource ID.

setContentView

public void setContentView(android.view.View view,
                           android.view.ViewGroup.LayoutParams params)
Description copied from class: ActionBarSherlock
Set the content of the activity inside the action bar.

Specified by:
setContentView in class ActionBarSherlock
Parameters:
view - The desired content to display.
params - Layout parameters to apply to the view.

addContentView

public void addContentView(android.view.View view,
                           android.view.ViewGroup.LayoutParams params)
Description copied from class: ActionBarSherlock
Variation on ActionBarSherlock.setContentView(android.view.View, android.view.ViewGroup.LayoutParams) to add an additional content view to the screen. Added after any existing ones on the screen -- existing views are NOT removed.

Specified by:
addContentView in class ActionBarSherlock
Parameters:
view - The desired content to display.
params - Layout parameters for the view.

cleanActivityName

public static String cleanActivityName(String manifestPackage,
                                       String activityName)

ensureActionBar

public void ensureActionBar()
Description copied from class: ActionBarSherlock
Ensure that the action bar is attached.

Overrides:
ensureActionBar in class ActionBarSherlock


Copyright © 2012-2013. All Rights Reserved.