From 3202f22107fb2c9bb038913c7f8cf841313ed692 Mon Sep 17 00:00:00 2001 From: M66B Date: Thu, 18 Oct 2018 11:33:24 +0000 Subject: [PATCH] Removed previous/next navigation --- .../eu/faircode/email/FragmentMessages.java | 33 +---------------- .../eu/faircode/email/ViewModelMessages.java | 36 ------------------- .../res/drawable/baseline_skip_next_24.xml | 11 ------ .../drawable/baseline_skip_previous_24.xml | 11 ------ app/src/main/res/layout/fragment_messages.xml | 26 -------------- app/src/main/res/values/colors.xml | 2 -- app/src/main/res/values/styles.xml | 3 -- 7 files changed, 1 insertion(+), 121 deletions(-) delete mode 100644 app/src/main/java/eu/faircode/email/ViewModelMessages.java delete mode 100644 app/src/main/res/drawable/baseline_skip_next_24.xml delete mode 100644 app/src/main/res/drawable/baseline_skip_previous_24.xml diff --git a/app/src/main/java/eu/faircode/email/FragmentMessages.java b/app/src/main/java/eu/faircode/email/FragmentMessages.java index ba2ab74e..363e13b7 100644 --- a/app/src/main/java/eu/faircode/email/FragmentMessages.java +++ b/app/src/main/java/eu/faircode/email/FragmentMessages.java @@ -56,7 +56,6 @@ import androidx.fragment.app.FragmentTransaction; import androidx.lifecycle.Lifecycle; import androidx.lifecycle.LiveData; import androidx.lifecycle.Observer; -import androidx.lifecycle.ViewModelProviders; import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.paging.LivePagedListBuilder; import androidx.paging.PagedList; @@ -77,8 +76,6 @@ public class FragmentMessages extends FragmentEx { private Group grpHintActions; private Group grpReady; private FloatingActionButton fab; - private FloatingActionButton fabPrev; - private FloatingActionButton fabNext; private long folder = -1; private long account = -1; @@ -147,8 +144,6 @@ public class FragmentMessages extends FragmentEx { grpHintActions = view.findViewById(R.id.grpHintActions); grpReady = view.findViewById(R.id.grpReady); fab = view.findViewById(R.id.fab); - fabPrev = view.findViewById(R.id.fabPrev); - fabNext = view.findViewById(R.id.fabNext); final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); @@ -482,17 +477,12 @@ public class FragmentMessages extends FragmentEx { } }; - fabPrev.setOnClickListener(navigate); - fabNext.setOnClickListener(navigate); - // Initialize tvNoEmail.setVisibility(View.GONE); grpReady.setVisibility(View.GONE); pbWait.setVisibility(View.VISIBLE); fab.hide(); - fabPrev.hide(); - fabNext.hide(); return view; } @@ -582,23 +572,7 @@ public class FragmentMessages extends FragmentEx { loadMessages(); // Compose FAB - if (viewType == AdapterMessage.ViewType.THREAD) { - ViewModelMessages model = ViewModelProviders.of(getActivity()).get(ViewModelMessages.class); - String[] pn = model.getPrevNext(thread); - - fabPrev.setTag(pn[0]); - fabNext.setTag(pn[1]); - - if (pn[0] == null) - fabPrev.hide(); - else - fabPrev.show(); - - if (pn[1] == null) - fabNext.hide(); - else - fabNext.show(); - } else { + if (viewType != AdapterMessage.ViewType.THREAD) { Bundle args = new Bundle(); args.putLong("account", account); @@ -853,11 +827,6 @@ public class FragmentMessages extends FragmentEx { return; } - if (viewType != AdapterMessage.ViewType.THREAD) { - ViewModelMessages model = ViewModelProviders.of(getActivity()).get(ViewModelMessages.class); - model.setMessages(messages); - } - if (viewType == AdapterMessage.ViewType.THREAD && autoExpand) { autoExpand = false; diff --git a/app/src/main/java/eu/faircode/email/ViewModelMessages.java b/app/src/main/java/eu/faircode/email/ViewModelMessages.java deleted file mode 100644 index baa22ee4..00000000 --- a/app/src/main/java/eu/faircode/email/ViewModelMessages.java +++ /dev/null @@ -1,36 +0,0 @@ -package eu.faircode.email; - -import androidx.lifecycle.ViewModel; -import androidx.paging.PagedList; - -public class ViewModelMessages extends ViewModel { - private PagedList messages = null; - - void setMessages(PagedList messages) { - this.messages = messages; - } - - String[] getPrevNext(String thread) { - if (messages == null) - return new String[]{null, null}; - - boolean found = false; - TupleMessageEx prev = null; - TupleMessageEx next = null; - for (int i = 0; i < messages.size(); i++) { - TupleMessageEx item = messages.get(i); - if (item == null) - continue; - if (found) { - next = item; - messages.loadAround(i); - break; - } - if (thread.equals(item.thread)) - found = true; - else - prev = item; - } - return new String[]{prev == null ? null : prev.thread, next == null ? null : next.thread}; - } -} diff --git a/app/src/main/res/drawable/baseline_skip_next_24.xml b/app/src/main/res/drawable/baseline_skip_next_24.xml deleted file mode 100644 index 2db5de09..00000000 --- a/app/src/main/res/drawable/baseline_skip_next_24.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/app/src/main/res/drawable/baseline_skip_previous_24.xml b/app/src/main/res/drawable/baseline_skip_previous_24.xml deleted file mode 100644 index c846e93f..00000000 --- a/app/src/main/res/drawable/baseline_skip_previous_24.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - diff --git a/app/src/main/res/layout/fragment_messages.xml b/app/src/main/res/layout/fragment_messages.xml index 3abbe357..4378c0b5 100644 --- a/app/src/main/res/layout/fragment_messages.xml +++ b/app/src/main/res/layout/fragment_messages.xml @@ -162,30 +162,4 @@ app:backgroundTint="?attr/colorAccent" app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintEnd_toEndOf="parent" /> - - - - diff --git a/app/src/main/res/values/colors.xml b/app/src/main/res/values/colors.xml index 26f6bc56..cbafc39c 100644 --- a/app/src/main/res/values/colors.xml +++ b/app/src/main/res/values/colors.xml @@ -14,7 +14,6 @@ #99000000 #111 #eee - #8aaa #fff #555 @@ -23,7 +22,6 @@ #997f7f7f #fff #222 - #8666 #ff000000 diff --git a/app/src/main/res/values/styles.xml b/app/src/main/res/values/styles.xml index c37db1b1..3de993a6 100644 --- a/app/src/main/res/values/styles.xml +++ b/app/src/main/res/values/styles.xml @@ -5,7 +5,6 @@ -