Java Code Examples for com.actionbarsherlock.view.MenuItem#isVisible()

The following examples show how to use com.actionbarsherlock.view.MenuItem#isVisible() . 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: MenuPopupHelper.java    From CSipSimple with GNU General Public License v3.0 6 votes vote down vote up
@Override
public boolean onSubMenuSelected(SubMenuBuilder subMenu) {
    if (subMenu.hasVisibleItems()) {
        MenuPopupHelper subPopup = new MenuPopupHelper(mContext, subMenu, mAnchorView, false);
        subPopup.setCallback(mPresenterCallback);

        boolean preserveIconSpacing = false;
        final int count = subMenu.size();
        for (int i = 0; i < count; i++) {
            MenuItem childItem = subMenu.getItem(i);
            if (childItem.isVisible() && childItem.getIcon() != null) {
                preserveIconSpacing = true;
                break;
            }
        }
        subPopup.setForceShowIcon(preserveIconSpacing);

        if (subPopup.tryShow()) {
            if (mPresenterCallback != null) {
                mPresenterCallback.onOpenSubMenu(subMenu);
            }
            return true;
        }
    }
    return false;
}
 
Example 2
Source File: ActionMenuPresenter.java    From CSipSimple with GNU General Public License v3.0 6 votes vote down vote up
public ActionButtonSubmenu(Context context, SubMenuBuilder subMenu) {
    super(context, subMenu);
    //UNUSED mSubMenu = subMenu;

    MenuItemImpl item = (MenuItemImpl) subMenu.getItem();
    if (!item.isActionButton()) {
        // Give a reasonable anchor to nested submenus.
        setAnchorView(mOverflowButton == null ? (View) mMenuView : mOverflowButton);
    }

    setCallback(mPopupPresenterCallback);

    boolean preserveIconSpacing = false;
    final int count = subMenu.size();
    for (int i = 0; i < count; i++) {
        MenuItem childItem = subMenu.getItem(i);
        if (childItem.isVisible() && childItem.getIcon() != null) {
            preserveIconSpacing = true;
            break;
        }
    }
    setForceShowIcon(preserveIconSpacing);
}
 
Example 3
Source File: MenuPopupHelper.java    From android-apps with MIT License 6 votes vote down vote up
@Override
public boolean onSubMenuSelected(SubMenuBuilder subMenu) {
    if (subMenu.hasVisibleItems()) {
        MenuPopupHelper subPopup = new MenuPopupHelper(mContext, subMenu, mAnchorView, false);
        subPopup.setCallback(mPresenterCallback);

        boolean preserveIconSpacing = false;
        final int count = subMenu.size();
        for (int i = 0; i < count; i++) {
            MenuItem childItem = subMenu.getItem(i);
            if (childItem.isVisible() && childItem.getIcon() != null) {
                preserveIconSpacing = true;
                break;
            }
        }
        subPopup.setForceShowIcon(preserveIconSpacing);

        if (subPopup.tryShow()) {
            if (mPresenterCallback != null) {
                mPresenterCallback.onOpenSubMenu(subMenu);
            }
            return true;
        }
    }
    return false;
}
 
Example 4
Source File: ActionMenuPresenter.java    From android-apps with MIT License 6 votes vote down vote up
public ActionButtonSubmenu(Context context, SubMenuBuilder subMenu) {
    super(context, subMenu);
    //UNUSED mSubMenu = subMenu;

    MenuItemImpl item = (MenuItemImpl) subMenu.getItem();
    if (!item.isActionButton()) {
        // Give a reasonable anchor to nested submenus.
        setAnchorView(mOverflowButton == null ? (View) mMenuView : mOverflowButton);
    }

    setCallback(mPopupPresenterCallback);

    boolean preserveIconSpacing = false;
    final int count = subMenu.size();
    for (int i = 0; i < count; i++) {
        MenuItem childItem = subMenu.getItem(i);
        if (childItem.isVisible() && childItem.getIcon() != null) {
            preserveIconSpacing = true;
            break;
        }
    }
    setForceShowIcon(preserveIconSpacing);
}
 
Example 5
Source File: MenuPopupHelper.java    From zen4android with MIT License 6 votes vote down vote up
@Override
public boolean onSubMenuSelected(SubMenuBuilder subMenu) {
    if (subMenu.hasVisibleItems()) {
        MenuPopupHelper subPopup = new MenuPopupHelper(mContext, subMenu, mAnchorView, false);
        subPopup.setCallback(mPresenterCallback);

        boolean preserveIconSpacing = false;
        final int count = subMenu.size();
        for (int i = 0; i < count; i++) {
            MenuItem childItem = subMenu.getItem(i);
            if (childItem.isVisible() && childItem.getIcon() != null) {
                preserveIconSpacing = true;
                break;
            }
        }
        subPopup.setForceShowIcon(preserveIconSpacing);

        if (subPopup.tryShow()) {
            if (mPresenterCallback != null) {
                mPresenterCallback.onOpenSubMenu(subMenu);
            }
            return true;
        }
    }
    return false;
}
 
