Example usage for android.view Menu equals

List of usage examples for android.view Menu equals

Introduction

In this page you can find the example usage for android.view Menu equals.

Prototype

public boolean equals(Object obj) 

Source Link

Document

Indicates whether some other object is "equal to" this one.

Usage

From source file:org.brandroid.openmanager.activities.OpenExplorer.java

@Override
public boolean onMenuOpened(int featureId, Menu menu) {
    Logger.LogDebug("OpenExplorer.onMenuOpened(0x" + Integer.toHexString(featureId) + "," + menu + ")");
    if (USE_PRETTY_MENUS) {
        if (menu != null && !menu.equals(mMainMenu) && !menu.equals(mOptsMenu))
            menu.close();/*from  ww  w.  j  a va2 s.  c o  m*/
        return false;
    }
    return super.onMenuOpened(featureId, menu);
}

From source file:org.brandroid.openmanager.activities.OpenExplorer.java

public boolean onCreateOptionsMenu(Menu menu, boolean fromSystem) {
    MenuUtils.scanMenuShortcuts(menu, getMenuInflater());
    //mActionBarHelper.onCreateOptionsMenu(menu);
    OpenFragment frag = getSelectedFragment();

    //if(menu == null) menu = new MenuBuilder(this);
    menu.clear();// ww w. jav  a 2s . c  o m

    if (DEBUG)
        Logger.LogDebug("OpenExplorer.onCreateOptionsMenu(" + menu + "," + fromSystem + ")");
    //getMenuInflater().inflate(R.menu.global_top, menu);
    if (frag != null) // && frag.hasOptionsMenu())
        frag.onCreateOptionsMenu(menu, getMenuInflater());
    getMenuInflater().inflate(R.menu.global, menu);

    if (!USE_PRETTY_MENUS) {
        MenuUtils.setMenuVisible(menu, false, R.id.menu_more);
        return true;
    }

    /*
    if(!BEFORE_HONEYCOMB)
       for(int i = 0; i < menu.size(); i++)
       {
    MenuItem item = menu.getItem(i);
    if(item.getActionView() == null)
       item.setActionView(makeMenuButton(item, null));
       }
    */

    if (mOptsMenu == null)
        mOptsMenu = new MenuBuilder(this);
    mOptsMenu.clear();
    mOptsMenu.setQwertyMode(true);
    MenuUtils.transferMenu(menu, mOptsMenu, false);
    MenuUtils.setMenuVisible(mOptsMenu, false, R.id.menu_more);
    MenuUtils.hideMenuGrandChildren(mOptsMenu);

    if (!USE_PRETTY_MENUS) {
        handleMoreMenu(menu, false);
        MenuUtils.fillSubMenus(menu, getMenuInflater());
    } else { // if(isGTV()) {
        if (isGTV()) {
            handleMoreMenu(mMainMenu, true, 6); //*/
            if (!menu.equals(mMainMenu))
                menu.clear();
            else
                MenuUtils.fillSubMenus(menu, getMenuInflater());
        } else {
            handleMoreMenu(menu, true);
            if (!menu.equals(mMainMenu) && !getResources().getBoolean(R.bool.allow_split_actionbar))
                MenuUtils.setMenuVisible(menu, false);
            //else fillSubMenus(menu, getMenuInflater());
        }
    } //else MenuUtils.setMenuVisible(menu, false, R.id.menu_more);
    /*else {
       fillSubMenus(mMainMenu, getMenuInflater());
       handleMoreMenu(menu, false);
    }*/

    return true;
}