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.orange.querysystem.content.ListPostsFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    // Place an action bar item for searching.
    MenuItem item = menu.add(Menu.NONE, SEARCH, Menu.NONE, R.string.search);
    item.setIcon(R.drawable.ic_action_search);
    MenuItemCompat.setShowAsAction(item,
            MenuItemCompat.SHOW_AS_ACTION_ALWAYS | MenuItemCompat.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
    Context context = Build.VERSION.SDK_INT < Build.VERSION_CODES.ICE_CREAM_SANDWICH
            ? getActivity().getApplicationContext()
            : getActivity().getActionBar().getThemedContext();
    View searchView = SearchViewCompat.newSearchView(context);
    if (searchView != null) {
        SearchViewCompat.setOnQueryTextListener(searchView, new OnQueryTextListenerCompat() {
            @Override/*from   w w  w  . j a  v  a 2 s  .c o  m*/
            public boolean onQueryTextChange(String newText) {
                onSearchTextChanged(newText);
                return true;
            }
        });
        MenuItemCompat.setActionView(item, searchView);
    }
}

From source file:net.ustyugov.jtalk.activity.muc.MucUsers.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo info) {
    menu.setHeaderTitle(R.string.Actions);
    menu.add(Menu.NONE, CONTEXT_EDIT, Menu.NONE, R.string.Edit);
    menu.add(Menu.NONE, CONTEXT_REMOVE, Menu.NONE, R.string.Remove);
    super.onCreateContextMenu(menu, v, info);
}

From source file:com.gh4a.activities.DiffViewerActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    MenuInflater inflater = getMenuInflater();
    inflater.inflate(R.menu.download_menu, menu);

    menu.removeItem(R.id.download);/*  w w  w .j a  v a  2  s  .  c om*/

    String viewAtTitle = getString(R.string.object_view_file_at, mSha.substring(0, 7));
    MenuItem item = menu.add(0, MENU_ITEM_VIEW, Menu.NONE, viewAtTitle);
    MenuItemCompat.setShowAsAction(item, MenuItemCompat.SHOW_AS_ACTION_NEVER);

    return super.onCreateOptionsMenu(menu);
}

From source file:org.catnut.fragment.TimelineFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    menu.add(Menu.NONE, R.id.refresh, Menu.NONE, R.string.refresh)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER); // prefer actionbar refresh
    menu.add(Menu.NONE, R.id.action_back_top, Menu.NONE, getString(R.string.back_to_top))
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_NEVER);
    // ??//from   w  ww  .  j  av a 2  s .  com
    MenuItem search = menu.add(android.R.string.search_go);
    search.setIcon(R.drawable.ic_title_search_default);
    search.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);
    mSearchView = VividSearchView.getSearchView(getActivity());
    mSearchView.setOnQueryTextListener(this);
    mSearchView.setOnCloseListener(this);
    search.setActionView(mSearchView);
}

From source file:de.stadtrallye.rallyesoft.fragments.TaskDetailsFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    MenuItem submitItem = menu.add(Menu.NONE, R.id.submit_menu, Menu.NONE, R.string.submit_new_solution);
    submitItem.setIcon(R.drawable.ic_send_now_light);
    submitItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
}

From source file:net.olejon.mdapp.NotesEditActivity.java

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

    if (noteId != 0) {
        MenuItem menuItem = menu/*from  w ww.  ja  v a 2 s .c  o  m*/
                .add(Menu.NONE, Menu.NONE, Menu.NONE, getString(R.string.notes_edit_menu_delete))
                .setIcon(R.drawable.ic_delete_white_24dp);
        menuItem.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

        menuItem.setOnMenuItemClickListener(new MenuItem.OnMenuItemClickListener() {
            @Override
            public boolean onMenuItemClick(MenuItem menuItem) {
                deleteNote(false);
                return true;
            }
        });
    }

    return true;
}

From source file:de.stadtrallye.rallyesoft.fragments.TasksPagerFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    MenuItem resize = menu.add(Menu.NONE, R.id.resize_menu, 40, R.string.resize);
    resize.setIcon(R.drawable.ic_center_light);
    resize.setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
}

