Example usage for android.view Menu NONE

List of usage examples for android.view Menu NONE

Introduction

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

Prototype

int NONE

To view the source code for android.view Menu NONE.

Click Source Link

Document

Value to use for group and item identifier integers when you don't care about them.

Usage

From source file:org.alfresco.mobile.android.application.fragments.sync.SyncCursorAdapter.java

public void getMenu(Menu menu, Integer statut, boolean rootSynced) {
    MenuItem mi;//w w  w  . j  a va2  s .  c o m

    switch (statut) {
    case SyncContentStatus.STATUS_HIDDEN:
        mi = menu.add(Menu.NONE, R.id.menu_action_favorite_group, Menu.FIRST, R.string.favorite);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        break;
    case SyncContentStatus.STATUS_FAILED:
    case SyncContentStatus.STATUS_REQUEST_USER:
        mi = menu.add(Menu.NONE, R.id.menu_sync_resolution, Menu.FIRST, R.string.sync_resolve_conflict);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        break;
    default:
        if (rootSynced) {
            mi = menu.add(Menu.NONE, R.id.menu_action_sync_group_unsync, Menu.FIRST, R.string.unsync);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
        }
        break;
    }
}

From source file:com.development.androrb.listfolders.java

private void populateMenu(Menu menu) {
    menu.add(Menu.NONE, ONE_ID, Menu.NONE, "Login Setup");
    //menu.add(Menu.NONE, BETA_ID, Menu.NONE, "ApiKey (Dev Mode)");
    menu.add(Menu.NONE, MAX_ID, Menu.NONE, "Max Items p.Page");
    menu.add(Menu.NONE, TWO_ID, Menu.NONE, "Help / About");
}

From source file:io.mapsquare.osmcontributor.ui.activities.MapActivity.java

@Subscribe(threadMode = ThreadMode.MAIN)
public void onPleaseInitializeDrawer(PleaseInitializeDrawer event) {
    Timber.d("initializing drawer with poiType");

    if (filtersItemList == null) {
        filtersItemList = new ArrayList<>();
    }//from w ww.  j a v  a 2 s  . c  o  m
    List<PoiType> poiTypes = event.getPoiTypes();

    poiTypesHidden = event.getPoiTypeHidden();

    filters.clear();
    for (PoiType poiType : poiTypes) {
        Long id = poiType.getId();
        filters.add(new PoiTypeFilter(poiType.getName(), id, poiType.getIcon(), !poiTypesHidden.contains(id)));
    }
    Collections.sort(filters);

    Menu menu = filterView.getMenu();

    int order = 1;
    for (PoiTypeFilter poiTypeFilter : filters) {
        PoiTypeFilter nextPoiTypeFilter = null;
        if (order < filters.size()) {
            nextPoiTypeFilter = filters.get(order);
        }
        // Add only menu if not present
        if (menu.findItem(poiTypeFilter.getPoiTypeId().intValue()) == null) {
            filtersItemList.add(menu
                    .add(Menu.NONE, poiTypeFilter.getPoiTypeId().intValue(),
                            (nextPoiTypeFilter != null
                                    ? (poiTypeFilter.compareTo(nextPoiTypeFilter) > 0 ? order - 1 : order)
                                    : order),
                            poiTypeFilter.getPoiTypeName())
                    .setChecked(poiTypeFilter.isActive())
                    .setIcon(bitmapHandler.getDrawable(poiTypeFilter.getPoiTypeIconName())));
        }
        order++;
    }

    // Remove only filter removed by user
    if (filters.size() < filtersItemList.size()) {
        List<MenuItem> temp = new ArrayList<>(filters.size());
        for (MenuItem menuItem : filtersItemList) {
            PoiTypeFilter poiTypeFilter = new PoiTypeFilter("", (long) menuItem.getItemId(), "", true);
            if (!filters.contains(poiTypeFilter)) {
                menu.removeItem(poiTypeFilter.getPoiTypeId().intValue());
            } else {
                temp.add(menuItem);
            }
        }

        filtersItemList.clear();
        filtersItemList.addAll(temp);
        temp.clear();
    }

    selectAllMenuItem.setChecked(poiTypesHidden.isEmpty());
}

From source file:com.github.rubensousa.floatingtoolbar.FloatingToolbar.java

/**
 * Place the menu items with icons inside a horizontal LinearLayout
 *///from   w  w w .ja va2s  .  c o m
private void addMenuItems() {

    if (mMenu == null) {
        mMenu = new MenuBuilder(getContext());
        new SupportMenuInflater(getContext()).inflate(mMenuRes, mMenu);
    }

    LinearLayoutCompat.LayoutParams layoutParams = new LinearLayoutCompat.LayoutParams(
            LayoutParams.WRAP_CONTENT, LayoutParams.MATCH_PARENT, 1);

    setWeightSum(mMenu.size());

    for (int i = 0; i < mMenu.size(); i++) {
        MenuItem item = mMenu.getItem(i);
        if (item.isVisible()) {
            AppCompatImageButton imageButton = new AppCompatImageButton(getContext());
            //noinspection ResourceType
            imageButton.setId(item.getItemId() == Menu.NONE ? genViewId() : item.getItemId());
            imageButton.setBackgroundResource(mItemBackground);
            imageButton.setImageDrawable(item.getIcon());
            imageButton.setOnClickListener(this);
            imageButton.setOnLongClickListener(this);
            imageButton.setTag(item);
            mMenuLayout.addView(imageButton, layoutParams);
        }
    }
}

