Search in sources :

Example 61 with MenuItem

use of com.actionbarsherlock.view.MenuItem in project httpclient by pixmob.

the class MenuWrapper method addInternal.

private MenuItem addInternal(android.view.MenuItem nativeItem) {
    MenuItem item = new MenuItemWrapper(nativeItem);
    mNativeMap.put(nativeItem, item);
    return item;
}
Also used : MenuItem(com.actionbarsherlock.view.MenuItem)

Example 62 with MenuItem

use of com.actionbarsherlock.view.MenuItem in project cw-omnibus by commonsguy.

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);
        }
    }
}
Also used : MenuItem(com.actionbarsherlock.view.MenuItem)

Example 63 with MenuItem

use of com.actionbarsherlock.view.MenuItem in project cw-omnibus by commonsguy.

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;
}
Also used : MenuItem(com.actionbarsherlock.view.MenuItem) MenuItemWrapper(com.actionbarsherlock.internal.view.menu.MenuItemWrapper)

Example 64 with MenuItem

use of com.actionbarsherlock.view.MenuItem in project cw-omnibus by commonsguy.

the class MenuBuilder method addIntentOptions.

public int addIntentOptions(int group, int id, int categoryOrder, 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(group);
    }
    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(group, id, categoryOrder, ri.loadLabel(pm)).setIcon(ri.loadIcon(pm)).setIntent(rintent);
        if (outSpecificItems != null && ri.specificIndex >= 0) {
            outSpecificItems[ri.specificIndex] = item;
        }
    }
    return N;
}
Also used : ResolveInfo(android.content.pm.ResolveInfo) PackageManager(android.content.pm.PackageManager) Intent(android.content.Intent) ComponentName(android.content.ComponentName) MenuItem(com.actionbarsherlock.view.MenuItem)

Example 65 with MenuItem

use of com.actionbarsherlock.view.MenuItem in project cw-omnibus by commonsguy.

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();
    }
}
Also used : MenuItem(com.actionbarsherlock.view.MenuItem) ActionMenuItem(com.actionbarsherlock.internal.view.menu.ActionMenuItem)

Aggregations

MenuItem (com.actionbarsherlock.view.MenuItem)93 View (android.view.View)18 ComponentName (android.content.ComponentName)16 Intent (android.content.Intent)16 PackageManager (android.content.pm.PackageManager)16 ResolveInfo (android.content.pm.ResolveInfo)16 Parcelable (android.os.Parcelable)16 SubMenu (com.actionbarsherlock.view.SubMenu)10 ActionMenuItem (com.actionbarsherlock.internal.view.menu.ActionMenuItem)8 MenuItemWrapper (com.actionbarsherlock.internal.view.menu.MenuItemWrapper)5 OnClickListener (android.view.View.OnClickListener)2 OnFocusChangeListener (android.view.View.OnFocusChangeListener)2 AutoCompleteTextView (android.widget.AutoCompleteTextView)2 ImageView (android.widget.ImageView)2 OnActionExpandListener (com.actionbarsherlock.view.MenuItem.OnActionExpandListener)2 OnMenuItemClickListener (com.actionbarsherlock.view.MenuItem.OnMenuItemClickListener)2 ShareActionProvider (com.actionbarsherlock.widget.ShareActionProvider)2 Drawable (android.graphics.drawable.Drawable)1 Editable (android.text.Editable)1 TextWatcher (android.text.TextWatcher)1