mirror of https://github.com/M66B/FairEmail.git
parent
4fb7891cda
commit
dcd6b7c384
@ -0,0 +1,36 @@
|
||||
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};
|
||||
}
|
||||
}
|
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M15.41,7.41L14,6l-6,6 6,6 1.41,-1.41L10.83,12z"/>
|
||||
</vector>
|
@ -0,0 +1,10 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="24dp"
|
||||
android:height="24dp"
|
||||
android:viewportWidth="24.0"
|
||||
android:viewportHeight="24.0"
|
||||
android:tint="?attr/colorControlNormal">
|
||||
<path
|
||||
android:fillColor="@android:color/white"
|
||||
android:pathData="M10,6L8.59,7.41 13.17,12l-4.58,4.59L10,18l6,-6z"/>
|
||||
</vector>
|
@ -0,0 +1,13 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<menu xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item
|
||||
android:id="@+id/action_prev"
|
||||
android:icon="@drawable/baseline_navigate_before_24"
|
||||
android:title="" />
|
||||
|
||||
<item
|
||||
android:id="@+id/action_next"
|
||||
android:icon="@drawable/baseline_navigate_next_24"
|
||||
android:title="" />
|
||||
</menu>
|
Loading…
Reference in new issue