From source file:org.catnut.plugin.zhihu.ZhihuItemFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    menu.add(Menu.NONE, ACTION_VIEW_ALL_ON_WEB, Menu.NONE, getString(R.string.view_all_answer))
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    menu.add(Menu.NONE, ACTION_VIEW_ON_WEB, Menu.NONE, getString(R.string.zhihu_view_on_web))
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
}

From source file:com.normalexception.app.rx8club.fragment.category.CategoryFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    menu.add(Menu.NONE, MENU_FAVE, Menu.NONE, "Add As Favorite");
    menu.add(Menu.NONE, MENU_FILTER_USER, Menu.NONE, "Add As User Filter");
    menu.add(Menu.NONE, MENU_FILTER_TITLE, Menu.NONE, "Add As Title Filter");
    menu.add(Menu.NONE, MENU_FILTER_LASTUSER, Menu.NONE, "Add As Last User Filter");
}

From source file:org.smilec.smile.ui.GeneralActivity.java

@Override
public boolean onPrepareOptionsMenu(Menu menu) {

    // Adding Retake button to menu
    if (btResults.isEnabled()) {
        MenuItem item = menu.findItem(R.id.bt_retake);
        if (item == null) {
            menu.add(0, R.id.bt_retake, Menu.NONE, R.string.retake).setIcon(R.drawable.retake);
        }/*from  w w  w  . j  a v a 2 s .  c  o  m*/
    } else {
        menu.removeItem(R.id.bt_retake);
    }

    return super.onPrepareOptionsMenu(menu);
}

From source file:in.shick.diode.mail.InboxListActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    int rowId = (int) info.id;
    ThingInfo item = mMessagesAdapter.getItem(rowId);

    // Mark the message/comment as selected
    mVoteTargetThingInfo = item;//from  w ww .  j ava2s . c  o m
    mReplyTargetName = item.getName();

    if (item.isWas_comment()) {
        menu.add(0, Constants.DIALOG_COMMENT_CLICK, Menu.NONE, R.string.view_context);
    } else {
        menu.add(0, Constants.DIALOG_MESSAGE_CLICK, Menu.NONE, "Reply");
    }
    // Lazy-load the URL list to make the list-loading more 'snappy'.
    if (mVoteTargetThingInfo.getUrls() != null && mVoteTargetThingInfo.getUrls().isEmpty()) {
        Markdown.getURLs(mVoteTargetThingInfo.getBody(), mVoteTargetThingInfo.getUrls());
    }
    if (mVoteTargetThingInfo.getUrls() != null && !mVoteTargetThingInfo.getUrls().isEmpty()) {
        menu.add(0, Constants.DIALOG_LINKS, Menu.NONE, R.string.links_menu_item);
    }
}

From source file:jp.ksksue.app.terminal.AndroidUSBSerialMonitorLite.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.add(Menu.NONE, MENU_ID_OPENDEVICE, Menu.NONE, "Open Device");
    menu.add(Menu.NONE, MENU_ID_WORDLIST, Menu.NONE, "Word List ...");
    menu.add(Menu.NONE, MENU_ID_SETTING, Menu.NONE, "Setting ...");
    menu.add(Menu.NONE, MENU_ID_CLEARTEXT, Menu.NONE, "Clear Text");
    menu.add(Menu.NONE, MENU_ID_SENDTOEMAIL, Menu.NONE, "Email to ...");
    menu.add(Menu.NONE, MENU_ID_CLOSEDEVICE, Menu.NONE, "Close Device");
    /*        if(mSerial!=null) {
    if(mSerial.isConnected()) {//from   w  ww .  j a v a2  s.  co  m
        menu.getItem(MENU_ID_OPENDEVICE).setEnabled(false);
    } else {
        menu.getItem(MENU_ID_CLOSEDEVICE).setEnabled(false);
    }
            }
    */ return super.onCreateOptionsMenu(menu);
}

From source file:nl.thehyve.transmartclient.MainActivity.java

private void refreshNavigationMenu() {

    NavigationView mNavigationView = (NavigationView) findViewById(R.id.nav_view);
    final Menu menu = mNavigationView.getMenu();
    List<TransmartServer> connectedServers = getConnectedServers();

    menu.clear();/* w  w w. j  a  va  2s  .com*/

    int order = 0;
    int group = 1;

    SubMenu serverMenu = menu.addSubMenu(Menu.NONE, order, order, getString(R.string.menu_serversSubmenu));
    order += 1;

    for (TransmartServer transmartServer : connectedServers) {
        int menuItemID = serverMenu.add(group, order, order, transmartServer.getServerLabel())
                .setIcon(R.drawable.ic_action_accounts).getItemId();
        transmartServer.setMenuItemID(menuItemID);
        order += 1;
    }
    add_server_item = serverMenu.add(group, order, order, R.string.menu_addNewServer)
            .setIcon(R.drawable.ic_action_new_account).getItemId();
    order += 1;

    serverMenu.setGroupCheckable(group, true, true);

    about_item = menu.add(Menu.NONE, order, order, R.string.menu_about).setIcon(R.drawable.ic_action_about)
            .getItemId();
}