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.asksven.commandcenter.BasicMasterFragment.java

public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo info) {
    super.onCreateContextMenu(menu, v, info);
    menu.setHeaderTitle("Actions");
    // menu depends on capabilities
    if (m_bEditable) {
        menu.add(m_iContextMenuId, CONTEXT_ADD_ID, Menu.NONE, "Add");
        menu.add(m_iContextMenuId, CONTEXT_EDIT_ID, Menu.NONE, "Edit");
        menu.add(m_iContextMenuId, CONTEXT_DELETE_ID, Menu.NONE, "Delete");
        menu.add(m_iContextMenuId, CONTEXT_EXECUTE_ID, Menu.NONE, "Execute");

    } else {/*from  w  ww. ja va  2  s  .co  m*/
        menu.add(m_iContextMenuId, CONTEXT_VIEW_ID, Menu.NONE, "View");
        menu.add(m_iContextMenuId, CONTEXT_EXECUTE_ID, Menu.NONE, "Execute");
        menu.add(m_iContextMenuId, CONTEXT_ADDUSER_ID, Menu.NONE, "Copy to User");
        //           menu.add(m_iContextMenuId, CONTEXT_REFRESH, Menu.NONE, "Refresh");
        //           menu.add(m_iContextMenuId, CONTEXT_RELOAD, Menu.NONE, "Reload");
    }
}

From source file:br.com.GUI.perfil.BuscarUsuario.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.buscar_usuario, menu);

    final SearchView searchView = new SearchView(this.getActionBar().getThemedContext());
    searchView.setQueryHint("Search");

    menu.add(Menu.NONE, Menu.NONE, 1, "@string").setIcon(android.R.drawable.ic_menu_search)
            .setActionView(searchView)/*ww w . java 2  s.c  o m*/
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS | MenuItem.SHOW_AS_ACTION_COLLAPSE_ACTION_VIEW);

    searchView.setOnQueryTextListener(new OnQueryTextListener() {
        @Override
        public boolean onQueryTextChange(String newText) {
            /* if (newText.length() > 0) {
                if(pref.getString("tipo", null).equals("personal")){
                   pesquisarAluno(newText.toString());
                }else if(pref.getString("tipo", null).equals("aluno")){
                   pesquisarPersonal(newText.toString());
                }
                    
             } else {
                if(pref.getString("tipo", null).equals("personal")){
                   pesquisarAluno("");
                }else if(pref.getString("tipo", null).equals("aluno")){
                   pesquisarPersonal("");
                }
                        
            }*/
            return false;
        }

        @Override
        public boolean onQueryTextSubmit(String arg0) {
            if (pref.getString("tipo", null).equals("personal")) {
                pesquisarAluno(arg0);
            } else if (pref.getString("tipo", null).equals("aluno")) {
                pesquisarPersonal(arg0);
            }

            return false;
        }
    });
    return true;
}

From source file:org.uguess.android.sysinfo.NetStateManager.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    MenuItem mi = menu.add(Menu.NONE, MI_PREFERENCE, Menu.NONE, R.string.preference);
    mi.setIcon(android.R.drawable.ic_menu_preferences);
    Util.setShowAsAction(mi, MenuItem.SHOW_AS_ACTION_NEVER);
}

From source file:com.example.office365sample.MainActivity.java

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

    menu.add(Menu.NONE, MENU_RESET_TOKEN, Menu.NONE, "Clear Token Cache");
    menu.add(Menu.NONE, MENU_LOGIN, Menu.NONE, "Login");
    menu.add(Menu.NONE, MENU_READ_MESSAGES, Menu.NONE, "Read Messages");
    return true;// ww  w  . ja  v  a2 s . co  m
}

From source file:io.indy.drone.activity.StrikeListActivity.java

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

    if (AppConfig.DEBUG) {
        menu.add(Menu.NONE, mDebugMenuItemId, Menu.NONE, getString(R.string.temp_action_test));
    }/*from www .j a  v a  2  s.  c o  m*/

    return super.onCreateOptionsMenu(menu);
}

