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:com.josecalles.tistiq.mvp.view.MainActivity.java

@Override
public void updateContactListView(List<String> contacts) {
    submenu.clear();/*from   ww w .ja  v a 2  s  .  c  o m*/
    int i = 0;
    for (String name : contacts) {
        switch (i) {
        case 0:
            submenu.add(Menu.NONE, Menu.NONE, Menu.NONE, name).setIcon(R.drawable.ic_one_rank);
            break;
        case 1:
            submenu.add(Menu.NONE, Menu.NONE, Menu.NONE, name).setIcon(R.drawable.ic_two_rank);
            break;
        case 2:
            submenu.add(Menu.NONE, Menu.NONE, Menu.NONE, name).setIcon(R.drawable.ic_three_rank);
            break;
        default:
            submenu.add(Menu.NONE, Menu.NONE, Menu.NONE, name);
            break;
        }
        i++;
    }

    refreshContactList();
    dismissProgressDialog();
}

From source file:com.wenhui.syncedListView.demo.demo.SyncListViewContainerFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    String title = (mLayout.isAnimating()) ? "Stop anim" : "Start anim";
    mAnimMenu = menu.add(Menu.NONE, R.id.animation, 0, title);
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.HONEYCOMB) {
        mAnimMenu.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }//from  w w w  . j  av  a 2  s.  c  o  m
    super.onCreateOptionsMenu(menu, inflater);
}

From source file:edu.illinois.whereru.FriendListFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);

    menu.add(Menu.NONE, ADD_MENU_ID, Menu.NONE, "ADD Friend");
}

From source file:com.giantturtle.badenumbersquiz.PrepareYourSelfActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    super.onCreateOptionsMenu(menu);
    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)//ako je predposlednja stranica onda  da prikae finish, a ako nije predposlednja
                    ? R.string.action_finish
                    : R.string.action_next);
    item.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_WITH_TEXT);
    return true;/*from   ww w  . j av a 2 s .com*/
}

From source file:com.wheelly.fragments.LocationsMapFragment.java

@SuppressWarnings("deprecation")
@Override/*ww w .ja v a 2  s.co  m*/
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    super.onCreateOptionsMenu(menu, inflater);
    MenuCompat.setShowAsAction(
            menu.add(Menu.NONE, 1, Menu.NONE, R.string.item_add).setIcon(android.R.drawable.ic_menu_add),
            MenuItem.SHOW_AS_ACTION_IF_ROOM);
}

From source file:com.glabs.homegenie.fragments.GroupsViewFragment.java

public void UpdateJumpToGroupMenu(ArrayList<Group> groups) {
    StartActivity rootactivity = (StartActivity) getActivity();
    if (rootactivity != null) {
        Menu menu = rootactivity.getActionMenu();
        if (menu != null) {
            MenuItem jumpto = menu.findItem(R.id.action_jumpto);
            Menu submenu = jumpto.getSubMenu();
            if (submenu == null)
                return;
            ///* www.j  a v  a 2 s. co m*/
            submenu.removeGroup(Menu.NONE);
            if (groups.size() > 0) {
                int gid = 0;
                for (Group group : groups) {
                    MenuItem grp = submenu.add(Menu.NONE, gid, gid, group.Name);
                    //                    prg.setIcon(R.drawable.ic_action_flash_on);
                    MenuCompat.setShowAsAction(grp, SHOW_AS_ACTION_IF_ROOM | SHOW_AS_ACTION_WITH_TEXT);
                    grp.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
                        @Override
                        public boolean onMenuItemClick(MenuItem menuItem) {
                            mIndicator.setCurrentItem(menuItem.getItemId());
                            return true;
                        }
                    });
                    gid++;
                }
            }
        }
    }
}

From source file:com.zoterodroid.activity.BrowseCitations.java

