From 2fa33a6ddef431e7e7d6558d44af06344ef7015f Mon Sep 17 00:00:00 2001 From: M66B Date: Wed, 8 Apr 2020 20:25:48 +0200 Subject: [PATCH] Added help to search menu --- .../eu/faircode/email/FragmentMessages.java | 34 +++++++++++-------- 1 file changed, 20 insertions(+), 14 deletions(-) diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index ae699d7131..d2395ea17a 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -1030,23 +1030,29 @@ public class FragmentMessages extends FragmentBase implements SharedPreferences. popupMenu.getMenu().add(Menu.NONE, 3, order++, account.name) .setIntent(new Intent().putExtra("account", account.id)); + popupMenu.getMenu().add(Menu.NONE, 999, order++, R.string.title_setup_help); + popupMenu.setOnMenuItemClickListener(new PopupMenu.OnMenuItemClickListener() { @Override public boolean onMenuItemClick(MenuItem target) { - if (target.getItemId() == 1) { - SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); - boolean search_text = prefs.getBoolean("search_text", false); - prefs.edit().putBoolean("search_text", !search_text).apply(); - return true; - } - - if (target.getItemId() == 2) { - search( - getContext(), getViewLifecycleOwner(), getParentFragmentManager(), - account, folder, - true, - query); - return true; + switch (target.getItemId()) { + case 1: // Search text + SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); + boolean search_text = prefs.getBoolean("search_text", false); + prefs.edit().putBoolean("search_text", !search_text).apply(); + return true; + + case 2: // Search same folder + search( + getContext(), getViewLifecycleOwner(), getParentFragmentManager(), + account, folder, + true, + query); + return true; + + case 999: // Help + Helper.viewFAQ(getContext(), 13); + return true; } Intent intent = target.getIntent();