Closed thellmund closed 3 years ago
@thellmund It seems like what I need But there are still some errors as below
Wrong snapping page behavior https://user-images.githubusercontent.com/9895294/116836057-5b2ad800-abef-11eb-9e0b-869965ccbc13.mp4
Wrong week page after snapping page. For example: At the first snapping, Correct behavior is still keeping 05/03 -> 05/09 But, the week view was scrolled to 04/26 -> 05/02 https://user-images.githubusercontent.com/9895294/116836177-be1c6f00-abef-11eb-9ebf-7a7b7318be55.mp4
Besides, it sometimes crashes
2021-05-03 09:06:31.109 7945-7945/com.alamkanak.weekview E/AndroidRuntime: FATAL EXCEPTION: main Process: com.alamkanak.weekview, PID: 7945 java.lang.IllegalArgumentException: Layout: -1 < 0 at android.text.Layout.<init>(Layout.java:253) at android.text.StaticLayout.<init>(StaticLayout.java:562) at android.text.StaticLayout.<init>(StaticLayout.java:49) at android.text.StaticLayout$Builder.build(StaticLayout.java:416) at com.alamkanak.weekview.TextExtensionsKt.toTextLayout(TextExtensions.kt:29) at com.alamkanak.weekview.TextExtensionsKt.toTextLayout$default(TextExtensions.kt:22) at com.alamkanak.weekview.TextFitter.fitText(TextFitter.kt:37) at com.alamkanak.weekview.TextFitter.fitSingleEvent(TextFitter.kt:30) at com.alamkanak.weekview.TextFitter.fit(TextFitter.kt:17) at com.alamkanak.weekview.SingleEventsUpdater.calculateTextLayouts(CalendarRenderer.kt:98) at com.alamkanak.weekview.SingleEventsUpdater.update(CalendarRenderer.kt:63) at com.alamkanak.weekview.CalendarRenderer.render(CalendarRenderer.kt:30) at com.alamkanak.weekview.WeekView.performRendering(WeekView.kt:132) at com.alamkanak.weekview.WeekView.onDraw(WeekView.kt:106) at android.view.View.draw(View.java:22246) at android.view.View.buildDrawingCacheImpl(View.java:21519) at android.view.View.buildDrawingCache(View.java:21379) at android.view.View.updateDisplayListIfDirty(View.java:21099) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4403) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4376) at android.view.View.updateDisplayListIfDirty(View.java:21082) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4403) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4376) at android.view.View.updateDisplayListIfDirty(View.java:21082) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4403) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4376) at android.view.View.updateDisplayListIfDirty(View.java:21082) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4403) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4376) at android.view.View.updateDisplayListIfDirty(View.java:21082) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4403) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4376) at android.view.View.updateDisplayListIfDirty(View.java:21082) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4403) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4376) at android.view.View.updateDisplayListIfDirty(View.java:21082) at android.view.ViewGroup.recreateChildDisplayList(ViewGroup.java:4403) at android.view.ViewGroup.dispatchGetDisplayList(ViewGroup.java:4376) at android.view.View.updateDisplayListIfDirty(View.java:21082) at android.view.ThreadedRenderer.updateViewTreeDisplayList(ThreadedRenderer.java:559) at android.view.ThreadedRenderer.updateRootDisplayList(ThreadedRenderer.java:565) at android.view.ThreadedRenderer.draw(ThreadedRenderer.java:642) at android.view.ViewRootImpl.draw(ViewRootImpl.java:4031) at android.view.ViewRootImpl.performDraw(ViewRootImpl.java:3758) at android.view.ViewRootImpl.performTraversals(ViewRootImpl.java:3031) at android.view.ViewRootImpl.doTraversal(ViewRootImpl.java:1906) at android.view.ViewRootImpl$TraversalRunnable.run(ViewRootImpl.java:8089) at android.view.Choreographer$CallbackRecord.run(Choreographer.java:972) at android.view.Choreographer.doCallbacks(Choreographer.java:796) at android.view.Choreographer.doFrame(Choreographer.java:731) at android.view.Choreographer$FrameDisplayEventReceiver.run(Choreographer.java:957) at android.os.Handler.handleCallback(Handler.java:907) at android.os.Handler.dispatchMessage(Handler.java:99) at android.os.Looper.loop(Looper.java:223) at android.app.ActivityThread.main(ActivityThread.java:7478) at java.lang.reflect.Method.invoke(Native Method) at com.android.internal.os.RuntimeInit$MethodAndArgsCaller.run(RuntimeInit.java:549) 2021-05-03 09:06:31.109 7945-7945/com.alamkanak.weekview E/AndroidRuntime: at com.android.internal.os.ZygoteInit.main(ZygoteInit.java:941)
After zoom, the week view is scrolled to next week
https://user-images.githubusercontent.com/9895294/116836536-1acc5980-abf1-11eb-9bd6-3383b2076a8e.mp4
You can refer to my repositories https://github.com/HuuNguyen312/Android-Week-View/
While the code is not pretty, the behavior seems to be correct :D
@HuuNguyen312 These issues should be resolved now. Take it for another spin and let me know if things look good to you.
Resolves: #243 Resolves: #244
Previous behavior
https://user-images.githubusercontent.com/11819826/116818963-f8c4cf80-ab3b-11eb-80da-f942bfb4e1c1.mp4
New behavior with
stickToActualWeek
enabledhttps://user-images.githubusercontent.com/11819826/116818896-a5528180-ab3b-11eb-95bc-f3230ad19c60.mp4