Browse Source

Fixed search spinner

main
M66B 6 years ago
parent
commit
c2a078a340
2 changed files with 16 additions and 18 deletions
  1. +3
    -8
      app/src/main/java/eu/faircode/email/BoundaryCallbackMessages.java
  2. +13
    -10
      app/src/main/java/eu/faircode/email/FragmentMessages.java

+ 3
- 8
app/src/main/java/eu/faircode/email/BoundaryCallbackMessages.java View File

@ -65,7 +65,6 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
private int index;
private boolean searching = false;
private int loaded = 0;
private boolean destroyed = false;
interface IBoundaryCallbackMessages {
void onLoading();
@ -87,7 +86,6 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
@Override
public void onStateChanged(LifecycleOwner source, Lifecycle.Event event) {
if (event == Lifecycle.Event.ON_DESTROY) {
destroyed = true;
executor.submit(new Runnable() {
@Override
public void run() {
@ -140,8 +138,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
handler.post(new Runnable() {
@Override
public void run() {
if (!destroyed)
intf.onLoading();
intf.onLoading();
}
});
@ -232,8 +229,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
handler.post(new Runnable() {
@Override
public void run() {
if (!destroyed)
intf.onError(context, ex);
intf.onError(context, ex);
}
});
} finally {
@ -241,8 +237,7 @@ public class BoundaryCallbackMessages extends PagedList.BoundaryCallback<TupleMe
handler.post(new Runnable() {
@Override
public void run() {
if (!destroyed)
intf.onLoaded();
intf.onLoaded();
}
});
}


+ 13
- 10
app/src/main/java/eu/faircode/email/FragmentMessages.java View File

@ -52,6 +52,7 @@ import androidx.annotation.Nullable;
import androidx.appcompat.widget.SearchView;
import androidx.constraintlayout.widget.Group;
import androidx.fragment.app.FragmentTransaction;
import androidx.lifecycle.Lifecycle;
import androidx.lifecycle.LiveData;
import androidx.lifecycle.Observer;
import androidx.paging.LivePagedListBuilder;
@ -682,11 +683,12 @@ public class FragmentMessages extends FragmentEx {
@Override
public void onError(Context context, Throwable ex) {
new DialogBuilderLifecycle(getContext(), getViewLifecycleOwner())
.setMessage(Helper.formatThrowable(ex))
.setPositiveButton(android.R.string.cancel, null)
.create()
.show();
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
new DialogBuilderLifecycle(getContext(), getViewLifecycleOwner())
.setMessage(Helper.formatThrowable(ex))
.setPositiveButton(android.R.string.cancel, null)
.create()
.show();
}
});
@ -727,11 +729,12 @@ public class FragmentMessages extends FragmentEx {
@Override
public void onError(Context context, Throwable ex) {
new DialogBuilderLifecycle(getContext(), getViewLifecycleOwner())
.setMessage(Helper.formatThrowable(ex))
.setPositiveButton(android.R.string.cancel, null)
.create()
.show();
if (getLifecycle().getCurrentState().isAtLeast(Lifecycle.State.RESUMED))
new DialogBuilderLifecycle(getContext(), getViewLifecycleOwner())
.setMessage(Helper.formatThrowable(ex))
.setPositiveButton(android.R.string.cancel, null)
.create()
.show();
}
});


Loading…
Cancel
Save