diff --git a/app/src/main/java/eu/faircode/email/ActivityBase.java b/app/src/main/java/eu/faircode/email/ActivityBase.java index b9fa7afa44..08e009c8de 100644 --- a/app/src/main/java/eu/faircode/email/ActivityBase.java +++ b/app/src/main/java/eu/faircode/email/ActivityBase.java @@ -96,8 +96,8 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc "avatars".equals(key) || "identicons".equals(key) || "preview".equals(key) || + "actionbar".equals(key) || "confirm".equals(key) || - "navigation".equals(key) || "debug".equals(key))) finish(); } diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index 4d651f657f..9bfda970b6 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -95,6 +95,7 @@ public class FragmentMessages extends FragmentEx { private boolean found = false; private String search = null; + private boolean actionbar = false; private boolean autoclose = false; private long primary = -1; @@ -137,6 +138,7 @@ public class FragmentMessages extends FragmentEx { search = args.getString("search"); SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); + actionbar = prefs.getBoolean("actionbar", true); autoclose = prefs.getBoolean("autoclose", false); if (TextUtils.isEmpty(search)) @@ -965,31 +967,32 @@ public class FragmentMessages extends FragmentEx { else fabMore.hide(); - if (viewType == AdapterMessage.ViewType.THREAD) - db.folder().liveSystemFolders(account).observe(getViewLifecycleOwner(), new Observer>() { - @Override - public void onChanged(@Nullable List folders) { - boolean hasTrash = false; - boolean hasArchive = false; - if (folders != null) - for (EntityFolder folder : folders) - if (EntityFolder.TRASH.equals(folder.type)) - hasTrash = true; - else if (EntityFolder.ARCHIVE.equals(folder.type)) - hasArchive = true; + if (viewType == AdapterMessage.ViewType.THREAD) { + if (actionbar) + db.folder().liveSystemFolders(account).observe(getViewLifecycleOwner(), new Observer>() { + @Override + public void onChanged(@Nullable List folders) { + boolean hasTrash = false; + boolean hasArchive = false; + if (folders != null) + for (EntityFolder folder : folders) + if (EntityFolder.TRASH.equals(folder.type)) + hasTrash = true; + else if (EntityFolder.ARCHIVE.equals(folder.type)) + hasArchive = true; - ViewModelMessages model = ViewModelProviders.of(getActivity()).get(ViewModelMessages.class); - ViewModelMessages.Target[] pn = model.getPrevNext(thread); - bottom_navigation.setTag(pn); - bottom_navigation.getMenu().findItem(R.id.action_prev).setEnabled(pn[0] != null); - bottom_navigation.getMenu().findItem(R.id.action_next).setEnabled(pn[1] != null); + ViewModelMessages model = ViewModelProviders.of(getActivity()).get(ViewModelMessages.class); + ViewModelMessages.Target[] pn = model.getPrevNext(thread); + bottom_navigation.setTag(pn); + bottom_navigation.getMenu().findItem(R.id.action_prev).setEnabled(pn[0] != null); + bottom_navigation.getMenu().findItem(R.id.action_next).setEnabled(pn[1] != null); - bottom_navigation.getMenu().findItem(R.id.action_delete).setVisible(hasTrash); - bottom_navigation.getMenu().findItem(R.id.action_archive).setVisible(hasArchive); - bottom_navigation.setVisibility(View.VISIBLE); - } - }); - else { + bottom_navigation.getMenu().findItem(R.id.action_delete).setVisible(hasTrash); + bottom_navigation.getMenu().findItem(R.id.action_archive).setVisible(hasArchive); + bottom_navigation.setVisibility(View.VISIBLE); + } + }); + } else { db.account().liveAccountDraft(account < 0 ? null : account).observe(getViewLifecycleOwner(), new Observer() { @Override public void onChanged(EntityAccount account) { diff --git a/app/src/main/java/eu/faircode/email/FragmentOptions.java b/app/src/main/java/eu/faircode/email/FragmentOptions.java index 82fa80b8d6..849dbc2248 100644 --- a/app/src/main/java/eu/faircode/email/FragmentOptions.java +++ b/app/src/main/java/eu/faircode/email/FragmentOptions.java @@ -49,6 +49,7 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS private SwitchCompat swLight; private SwitchCompat swBrowse; private SwitchCompat swSwipe; + private SwitchCompat swActionbar; private SwitchCompat swAutoclose; private SwitchCompat swConfirm; private SwitchCompat swSender; @@ -73,6 +74,7 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS swLight = view.findViewById(R.id.swLight); swBrowse = view.findViewById(R.id.swBrowse); swSwipe = view.findViewById(R.id.swSwipe); + swActionbar = view.findViewById(R.id.swActionbar); swAutoclose = view.findViewById(R.id.swAutoclose); swConfirm = view.findViewById(R.id.swConfirm); swSender = view.findViewById(R.id.swSender); @@ -183,11 +185,11 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS } }); - swConfirm.setChecked(prefs.getBoolean("confirm", false)); - swConfirm.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + swActionbar.setChecked(prefs.getBoolean("actionbar", true)); + swActionbar.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { - prefs.edit().putBoolean("confirm", checked).apply(); + prefs.edit().putBoolean("actionbar", checked).apply(); } }); @@ -199,6 +201,14 @@ public class FragmentOptions extends FragmentEx implements SharedPreferences.OnS } }); + swConfirm.setChecked(prefs.getBoolean("confirm", false)); + swConfirm.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { + @Override + public void onCheckedChanged(CompoundButton compoundButton, boolean checked) { + prefs.edit().putBoolean("confirm", checked).apply(); + } + }); + swSender.setChecked(prefs.getBoolean("sender", false)); swSender.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @Override diff --git a/app/src/main/res/layout/fragment_options.xml b/app/src/main/res/layout/fragment_options.xml index dba1dd015a..cc6226a9d0 100644 --- a/app/src/main/res/layout/fragment_options.xml +++ b/app/src/main/res/layout/fragment_options.xml @@ -83,6 +83,15 @@ app:layout_constraintStart_toStartOf="parent" app:layout_constraintTop_toBottomOf="@id/swBrowse" /> + + + app:layout_constraintTop_toBottomOf="@id/swActionbar" /> Use notification light Browse messages on the server Swipe actions + Conversation action bar Automatically close conversations Confirm actions that might leak privacy sensitive information Allow editing sender address