Open betri28 opened 7 years ago
When does this occur?
I dont know when. I see that in crash report in firebase. I read your code in ScrollingUtilities, exception divide by zero at
layoutManager.scrollToPositionWithOffset(spanCount * exactItemPos / scrollPosState.rowHeight,
-(exactItemPos % scrollPosState.rowHeight));
scrollPosState.rowHeight = 0 at some potision. Can rowHeight = 0 ???
This may happen if materialScrollBar.recyclerView.getChildAt(0);
returns null. Could I see the adapter for the recyclerView in question?
i'm having the same issue
Could I see the adapter for the recyclerView in question?
@turing-tech, i'm having the same issue in firebase logs too.
As adapter I use FastAdapter library by mikepenz:
protected ModelAdapter<Model, Item> itemAdapter = new ModelAdapter<>(this::toItem);
protected ItemAdapter<ProgressItem> footerAdapter = ItemAdapter.items();
protected FastAdapter<Item> fastAdapter = FastAdapter.with(Arrays.asList(itemAdapter, footerAdapter));
...
recyclerView.setAdapter(fastAdapter);
dragScrollBar.setRecyclerView(recyclerView);
Both sub-adapters can be empty.
@DranzerX I am still unable to replicate. I have copied the given code verbatim.
Could you give me an updated stacktrace with the latest version of the library? The one originally provided no longer matches the code.
@turing-tech here it is:
Fatal Exception: java.lang.ArithmeticException
divide by zero
com.turingtechnologies.materialscrollbar.ScrollingUtilities.scrollToPositionAtProgress (ScrollingUtilities.java:129)
com.turingtechnologies.materialscrollbar.MaterialScrollBar.setTouchIntercept (MaterialScrollBar.java:745)
com.turingtechnologies.materialscrollbar.DragScrollBar.setTouchIntercept (DragScrollBar.java:65)
com.turingtechnologies.materialscrollbar.DragScrollBar$$Lambda$1.onTouch (Unknown Source:4)
android.view.View.dispatchTouchEvent (View.java:11784)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2968)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2647)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2974)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2604)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2974)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2604)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2974)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2604)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2974)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2604)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2974)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2604)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2974)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2604)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2974)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2604)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2974)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2604)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2974)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2604)
android.view.ViewGroup.dispatchTransformedTouchEvent (ViewGroup.java:2974)
android.view.ViewGroup.dispatchTouchEvent (ViewGroup.java:2604)
com.android.internal.policy.DecorView.superDispatchTouchEvent (DecorView.java:549)
com.android.internal.policy.PhoneWindow.superDispatchTouchEvent (PhoneWindow.java:1953)
android.app.Activity.dispatchTouchEvent (Activity.java:3548)
android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent (WindowCallbackWrapper.java:68)
android.support.v7.view.WindowCallbackWrapper.dispatchTouchEvent (WindowCallbackWrapper.java:68)
com.android.internal.policy.DecorView.dispatchTouchEvent (DecorView.java:502)
android.view.View.dispatchPointerEvent (View.java:12027)
android.view.ViewRootImpl$ViewPostImeInputStage.processPointerEvent (ViewRootImpl.java:5240)
android.view.ViewRootImpl$ViewPostImeInputStage.onProcess (ViewRootImpl.java:5030)
android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4544)
android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:4597)
android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:4563)
android.view.ViewRootImpl$AsyncInputStage.forward (ViewRootImpl.java:4690)
android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:4571)
android.view.ViewRootImpl$AsyncInputStage.apply (ViewRootImpl.java:4747)
android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4544)
android.view.ViewRootImpl$InputStage.onDeliverToNext (ViewRootImpl.java:4597)
android.view.ViewRootImpl$InputStage.forward (ViewRootImpl.java:4563)
android.view.ViewRootImpl$InputStage.apply (ViewRootImpl.java:4571)
android.view.ViewRootImpl$InputStage.deliver (ViewRootImpl.java:4544)
android.view.ViewRootImpl.deliverInputEvent (ViewRootImpl.java:7121)
android.view.ViewRootImpl.doProcessInputEvents (ViewRootImpl.java:7095)
android.view.ViewRootImpl.enqueueInputEvent (ViewRootImpl.java:7056)
android.view.ViewRootImpl$WindowInputEventReceiver.onInputEvent (ViewRootImpl.java:7277)
android.view.InputEventReceiver.dispatchInputEvent (InputEventReceiver.java:192)
android.os.MessageQueue.nativePollOnce (MessageQueue.java)
android.os.MessageQueue.next (MessageQueue.java:379)
android.os.Looper.loop (Looper.java:144)
android.app.ActivityThread.main (ActivityThread.java:7425)
java.lang.reflect.Method.invoke (Method.java)
com.android.internal.os.Zygote$MethodAndArgsCaller.run (Zygote.java:245)
com.android.internal.os.ZygoteInit.main (ZygoteInit.java:921)
I can't reproduce this too, but I see ~100 crashes per 20k runs in firebase crashlytics, on different devices and different versions of Android. Maybe dragbar incorrectly stay visible when the adapter is empty and user interaction cause this problem?
Push the newest version and see what happens. I basically just wrapped it in a try catch, as I'm hoping it's just an edge case that happens when the view first appears. If reports of misbehaviour continue to occur I'll look into it further.
@turing-tech thank you, I'll try.
Crash in some device:
Model: LG-F160 Board: Gv Android API: 16 Android OS: 4.1.2
Model: SM-G928C Board: Universal7420 Android API: 24 Android OS: 7.0
Here is log stack traces: