List of usage examples for android.view MenuItem setTitle
public MenuItem setTitle(@StringRes int title);
From source file:com.ezac.gliderlogs.FlightOverviewActivity.java
public void OptionUnSelect(int sel_1) { MenuItem mi = menu.findItem(sel_1); String tmp = (String) mi.getTitle(); mi.setTitle(tmp.replace(">", "").replace("<", "")); }
From source file:github.popeen.dsub.fragments.SubsonicFragment.java
public void onCreateContextMenuSupport(Menu menu, MenuInflater menuInflater, UpdateView updateView, Object selected) {/*from w w w .j a v a 2 s.co m*/ if (selected instanceof Entry) { Entry entry = (Entry) selected; if (entry instanceof PodcastEpisode) { if (Util.isOffline(context)) { if (entry.isVideo()) { menuInflater.inflate(R.menu.select_video_context_offline, menu); } else { menuInflater.inflate(R.menu.select_podcast_episode_context_offline, menu); } } else { if (entry.isVideo()) { menuInflater.inflate(R.menu.select_podcast_episode_video_context, menu); } else { menuInflater.inflate(R.menu.select_podcast_episode_context, menu); } if (entry.getBookmark() == null) { menu.removeItem(R.id.bookmark_menu_delete); } if (UserUtil.canPodcast()) { String status = ((PodcastEpisode) entry).getStatus(); if ("completed".equals(status)) { menu.removeItem(R.id.song_menu_server_download); } } else { menu.removeItem(R.id.song_menu_server_download); menu.removeItem(R.id.song_menu_server_delete); } } } else if (entry.isDirectory()) { if (Util.isOffline(context)) { menuInflater.inflate(R.menu.select_album_context_offline, menu); } else { menuInflater.inflate(R.menu.select_album_context, menu); if (Util.isTagBrowsing(context)) { menu.removeItem(R.id.menu_rate); } } } else if (!entry.isVideo()) { if (Util.isOffline(context)) { menuInflater.inflate(R.menu.select_song_context_offline, menu); } else { menuInflater.inflate(R.menu.select_song_context, menu); if (entry.getBookmark() == null) { menu.removeItem(R.id.bookmark_menu_delete); } String songPressAction = Util.getSongPressAction(context); if (!"next".equals(songPressAction) && !"last".equals(songPressAction)) { menu.setGroupVisible(R.id.hide_play_now, false); } } } else { if (Util.isOffline(context)) { menuInflater.inflate(R.menu.select_video_context_offline, menu); } else { menuInflater.inflate(R.menu.select_video_context, menu); } } MenuItem starMenu = menu.findItem(entry.isDirectory() ? R.id.album_menu_star : R.id.song_menu_star); if (starMenu != null) { starMenu.setTitle(entry.isStarred() ? R.string.common_unstar : R.string.common_star); } if (!isShowArtistEnabled() || (!Util.isTagBrowsing(context) && entry.getParent() == null) || (Util.isTagBrowsing(context) && entry.getArtistId() == null)) { menu.setGroupVisible(R.id.hide_show_artist, false); } } else if (selected instanceof Artist) { Artist artist = (Artist) selected; if (Util.isOffline(context)) { menuInflater.inflate(R.menu.select_artist_context_offline, menu); } else { menuInflater.inflate(R.menu.select_artist_context, menu); menu.findItem(R.id.artist_menu_star) .setTitle(artist.isStarred() ? R.string.common_unstar : R.string.common_star); } } MenuUtil.hideMenuItems(context, menu, updateView); }
From source file:uk.org.rivernile.edinburghbustracker.android.fragments.general.DisplayStopDataFragment.java
/** * {@inheritDoc}//from w w w.j a v a 2s .co m */ @Override public void onPrepareOptionsMenu(final Menu menu) { super.onPrepareOptionsMenu(menu); // Get the menu items. final MenuItem sortItem = menu.findItem(R.id.displaystopdata_option_menu_sort); final MenuItem autoRefreshItem = menu.findItem(R.id.displaystopdata_option_menu_autorefresh); final MenuItem proxItem = menu.findItem(R.id.displaystopdata_option_menu_prox); final MenuItem timeItem = menu.findItem(R.id.displaystopdata_option_menu_time); final MenuItem refreshItem = menu.findItem(R.id.displaystopdata_option_menu_refresh); // If progress is being shown, disable the refresh button. if (progressBig.getVisibility() == View.VISIBLE || progressSmall.getVisibility() == View.VISIBLE) { refreshItem.setEnabled(false); } else { refreshItem.setEnabled(true); } // If there's no bus times, disable all other menu items. if (listView.getVisibility() == View.VISIBLE) { sortItem.setEnabled(true); proxItem.setEnabled(true); timeItem.setEnabled(true); } else { sortItem.setEnabled(false); proxItem.setEnabled(false); timeItem.setEnabled(false); } // Sort by time or service? if (sp.getBoolean(PreferencesActivity.PREF_SERVICE_SORTING, false)) { sortItem.setTitle(R.string.displaystopdata_menu_sort_service); } else { sortItem.setTitle(R.string.displaystopdata_menu_sort_times); } // Auto-refresh on or off? if (autoRefresh) { autoRefreshItem.setTitle(R.string.displaystopdata_menu_turnautorefreshoff); } else { autoRefreshItem.setTitle(R.string.displaystopdata_menu_turnautorefreshon); } // Proximity alert active or not? if (sd.isActiveProximityAlert(stopCode)) { proxItem.setTitle(R.string.displaystopdata_menu_prox_rem).setIcon(R.drawable.ic_menu_proximityremove); } else { proxItem.setTitle(R.string.displaystopdata_menu_prox_add).setIcon(R.drawable.ic_menu_proximityadd); } // Time alert active or not? if (sd.isActiveTimeAlert(stopCode)) { timeItem.setTitle(R.string.displaystopdata_menu_time_rem).setIcon(R.drawable.ic_menu_arrivalremove); } else { timeItem.setTitle(R.string.displaystopdata_menu_time_add).setIcon(R.drawable.ic_menu_arrivaladd); } }
From source file:com.ezac.gliderlogs.FlightOverviewActivity.java
public void OptionSelect(int sel_1, int sel_2, int sel_3, int sel_4, int sel_5) { MenuItem mi = menu.findItem(sel_1); String tmp = (String) mi.getTitle(); if (tmp.indexOf('>') < 0) { mi.setTitle(">" + mi.getTitle() + "<"); }//w ww . j a va 2 s. co m OptionUnSelect(sel_2); OptionUnSelect(sel_3); OptionUnSelect(sel_4); OptionUnSelect(sel_5); }
From source file:group.pals.android.lib.ui.filechooser.FragmentFiles.java
@Override public void onPrepareOptionsMenu(Menu menu) { if (BuildConfig.DEBUG) Log.d(CLASSNAME, "onPrepareOptionsMenu()"); /*//from ww w . j a v a 2 s . c o m * Some bugs? This method seems to be called even after `onDestroy()`... */ if (getActivity() == null) return; /* * Sorting. */ final boolean sortAscending = DisplayPrefs.isSortAscending(getActivity()); MenuItem miSort = menu.findItem(R.id.afc_menuitem_sort); switch (DisplayPrefs.getSortType(getActivity())) { case BaseFile.SORT_BY_NAME: miSort.setIcon(Ui.resolveAttribute(getActivity(), sortAscending ? R.attr.afc_ic_menu_sort_by_name_asc : R.attr.afc_ic_menu_sort_by_name_desc)); break; case BaseFile.SORT_BY_SIZE: miSort.setIcon(Ui.resolveAttribute(getActivity(), sortAscending ? R.attr.afc_ic_menu_sort_by_size_asc : R.attr.afc_ic_menu_sort_by_size_desc)); break; case BaseFile.SORT_BY_MODIFICATION_TIME: miSort.setIcon(Ui.resolveAttribute(getActivity(), sortAscending ? R.attr.afc_ic_menu_sort_by_date_asc : R.attr.afc_ic_menu_sort_by_date_desc)); break; } /* * View type. */ MenuItem menuItem = menu.findItem(R.id.afc_menuitem_switch_viewmode); switch (DisplayPrefs.getViewType(getActivity())) { case GRID: menuItem.setIcon(Ui.resolveAttribute(getActivity(), R.attr.afc_ic_menu_listview)); menuItem.setTitle(R.string.afc_cmd_list_view); break; case LIST: menuItem.setIcon(Ui.resolveAttribute(getActivity(), R.attr.afc_ic_menu_gridview)); menuItem.setTitle(R.string.afc_cmd_grid_view); break; } /* * New folder. */ menu.findItem(R.id.afc_menuitem_new_folder).setEnabled(!mLoading); }
From source file:com.simadanesh.isatis.ScreenSlideActivity.java
private void showfilterMenu() { View p = findViewById(R.id.anchorer); progressbar.setVisibility(View.GONE); final PopupMenu popup = new PopupMenu(this, p); //Inflating the Popup using xml file popup.getMenuInflater().inflate(R.menu.filter, popup.getMenu()); for (int i = 0; i < popup.getMenu().size(); i++) { MenuItem item = popup.getMenu().getItem(i); String countstr = "0"; switch (item.getItemId()) { case R.id.filter_no_filter: countstr = countFilterNofilter(); break; case R.id.filter_no_data: countstr = countFilterNodata(); break; case R.id.filter_valid_reading: countstr = countFilterValid(); break; case R.id.filter_hilow: countstr = countFilterHilow(); break; case R.id.filter_maneh: countstr = countFilterManeh(); break; case R.id.filter_inspection: countstr = countFilterInspection(); break; case R.id.filter_register_field: countstr = countFilterRegisterField(); break; case R.id.filter_not_register_field: countstr = countFilterRegisterNotField(); break; }//from w w w . j a v a 2 s . co m item.setTitle(item.getTitle() + "\t" + countstr); } //registering popup with OnMenuItemClickListener popup.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { public boolean onMenuItemClick(MenuItem item) { switch (item.getItemId()) { case R.id.filter_no_filter: filterNofilter(); break; case R.id.filter_no_data: filterNodata(); break; case R.id.filter_valid_reading: filterValid(); break; case R.id.filter_hilow: filterHilow(); break; case R.id.filter_maneh: //filterManeh(); showManehMenu(); break; case R.id.filter_inspection: filterInspection(); break; case R.id.filter_register_field: filterRegisterField(); break; case R.id.filter_not_register_field: filterRegisterNotField(); break; } return true; } }); final Handler handler1 = new Handler(); progressbar.setVisibility(View.GONE); //android.R.attr.progressBarStyleLarge handler1.postDelayed(new Runnable() { @Override public void run() { popup.show(); } }, 100); }
From source file:com.ezac.gliderlogs.FlightOverviewActivity.java
public void DoSettings() { // get settings.xml view LayoutInflater li = LayoutInflater.from(context); settingsView = li.inflate(R.layout.settings, null); AlertDialog.Builder alertDialogBuilder = new AlertDialog.Builder(context); // set settings.xml to alertdialog builder alertDialogBuilder.setView(settingsView); // get user input for service code final EditText userInput = (EditText) settingsView.findViewById(R.id.editTextDialogUserInput); // set dialog message alertDialogBuilder.setCancelable(false).setPositiveButton("OK", new DialogInterface.OnClickListener() { @Override// w ww. ja v a 2 s . c o m public void onClick(DialogInterface dialog, int id) { SharedPreferences prefs = context.getSharedPreferences("Share", Context.MODE_PRIVATE); prefs.edit().clear(); SharedPreferences.Editor es = prefs.edit(); String[] mTestArray; if (userInput.getText().toString().equals("NoAccess")) { // prefs URL EditText et1 = (EditText) settingsView.findViewById(R.id.setting_url); appURL = et1.getText().toString(); es.putString("com.ezac.gliderlogs.url", appURL).apply(); } // prefs PRE EditText et2 = (EditText) settingsView.findViewById(R.id.setting_pre); appPRE = et2.getText().toString().replace(" ", ""); es.putString("com.ezac.gliderlogs.pre", appPRE).apply(); if (userInput.getText().toString().equals("NoAccess")) { // prefs SCN EditText et3 = (EditText) settingsView.findViewById(R.id.setting_scn); appSCN = et3.getText().toString(); es.putString("com.ezac.gliderlogs.scn", appSCN).apply(); // prefs KEY EditText et4 = (EditText) settingsView.findViewById(R.id.setting_key); appKEY = et4.getText().toString(); es.putString("com.ezac.gliderlogs.key", appKEY).apply(); // prefs KEY EditText et5 = (EditText) settingsView.findViewById(R.id.setting_secret); appSCT = et5.getText().toString(); es.putString("com.ezac.gliderlogs.sct", appSCT).apply(); // prefs Meteo mTestArray = getResources().getStringArray(R.array.meteo_id_arrays); Spinner et6 = (Spinner) settingsView.findViewById(R.id.setting_station); String sel6 = (String) et6.getSelectedItem(); //String sel6_id = ""; for (int i = 0; i < et6.getCount(); i++) { String s1 = (String) et6.getItemAtPosition(i); if (s1.equalsIgnoreCase(sel6)) { appMST = mTestArray[i]; } } es.putString("com.ezac.gliderlogs.mst", appMST).apply(); // prefs Metar EditText et7 = (EditText) settingsView.findViewById(R.id.setting_metar); appMTR = et7.getText().toString(); es.putString("com.ezac.gliderlogs.mst", appMST).apply(); } // prefs Flags CheckBox et9a = (CheckBox) settingsView.findViewById(R.id.setting_menu01); CheckBox et9b = (CheckBox) settingsView.findViewById(R.id.setting_menu02); CheckBox et9c = (CheckBox) settingsView.findViewById(R.id.setting_menu11); CheckBox et9d = (CheckBox) settingsView.findViewById(R.id.setting_menu12); CheckBox et9e = (CheckBox) settingsView.findViewById(R.id.setting_menu13); CheckBox et9f = (CheckBox) settingsView.findViewById(R.id.setting_menu14); CheckBox et9g = (CheckBox) settingsView.findViewById(R.id.setting_menu21); CheckBox et9h = (CheckBox) settingsView.findViewById(R.id.setting_menu22); String et9aa, et9ab; String v[]; if (userInput.getText().toString().equals("To3Myd4T")) { et9aa = et9a.isChecked() ? "true" : "false"; et9ab = et9b.isChecked() ? "true" : "false"; } else { v = appFLG.split(";"); et9aa = v[0]; et9ab = v[1]; } String et9ac = et9c.isChecked() ? "true" : "false"; String et9ad = et9d.isChecked() ? "true" : "false"; String et9ae = et9e.isChecked() ? "true" : "false"; String et9af = et9f.isChecked() ? "true" : "false"; String et9ag = et9g.isChecked() ? "true" : "false"; String et9ah = et9h.isChecked() ? "true" : "false"; appFLG = et9aa + ";" + et9ab + ";" + et9ac + ";" + et9ad + ";" + et9ae + ";" + et9af + ";" + et9ag + ";" + et9ah + ";false;false"; v = appFLG.split(";"); menu.findItem(R.id.action_ezac).setVisible(Boolean.parseBoolean(v[2])); menu.findItem(R.id.action_meteo_group).setVisible(Boolean.parseBoolean(v[3])); menu.findItem(R.id.action_ntm_nld).setVisible(Boolean.parseBoolean(v[4])); menu.findItem(R.id.action_ntm_blx).setVisible(Boolean.parseBoolean(v[4])); menu.findItem(R.id.action_ogn_flarm).setVisible(Boolean.parseBoolean(v[5])); menu.findItem(R.id.action_adsb).setVisible(Boolean.parseBoolean(v[6])); menu.findItem(R.id.action_adsb_lcl).setVisible(Boolean.parseBoolean(v[7])); es.putString("com.ezac.gliderlogs.flg", appFLG).apply(); // adjust value in menu button to value in use MenuItem MenuItem_dur = menu.findItem(R.id.action_45min); MenuItem_dur.setTitle(" " + appPRE + " Min "); if (userInput.getText().toString().equals("To3Myd4T")) { // prefs airfield heading mTestArray = getResources().getStringArray(R.array.heading_arrays); Spinner et10 = (Spinner) settingsView.findViewById(R.id.setting_heading); String sel10 = (String) et10.getSelectedItem(); //String sel10_id = ""; for (int i = 0; i < et10.getCount(); i++) { String s2 = (String) et10.getItemAtPosition(i); if (s2.equalsIgnoreCase(sel10)) { appLND = mTestArray[i]; es.putString("com.ezac.gliderlogs.lnd", appLND).apply(); } } } } }).setNegativeButton("Cancel", new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { dialog.cancel(); } }); // create alert dialog & and load it's data AlertDialog alertDialog = alertDialogBuilder.create(); EditText et1 = (EditText) settingsView.findViewById(R.id.setting_url); EditText et2 = (EditText) settingsView.findViewById(R.id.setting_pre); EditText et3 = (EditText) settingsView.findViewById(R.id.setting_scn); EditText et4 = (EditText) settingsView.findViewById(R.id.setting_key); EditText et5 = (EditText) settingsView.findViewById(R.id.setting_secret); Spinner et6 = (Spinner) settingsView.findViewById(R.id.setting_station); EditText et7 = (EditText) settingsView.findViewById(R.id.setting_metar); //EditText et8 = (EditText) settingsView.findViewById(R.id.setting_ntp); CheckBox et9a = (CheckBox) settingsView.findViewById(R.id.setting_menu01); CheckBox et9b = (CheckBox) settingsView.findViewById(R.id.setting_menu02); CheckBox et9c = (CheckBox) settingsView.findViewById(R.id.setting_menu11); CheckBox et9d = (CheckBox) settingsView.findViewById(R.id.setting_menu12); CheckBox et9e = (CheckBox) settingsView.findViewById(R.id.setting_menu13); CheckBox et9f = (CheckBox) settingsView.findViewById(R.id.setting_menu14); CheckBox et9g = (CheckBox) settingsView.findViewById(R.id.setting_menu21); CheckBox et9h = (CheckBox) settingsView.findViewById(R.id.setting_menu22); Spinner et10 = (Spinner) settingsView.findViewById(R.id.setting_heading); et1.setText(appURL); et2.setText(appPRE); et3.setText(appSCN); et4.setText(appKEY); et5.setText(appSCT); // get settings value for meteo station and set spinner String[] mTestArray; mTestArray = getResources().getStringArray(R.array.meteo_id_arrays); for (int i = 0; i < mTestArray.length; i++) { String s = mTestArray[i]; if (s.equals(appMST)) { et6.setSelection(i); } } et7.setText(appMTR); // get settings value for menu tabs and set checkboxes String v[] = appFLG.split(";"); et9a.setChecked(Boolean.parseBoolean(v[0])); et9b.setChecked(Boolean.parseBoolean(v[1])); et9c.setChecked(Boolean.parseBoolean(v[2])); et9d.setChecked(Boolean.parseBoolean(v[3])); et9e.setChecked(Boolean.parseBoolean(v[4])); et9f.setChecked(Boolean.parseBoolean(v[5])); et9g.setChecked(Boolean.parseBoolean(v[6])); et9h.setChecked(Boolean.parseBoolean(v[7])); // re-use mTestArray mTestArray = getResources().getStringArray(R.array.heading_arrays); for (int i = 0; i < mTestArray.length; i++) { String s = mTestArray[i]; if (s.equals(appLND)) { et10.setSelection(i); } } // show it alertDialog.show(); }
From source file:de.enlightened.peris.CategoriesFragment.java
public final void onCreateContextMenu(final ContextMenu menu, final View v, final ContextMenuInfo menuInfo) { final String serverUserId = this.application.getSession().getServer().serverUserId; final AdapterContextMenuInfo info = (AdapterContextMenuInfo) menuInfo; this.clickedTopicItem = (TopicItem) CategoriesFragment.this.getListView().getItemAtPosition(info.position); if (serverUserId == null) { return;/*from w ww. j a v a2 s . c om*/ } super.onCreateContextMenu(menu, v, menuInfo); menu.setHeaderTitle(this.clickedTopicItem.getHeading()); final MenuInflater inflater = this.activity.getMenuInflater(); inflater.inflate(R.menu.categories_context, menu); final MenuItem ubsubItem = menu.findItem(R.id.categories_unsubscribe); final MenuItem subItem = menu.findItem(R.id.categories_subscribe); final MenuItem stickyItem = menu.findItem(R.id.categories_context_sticky); final MenuItem lockItem = menu.findItem(R.id.categories_context_lock); final MenuItem deleteItem = menu.findItem(R.id.categories_context_delete); final MenuItem subscribeItem = menu.findItem(R.id.categories_add_favorite); final MenuItem unsubscribeItem = menu.findItem(R.id.categories_remove_favorite); if (this.clickedTopicItem instanceof Category) { final Category category = (Category) this.clickedTopicItem; ubsubItem.setVisible(false); subItem.setVisible(false); stickyItem.setVisible(false); lockItem.setVisible(false); deleteItem.setVisible(false); if (category.isCanSubscribe()) { subscribeItem.setVisible(true); } else { subscribeItem.setVisible(false); } if (category.isSubscribed()) { unsubscribeItem.setVisible(true); subscribeItem.setVisible(false); } else { unsubscribeItem.setVisible(false); } } else { final Topic topic = (Topic) this.clickedTopicItem; unsubscribeItem.setVisible(false); subscribeItem.setVisible(false); if (topic.isCanStick()) { stickyItem.setVisible(true); if (Topic.Type.Sticky == topic.getType()) { stickyItem.setTitle("Unstick Topic"); } else { stickyItem.setTitle("Stick Topic"); } } else { stickyItem.setVisible(false); } if (topic.isCanDelete()) { deleteItem.setVisible(true); } else { deleteItem.setVisible(false); } if (topic.isCanClose()) { lockItem.setVisible(true); if (topic.isClosed()) { lockItem.setTitle("Unlock Topic"); } else { lockItem.setTitle("Lock Topic"); } } else { lockItem.setVisible(false); } if (this.subforumId.contentEquals("favs")) { ubsubItem.setVisible(true); subItem.setVisible(false); } else { ubsubItem.setVisible(false); subItem.setVisible(true); } } }
From source file:com.haibison.android.anhuu.FragmentFiles.java
@Override public void onPrepareOptionsMenu(Menu menu) { if (BuildConfig.DEBUG) Log.d(CLASSNAME, "onPrepareOptionsMenu()"); /*// ww w. j a v a 2 s .com * Some bugs? This method seems to be called even after `onDestroy()`... */ if (getActivity() == null) return; /* * Sorting. */ final boolean sortAscending = Display.isSortAscending(getActivity()); MenuItem miSort = menu.findItem(R.id.anhuu_f5be488d_menuitem_sort); switch (Display.getSortType(getActivity())) { case BaseFile.SORT_BY_NAME: miSort.setIcon(UI.resolveAttribute(getActivity(), sortAscending ? R.attr.anhuu_f5be488d_ic_menu_sort_by_name_asc : R.attr.anhuu_f5be488d_ic_menu_sort_by_name_desc)); break; case BaseFile.SORT_BY_SIZE: miSort.setIcon(UI.resolveAttribute(getActivity(), sortAscending ? R.attr.anhuu_f5be488d_ic_menu_sort_by_size_asc : R.attr.anhuu_f5be488d_ic_menu_sort_by_size_desc)); break; case BaseFile.SORT_BY_MODIFICATION_TIME: miSort.setIcon(UI.resolveAttribute(getActivity(), sortAscending ? R.attr.anhuu_f5be488d_ic_menu_sort_by_date_asc : R.attr.anhuu_f5be488d_ic_menu_sort_by_date_desc)); break; } /* * View type. */ MenuItem menuItem = menu.findItem(R.id.anhuu_f5be488d_menuitem_switch_viewmode); switch (Display.getViewType(getActivity())) { case GRID: menuItem.setIcon(UI.resolveAttribute(getActivity(), R.attr.anhuu_f5be488d_ic_menu_listview)); menuItem.setTitle(R.string.anhuu_f5be488d_cmd_list_view); break; case LIST: menuItem.setIcon(UI.resolveAttribute(getActivity(), R.attr.anhuu_f5be488d_ic_menu_gridview)); menuItem.setTitle(R.string.anhuu_f5be488d_cmd_grid_view); break; } /* * New folder. */ menu.findItem(R.id.anhuu_f5be488d_menuitem_new_folder).setEnabled(!mLoading); }
From source file:com.aimfire.gallery.GalleryActivity.java
/** * Override Activity lifecycle method./*from w ww .j av a 2s . c o m*/ */ @Override public boolean onPrepareOptionsMenu(Menu menu) { MenuItem sbs = menu.findItem(R.id.action_sbs); MenuItem tv = menu.findItem(R.id.action_3dtv); MenuItem ag = menu.findItem(R.id.action_anaglyph); MenuItem sw = menu.findItem(R.id.action_swap); MenuItem gs = menu.findItem(R.id.action_grayscale); switch (mDisplayMode) { case SbsFull: sbs.setChecked(true); sw.setEnabled(true); if (mDisplaySwap) { sbs.setIcon(R.drawable.ic_crossed_eye); sbs.setTitle(R.string.action_sbs_cross); } else { sbs.setIcon(R.drawable.ic_parallel_eye_white); sbs.setTitle(R.string.action_sbs_parallel); } break; case SbsHalf: tv.setChecked(true); sw.setEnabled(false); break; case Anaglyph: ag.setChecked(true); sw.setEnabled(true); if (mDisplaySwap) { ag.setIcon(R.drawable.ic_cyan_red); ag.setTitle(R.string.action_anaglyph_cyanred); } else { ag.setIcon(R.drawable.ic_red_cyan); ag.setTitle(R.string.action_anaglyph_redcyan); } break; default: break; } if (mDisplaySwap) { sw.setChecked(true); } else { sw.setChecked(false); } if (mDisplayColor) { gs.setChecked(false); } else { gs.setChecked(true); } return super.onPrepareOptionsMenu(menu); }