List of usage examples for android.view MenuItem setVisible
public MenuItem setVisible(boolean visible);
From source file:de.tudarmstadt.informatik.secuso.phishedu2.PhishBaseActivity.java
@Override public void onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); MenuItem restart = menu.findItem(R.id.restart_level); restart.setVisible(enableRestartButton()); }
From source file:com.glanznig.beepme.view.MainActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { BeeperApp app = (BeeperApp) getApplication(); // hide/show test beep menu entry MenuItem testBeep = menu.findItem(R.id.action_test_beep); if (app.getPreferences().isTestMode() && app.isBeeperActive()) { testBeep.setVisible(true); } else {/*ww w .j a v a 2 s . co m*/ testBeep.setVisible(false); } // update toggle beeper icon MenuItem item = menu.findItem(R.id.action_toggle_beeper); if (app.isBeeperActive()) { item.setIcon(R.drawable.ic_menu_beeper_on); } else { item.setIcon(R.drawable.ic_menu_beeper_off); } return super.onPrepareOptionsMenu(menu); }
From source file:com.dm.wallpaper.board.activities.WallpaperBoardPreviewActivity.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.menu_wallpaper_preview, menu); MenuItem save = menu.findItem(R.id.menu_save); save.setVisible(getResources().getBoolean(R.bool.enable_wallpaper_download)); return super.onCreateOptionsMenu(menu); }
From source file:com.glanznig.beepme.view.MainActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { BeeperApp app = (BeeperApp) getApplication(); switch (item.getItemId()) { case R.id.action_toggle_beeper: if (app.isBeeperActive()) { app.cancelTimer(); //call before setBeeperActive app.setBeeperActive(BeeperApp.BEEPER_INACTIVE); item.setIcon(R.drawable.ic_menu_beeper_off); // hide generate beep menu entry if (this.actionMenu != null && app.getPreferences().isTestMode()) { MenuItem testBeep = actionMenu.findItem(R.id.action_test_beep); testBeep.setVisible(false); }/*from w w w . j a v a 2 s .co m*/ } else { app.setBeeperActive(BeeperApp.BEEPER_ACTIVE); app.setTimer(); item.setIcon(R.drawable.ic_menu_beeper_on); // show generate beep menu entry if (this.actionMenu != null && app.getPreferences().isTestMode()) { MenuItem testBeep = actionMenu.findItem(R.id.action_test_beep); testBeep.setVisible(true); } } return true; case R.id.action_test_beep: app.beep(); return true; case R.id.action_export: Intent iExport = new Intent(this, ExportActivity.class); startActivity(iExport); return true; case R.id.action_settings: Intent iSettings = new Intent(this, SettingsActivity.class); startActivity(iSettings); return true; case R.id.action_about: // thanks to F-Droid for the inspiration View view = null; LayoutInflater inflater = LayoutInflater.from(this); view = inflater.inflate(R.layout.about, null); try { PackageInfo pkgInfo = getPackageManager().getPackageInfo(getApplicationContext().getPackageName(), 0); ((TextView) view.findViewById(R.id.about_version)).setText(pkgInfo.versionName); } catch (Exception e) { } AlertDialog.Builder alertBuilder = null; alertBuilder = new AlertDialog.Builder(this).setView(view); AlertDialog dia = alertBuilder.create(); dia.setIcon(R.drawable.ic_launcher_beepme); dia.setTitle(getString(R.string.about_title)); dia.setButton(AlertDialog.BUTTON_NEUTRAL, getString(R.string.about_donate_button), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { Uri uri = Uri.parse("http://beepme.yourexp.at/support-beepme"); startActivity(new Intent(Intent.ACTION_VIEW, uri)); } }); dia.setButton(AlertDialog.BUTTON_NEGATIVE, getString(android.R.string.ok), new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int whichButton) { } }); dia.show(); return true; } return super.onOptionsItemSelected(item); }
From source file:ca.ualberta.cmput301w14t08.geochan.fragments.ThreadListFragment.java
/** * Initialize's the ThreadList's menu.//w w w . ja v a 2s. c om * * @param menu * The Menu of the fragment. * @param inflater * A MenuInflater to inflate the fragment's menu. */ @Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { // Inflate the menu; this adds items to the action bar if it is present. super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.thread_list, menu); MenuItem item = menu.findItem(R.id.action_settings); item.setVisible(true); }
From source file:id.ridon.keude.Keude.java
@Override public boolean onCreateOptionsMenu(Menu menu) { getMenuInflater().inflate(R.menu.main, menu); if (fdroidApp.bluetoothAdapter == null) { // ignore on devices without Bluetooth MenuItem btItem = menu.findItem(R.id.action_bluetooth_apk); btItem.setVisible(false); }/*from w w w .j av a 2 s. c o m*/ return super.onCreateOptionsMenu(menu); }
From source file:de.questmaster.fatremote.fragments.RemoteFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { super.onCreateOptionsMenu(menu, inflater); inflater.inflate(R.menu.options_menu, menu); // For Honeycomb and up if (Build.VERSION.SDK_INT >= 11) { MenuItem mi = menu.findItem(R.id.MENU_ITEM_SELECTFAT); mi.setVisible(false); }/*from w w w .j a v a 2 s .com*/ // For testing purpose if (DebugHelper.SHOW_DEBUG_SCREEN) { MenuItem mi = menu.findItem(R.id.MENU_ITEM_DEBUG); mi.setVisible(true); } }
From source file:com.example.vivek.team.EditorActivity.java
@Override public boolean onPrepareOptionsMenu(Menu menu) { super.onPrepareOptionsMenu(menu); // If this is a new user, hide the "Delete" menu item. if (mCurrentUserUri == null) { MenuItem menuItem = menu.findItem(R.id.delete); menuItem.setVisible(false); }// w w w . j a v a2 s .c om return true; }
From source file:com.lovejoy777sarootool.rootool.fragments.BrowserFragment.java
@Override public void onCreateOptionsMenu(Menu menu, MenuInflater inflater) { inflater.inflate(R.menu.main, menu); if (BrowserActivity.isDrawerOpen()) { menu.findItem(R.id.paste).setVisible(false); menu.findItem(R.id.folderinfo).setVisible(false); menu.findItem(R.id.search).setVisible(false); }// www . ja va 2 s. c o m MenuItem paste = menu.findItem(R.id.paste); paste.setVisible(!ClipBoard.isEmpty()); }
From source file:com.benlinskey.greekreference.syntax.SyntaxDetailActivity.java
private void setSyntaxBookmarkIcon(Menu menu) { MenuItem addBookmark = menu.findItem(R.id.action_add_bookmark); MenuItem removeBookmark = menu.findItem(R.id.action_remove_bookmark); // Hide both icons when no word is selected or the app is in one-pane mode. if (isBookmark(mSyntaxId)) { addBookmark.setVisible(false); removeBookmark.setVisible(true); } else {//from ww w.j a v a 2 s .c om addBookmark.setVisible(true); removeBookmark.setVisible(false); } }