From source file:org.tigase.mobile.roster.RosterFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);

    final Long id = extractId(menuInfo);

    if (id != null && id != -1) {
        RosterItem r = getJid(id);//from w w w  . j a  v a  2  s.  co m
        final boolean sessionEstablished = r != null && isSessionEstablished(r.getSessionObject());

        MenuInflater m = new MenuInflater(getActivity());
        try {
            Presence p = r.getSessionObject().getPresence().getBestPresence(r.getJid());
            if (p != null && p.getType() == null) {
                SubMenu sm = menu.addSubMenu(R.id.contactsOnlineGroup, Menu.NONE, Menu.NONE, "Chat with");
                prepareResources(sm, id);
            }
        } catch (Exception e) {
        }
        m.inflate(R.menu.roster_context_menu, menu);

        JaxmppCore jaxmpp = this.getMulti().get(r.getSessionObject());
        if (jaxmpp != null && sessionEstablished) {
            GeolocationModule module = jaxmpp.getModule(GeolocationModule.class);
            if (module != null) {
                ContentValues location = module.getLocationForJid(r.getJid());
                if (location != null) {
                    Double lat = location.getAsDouble(GeolocationTableMetaData.FIELD_LAT);
                    Double lon = location.getAsDouble(GeolocationTableMetaData.FIELD_LON);
                    String uriStr = null;
                    if (lon == null || lat == null) {
                        String str = "";
                        String val = location.getAsString(GeolocationTableMetaData.FIELD_STREET);
                        Log.v(TAG, "Street = " + String.valueOf(val));
                        if (val != null) {
                            str += val;
                        }
                        val = location.getAsString(GeolocationTableMetaData.FIELD_LOCALITY);
                        Log.v(TAG, "Locality = " + String.valueOf(val));
                        if (val != null) {
                            if (!isEmpty(str)) {
                                str += " ";
                            }
                            str += val;
                        }
                        val = location.getAsString(GeolocationTableMetaData.FIELD_COUNTRY);
                        Log.v(TAG, "Country = " + String.valueOf(val));
                        if (val != null) {
                            if (!isEmpty(str)) {
                                str += " ";
                            }
                            str += val;
                        }

                        if (!isEmpty(str)) {
                            str = str.replace(' ', '+');
                            uriStr = "geo:0,0?q=" + str;
                        }
                    } else {
                        Log.v(TAG, "latitude = " + String.valueOf(lat));
                        Log.v(TAG, "longitude = " + String.valueOf(lon));
                        uriStr = "geo:" + String.valueOf(lat) + "," + String.valueOf(lon) + "?z=14";
                    }
                    if (uriStr != null) {
                        uriStr += "(" + RosterDisplayTools.getDisplayName(r) + ")";
                        Log.v(TAG, "created geolocation uri = " + uriStr);
                        Uri uri = Uri.parse(uriStr);
                        MenuItem item = menu.add(R.string.geolocation_show);
                        Intent intent = new Intent(Intent.ACTION_VIEW, uri);
                        item.setIntent(intent);
                    }
                }
            }
        }

        menu.setGroupVisible(R.id.contactsOnlineGroup, sessionEstablished);
    }
}

From source file:me.piebridge.prevent.ui.UserGuideActivity.java

@Override
public boolean onCreateOptionsMenu(Menu menu) {
    menu.clear();/*w  ww. ja  va 2  s .  co  m*/
    if (BuildConfig.DONATE && donateView.getVisibility() == View.GONE) {
        menu.add(Menu.NONE, R.string.donate, Menu.NONE, R.string.donate);
    }
    menu.add(Menu.NONE, R.string.version, Menu.NONE, R.string.version);
    if (BuildConfig.DONATE) {
        menu.add(Menu.NONE, R.string.feedback, Menu.NONE, R.string.feedback);
        if (TextUtils.isEmpty(LicenseUtils.getLicense(this))) {
            menu.add(Menu.NONE, R.string.request_license, Menu.NONE, R.string.request_license);
        }
    }
    menu.add(Menu.NONE, R.string.advanced_settings, Menu.NONE, R.string.advanced_settings);
    return super.onCreateOptionsMenu(menu);
}

From source file:net.gaast.giggity.ChooserActivity.java

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

    menu.add(Menu.NONE, 1, 5, R.string.settings).setShortcut('0', 's')
            .setIcon(R.drawable.ic_settings_white_24dp).setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);
    menu.add(Menu.NONE, 2, 7, R.string.add_dialog).setShortcut('0', 'a').setIcon(R.drawable.ic_add_white_24dp)
            .setShowAsAction(MenuItem.SHOW_AS_ACTION_ALWAYS);

    return true;//from ww w.ja v  a  2  s  .  c o  m
}

From source file:com.nttec.everychan.ui.BoardsListFragment.java

@Override
public void onCreateContextMenu(ContextMenu menu, View v, ContextMenuInfo menuInfo) {
    super.onCreateContextMenu(menu, v, menuInfo);
    if (adapter == null)
        return;//  www . j a v a  2  s.  c o m
    try {
        if (v.getId() == android.R.id.list) {
            AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo;
            SimpleBoardModel boardModel = adapter.getItem(info.position).model;
            if (boardModel != null) {
                UrlPageModel model = getUrlModel(boardModel.boardName);
                model = UrlHandler.getPageModel(chan.buildUrl(model));
                if (model != null) {
                    boolean isFavorite = database.isFavorite(model.chanName, model.boardName,
                            Integer.toString(model.boardPage), null);
                    menu.add(Menu.NONE, R.id.context_menu_favorites_from_fragment, 1,
                            isFavorite ? R.string.context_menu_remove_favorites
                                    : R.string.context_menu_add_favorites);

                    for (QuickAccess.Entry entry : quickAccessList)
                        if (entry.boardName != null && entry.chan != null)
                            if (entry.chan.getChanName().equals(model.chanName)
                                    && entry.boardName.equals(model.boardName))
                                return;
                    menu.add(Menu.NONE, R.id.context_menu_quickaccess_add, 2,
                            R.string.context_menu_quickaccess_add);
                }
            }
        }
    } catch (Exception e) {
        Logger.e(TAG, e);
    }
}

From source file:org.alfresco.mobile.android.application.fragments.preferences.AccountSettingsFragment.java

@Override
public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) {
    menu.clear();/*from w  ww .  ja va 2  s .  c  om*/
    MenuItem mi = menu.add(Menu.NONE, R.id.menu_account_delete, Menu.FIRST + 10, R.string.delete);
    mi.setIcon(R.drawable.ic_clear_grey);
    mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);

    if (SessionManager.getInstance(getActivity()).hasSession(account.getId())) {
        mi = menu.add(Menu.NONE, R.id.my_profile, Menu.FIRST, R.string.my_profile);
        mi.setIcon(R.drawable.ic_account_circle_grey);
        mi.setShowAsAction(MenuItem.SHOW_AS_ACTION_IF_ROOM);
    }
}