From source file:com.grarak.kerneladiutor.fragments.tools.InitdFragment.java

private void load(List<RecyclerViewItem> items) {
    for (final String initd : Initd.list()) {
        CardView cardView = new CardView(getActivity());
        cardView.setOnMenuListener(new CardView.OnMenuListener() {
            @Override/*from  ww w .j  a v a 2  s  . c  o  m*/
            public void onMenuReady(CardView cardView, PopupMenu popupMenu) {
                Menu menu = popupMenu.getMenu();
                menu.add(Menu.NONE, 0, Menu.NONE, getString(R.string.edit));
                menu.add(Menu.NONE, 1, Menu.NONE, getString(R.string.delete));

                popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() {
                    @Override
                    public boolean onMenuItemClick(MenuItem item) {
                        switch (item.getItemId()) {
                        case 0:
                            mEditInitd = initd;
                            Intent intent = new Intent(getActivity(), EditorActivity.class);
                            intent.putExtra(EditorActivity.TITLE_INTENT, initd);
                            intent.putExtra(EditorActivity.TEXT_INTENT, Initd.read(initd));
                            startActivityForResult(intent, 0);
                            break;
                        case 1:
                            mDeleteDialog = ViewUtils.dialogBuilder(getString(R.string.sure_question),
                                    new DialogInterface.OnClickListener() {
                                        @Override
                                        public void onClick(DialogInterface dialogInterface, int i) {
                                        }
                                    }, new DialogInterface.OnClickListener() {
                                        @Override
                                        public void onClick(DialogInterface dialogInterface, int i) {
                                            Initd.delete(initd);
                                            reload();
                                        }
                                    }, new DialogInterface.OnDismissListener() {
                                        @Override
                                        public void onDismiss(DialogInterface dialogInterface) {
                                            mDeleteDialog = null;
                                        }
                                    }, getActivity());
                            mDeleteDialog.show();
                            break;
                        }
                        return false;
                    }
                });
            }
        });

        DescriptionView descriptionView = new DescriptionView();
        descriptionView.setSummary(initd);
        descriptionView.setOnItemClickListener(new RecyclerViewItem.OnItemClickListener() {
            @Override
            public void onClick(RecyclerViewItem item) {
                mExecuteDialog = ViewUtils.dialogBuilder(getString(R.string.exceute_question, initd),
                        new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialogInterface, int i) {
                            }
                        }, new DialogInterface.OnClickListener() {
                            @Override
                            public void onClick(DialogInterface dialogInterface, int i) {
                                execute(initd);
                            }
                        }, new DialogInterface.OnDismissListener() {
                            @Override
                            public void onDismiss(DialogInterface dialogInterface) {
                                mExecuteDialog = null;
                            }
                        }, getActivity());
                mExecuteDialog.show();
            }
        });

        cardView.addItem(descriptionView);
        items.add(cardView);
    }
}

From source file:com.application.treasurehunt.ScanQRCodeActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {

    //http://mobileorchard.com/android-app-development-menus-part-1-options-menu/
    super.onCreateOptionsMenu(menu);
    getMenuInflater().inflate(R.menu.login, menu);
    menu.add(Menu.NONE, 1, Menu.NONE, "Home");
    menu.add(Menu.NONE, 2, Menu.NONE, "Log out");
    return true;/*from   w  w  w  .ja va  2 s.  c  o m*/
}

From source file:edu.stanford.mobisocial.dungbeetle.GroupsActivity.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
    Cursor cursor = (Cursor) mGroups.getItem(info.position);
    final Group g = new Group(cursor);
    menu.setHeaderTitle(g.name);/*from  w w w. j  ava2s.  c  om*/
    String[] menuItems = new String[] { "Delete" };//, "Write to Tag" };
    for (int i = 0; i < menuItems.length; i++) {
        menu.add(Menu.NONE, i, i, menuItems[i]);
    }
}