Added fail safe

pull/207/head
M66B 3 years ago
parent 9abb755fb8
commit 3ab55e2bf9

@ -674,7 +674,12 @@ public class AdapterAccount extends RecyclerView.Adapter<AdapterAccount.ViewHold
Log.d("Changed @" + position + " #" + count);
}
});
diff.dispatchUpdatesTo(this);
try {
diff.dispatchUpdatesTo(this);
} catch (Throwable ex) {
Log.e(ex);
}
}
void setCompact(boolean compact) {

@ -357,7 +357,12 @@ public class AdapterAnswer extends RecyclerView.Adapter<AdapterAnswer.ViewHolder
Log.d("Changed @" + position + " #" + count);
}
});
diff.dispatchUpdatesTo(this);
try {
diff.dispatchUpdatesTo(this);
} catch (Throwable ex) {
Log.e(ex);
}
}
public void search(String query) {

@ -413,7 +413,12 @@ public class AdapterAttachment extends RecyclerView.Adapter<AdapterAttachment.Vi
Log.d("Changed @" + position + " #" + count);
}
});
diff.dispatchUpdatesTo(this);
try {
diff.dispatchUpdatesTo(this);
} catch (Throwable ex) {
Log.e(ex);
}
}
private static class DiffCallback extends DiffUtil.Callback {

@ -250,7 +250,12 @@ public class AdapterCertificate extends RecyclerView.Adapter<AdapterCertificate.
Log.d("Changed @" + position + " #" + count);
}
});
diff.dispatchUpdatesTo(this);
try {
diff.dispatchUpdatesTo(this);
} catch (Throwable ex) {
Log.e(ex);
}
}
private static class DiffCallback extends DiffUtil.Callback {

@ -444,7 +444,12 @@ public class AdapterContact extends RecyclerView.Adapter<AdapterContact.ViewHold
Log.d("Changed @" + position + " #" + count);
}
});
diff.dispatchUpdatesTo(AdapterContact.this);
try {
diff.dispatchUpdatesTo(AdapterContact.this);
} catch (Throwable ex) {
Log.e(ex);
}
}
@Override

@ -1361,7 +1361,32 @@ public class AdapterFolder extends RecyclerView.Adapter<AdapterFolder.ViewHolder
Log.d("Changed @" + position + " #" + count);
}
});
diff.dispatchUpdatesTo(this);
try {
diff.dispatchUpdatesTo(this);
} catch (Throwable ex) {
Log.e(ex);
/*
java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling eu.faircode.email.FixedRecyclerView{bc0fa01 VFED..... ........ 0,0-1080,1984 #7f0a0533 app:id/rvFolder}, adapter:eu.faircode.email.AdapterFolder@b1cf0a6, layout:androidx.recyclerview.widget.LinearLayoutManager@3093ae7, context:eu.faircode.email.ActivityView@832e020
at androidx.recyclerview.widget.RecyclerView.assertNotInLayoutOrScroll(SourceFile:3)
at androidx.recyclerview.widget.RecyclerView$RecyclerViewDataObserver.onItemRangeChanged(SourceFile:1)
at androidx.recyclerview.widget.RecyclerView$AdapterDataObservable.notifyItemRangeChanged(SourceFile:3)
at androidx.recyclerview.widget.RecyclerView$Adapter.notifyItemRangeChanged(SourceFile:2)
at androidx.recyclerview.widget.AdapterListUpdateCallback.onChanged(SourceFile:1)
at androidx.recyclerview.widget.BatchingListUpdateCallback.dispatchLastEvent(SourceFile:2)
at androidx.recyclerview.widget.BatchingListUpdateCallback.onChanged(SourceFile:4)
at androidx.recyclerview.widget.DiffUtil$DiffResult.dispatchUpdatesTo(SourceFile:34)
at androidx.recyclerview.widget.DiffUtil$DiffResult.dispatchUpdatesTo(SourceFile:1)
at eu.faircode.email.AdapterFolder.set(SourceFile:46)
at eu.faircode.email.FragmentFolders$12.onChanged(SourceFile:3)
at eu.faircode.email.FragmentFolders$12.onChanged(SourceFile:1)
at androidx.lifecycle.LiveData.considerNotify(SourceFile:6)
at androidx.lifecycle.LiveData.dispatchingValue(SourceFile:8)
at androidx.lifecycle.LiveData.setValue(SourceFile:4)
at androidx.lifecycle.LiveData$1.run(SourceFile:5)
at android.os.Handler.handleCallback(Handler.java:938)
*/
}
}
public void search(String query) {

@ -476,7 +476,12 @@ public class AdapterIdentity extends RecyclerView.Adapter<AdapterIdentity.ViewHo
Log.d("Changed @" + position + " #" + count);
}
});
diff.dispatchUpdatesTo(this);
try {
diff.dispatchUpdatesTo(this);
} catch (Throwable ex) {
Log.e(ex);
}
}
private static class DiffCallback extends DiffUtil.Callback {

@ -340,7 +340,12 @@ public class AdapterImage extends RecyclerView.Adapter<AdapterImage.ViewHolder>
Log.d("Changed @" + position + " #" + count);
}
});
diff.dispatchUpdatesTo(this);
try {
diff.dispatchUpdatesTo(this);
} catch (Throwable ex) {
Log.e(ex);
}
}
private static class DiffCallback extends DiffUtil.Callback {

@ -272,7 +272,12 @@ public class AdapterKeyword extends RecyclerView.Adapter<AdapterKeyword.ViewHold
Log.d("Changed @" + position + " #" + count);
}
});
diff.dispatchUpdatesTo(this);
try {
diff.dispatchUpdatesTo(this);
} catch (Throwable ex) {
Log.e(ex);
}
}

