Small improvement

This commit is contained in:
M66B 2019-04-20 11:15:21 +02:00
parent 581e26f1c4
commit 5fe9587af9
1 changed files with 5 additions and 12 deletions

View File

@ -1941,19 +1941,15 @@ public class FragmentMessages extends FragmentBase {
public void onPrepareOptionsMenu(Menu menu) { public void onPrepareOptionsMenu(Menu menu) {
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean selection = (selectionTracker != null && selectionTracker.hasSelection());
menu.findItem(R.id.menu_search).setVisible( menu.findItem(R.id.menu_search).setVisible(
viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER); viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER);
menu.findItem(R.id.menu_folders).setVisible( menu.findItem(R.id.menu_folders).setVisible(viewType == AdapterMessage.ViewType.UNIFIED && primary >= 0);
viewType == AdapterMessage.ViewType.UNIFIED && primary >= 0);
menu.findItem(R.id.menu_folders).setIcon(connected menu.findItem(R.id.menu_folders).setIcon(connected
? R.drawable.baseline_folder_special_24 ? R.drawable.baseline_folder_special_24 : R.drawable.baseline_folder_open_24);
: R.drawable.baseline_folder_open_24);
menu.findItem(R.id.menu_sort_on).setVisible(!selection && menu.findItem(R.id.menu_sort_on).setVisible(
(viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER)); viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER);
String sort = prefs.getString("sort", "time"); String sort = prefs.getString("sort", "time");
if ("time".equals(sort)) if ("time".equals(sort))
@ -1969,12 +1965,9 @@ public class FragmentMessages extends FragmentBase {
else if ("size".equals(sort)) else if ("size".equals(sort))
menu.findItem(R.id.menu_sort_on_size).setChecked(true); menu.findItem(R.id.menu_sort_on_size).setChecked(true);
menu.findItem(R.id.menu_zoom).setVisible(!selection);
menu.findItem(R.id.menu_compact).setVisible(!selection);
menu.findItem(R.id.menu_compact).setChecked(prefs.getBoolean("compact", false)); menu.findItem(R.id.menu_compact).setChecked(prefs.getBoolean("compact", false));
menu.findItem(R.id.menu_snoozed).setVisible(!selection && !outbox && menu.findItem(R.id.menu_snoozed).setVisible(!outbox &&
(viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER)); (viewType == AdapterMessage.ViewType.UNIFIED || viewType == AdapterMessage.ViewType.FOLDER));
menu.findItem(R.id.menu_snoozed).setChecked(prefs.getBoolean("snoozed", false)); menu.findItem(R.id.menu_snoozed).setChecked(prefs.getBoolean("snoozed", false));