First, if you set minHour to x and maxHour to x +1 the app crashes when creating a weekView with this values (also observed in 5.2.1 in my app).
Second, similar to the first one in 5.3.0 the app crashes also for wider ranges for minHour and maxHour. (E.g. minHour = 11 and maxHour = 20 is ok, but minHour = 12 and maxHour 20 leads to a crash)
To Reproduce
Use the setter methods to set the specific values and my app crashes instantly.
Additional context
Tested Android version: 10 on a 10" Samsung Tablet
WeekView version: 5.2.1 and 5.3.0
java.lang.IllegalArgumentException: Cannot coerce value to an empty range: maximum 0.0 is less than minimum 36.0.
at kotlin.ranges.RangesKt___RangesKt.coerceIn(_Ranges.kt:1131)
at com.alamkanak.weekview.Navigator.scrollVerticallyTo(Navigator.kt:73)
at com.alamkanak.weekview.WeekView.scrollToTime(WeekView.kt:1249)
at com.alamkanak.weekview.WeekView$scrollToDateTime$1.invoke(WeekView.kt:1210)
at com.alamkanak.weekview.WeekView$scrollToDateTime$1.invoke(WeekView.kt:21)
at com.alamkanak.weekview.WeekView.internalScrollToDate(WeekView.kt:1300)
at com.alamkanak.weekview.WeekView.scrollToDateTime(WeekView.kt:1209)
at com.alamkanak.weekview.WeekView.performPendingScroll(WeekView.kt:113)
at com.alamkanak.weekview.WeekView.onDraw(WeekView.kt:103)
at android.view.View.draw(View.java:23182)
at android.view.View.buildDrawingCacheImpl(View.java:22454)
at android.view.View.buildDrawingCache(View.java:22314)
at android.view.View.draw(View.java:22904)
at android.view.ViewGroup.drawChild(ViewGroup.java:5230)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987)
at android.view.View.updateDisplayListIfDirty(View.java:22043)
at android.view.View.draw(View.java:22912)
at android.view.ViewGroup.drawChild(ViewGroup.java:5230)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987)
at android.view.View.updateDisplayListIfDirty(View.java:22043)
at android.view.View.draw(View.java:22912)
at android.view.ViewGroup.drawChild(ViewGroup.java:5230)
at androidx.drawerlayout.widget.DrawerLayout.drawChild(DrawerLayout.java:1426)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987)
at android.view.View.updateDisplayListIfDirty(View.java:22043)
at android.view.View.draw(View.java:22912)
at android.view.ViewGroup.drawChild(ViewGroup.java:5230)
at androidx.coordinatorlayout.widget.CoordinatorLayout.drawChild(CoordinatorLayout.java:1277)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987)
at android.view.View.updateDisplayListIfDirty(View.java:22043)
at android.view.View.draw(View.java:22912)
at android.view.ViewGroup.drawChild(ViewGroup.java:5230)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987)
at android.view.View.updateDisplayListIfDirty(View.java:22043)
at android.view.View.draw(View.java:22912)
at android.view.ViewGroup.drawChild(ViewGroup.java:5230)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987)
at android.view.View.updateDisplayListIfDirty(View.java:22043)
at android.view.View.draw(View.java:22912)
at android.view.ViewGroup.drawChild(ViewGroup.java:5230)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987)
at android.view.View.updateDisplayListIfDirty(View.java:22043)
at android.view.View.draw(View.java:22912)
at android.view.ViewGroup.drawChild(ViewGroup.java:5230)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987)
at android.view.View.updateDisplayListIfDirty(View.java:22043)
at android.view.View.draw(View.java:22912)
at android.view.ViewGroup.drawChild(ViewGroup.java:5230)
at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987)
at android.view.View.draw(View.java:23185)
at com.android.internal.policy.DecorView.draw(DecorView.java:1120)
at android.view.View.updateDisplayListIfDirty(View.java:22057)
at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:588)
at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:594)
at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:667)
at android.view.ViewRootImpl.draw(ViewRootImpl.java:4267)
at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:4051)
at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3324)
at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2204)
at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9078)
at android.view.Choreographer$CallbackRecord.run(Choreographer.java:999)
at android.view.Choreographer.doCallbacks(Choreographer.java:797)
Describe the bug Basically their are 2 bugs:
First, if you set minHour to x and maxHour to x +1 the app crashes when creating a weekView with this values (also observed in 5.2.1 in my app). Second, similar to the first one in 5.3.0 the app crashes also for wider ranges for minHour and maxHour. (E.g. minHour = 11 and maxHour = 20 is ok, but minHour = 12 and maxHour 20 leads to a crash)
To Reproduce Use the setter methods to set the specific values and my app crashes instantly.
Additional context
WeekView version: 5.2.1 and 5.3.0
java.lang.IllegalArgumentException: Cannot coerce value to an empty range: maximum 0.0 is less than minimum 36.0. at kotlin.ranges.RangesKt___RangesKt.coerceIn(_Ranges.kt:1131) at com.alamkanak.weekview.Navigator.scrollVerticallyTo(Navigator.kt:73) at com.alamkanak.weekview.WeekView.scrollToTime(WeekView.kt:1249) at com.alamkanak.weekview.WeekView$scrollToDateTime$1.invoke(WeekView.kt:1210) at com.alamkanak.weekview.WeekView$scrollToDateTime$1.invoke(WeekView.kt:21) at com.alamkanak.weekview.WeekView.internalScrollToDate(WeekView.kt:1300) at com.alamkanak.weekview.WeekView.scrollToDateTime(WeekView.kt:1209) at com.alamkanak.weekview.WeekView.performPendingScroll(WeekView.kt:113) at com.alamkanak.weekview.WeekView.onDraw(WeekView.kt:103) at android.view.View.draw(View.java:23182) at android.view.View.buildDrawingCacheImpl(View.java:22454) at android.view.View.buildDrawingCache(View.java:22314) at android.view.View.draw(View.java:22904) at android.view.ViewGroup.drawChild(ViewGroup.java:5230) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987) at android.view.View.updateDisplayListIfDirty(View.java:22043) at android.view.View.draw(View.java:22912) at android.view.ViewGroup.drawChild(ViewGroup.java:5230) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987) at android.view.View.updateDisplayListIfDirty(View.java:22043) at android.view.View.draw(View.java:22912) at android.view.ViewGroup.drawChild(ViewGroup.java:5230) at androidx.drawerlayout.widget.DrawerLayout.drawChild(DrawerLayout.java:1426) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987) at android.view.View.updateDisplayListIfDirty(View.java:22043) at android.view.View.draw(View.java:22912) at android.view.ViewGroup.drawChild(ViewGroup.java:5230) at androidx.coordinatorlayout.widget.CoordinatorLayout.drawChild(CoordinatorLayout.java:1277) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987) at android.view.View.updateDisplayListIfDirty(View.java:22043) at android.view.View.draw(View.java:22912) at android.view.ViewGroup.drawChild(ViewGroup.java:5230) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987) at android.view.View.updateDisplayListIfDirty(View.java:22043) at android.view.View.draw(View.java:22912) at android.view.ViewGroup.drawChild(ViewGroup.java:5230) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987) at android.view.View.updateDisplayListIfDirty(View.java:22043) at android.view.View.draw(View.java:22912) at android.view.ViewGroup.drawChild(ViewGroup.java:5230) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987) at android.view.View.updateDisplayListIfDirty(View.java:22043) at android.view.View.draw(View.java:22912) at android.view.ViewGroup.drawChild(ViewGroup.java:5230) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987) at android.view.View.updateDisplayListIfDirty(View.java:22043) at android.view.View.draw(View.java:22912) at android.view.ViewGroup.drawChild(ViewGroup.java:5230) at android.view.ViewGroup.dispatchDraw(ViewGroup.java:4987) at android.view.View.draw(View.java:23185) at com.android.internal.policy.DecorView.draw(DecorView.java:1120) at android.view.View.updateDisplayListIfDirty(View.java:22057) at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:588) at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:594) at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:667) at android.view.ViewRootImpl.draw(ViewRootImpl.java:4267) at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:4051) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3324) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:2204) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:9078) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:999) at android.view.Choreographer.doCallbacks(Choreographer.java:797)