use of com.actionbarsherlock.view.MenuItem in project AndroidTraining by mixi-inc.
the class ActionBarSherlockNative method dispatchOptionsItemSelected.
@Override
public boolean dispatchOptionsItemSelected(android.view.MenuItem item) {
if (BuildConfig.DEBUG)
Log.d(TAG, "[dispatchOptionsItemSelected] item: " + item.getTitleCondensed());
MenuItem wrapped;
if (mMenu == null) {
if (item.getItemId() != android.R.id.home) {
throw new IllegalStateException("Non-home action item clicked before onCreateOptionsMenu with ID " + item.getItemId());
}
// Create a throw-away wrapper for now.
wrapped = new MenuItemWrapper(item);
} else {
wrapped = mMenu.findItem(item);
}
final boolean result = callbackOptionsItemSelected(wrapped);
if (BuildConfig.DEBUG)
Log.d(TAG, "[dispatchOptionsItemSelected] returning " + result);
return result;
}
use of com.actionbarsherlock.view.MenuItem in project AndroidTraining by mixi-inc.
the class ActionMenu method addIntentOptions.
public int addIntentOptions(int groupId, int itemId, int order, ComponentName caller, Intent[] specifics, Intent intent, int flags, MenuItem[] outSpecificItems) {
PackageManager pm = mContext.getPackageManager();
final List<ResolveInfo> lri = pm.queryIntentActivityOptions(caller, specifics, intent, 0);
final int N = lri != null ? lri.size() : 0;
if ((flags & FLAG_APPEND_TO_GROUP) == 0) {
removeGroup(groupId);
}
for (int i = 0; i < N; i++) {
final ResolveInfo ri = lri.get(i);
Intent rintent = new Intent(ri.specificIndex < 0 ? intent : specifics[ri.specificIndex]);
rintent.setComponent(new ComponentName(ri.activityInfo.applicationInfo.packageName, ri.activityInfo.name));
final MenuItem item = add(groupId, itemId, order, ri.loadLabel(pm)).setIcon(ri.loadIcon(pm)).setIntent(rintent);
if (outSpecificItems != null && ri.specificIndex >= 0) {
outSpecificItems[ri.specificIndex] = item;
}
}
return N;
}
use of com.actionbarsherlock.view.MenuItem in project AndroidTraining by mixi-inc.
the class ActionMenuPresenter method onRestoreInstanceState.
@Override
public void onRestoreInstanceState(Parcelable state) {
SavedState saved = (SavedState) state;
if (saved.openSubMenuId > 0) {
MenuItem item = mMenu.findItem(saved.openSubMenuId);
if (item != null) {
SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu();
onSubMenuSelected(subMenu);
}
}
}
use of com.actionbarsherlock.view.MenuItem in project Ushahidi_Android by ushahidi.
the class ActionBarSherlockNative method dispatchOptionsItemSelected.
@Override
public boolean dispatchOptionsItemSelected(android.view.MenuItem item) {
if (ActionBarSherlock.DEBUG)
Log.d(TAG, "[dispatchOptionsItemSelected] item: " + item.getTitleCondensed());
MenuItem wrapped;
if (mMenu == null) {
if (item.getItemId() != android.R.id.home) {
throw new IllegalStateException("Non-home action item clicked before onCreateOptionsMenu with ID " + item.getItemId());
}
// Create a throw-away wrapper for now.
wrapped = new MenuItemWrapper(item);
} else {
wrapped = mMenu.findItem(item);
}
final boolean result = callbackOptionsItemSelected(wrapped);
if (ActionBarSherlock.DEBUG)
Log.d(TAG, "[dispatchOptionsItemSelected] returning " + result);
return result;
}
use of com.actionbarsherlock.view.MenuItem in project MDM-Android-Agent by wso2-attic.
the class ActionMenuPresenter method onRestoreInstanceState.
@Override
public void onRestoreInstanceState(Parcelable state) {
SavedState saved = (SavedState) state;
if (saved.openSubMenuId > 0) {
MenuItem item = mMenu.findItem(saved.openSubMenuId);
if (item != null) {
SubMenuBuilder subMenu = (SubMenuBuilder) item.getSubMenu();
onSubMenuSelected(subMenu);
}
}
}
Aggregations