List of usage examples for android.view MenuItem setTitle
public MenuItem setTitle(@StringRes int title);
From source file:com.loloof64.android.chess_position_manager.MainActivity.java
private void setSelectionMode(boolean selectionMode) { this.selectionMode = selectionMode; if (listAdapter != null) listAdapter.setSelectionMode(selectionMode); if (menu != null) { MenuItem toggleSelectionItem = menu.findItem(R.id.action_toggle_selection_mode); toggleSelectionItem.setIcon(//from w w w . ja v a2s .co m selectionMode ? R.drawable.ic_action_action_navigate : R.drawable.ic_action_action_list); toggleSelectionItem.setTitle(selectionMode ? R.string.action_toggle_in_navigation_mode : R.string.action_toggle_in_list_mode); } }
From source file:com.duy.pascal.ui.file.FileExplorerAction.java
@Override public boolean onActionItemClicked(ActionMode mode, MenuItem item) { int id = item.getItemId(); if (id == R.id.select_all) { if (!item.isChecked()) { mView.setSelectAll(true);//from w w w . ja v a2s . c o m item.setChecked(true); item.setTitle(R.string.cancel_select_all); } else { mView.setSelectAll(false); } } else if (id == R.id.copy && !mCheckedList.isEmpty()) { mFileClipboard.setData(true, mCheckedList); destroyActionMode(); } else if (id == R.id.cut && !mCheckedList.isEmpty()) { mFileClipboard.setData(false, mCheckedList); destroyActionMode(); } else if (id == R.id.paste) { destroyActionMode(); mFileClipboard.paste(mContext, mExplorerContext.getCurrentDirectory(), new OnClipboardPasteFinishListener() { @Override public void onFinish(int count, String error) { mFileClipboard.showPasteResult(mContext, count, error); } }); } else if (id == R.id.rename) { doRenameAction(); } else if (id == R.id.share) { shareFile(); } else if (id == R.id.delete) { doDeleteAction(); } else { return false; } return true; }
From source file:org.addhen.smssync.presentation.view.ui.activity.MainActivity.java
private void setupDrawerContent() { PrefsFactory prefs = getAppComponent().prefsFactory(); MenuItem phoneName = mNavigationView.getMenu().findItem(R.id.nav_device_name); if (phoneName != null && !TextUtils.isEmpty(prefs.uniqueName().get())) { phoneName.setVisible(true);/*from w w w .j a v a 2 s . c o m*/ phoneName.setTitle( Utility.capitalizeFirstLetter(prefs.uniqueName().get()) + " - " + prefs.uniqueId().get()); } mNavigationView.setNavigationItemSelectedListener(menuItem -> { setupFragment(menuItem); mDrawerLayout.closeDrawers(); return true; }); }
From source file:t0mm13b.dmesglog.ui.DMesgViewer.java
private void handlePause(MenuItem item) { if (this.mDmesgLogHandler.getIsPaused()) return;/* w w w. j a v a2 s . com*/ this.mDmesgLogHandler.Pause(); item.setIcon(R.drawable.ic_media_play); item.setTitle(getString(R.string.menu_resume)); fixUpTitle(true); }
From source file:de.k3b.android.toGoZip.SettingsActivity.java
private void updateMenuItem(Menu menu, int cmd, int menuTitle, boolean visible) { MenuItem item = menu.findItem(cmd); if (item != null) { if ((visible) && (menuTitle != 0)) { item.setTitle(getString(menuTitle, SettingsImpl.getZipFile())); }/*from w w w .jav a2 s.c om*/ item.setVisible(visible); } }
From source file:t0mm13b.dmesglog.ui.DMesgViewer.java
private void handleResume(MenuItem item) { if (!this.mDmesgLogHandler.getIsPaused()) return;//from w ww . j av a 2s .c o m this.mDmesgLogHandler.Resume(); item.setIcon(R.drawable.ic_media_pause); item.setTitle(getString(R.string.menu_pause)); fixUpTitle(false); }
From source file:com.byteshaft.licenseservice.StartTestActivity.java
@Override public boolean onOptionsItemSelected(MenuItem item) { switch (item.getItemId()) { case R.id.action_instant_questions: if (Helpers.isInstantAnswerEnabled()) { Helpers.saveInstantAnswerValue(false); item.setTitle("Enable Instant Answer"); nextButton.setVisibility(View.VISIBLE); okButton.setVisibility(View.GONE); } else {/*w w w. j a v a 2 s . c o m*/ Helpers.saveInstantAnswerValue(true); item.setTitle("Disable Instant Answer"); okButton.setVisibility(View.VISIBLE); nextButton.setVisibility(View.GONE); } return true; } return false; }
From source file:gov.wa.wsdot.android.wsdot.ui.camera.CameraImageFragment.java
private void toggleStar(MenuItem item) { Snackbar added_snackbar = Snackbar.make(getView(), R.string.add_favorite, Snackbar.LENGTH_SHORT); Snackbar removed_snackbar = Snackbar.make(getView(), R.string.remove_favorite, Snackbar.LENGTH_SHORT); if (mIsStarred) { item.setIcon(R.drawable.ic_menu_star); item.setTitle("Favorite checkbox, not checked"); viewModel.setIsStarredFor(mId, 0); removed_snackbar.show();/*from w w w .j av a2s . c o m*/ mIsStarred = false; } else { item.setIcon(R.drawable.ic_menu_star_on); item.setTitle("Favorite checkbox, checked"); viewModel.setIsStarredFor(mId, 1); added_snackbar.show(); mIsStarred = true; } }
From source file:com.projects.nosleepreader.MainActivity.java
@Override public void onCreateContextMenu(ContextMenu menu, View v, ContextMenu.ContextMenuInfo menuInfo) { super.onCreateContextMenu(menu, v, menuInfo); getMenuInflater().inflate(R.menu.context_menu_main, menu); AdapterView.AdapterContextMenuInfo info = (AdapterView.AdapterContextMenuInfo) menuInfo; menu.setHeaderTitle(mValuesArray.get(info.position).getAsString(ListingDbHelper.COLUMN_TITLE)); MenuItem favorites = menu.findItem(R.id.context_menu_favorite); if (mCurrentTable.equals(ListingDbHelper.TABLE_NAME_FAVORITES)) { favorites.setTitle("Remove from Favorites"); }//from w w w . ja v a 2s .c om }
From source file:uk.org.openseizuredetector.MainActivity.java
/** * Start the SdServer service//w w w.j a v a 2s . c o m */ private void startServer() { // Start the server sdServerIntent = new Intent(MainActivity.this, SdServer.class); sdServerIntent.setData(Uri.parse("Start")); getApplicationContext().startService(sdServerIntent); // Change the action bar icon to show the option to stop the service. if (mOptionsMenu != null) { Log.v(TAG, "Changing menu icons"); MenuItem menuItem = mOptionsMenu.findItem(R.id.action_start_stop); menuItem.setIcon(R.drawable.stop_server); menuItem.setTitle("Stop Server"); } else { Log.v(TAG, "mOptionsMenu is null - not changing icons!"); } }