mirror of
https://github.com/M66B/FairEmail.git
synced 2024-12-21 23:32:51 +00:00
Prevent crash
This commit is contained in:
parent
980f077990
commit
ecd99a08fd
2 changed files with 54 additions and 1 deletions
|
@ -94,7 +94,28 @@ final class GestureRouter<T extends OnGestureListener & OnDoubleTapListener>
|
|||
|
||||
@Override
|
||||
public void onLongPress(@NonNull MotionEvent e) {
|
||||
mDelegates.get(e).onLongPress(e);
|
||||
try {
|
||||
mDelegates.get(e).onLongPress(e);
|
||||
} catch (Throwable ex) {
|
||||
eu.faircode.email.Log.w(ex);
|
||||
/*
|
||||
java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling eu.faircode.email.FixedRecyclerView{239c688b VFED.... ........ 0,0-800,1162 #7f0a04da app:id/rvMessage}, adapter:eu.faircode.email.AdapterMessage@209415c5, layout:eu.faircode.email.FragmentMessages$7@190d7b1a, context:eu.faircode.email.ActivityView@3e8522fb
|
||||
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.notifyItemChanged(SourceFile:2)
|
||||
at androidx.recyclerview.selection.EventBridge$TrackerToAdapterBridge.onItemStateChanged(SourceFile:3)
|
||||
at androidx.recyclerview.selection.DefaultSelectionTracker.notifyItemStateChanged(SourceFile:3)
|
||||
at androidx.recyclerview.selection.DefaultSelectionTracker.select(SourceFile:8)
|
||||
at androidx.recyclerview.selection.MotionInputHandler.selectItem(SourceFile:4)
|
||||
at androidx.recyclerview.selection.TouchInputHandler.onLongPress(SourceFile:10)
|
||||
at androidx.recyclerview.selection.GestureRouter.onLongPress(SourceFile:1)
|
||||
at android.view.GestureDetector.dispatchLongPress(GestureDetector.java:700)
|
||||
at android.view.GestureDetector.access$200(GestureDetector.java:40)
|
||||
at android.view.GestureDetector$GestureHandler.handleMessage(GestureDetector.java:273)
|
||||
at android.os.Handler.dispatchMessage(Handler.java:102)
|
||||
*/
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -83,3 +83,35 @@
|
|||
}
|
||||
}
|
||||
},
|
||||
--- a/app/src/main/java/androidx/recyclerview/selection/GestureRouter.java
|
||||
+++ b/app/src/main/java/androidx/recyclerview/selection/GestureRouter.java
|
||||
@@ -94,7 +94,28 @@ final class GestureRouter<T extends OnGestureListener & OnDoubleTapListener>
|
||||
|
||||
@Override
|
||||
public void onLongPress(@NonNull MotionEvent e) {
|
||||
- mDelegates.get(e).onLongPress(e);
|
||||
+ try {
|
||||
+ mDelegates.get(e).onLongPress(e);
|
||||
+ } catch (Throwable ex) {
|
||||
+ eu.faircode.email.Log.w(ex);
|
||||
+ /*
|
||||
+ java.lang.IllegalStateException: Cannot call this method while RecyclerView is computing a layout or scrolling eu.faircode.email.FixedRecyclerView{239c688b VFED.... ........ 0,0-800,1162 #7f0a04da app:id/rvMessage}, adapter:eu.faircode.email.AdapterMessage@209415c5, layout:eu.faircode.email.FragmentMessages$7@190d7b1a, context:eu.faircode.email.ActivityView@3e8522fb
|
||||
+ 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.notifyItemChanged(SourceFile:2)
|
||||
+ at androidx.recyclerview.selection.EventBridge$TrackerToAdapterBridge.onItemStateChanged(SourceFile:3)
|
||||
+ at androidx.recyclerview.selection.DefaultSelectionTracker.notifyItemStateChanged(SourceFile:3)
|
||||
+ at androidx.recyclerview.selection.DefaultSelectionTracker.select(SourceFile:8)
|
||||
+ at androidx.recyclerview.selection.MotionInputHandler.selectItem(SourceFile:4)
|
||||
+ at androidx.recyclerview.selection.TouchInputHandler.onLongPress(SourceFile:10)
|
||||
+ at androidx.recyclerview.selection.GestureRouter.onLongPress(SourceFile:1)
|
||||
+ at android.view.GestureDetector.dispatchLongPress(GestureDetector.java:700)
|
||||
+ at android.view.GestureDetector.access$200(GestureDetector.java:40)
|
||||
+ at android.view.GestureDetector$GestureHandler.handleMessage(GestureDetector.java:273)
|
||||
+ at android.os.Handler.dispatchMessage(Handler.java:102)
|
||||
+ */
|
||||
+ }
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
Loading…
Reference in a new issue