Browse Source

Removed previous/next navigation

main
M66B 6 years ago
parent
commit
3202f22107
7 changed files with 1 additions and 121 deletions
  1. +1
    -32
      app/src/main/java/eu/faircode/email/FragmentMessages.java
  2. +0
    -36
      app/src/main/java/eu/faircode/email/ViewModelMessages.java
  3. +0
    -11
      app/src/main/res/drawable/baseline_skip_next_24.xml
  4. +0
    -11
      app/src/main/res/drawable/baseline_skip_previous_24.xml
  5. +0
    -26
      app/src/main/res/layout/fragment_messages.xml
  6. +0
    -2
      app/src/main/res/values/colors.xml
  7. +0
    -3
      app/src/main/res/values/styles.xml

+ 1
- 32
app/src/main/java/eu/faircode/email/FragmentMessages.java View File

@ -56,7 +56,6 @@ import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Lifecycle; import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LiveData; import androidx.lifecycle.LiveData;
import androidx.lifecycle.Observer; import androidx.lifecycle.Observer;
import androidx.lifecycle.ViewModelProviders;
import androidx.localbroadcastmanager.content.LocalBroadcastManager; import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import androidx.paging.LivePagedListBuilder; import androidx.paging.LivePagedListBuilder;
import androidx.paging.PagedList; import androidx.paging.PagedList;
@ -77,8 +76,6 @@ public class FragmentMessages extends FragmentEx {
private Group grpHintActions; private Group grpHintActions;
private Group grpReady; private Group grpReady;
private FloatingActionButton fab; private FloatingActionButton fab;
private FloatingActionButton fabPrev;
private FloatingActionButton fabNext;
private long folder = -1; private long folder = -1;
private long account = -1; private long account = -1;
@ -147,8 +144,6 @@ public class FragmentMessages extends FragmentEx {
grpHintActions = view.findViewById(R.id.grpHintActions); grpHintActions = view.findViewById(R.id.grpHintActions);
grpReady = view.findViewById(R.id.grpReady); grpReady = view.findViewById(R.id.grpReady);
fab = view.findViewById(R.id.fab); fab = view.findViewById(R.id.fab);
fabPrev = view.findViewById(R.id.fabPrev);
fabNext = view.findViewById(R.id.fabNext);
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext()); final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(getContext());
@ -482,17 +477,12 @@ public class FragmentMessages extends FragmentEx {
} }
}; };
fabPrev.setOnClickListener(navigate);
fabNext.setOnClickListener(navigate);
// Initialize // Initialize
tvNoEmail.setVisibility(View.GONE); tvNoEmail.setVisibility(View.GONE);
grpReady.setVisibility(View.GONE); grpReady.setVisibility(View.GONE);
pbWait.setVisibility(View.VISIBLE); pbWait.setVisibility(View.VISIBLE);
fab.hide(); fab.hide();
fabPrev.hide();
fabNext.hide();
return view; return view;
} }
@ -582,23 +572,7 @@ public class FragmentMessages extends FragmentEx {
loadMessages(); loadMessages();
// Compose FAB // 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(); Bundle args = new Bundle();
args.putLong("account", account); args.putLong("account", account);
@ -853,11 +827,6 @@ public class FragmentMessages extends FragmentEx {
return; return;
} }
if (viewType != AdapterMessage.ViewType.THREAD) {
ViewModelMessages model = ViewModelProviders.of(getActivity()).get(ViewModelMessages.class);
model.setMessages(messages);
}
if (viewType == AdapterMessage.ViewType.THREAD && autoExpand) { if (viewType == AdapterMessage.ViewType.THREAD && autoExpand) {
autoExpand = false; autoExpand = false;


+ 0
- 36
app/src/main/java/eu/faircode/email/ViewModelMessages.java View File

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

+ 0
- 11
app/src/main/res/drawable/baseline_skip_next_24.xml View File

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

+ 0
- 11
app/src/main/res/drawable/baseline_skip_previous_24.xml View File

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

+ 0
- 26
app/src/main/res/layout/fragment_messages.xml View File

@ -162,30 +162,4 @@
app:backgroundTint="?attr/colorAccent" app:backgroundTint="?attr/colorAccent"
app:layout_constraintBottom_toBottomOf="parent" app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="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> </androidx.coordinatorlayout.widget.CoordinatorLayout>

+ 0
- 2
app/src/main/res/values/colors.xml View File

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


+ 0
- 3
app/src/main/res/values/styles.xml View File

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


Loading…
Cancel
Save