@ -159,7 +159,12 @@ public class AdapterLog extends RecyclerView.Adapter<AdapterLog.ViewHolder> {
Log.d("Changed @" + position + " #" + count);
}
});
diff.dispatchUpdatesTo(AdapterLog.this);
try {
diff.dispatchUpdatesTo(AdapterLog.this);
} catch (Throwable ex) {
Log.e(ex);
}
}
@Override

@ -373,7 +373,12 @@ public class AdapterNavAccountFolder extends RecyclerView.Adapter<AdapterNavAcco
Log.d("Changed @" + position + " #" + count);
}
});
diff.dispatchUpdatesTo(this);
try {
diff.dispatchUpdatesTo(this);
} catch (Throwable ex) {
Log.e(ex);
}
}
public void setExpanded(boolean expanded) {

@ -195,7 +195,12 @@ public class AdapterNavMenu extends RecyclerView.Adapter<AdapterNavMenu.ViewHold
Log.d("Changed @" + position + " #" + count);
}
});
diff.dispatchUpdatesTo(this);
try {
diff.dispatchUpdatesTo(this);
} catch (Throwable ex) {
Log.e(ex);
}
}
public void setExpanded(boolean expanded) {

@ -168,7 +168,12 @@ public class AdapterNavSearch extends RecyclerView.Adapter<AdapterNavSearch.View
Log.d("Changed @" + position + " #" + count);
}
});
diff.dispatchUpdatesTo(this);
try {
diff.dispatchUpdatesTo(this);
} catch (Throwable ex) {
Log.e(ex);
}
}
public void setExpanded(boolean expanded) {

@ -242,7 +242,12 @@ public class AdapterNavUnified extends RecyclerView.Adapter<AdapterNavUnified.Vi
Log.d("Changed @" + position + " #" + count);
}
});
diff.dispatchUpdatesTo(this);
try {
diff.dispatchUpdatesTo(this);
} catch (Throwable ex) {
Log.e(ex);
}
}
public void setExpanded(boolean expanded) {

@ -304,7 +304,12 @@ public class AdapterOperation extends RecyclerView.Adapter<AdapterOperation.View
Log.d("Changed @" + position + " #" + count);
}
});
diff.dispatchUpdatesTo(this);
try {
diff.dispatchUpdatesTo(this);
} catch (Throwable ex) {
Log.e(ex);
}
}
private static class DiffCallback extends DiffUtil.Callback {

@ -117,7 +117,12 @@ public class AdapterOrder extends RecyclerView.Adapter<AdapterOrder.ViewHolder>
Log.d("Changed @" + position + " #" + count);
}
});
diff.dispatchUpdatesTo(this);
try {
diff.dispatchUpdatesTo(this);
} catch (Throwable ex) {
Log.e(ex);
}
}
private static class DiffCallback extends DiffUtil.Callback {

@ -596,7 +596,12 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> {
Log.d("Changed @" + position + " #" + count);
}
});
diff.dispatchUpdatesTo(this);
try {
diff.dispatchUpdatesTo(this);
} catch (Throwable ex) {
Log.e(ex);
}
}
public void search(String query) {

@ -121,7 +121,12 @@ public class AdapterRuleMatch extends RecyclerView.Adapter<AdapterRuleMatch.View
Log.d("Changed @" + position + " #" + count);
}
});
diff.dispatchUpdatesTo(this);
try {
diff.dispatchUpdatesTo(this);
} catch (Throwable ex) {
Log.e(ex);
}
}
private static class DiffCallback extends DiffUtil.Callback {

@ -686,7 +686,12 @@ public class FragmentOptionsSynchronize extends FragmentBase implements SharedPr
DiffUtil.DiffResult diff = DiffUtil.calculateDiff(new DiffCallback(items, accounts), false);
items = accounts;
diff.dispatchUpdatesTo(this);
try {
diff.dispatchUpdatesTo(this);
} catch (Throwable ex) {
Log.e(ex);
}
}
private class DiffCallback extends DiffUtil.Callback {

Loading…
Cancel
Save