Example usage for android.view MenuInflater MenuInflater

List of usage examples for android.view MenuInflater MenuInflater

Introduction

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

Prototype

public MenuInflater(Context context) 

Source Link

Document

Constructs a menu inflater.

Usage

From source file:org.blanco.tests.viewpager.MainActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = new MenuInflater(this);
    inflater.inflate(R.menu.main_menu, menu);
    return super.onCreateOptionsMenu(menu);
}

From source file:com.hiqes.android.demopermissionsm.ui.MainActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = new MenuInflater(this);
    inflater.inflate(R.menu.menu_main, menu);
    return super.onCreateOptionsMenu(menu);
}

From source file:net.survivalpad.android.ArticleViewActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater menuInflater = new MenuInflater(this);
    menuInflater.inflate(R.menu.article, menu);
    return super.onCreateOptionsMenu(menu);
}

From source file:net.bible.android.control.page.window.WindowControl.java

/**
 * Add the Window sub-menu resource which is not included in the main.xml for the main menu
 * Set the synchronised checkbox in the app menu before displayed
 * Disable various menu items if links window selected
 *//*from   w  w w .  j  a  v  a  2s .c  o m*/
public void updateOptionsMenu(Menu menu) {
    // when updating main menu rather than Window options menu
    MenuItem windowSubmenuItemPosition = menu.findItem(R.id.windowSubMenu);
    if (windowSubmenuItemPosition != null) {
        // check the Window sub-menu has been added
        Menu subMenuToPopulate = windowSubmenuItemPosition.getSubMenu();
        if (subMenuToPopulate.findItem(R.id.windowNew) == null) {
            new MenuInflater(BibleApplication.getApplication()).inflate(R.menu.window_popup_menu,
                    subMenuToPopulate);
        }
    }

    MenuItem synchronisedMenuItem = menu.findItem(R.id.windowSynchronise);
    MenuItem moveFirstMenuItem = menu.findItem(R.id.windowMoveFirst);
    MenuItem closeMenuItem = menu.findItem(R.id.windowClose);
    MenuItem minimiseMenuItem = menu.findItem(R.id.windowMinimise);
    MenuItem maximiseMenuItem = menu.findItem(R.id.windowMaximise);
    Window window = getActiveWindow();

    if (synchronisedMenuItem != null && moveFirstMenuItem != null) {
        // set synchronised & maximised checkbox state
        synchronisedMenuItem.setChecked(window.isSynchronised());
        maximiseMenuItem.setChecked(window.isMaximised());

        // the dedicated links window cannot be treated as a normal window
        boolean isDedicatedLinksWindowActive = isActiveWindow(windowRepository.getDedicatedLinksWindow());
        synchronisedMenuItem.setEnabled(!isDedicatedLinksWindowActive);
        moveFirstMenuItem.setEnabled(!isDedicatedLinksWindowActive);

        // cannot close last normal window
        closeMenuItem.setEnabled(isWindowRemovable(window));
        minimiseMenuItem.setEnabled(isWindowMinimisable(window));

        // if window is already first then cannot promote
        List<Window> visibleWindows = windowRepository.getVisibleWindows();
        if (visibleWindows.size() > 0 && window.equals(visibleWindows.get(0))) {
            moveFirstMenuItem.setEnabled(false);
        }
    }
}

From source file:org.barbon.mangaget.Main.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    if (!super.onCreateOptionsMenu(menu))
        return false;

    MenuInflater inflater = new MenuInflater(this);

    inflater.inflate(R.menu.main, menu);

    return true;//from   ww  w.java  2s  .c o m
}

From source file:org.blanco.lacuenta.MainActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    new MenuInflater(this).inflate(R.menu.main_activity_main_menu, menu);
    return true;//from   w w  w  . j av a 2  s  . c om
}

From source file:org.blanco.techmun.android.EventosActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = new MenuInflater(getBaseContext());
    inflater.inflate(R.menu.eventos_list_fragment_options_menu, menu);
    return true;//  w w w  . j  a va2s. c  o  m
}

From source file:android.support.v7.internal.view.StandaloneActionMode.java

@Override
public MenuInflater getMenuInflater() {
    return new MenuInflater(mContextView.getContext());
}

From source file:com.royclarkson.springagram.GalleryListFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    MenuInflater inflater = new MenuInflater(this.getActivity());
    inflater.inflate(R.menu.gallery_list_context_menu, menu);
}

From source file:link.kjr.file_manager.MainActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    MenuInflater mi = new MenuInflater(this);
    mi.inflate(R.menu.menu, menu);/*w w w.  j a  va 2  s .  c om*/
    return true;
}