Auto close only when no navigation

This commit is contained in:
M66B 2018-11-16 20:43:07 +01:00
parent 01f557093f
commit 36e53aa2b0
3 changed files with 8 additions and 5 deletions

2
FAQ.md
View File

@ -23,9 +23,7 @@ For:
## Planned features
* Notifications per account
* Disable autoclose for conversations(for previous/next navigation)
* IMAP namespaces
* Fixed action bar conversations
* Microsoft OAuth
Anything on this list is in random order and *might* be added in the near future.

View File

@ -97,6 +97,7 @@ abstract class ActivityBase extends AppCompatActivity implements SharedPreferenc
"identicons".equals(key) ||
"preview".equals(key) ||
"confirm".equals(key) ||
"navigation".equals(key) ||
"debug".equals(key)))
finish();
}

View File

@ -96,6 +96,8 @@ public class FragmentMessages extends FragmentEx {
private boolean found = false;
private String search = null;
private boolean navigation = true;
private long primary = -1;
private boolean outbox = false;
private boolean connected = false;
@ -135,6 +137,9 @@ public class FragmentMessages extends FragmentEx {
found = args.getBoolean("found", false);
search = args.getString("search");
SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
navigation = prefs.getBoolean("navigation", true);
if (TextUtils.isEmpty(search))
if (thread == null)
if (folder < 0)
@ -876,13 +881,12 @@ public class FragmentMessages extends FragmentEx {
if (viewType == AdapterMessage.ViewType.THREAD) {
// Navigation
boolean nav = prefs.getBoolean("navigation", 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);
bottom_navigation.setVisibility(!nav || (pn[0] == null && pn[1] == null) ? View.GONE : View.VISIBLE);
bottom_navigation.setVisibility(!navigation || (pn[0] == null && pn[1] == null) ? View.GONE : View.VISIBLE);
} else {
db.account().liveAccountDraft(account < 0 ? null : account).observe(getViewLifecycleOwner(), new Observer<EntityAccount>() {
@Override
@ -1226,7 +1230,7 @@ public class FragmentMessages extends FragmentEx {
handleExpand(expand.id);
}
} else {
if (autoCount > 0) {
if (autoCount > 0 && navigation) {
int count = 0;
for (int i = 0; i < messages.size(); i++) {
TupleMessageEx message = messages.get(i);