Example usage for android.view MenuItem SHOW_AS_ACTION_ALWAYS

List of usage examples for android.view MenuItem SHOW_AS_ACTION_ALWAYS

Introduction

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

Prototype

int SHOW_AS_ACTION_ALWAYS

To view the source code for android.view MenuItem SHOW_AS_ACTION_ALWAYS.

Click Source Link

Document

Always show this item as a button in an Action Bar.

Usage

From source file:net.lacolaco.smileessence.activity.EditExtractionActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuItem add = menu.add(Menu.NONE, R.id.menu_edit_list_add, Menu.NONE, "");
    add.setIcon(android.R.drawable.ic_menu_add);
    add.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    return true;//from   ww w .  ja v a2 s. com
}

From source file:org.odk.collect.android.fragments.AppListFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    Collect.getInstance().getActivityLogger().logInstanceAction(this, "onCreateOptionsMenu", "show");
    super.onCreateOptionsMenu(menu, inflater);

    menu.add(0, MENU_SORT, 0, R.string.sort_the_list).setIcon(R.drawable.ic_sort)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

    menu.add(0, MENU_FILTER, 0, R.string.filter_the_list).setIcon(R.drawable.ic_search)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
}

From source file:net.lacolaco.smileessence.activity.EditCommandActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuItem allOn = menu.add(Menu.NONE, R.id.menu_edit_command_all_on, Menu.NONE, "");
    allOn.setTitle(R.string.actionbar_edit_command_all_on);
    allOn.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    return true;//  w  w  w .j a v  a  2  s.  c om
}

From source file:com.example.shyam.popi.LearnEmotions.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    setVolumeControlStream(AudioManager.STREAM_MUSIC);
    getMenuInflater().inflate(R.menu.activity_screen_slide, menu);

    menu.findItem(R.id.action_previous).setEnabled(mPager.getCurrentItem() > 0);

    // Add either a "next" or "finish" button to the action bar, depending on which page
    // is currently selected.
    MenuItem item = menu.add(Menu.NONE, R.id.action_next, Menu.NONE,
            (mPager.getCurrentItem() == mPagerAdapter.getCount() - 1) ? R.string.action_finish
                    : R.string.action_next);
    item.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
    return true;/* w  ww.  ja v  a  2  s  .c  o m*/
}

From source file:com.jrummyapps.busybox.fragments.ScriptsFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    menu.add(0, R.id.action_settings, 0, R.string.settings).setIcon(R.drawable.ic_settings_white_24dp)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    menu.add(0, R.id.action_info, 0, R.string.about).setIcon(R.drawable.ic_information_white_24dp)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    super.onCreateOptionsMenu(menu, inflater);
}

From source file:com.zbrown.droidsteal.activities.HijackActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    MenuItem menu0 = menu.add(0, 0, 0, getString(R.string.back));
    menu0.setIcon(R.drawable.ic_action_back);
    menu0.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

    MenuItem menu1 = menu.add(0, 1, 0, getString(R.string.forward));
    menu1.setIcon(R.drawable.ic_action_forward);
    menu1.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

    MenuItem menu2 = menu.add(0, 2, 0, getString(R.string.reload));
    menu2.setIcon(R.drawable.ic_action_refresh);
    menu2.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    menu.add(0, 3, 0, getString(R.string.changeurl));
    menu.add(0, 4, 0, getString(R.string.close));
    return true;/*w w w .j  av a  2  s. c  om*/
}

From source file:com.orpheusdroid.screenrecorder.VideosListFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    MenuItem refresh = menu.add("Refresh");
    refresh.setIcon(R.drawable.ic_refresh_white_24dp);
    refresh.setShowAsActionFlags(MenuItem.SHOW_AS_ACTION_ALWAYS);
    refresh.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
        @Override/*w w  w.ja v a 2  s .  co  m*/
        public boolean onMenuItemClick(MenuItem menuItem) {
            // Prevent repeated refresh requests
            if (swipeRefreshLayout.isRefreshing())
                return false;
            videosList.clear();
            checkPermission();
            Log.d(Const.TAG, "Refreshing");
            return false;
        }
    });
}

From source file:com.facebook.react.views.toolbar.ReactToolbarManager.java

@Nullable
@Override//  ww w  .j  a  va  2  s  . c o  m
public Map<String, Object> getExportedViewConstants() {
    return MapBuilder.<String, Object>of("ShowAsAction", MapBuilder.of("never", MenuItem.SHOW_AS_ACTION_NEVER,
            "always", MenuItem.SHOW_AS_ACTION_ALWAYS, "ifRoom", MenuItem.SHOW_AS_ACTION_IF_ROOM));
}

From source file:org.mozilla.mozstumbler.client.navdrawer.MainDrawerActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    getMenuInflater().inflate(R.menu.main, menu);

    mMenuItemStartStop = menu.add(Menu.NONE, MENU_START_STOP, Menu.NONE, R.string.start_scanning);
    if (Build.VERSION.SDK_INT >= 14) {
        Switch s = new Switch(this);
        s.setChecked(false);//ww w.j ava  2  s  .c  om
        s.setOnCheckedChangeListener(mStartStopButtonListener);
        mMenuItemStartStop.setActionView(s);
        mMenuItemStartStop.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    } else {
        MenuItemCompat.setShowAsAction(mMenuItemStartStop, MenuItemCompat.SHOW_AS_ACTION_ALWAYS);
    }

    updateStartStopMenuItemState();
    return true;
}

From source file:org.peterbaldwin.vlcremote.app.PickServerActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    MenuItem scan = menu.add(0, MENU_SCAN, 0, R.string.scan);
    scan.setIcon(R.drawable.ic_menu_scan_network);
    scan.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
    return true;/* w  w  w  .j a v a  2s .com*/
}