Example 6
Source File: ActionMenuPresenter.java    From zen4android with MIT License 6 votes vote down vote up
public ActionButtonSubmenu(Context context, SubMenuBuilder subMenu) {
    super(context, subMenu);
    //UNUSED mSubMenu = subMenu;

    MenuItemImpl item = (MenuItemImpl) subMenu.getItem();
    if (!item.isActionButton()) {
        // Give a reasonable anchor to nested submenus.
        setAnchorView(mOverflowButton == null ? (View) mMenuView : mOverflowButton);
    }

    setCallback(mPopupPresenterCallback);

    boolean preserveIconSpacing = false;
    final int count = subMenu.size();
    for (int i = 0; i < count; i++) {
        MenuItem childItem = subMenu.getItem(i);
        if (childItem.isVisible() && childItem.getIcon() != null) {
            preserveIconSpacing = true;
            break;
        }
    }
    setForceShowIcon(preserveIconSpacing);
}
 
Example 7
Source File: MenuPopupHelper.java    From zhangshangwuda with Apache License 2.0 6 votes vote down vote up
@Override
public boolean onSubMenuSelected(SubMenuBuilder subMenu) {
    if (subMenu.hasVisibleItems()) {
        MenuPopupHelper subPopup = new MenuPopupHelper(mContext, subMenu, mAnchorView, false);
        subPopup.setCallback(mPresenterCallback);

        boolean preserveIconSpacing = false;
        final int count = subMenu.size();
        for (int i = 0; i < count; i++) {
            MenuItem childItem = subMenu.getItem(i);
            if (childItem.isVisible() && childItem.getIcon() != null) {
                preserveIconSpacing = true;
                break;
            }
        }
        subPopup.setForceShowIcon(preserveIconSpacing);

        if (subPopup.tryShow()) {
            if (mPresenterCallback != null) {
                mPresenterCallback.onOpenSubMenu(subMenu);
            }
            return true;
        }
    }
    return false;
}
 
Example 8
Source File: ActionMenuPresenter.java    From zhangshangwuda with Apache License 2.0 6 votes vote down vote up
public ActionButtonSubmenu(Context context, SubMenuBuilder subMenu) {
    super(context, subMenu);
    //UNUSED mSubMenu = subMenu;

    MenuItemImpl item = (MenuItemImpl) subMenu.getItem();
    if (!item.isActionButton()) {
        // Give a reasonable anchor to nested submenus.
        setAnchorView(mOverflowButton == null ? (View) mMenuView : mOverflowButton);
    }

    setCallback(mPopupPresenterCallback);

    boolean preserveIconSpacing = false;
    final int count = subMenu.size();
    for (int i = 0; i < count; i++) {
        MenuItem childItem = subMenu.getItem(i);
        if (childItem.isVisible() && childItem.getIcon() != null) {
            preserveIconSpacing = true;
            break;
        }
    }
    setForceShowIcon(preserveIconSpacing);
}
 
Example 9
Source File: MenuPopupHelper.java    From Libraries-for-Android-Developers with MIT License 6 votes vote down vote up
@Override
public boolean onSubMenuSelected(SubMenuBuilder subMenu) {
    if (subMenu.hasVisibleItems()) {
        MenuPopupHelper subPopup = new MenuPopupHelper(mContext, subMenu, mAnchorView, false);
        subPopup.setCallback(mPresenterCallback);

        boolean preserveIconSpacing = false;
        final int count = subMenu.size();
        for (int i = 0; i < count; i++) {
            MenuItem childItem = subMenu.getItem(i);
            if (childItem.isVisible() && childItem.getIcon() != null) {
                preserveIconSpacing = true;
                break;
            }
        }
        subPopup.setForceShowIcon(preserveIconSpacing);

        if (subPopup.tryShow()) {
            if (mPresenterCallback != null) {
                mPresenterCallback.onOpenSubMenu(subMenu);
            }
            return true;
        }
    }
    return false;
}
 
Example 10
Source File: ActionMenuPresenter.java    From Libraries-for-Android-Developers with MIT License 6 votes vote down vote up
public ActionButtonSubmenu(Context context, SubMenuBuilder subMenu) {
    super(context, subMenu);
    //UNUSED mSubMenu = subMenu;

    MenuItemImpl item = (MenuItemImpl) subMenu.getItem();
    if (!item.isActionButton()) {
        // Give a reasonable anchor to nested submenus.
        setAnchorView(mOverflowButton == null ? (View) mMenuView : mOverflowButton);
    }

    setCallback(mPopupPresenterCallback);

    boolean preserveIconSpacing = false;
    final int count = subMenu.size();
    for (int i = 0; i < count; i++) {
        MenuItem childItem = subMenu.getItem(i);
        if (childItem.isVisible() && childItem.getIcon() != null) {
            preserveIconSpacing = true;
            break;
        }
    }
    setForceShowIcon(preserveIconSpacing);
}