@Override
public void onCreate(Bundle savedInstanceState) {
    super.onCreate(savedInstanceState);
    setContentView(R.layout.browse_bookmarks);

    mAccountManager = AccountManager.get(this);
    mAccount = mAccountManager.getAccountsByType(Constants.ACCOUNT_TYPE)[0];
    mContext = this;

    Log.d("browse bookmarks", getIntent().getDataString());
    Uri data = getIntent().getData();/*from   w w w .  ja  v a  2 s.com*/
    String scheme = data.getScheme();
    String path = data.getPath();
    Log.d("path", path);
    String username = data.getQueryParameter("username");
    String tagname = data.getQueryParameter("tagname");
    String recent = data.getQueryParameter("recent");

    myself = mAccount.name.equals(username);

    ArrayList<Citation> citationList = new ArrayList<Citation>();

    if (scheme.equals("content") && path.equals("/citations") && myself) {

        try {

            String[] projection = new String[] { Citation._ID, Citation.Title, Citation.Key,
                    Citation.Creator_Summary, Citation.Item_Type };
            String selection = null;
            String sortorder = null;

            selection = Citation.Account + " = '" + username + "'";

            Uri citations = Citation.CONTENT_URI;

            Cursor c = managedQuery(citations, projection, selection, null, sortorder);

            if (c.moveToFirst()) {
                int idColumn = c.getColumnIndex(Citation._ID);
                int titleColumn = c.getColumnIndex(Citation.Title);
                int keyColumn = c.getColumnIndex(Citation.Key);
                int creatorSummaryColumn = c.getColumnIndex(Citation.Creator_Summary);
                int itemTypeColumn = c.getColumnIndex(Citation.Item_Type);

                do {

                    Citation b = new Citation(c.getInt(idColumn), c.getString(titleColumn),
                            c.getString(keyColumn), c.getString(creatorSummaryColumn),
                            c.getString(itemTypeColumn));

                    citationList.add(b);

                } while (c.moveToNext());

            }

            setListAdapter(new CitationListAdapter(this, R.layout.bookmark_view, citationList));
        } catch (Exception e) {
        }

    }

    lv = getListView();
    lv.setTextFilterEnabled(true);

    lv.setOnItemClickListener(new OnItemClickListener() {
        public void onItemClick(AdapterView<?> parent, View view, int position, long id) {

        }
    });

    /* Add Context-Menu listener to the ListView. */
    lv.setOnCreateContextMenuListener(new OnCreateContextMenuListener() {
        public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
            menu.setHeaderTitle("Actions");
            if (myself) {
                menu.add(Menu.NONE, 0, Menu.NONE, "Delete");
            } else {
                menu.add(Menu.NONE, 1, Menu.NONE, "Add");
            }

        }
    });
}

From source file:cm.aptoide.pt.RemoteInSearch.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    // TODO Auto-generated method stub
    super.onCreateOptionsMenu(menu);
    menu.add(Menu.NONE, MANAGE_REPO, 1, R.string.menu_manage).setIcon(android.R.drawable.ic_menu_agenda);
    menu.add(Menu.NONE, SEARCH_MENU, 2, R.string.menu_search).setIcon(android.R.drawable.ic_menu_search);
    menu.add(Menu.NONE, SETTINGS, 3, R.string.menu_settings).setIcon(android.R.drawable.ic_menu_preferences);
    menu.add(Menu.NONE, ABOUT, 4, R.string.menu_about).setIcon(android.R.drawable.ic_menu_help);
    return true;/*from  ww  w. j  a v a2  s .c om*/
}

From source file:org.alfresco.mobile.android.application.fragments.fileexplorer.FileActions.java

private void getMenu(Menu menu) {
    menu.clear();/*from w  ww.  j  a  va  2s  . co  m*/

    MenuItem mi;

    if (getFragment() instanceof ListingModeFragment) {
        switch (((ListingModeFragment) getFragment()).getMode()) {
        case FileExplorerFragment.MODE_LISTING:
            if (selectedFolder.isEmpty()) {
                mi = menu.add(Menu.NONE, R.id.menu_upload, Menu.FIRST + 30, R.string.upload);
                mi.setIcon(R.drawable.ic_upload);
                mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

                mi = menu.add(Menu.NONE, R.id.menu_action_share, Menu.FIRST + 100, R.string.share);
                mi.setIcon(R.drawable.ic_share);
                mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
            }

            mi = menu.add(Menu.NONE, R.id.menu_action_delete, Menu.FIRST + 1000, R.string.delete);
            mi.setIcon(R.drawable.ic_delete);
            mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
            break;

        case FileExplorerFragment.MODE_PICK:

            if (selectedFolder.isEmpty()) {
                mi = menu.add(Menu.NONE, R.id.menu_file_send, Menu.FIRST, R.string.action_upload);
                mi.setIcon(R.drawable.ic_upload);
                mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_WITH_TEXT | MenuItem.SHOW_AS_ACTION_ALWAYS);
            }

            break;

        default:
            break;
        }
        mi = menu.add(Menu.NONE, R.id.menu_select_all, Menu.FIRST + 200, R.string.select_all);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    }
}

From source file:com.andrew.apollo.ui.fragments.PlaylistFragment.java

/**
 * {@inheritDoc}/*  www . j  a  va2s  .  co  m*/
 */
@Override
public void onCreateContextMenu(final ContextMenu menu, final View v, final ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    // Get the position of the selected item
    final AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo;
    final int mPosition = info.position;
    // Create a new playlist
    mPlaylist = mAdapter.getItem(mPosition);

    // Play the playlist
    menu.add(GROUP_ID, FragmentMenuItems.PLAY_SELECTION, Menu.NONE, R.string.context_menu_play_selection);

    // Add the playlist to the queue
    menu.add(GROUP_ID, FragmentMenuItems.ADD_TO_QUEUE, Menu.NONE, R.string.add_to_queue);

    // Delete and rename (user made playlists)
    if (info.position > 1) {
        menu.add(GROUP_ID, FragmentMenuItems.RENAME_PLAYLIST, Menu.NONE, R.string.context_menu_rename_playlist);

        menu.add(GROUP_ID, FragmentMenuItems.DELETE, Menu.NONE, R.string.context_menu_delete);

    }
}