Removed previous/next navigation

pull/146/head
M66B 6 years ago
parent ce4734ca7d
commit 3202f22107

@ -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;

@ -1,36 +0,0 @@
package eu.faircode.email;
import androidx.lifecycle.ViewModel;
import androidx.paging.PagedList;
public class ViewModelMessages extends ViewModel {
private PagedList<TupleMessageEx> messages = null;
void setMessages(PagedList<TupleMessageEx> 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};
}
}

@ -1,11 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:alpha="0.5"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M6,18l8.5,-6L6,6v12zM16,6v12h2V6h-2z"/>
</vector>

@ -1,11 +0,0 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:alpha="0.5"
android:viewportWidth="24.0"
android:viewportHeight="24.0"
android:tint="?attr/colorControlNormal">
<path
android:fillColor="@android:color/white"
android:pathData="M6,6h2v12L6,18zM9.5,12l8.5,6L18,6z"/>
</vector>

@ -162,30 +162,4 @@
app:backgroundTint="?attr/colorAccent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabPrev"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|start"
android:layout_margin="16dp"
android:src="@drawable/baseline_skip_previous_24"
android:tint="@color/colorActionForeground"
app:backgroundTint="?attr/colorFabTransparent"
app:elevation="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<com.google.android.material.floatingactionbutton.FloatingActionButton
android:id="@+id/fabNext"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="bottom|end"
android:layout_margin="16dp"
android:src="@drawable/baseline_skip_next_24"
android:tint="@color/colorActionForeground"
app:backgroundTint="?attr/colorFabTransparent"
app:elevation="0dp"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent" />
</androidx.coordinatorlayout.widget.CoordinatorLayout>

@ -14,7 +14,6 @@
<color name="lightColorDrawerScrim">#99000000</color>
<color name="lightColorDrawerText">#111</color>
<color name="lightColorDrawerBackground">#eee</color>
<color name="lightColorFabTransparent">#8aaa</color>
<color name="darkColorUnread">#fff</color>
<color name="darkColorItemSelected">#555</color>
@ -23,7 +22,6 @@
<color name="darkColorDrawerScrim">#997f7f7f</color>
<color name="darkColorDrawerText">#fff</color>
<color name="darkColorDrawerBackground">#222</color>
<color name="darkColorFabTransparent">#8666</color>
<!-- default: #323232 -->
<color name="design_snackbar_background_color" tools:override="true">#ff000000</color>

@ -5,7 +5,6 @@
<attr name="colorDrawerScrim" format="reference" />
<attr name="colorDrawerText" format="reference" />
<attr name="colorDrawerBackground" format="reference" />
<attr name="colorFabTransparent" format="reference" />
<attr name="drawableItemBackground" format="reference" />
<style name="AppThemeLight" parent="Base.Theme.AppCompat.Light.DarkActionBar">
@ -21,7 +20,6 @@
<item name="colorDrawerScrim">@color/lightColorDrawerScrim</item>
<item name="colorDrawerText">@color/lightColorDrawerText</item>
<item name="colorDrawerBackground">@color/lightColorDrawerBackground</item>
<item name="colorFabTransparent">@color/lightColorFabTransparent</item>
<item name="drawableItemBackground">@drawable/item_background_light</item>
@ -44,7 +42,6 @@
<item name="colorDrawerScrim">@color/darkColorDrawerScrim</item>
<item name="colorDrawerText">@color/darkColorDrawerText</item>
<item name="colorDrawerBackground">@color/darkColorDrawerBackground</item>
<item name="colorFabTransparent">@color/darkColorFabTransparent</item>
<item name="drawableItemBackground">@drawable/item_background_dark</item>

Loading…
Cancel
Save