com.actionbarsherlock.view.SubMenu Java Examples

The following examples show how to use com.actionbarsherlock.view.SubMenu. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: ProfileEdit.java    From Favorite-Android-Client with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onCreateOptionsMenu(Menu menu) {
	super.onCreateOptionsMenu(menu);
	MenuItem item;

	SubMenu subMenu1 = menu.addSubMenu(getString(R.string.permission));
	subMenu1.add(0, 1001, 0, getString(R.string.privacy_content));
	subMenu1.add(0, 1002, 0, getString(R.string.write_permission));

	MenuItem subMenu1Item = subMenu1.getItem();
	subMenu1Item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
	
if(!Global.getSetting("user_srl", "0").matches(member_srl))	menu.add(0, 1, 0, getString(R.string.delete))
	.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);

	// item = menu.add(0, 1, 0, R.string.Main_MenuAddBookmark);
	// item.setIcon(R.drawable.ic_menu_add_bookmark);

	return true;
}
 
Example #2
Source File: MenuBuilder.java    From android-apps with MIT License 5 votes vote down vote up
public SubMenu addSubMenu(int group, int id, int categoryOrder, CharSequence title) {
    final MenuItemImpl item = (MenuItemImpl) addInternal(group, id, categoryOrder, title);
    final SubMenuBuilder subMenu = new SubMenuBuilder(mContext, this, item);
    item.setSubMenu(subMenu);

    return subMenu;
}
 
Example #3
Source File: MenuItemWrapper.java    From zen4android with MIT License 5 votes vote down vote up
@Override
public SubMenu getSubMenu() {
    if (hasSubMenu() && (mSubMenu == null)) {
        mSubMenu = new SubMenuWrapper(mNativeItem.getSubMenu());
    }
    return mSubMenu;
}
 
Example #4
Source File: MenuWrapper.java    From CSipSimple with GNU General Public License v3.0 5 votes vote down vote up
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;
}
 
Example #5
Source File: MenuBuilder.java    From zen4android with MIT License 5 votes vote down vote up
public SubMenu addSubMenu(int group, int id, int categoryOrder, CharSequence title) {
    final MenuItemImpl item = (MenuItemImpl) addInternal(group, id, categoryOrder, title);
    final SubMenuBuilder subMenu = new SubMenuBuilder(mContext, this, item);
    item.setSubMenu(subMenu);

    return subMenu;
}
 
Example #6
Source File: not_covered_not_covered_s.java    From coming with MIT License 5 votes vote down vote up
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;
}
 
Example #7
Source File: MenuWrapper.java    From zen4android with MIT License 5 votes vote down vote up
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;
}
 
Example #8
Source File: not_covered_not_covered_t.java    From coming with MIT License 5 votes vote down vote up
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;
}
 
Example #9
Source File: MenuItemWrapper.java    From android-apps with MIT License 5 votes vote down vote up
@Override
public SubMenu getSubMenu() {
    if (hasSubMenu() && (mSubMenu == null)) {
        mSubMenu = new SubMenuWrapper(mNativeItem.getSubMenu());
    }
    return mSubMenu;
}
 
Example #10
Source File: MenuWrapper.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
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;
}
 
Example #11
Source File: MenuItemWrapper.java    From zhangshangwuda with Apache License 2.0 5 votes vote down vote up
@Override
public SubMenu getSubMenu() {
    if (hasSubMenu() && (mSubMenu == null)) {
        mSubMenu = new SubMenuWrapper(mNativeItem.getSubMenu());
    }
    return mSubMenu;
}
 
Example #12
Source File: SubMenuBuilder.java    From android-apps with MIT License 4 votes vote down vote up
public SubMenu setHeaderTitle(int titleRes) {
    return (SubMenu) super.setHeaderTitleInt(titleRes);
}
 
Example #13
Source File: MenuBuilder.java    From Libraries-for-Android-Developers with MIT License 4 votes vote down vote up
public SubMenu addSubMenu(int titleRes) {
    return addSubMenu(0, 0, 0, mResources.getString(titleRes));
}
 
Example #14
Source File: SubMenuWrapper.java    From android-apps with MIT License 4 votes vote down vote up
@Override
public SubMenu setIcon(Drawable icon) {
    mNativeSubMenu.setIcon(icon);
    return this;
}
 
Example #15
Source File: MenuWrapper.java    From zen4android with MIT License 4 votes vote down vote up
@Override
public SubMenu addSubMenu(CharSequence title) {
    return addInternal(mNativeMenu.addSubMenu(title));
}
 
Example #16
Source File: MenuItemImpl.java    From android-apps with MIT License 4 votes vote down vote up
public SubMenu getSubMenu() {
    return mSubMenu;
}
 
Example #17
Source File: ActionMenuItem.java    From android-apps with MIT License 4 votes vote down vote up
public SubMenu getSubMenu() {
    return null;
}
 
Example #18
Source File: SubMenuWrapper.java    From zen4android with MIT License 4 votes vote down vote up
@Override
public SubMenu setHeaderIcon(int iconRes) {
    mNativeSubMenu.setHeaderIcon(iconRes);
    return this;
}
 
Example #19
Source File: MenuWrapper.java    From zhangshangwuda with Apache License 2.0 4 votes vote down vote up
@Override
public SubMenu addSubMenu(int groupId, int itemId, int order, CharSequence title) {
    return addInternal(mNativeMenu.addSubMenu(groupId, itemId, order, title));
}
 
Example #20
Source File: SubMenuWrapper.java    From zen4android with MIT License 4 votes vote down vote up
@Override
public SubMenu setIcon(int iconRes) {
    mNativeSubMenu.setIcon(iconRes);
    return this;
}
 
