use of com.actionbarsherlock.view.MenuItem in project Ushahidi_Android by ushahidi.
the class MenuBuilder method saveActionViewStates.
public void saveActionViewStates(Bundle outStates) {
SparseArray<Parcelable> viewStates = null;
final int itemCount = size();
for (int i = 0; i < itemCount; i++) {
final MenuItem item = getItem(i);
final View v = item.getActionView();
if (v != null && v.getId() != View.NO_ID) {
if (viewStates == null) {
viewStates = new SparseArray<Parcelable>();
}
v.saveHierarchyState(viewStates);
if (item.isActionViewExpanded()) {
outStates.putInt(EXPANDED_ACTION_VIEW_ID, item.getItemId());
}
}
if (item.hasSubMenu()) {
final SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu();
subMenu.saveActionViewStates(outStates);
}
}
if (viewStates != null) {
outStates.putSparseParcelableArray(getActionViewStatesKey(), viewStates);
}
}
use of com.actionbarsherlock.view.MenuItem in project httpclient by pixmob.
the class SubMenus method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
SubMenu subMenu1 = menu.addSubMenu("Action Item");
subMenu1.add("Sample");
subMenu1.add("Menu");
subMenu1.add("Items");
MenuItem subMenu1Item = subMenu1.getItem();
subMenu1Item.setIcon(R.drawable.ic_title_share_default);
subMenu1Item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
SubMenu subMenu2 = menu.addSubMenu("Overflow Item");
subMenu2.add("These");
subMenu2.add("Are");
subMenu2.add("Sample");
subMenu2.add("Items");
MenuItem subMenu2Item = subMenu2.getItem();
subMenu2Item.setIcon(R.drawable.ic_compose);
return super.onCreateOptionsMenu(menu);
}
use of com.actionbarsherlock.view.MenuItem in project httpclient by pixmob.
the class MainActivity method onCreateOptionsMenu.
@Override
public boolean onCreateOptionsMenu(Menu menu) {
getSupportMenuInflater().inflate(R.menu.main_menu, menu);
// set up a listener for the refresh item
final MenuItem refresh = (MenuItem) menu.findItem(R.id.menu_refresh);
refresh.setOnMenuItemClickListener(new OnMenuItemClickListener() {
// on selecting show progress spinner for 1s
public boolean onMenuItemClick(MenuItem item) {
// item.setActionView(R.layout.progress_action);
handler.postDelayed(new Runnable() {
public void run() {
refresh.setActionView(null);
}
}, 1000);
return false;
}
});
return super.onCreateOptionsMenu(menu);
}
use of com.actionbarsherlock.view.MenuItem in project httpclient by pixmob.
the class MenuWrapper method addInternal.
private SubMenu addInternal(android.view.SubMenu nativeSubMenu) {
SubMenu subMenu = new SubMenuWrapper(nativeSubMenu);
android.view.MenuItem nativeItem = nativeSubMenu.getItem();
MenuItem item = subMenu.getItem();
mNativeMap.put(nativeItem, item);
return subMenu;
}
use of com.actionbarsherlock.view.MenuItem in project httpclient by pixmob.
the class ActionBarView method onRestoreInstanceState.
@Override
public void onRestoreInstanceState(Parcelable p) {
SavedState state = (SavedState) p;
super.onRestoreInstanceState(state.getSuperState());
if (state.expandedMenuItemId != 0 && mExpandedMenuPresenter != null && mOptionsMenu != null) {
final MenuItem item = mOptionsMenu.findItem(state.expandedMenuItemId);
if (item != null) {
item.expandActionView();
}
}
if (state.isOverflowOpen) {
postShowOverflowMenu();
}
}
Aggregations