public class ActionBarSherlockCompat extends ActionBarSherlock implements MenuBuilder.Callback, Window.Callback, MenuPresenter.Callback, android.view.MenuItem.OnMenuItemClickListener
ActionBarSherlock.Implementation, ActionBarSherlock.OnActionModeFinishedListener, ActionBarSherlock.OnActionModeStartedListener, ActionBarSherlock.OnCreateOptionsMenuListener, ActionBarSherlock.OnCreatePanelMenuListener, ActionBarSherlock.OnMenuItemSelectedListener, ActionBarSherlock.OnOptionsItemSelectedListener, ActionBarSherlock.OnPrepareOptionsMenuListener, ActionBarSherlock.OnPreparePanelListener
Modifier and Type | Field and Description |
---|---|
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.
|
DEBUG, FLAG_DELEGATE, mActivity, mIsDelegate, mMenuInflater, TAG
Constructor and Description |
---|
ActionBarSherlockCompat(android.app.Activity activity,
int flags) |
Modifier and Type | Method and Description |
---|---|
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 |
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.
|
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.
|
callbackCreateOptionsMenu, callbackOptionsItemSelected, callbackPrepareOptionsMenu, getMenuInflater, registerImplementation, setContentView, setTitle, unregisterImplementation, wrap, wrap
protected static final int DEFAULT_FEATURES
protected HashMap<android.view.MenuItem,MenuItemImpl> mNativeItemMap
public ActionBarSherlockCompat(android.app.Activity activity, int flags)
public ActionBar getActionBar()
ActionBarSherlock
getActionBar
in class ActionBarSherlock
protected android.content.Context getThemedContext()
getThemedContext
in class ActionBarSherlock
public void setTitle(CharSequence title)
ActionBarSherlock
setTitle
in class ActionBarSherlock
public ActionMode startActionMode(ActionMode.Callback callback)
ActionBarSherlock
startActionMode
in class ActionBarSherlock
callback
- Callback that will manage lifecycle events for this
context mode.ActionMode
public void dispatchConfigurationChanged(android.content.res.Configuration newConfig)
ActionBarSherlock
dispatchConfigurationChanged
in class ActionBarSherlock
newConfig
- The new device configuration.public void dispatchPostResume()
ActionBarSherlock
dispatchPostResume
in class ActionBarSherlock
public void dispatchPause()
ActionBarSherlock
dispatchPause
in class ActionBarSherlock
public void dispatchStop()
ActionBarSherlock
dispatchStop
in class ActionBarSherlock
public void dispatchInvalidateOptionsMenu()
ActionBarSherlock
ActionBarSherlock.OnCreateOptionsMenuListener.onCreateOptionsMenu(com.actionbarsherlock.view.Menu)
.dispatchInvalidateOptionsMenu
in class ActionBarSherlock
public boolean dispatchOpenOptionsMenu()
ActionBarSherlock
false
.
dispatchOpenOptionsMenu
in class ActionBarSherlock
true
if the opening of the menu was handled internally.public boolean dispatchCloseOptionsMenu()
ActionBarSherlock
false
.
dispatchCloseOptionsMenu
in class ActionBarSherlock
true
if the closing of the menu was handled internally.public void dispatchPostCreate(android.os.Bundle savedInstanceState)
ActionBarSherlock
dispatchPostCreate
in class ActionBarSherlock
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.public boolean dispatchCreateOptionsMenu(android.view.Menu menu)
ActionBarSherlock
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.dispatchCreateOptionsMenu
in class ActionBarSherlock
menu
- Activity native menu.true
since we always want to say that we have a nativepublic boolean dispatchPrepareOptionsMenu(android.view.Menu menu)
ActionBarSherlock
dispatchPrepareOptionsMenu
in class ActionBarSherlock
menu
- Activity native menu.true
if menu display should proceed.public boolean dispatchOptionsItemSelected(android.view.MenuItem item)
ActionBarSherlock
dispatchOptionsItemSelected
in class ActionBarSherlock
item
- Options menu item.public boolean dispatchMenuOpened(int featureId, android.view.Menu menu)
ActionBarSherlock
true
if this method
returns true
, otherwise return the result of the superclass
method.
dispatchMenuOpened
in class ActionBarSherlock
featureId
- Window feature which triggered the event.menu
- Activity native menu.true
if the event was handled by this method.public void dispatchPanelClosed(int featureId, android.view.Menu menu)
ActionBarSherlock
dispatchPanelClosed
in class ActionBarSherlock
public void dispatchTitleChanged(CharSequence title, int color)
ActionBarSherlock
dispatchTitleChanged
in class ActionBarSherlock
title
- New activity title.color
- New activity color.public boolean dispatchKeyEvent(android.view.KeyEvent event)
ActionBarSherlock
dispatchKeyEvent
in class ActionBarSherlock
event
- Description of the key event.true
if the event was handled.public void dispatchDestroy()
ActionBarSherlock
dispatchDestroy
in class ActionBarSherlock
public boolean onMenuItemSelected(MenuBuilder menu, MenuItem item)
MenuBuilder.Callback
onMenuItemSelected
in interface MenuBuilder.Callback
menu
- The menu that is the parent of the itemitem
- The menu item that is selectedpublic void onMenuModeChange(MenuBuilder menu)
MenuBuilder.Callback
onMenuModeChange
in interface MenuBuilder.Callback
menu
- the menu that has changed modespublic boolean onOpenSubMenu(MenuBuilder subMenu)
MenuPresenter.Callback
onOpenSubMenu
in interface MenuPresenter.Callback
subMenu
- Submenu currently being openedpublic void onCloseMenu(MenuBuilder menu, boolean allMenusAreClosing)
MenuPresenter.Callback
onCloseMenu
in interface MenuPresenter.Callback
public boolean onMenuItemClick(android.view.MenuItem item)
onMenuItemClick
in interface android.view.MenuItem.OnMenuItemClickListener
public boolean onMenuItemSelected(int featureId, MenuItem item)
Window.Callback
onMenuItemSelected
in interface Window.Callback
featureId
- The panel that the menu is in.item
- The menu item that was selected.public void setProgressBarVisibility(boolean visible)
ActionBarSherlock
In order for the progress bar to be shown, the feature must be requested
via #requestWindowFeature(int)
.
setProgressBarVisibility
in class ActionBarSherlock
visible
- Whether to show the progress bars in the title.public void setProgressBarIndeterminateVisibility(boolean visible)
ActionBarSherlock
In order for the progress bar to be shown, the feature must be requested
via #requestWindowFeature(int)
.
setProgressBarIndeterminateVisibility
in class ActionBarSherlock
visible
- Whether to show the progress bars in the title.public void setProgressBarIndeterminate(boolean indeterminate)
ActionBarSherlock
In order for the progress bar to be shown, the feature must be requested
via #requestWindowFeature(int)
.
setProgressBarIndeterminate
in class ActionBarSherlock
indeterminate
- Whether the horizontal progress bar should be indeterminate.public void setProgress(int progress)
ActionBarSherlock
In order for the progress bar to be shown, the feature must be requested
via #requestWindowFeature(int)
.
setProgress
in class ActionBarSherlock
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.public void setSecondaryProgress(int secondaryProgress)
ActionBarSherlock
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)
.
setSecondaryProgress
in class ActionBarSherlock
secondaryProgress
- The secondary progress for the progress bar. Valid ranges are from
0 to 10000 (both inclusive).public boolean hasFeature(int featureId)
ActionBarSherlock
hasFeature
in class ActionBarSherlock
featureId
- The feature ID to check.true
if feature is enabled, false
otherwise.public boolean requestFeature(int featureId)
ActionBarSherlock
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.requestFeature
in class ActionBarSherlock
featureId
- The desired features, defined as constants by Window.public void setUiOptions(int uiOptions)
ActionBarSherlock
setUiOptions
in class ActionBarSherlock
uiOptions
- Flags specifying extra options for this window.public void setUiOptions(int uiOptions, int mask)
ActionBarSherlock
setUiOptions
in class ActionBarSherlock
uiOptions
- Flags specifying extra options for this window.mask
- Flags specifying which options should be modified. Others
will remain unchanged.public void setContentView(int layoutResId)
ActionBarSherlock
setContentView
in class ActionBarSherlock
layoutResId
- Layout resource ID.public void setContentView(android.view.View view, android.view.ViewGroup.LayoutParams params)
ActionBarSherlock
setContentView
in class ActionBarSherlock
view
- The desired content to display.params
- Layout parameters to apply to the view.public void addContentView(android.view.View view, android.view.ViewGroup.LayoutParams params)
ActionBarSherlock
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.addContentView
in class ActionBarSherlock
view
- The desired content to display.params
- Layout parameters for the view.Copyright © 2011–2014. All rights reserved.