Example usage for android.view Menu findItem

List of usage examples for android.view Menu findItem

Introduction

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

Prototype

public MenuItem findItem(int id);

Source Link

Document

Return the menu item with a particular identifier.

Usage

From source file:br.com.anteros.vendas.gui.PedidoCadastroActivity.java

/**
 * Habilita o menu de acordo com a aba ativa.
 * @param menu menu//from   w  ww  .jav a 2  s  .  co m
 * @return
 */
@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    if (tabAtiva == 1) {
        menu.findItem(R.id.menu_pedido_adicionarProduto).setVisible(true);
    } else {
        menu.findItem(R.id.menu_pedido_adicionarProduto).setVisible(false);
    }
    return super.onPrepareOptionsMenu(menu);
}

From source file:net.coding.program.project.init.create.ProjectCreateFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    mMenuSave = menu.findItem(R.id.action_finish);
    updateSendButton();//from  ww  w.  j a v a 2  s.  co  m
    super.onCreateOptionsMenu(menu, inflater);
}

From source file:butter.droid.activities.base.ButterBaseActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    getMenuInflater().inflate(R.menu.activity_base, menu);

    BeamManager beamManager = BeamManager.getInstance(this);
    Boolean castingVisible = mShowCasting && beamManager.hasCastDevices();
    MenuItem item = menu.findItem(R.id.action_casting);
    item.setVisible(castingVisible);/* w  w w .  jav  a2s .co m*/
    item.setIcon(
            beamManager.isConnected() ? R.drawable.ic_av_beam_connected : R.drawable.ic_av_beam_disconnected);

    return true;
}

From source file:com.alainesp.fan.sanderson.ReadTorCommentActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.show_book_menu, menu);

    nextCommentItem = menu.findItem(R.id.book_menu_next);
    prevCommentItem = menu.findItem(R.id.book_menu_prev);

    int index = comments.indexOf(TorRereadCommentsActivity.readingComment);
    prevCommentItem.setVisible(index > 0);
    nextCommentItem.setVisible((index + 1) < comments.size());

    return true;//from   www. j  a v a  2s .c  om
}

From source file:fr.simon.marquis.preferencesmanager.ui.PreferencesActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {
    boolean fav = Utils.isFavorite(packageName, this);
    MenuItem itemFav = menu.findItem(R.id.action_fav);
    if (itemFav != null) {
        itemFav.setIcon(fav ? R.drawable.ic_action_star_10 : R.drawable.ic_action_star_0)
                .setTitle(fav ? R.string.action_unfav : R.string.action_fav);
    }// ww w .j  a  v  a 2 s .com
    return super.onPrepareOptionsMenu(menu);
}

From source file:codepath.watsiapp.activities.BaseFragmentActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);

    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.common_menus, menu);

    myprofile = menu.findItem(R.id.action_profileView);
    logout = menu.findItem(R.id.action_logout);
    checkLogOutVisible();//from   ww  w  .ja  v  a2s .  c  om
    return true;
}

From source file:io.samsungsami.example.SAMInBLEws.SAMIDeviceActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.samidevices, menu);
    menu.findItem(R.id.menu_logout_sami).setVisible(true);
    return true;//from  w  w w.  ja v a2 s.  c o m
}

From source file:am.roadpolice.roadpolice.ViolationInfoActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // Inflate the menu; this adds items to the action bar if it is present.
    getMenuInflater().inflate(R.menu.menu_info, menu);

    // Get 'Settings' Menu item.
    MenuItem itemSettings = menu.findItem(R.id.action_settings);
    // Disable 'Settings' menu item in the case if user is not
    // logged-in, but just entered activity for data view.
    itemSettings.setEnabled(mAutoLogin);

    return true;// w  w  w  .  jav  a 2 s  .  c om
}

From source file:com.amobletool.bluetooth.le.downexample.ui.DeviceScanActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main, menu);
    if (!mScanning) {
        menu.findItem(R.id.menu_stop).setVisible(false);
        menu.findItem(R.id.menu_scan).setVisible(true);
        menu.findItem(R.id.menu_refresh).setActionView(null);
    } else {//from   www.j av  a 2s .  c o m
        menu.findItem(R.id.menu_stop).setVisible(true);
        menu.findItem(R.id.menu_scan).setVisible(false);
        menu.findItem(R.id.menu_refresh).setActionView(R.layout.actionbar_indeterminate_progress);
    }
    return true;
}

From source file:ca.farrelltonsolar.classic.DayLogChart.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    inflater.inflate(R.menu.day_log_chart_menu, menu); // inflate the menu
    MenuItem shareItem = menu.findItem(R.id.day_log_chart_preference);
    setupSpinner(shareItem);/* w w  w.j a v a 2 s  .  co  m*/
    super.onCreateOptionsMenu(menu, inflater);
}