Example #21
Source File: SubMenuWrapper.java    From android-apps with MIT License 4 votes vote down vote up
@Override
public SubMenu setHeaderIcon(int iconRes) {
    mNativeSubMenu.setHeaderIcon(iconRes);
    return this;
}
 
Example #22
Source File: SubMenuWrapper.java    From android-apps with MIT License 4 votes vote down vote up
@Override
public SubMenu setHeaderTitle(CharSequence title) {
    mNativeSubMenu.setHeaderTitle(title);
    return this;
}
 
Example #23
Source File: SubMenuWrapper.java    From android-apps with MIT License 4 votes vote down vote up
@Override
public SubMenu setHeaderTitle(int titleRes) {
    mNativeSubMenu.setHeaderTitle(titleRes);
    return this;
}
 
Example #24
Source File: SubMenuWrapper.java    From android-apps with MIT License 4 votes vote down vote up
public SubMenuWrapper(android.view.SubMenu nativeSubMenu) {
    super(nativeSubMenu);
    mNativeSubMenu = nativeSubMenu;
}
 
Example #25
Source File: MenuBuilder.java    From android-apps with MIT License 4 votes vote down vote up
public boolean bindNativeOverflow(android.view.Menu menu, android.view.MenuItem.OnMenuItemClickListener listener, HashMap<android.view.MenuItem, MenuItemImpl> map) {
    final List<MenuItemImpl> nonActionItems = getNonActionItems();
    if (nonActionItems == null || nonActionItems.size() == 0) {
        return false;
    }

    boolean visible = false;
    menu.clear();
    for (MenuItemImpl nonActionItem : nonActionItems) {
        if (!nonActionItem.isVisible()) {
            continue;
        }
        visible = true;

        android.view.MenuItem nativeItem;
        if (nonActionItem.hasSubMenu()) {
            android.view.SubMenu nativeSub = menu.addSubMenu(nonActionItem.getGroupId(), nonActionItem.getItemId(),
                    nonActionItem.getOrder(), nonActionItem.getTitle());

            SubMenuBuilder subMenu = (SubMenuBuilder)nonActionItem.getSubMenu();
            for (MenuItemImpl subItem : subMenu.getVisibleItems()) {
                android.view.MenuItem nativeSubItem = nativeSub.add(subItem.getGroupId(), subItem.getItemId(),
                        subItem.getOrder(), subItem.getTitle());

                nativeSubItem.setIcon(subItem.getIcon());
                nativeSubItem.setOnMenuItemClickListener(listener);
                nativeSubItem.setEnabled(subItem.isEnabled());
                nativeSubItem.setIntent(subItem.getIntent());
                nativeSubItem.setNumericShortcut(subItem.getNumericShortcut());
                nativeSubItem.setAlphabeticShortcut(subItem.getAlphabeticShortcut());
                nativeSubItem.setTitleCondensed(subItem.getTitleCondensed());
                nativeSubItem.setCheckable(subItem.isCheckable());
                nativeSubItem.setChecked(subItem.isChecked());

                if (subItem.isExclusiveCheckable()) {
                    nativeSub.setGroupCheckable(subItem.getGroupId(), true, true);
                }

                map.put(nativeSubItem, subItem);
            }

            nativeItem = nativeSub.getItem();
        } else {
            nativeItem = menu.add(nonActionItem.getGroupId(), nonActionItem.getItemId(),
                    nonActionItem.getOrder(), nonActionItem.getTitle());
        }
        nativeItem.setIcon(nonActionItem.getIcon());
        nativeItem.setOnMenuItemClickListener(listener);
        nativeItem.setEnabled(nonActionItem.isEnabled());
        nativeItem.setIntent(nonActionItem.getIntent());
        nativeItem.setNumericShortcut(nonActionItem.getNumericShortcut());
        nativeItem.setAlphabeticShortcut(nonActionItem.getAlphabeticShortcut());
        nativeItem.setTitleCondensed(nonActionItem.getTitleCondensed());
        nativeItem.setCheckable(nonActionItem.isCheckable());
        nativeItem.setChecked(nonActionItem.isChecked());

        if (nonActionItem.isExclusiveCheckable()) {
            menu.setGroupCheckable(nonActionItem.getGroupId(), true, true);
        }

        map.put(nativeItem, nonActionItem);
    }
    return visible;
}
 
Example #26
Source File: MenuBuilder.java    From android-apps with MIT License 4 votes vote down vote up
public SubMenu addSubMenu(int group, int id, int categoryOrder, int title) {
    return addSubMenu(group, id, categoryOrder, mResources.getString(title));
}
 
Example #27
Source File: ActionMenu.java    From zhangshangwuda with Apache License 2.0 4 votes vote down vote up
public SubMenu addSubMenu(int groupId, int itemId, int order,
        CharSequence title) {
    // TODO Implement submenus
    return null;
}
 
Example #28
Source File: SubMenuBuilder.java    From Libraries-for-Android-Developers with MIT License 4 votes vote down vote up
public SubMenu setHeaderView(View view) {
    return (SubMenu) super.setHeaderViewInt(view);
}
 
Example #29
Source File: ActionMenu.java    From android-apps with MIT License 4 votes vote down vote up
public SubMenu addSubMenu(int groupId, int itemId, int order, int titleRes) {
    // TODO Implement submenus
    return null;
}
 
Example #30
Source File: SubMenuWrapper.java    From zhangshangwuda with Apache License 2.0 4 votes vote down vote up
@Override
public SubMenu setHeaderView(View view) {
    mNativeSubMenu.setHeaderView(view);
    return this;
}