thellmund / Android-Week-View

Display highly customizable calendar views in your Android app
Apache License 2.0
188 stars 98 forks source link

Adapter#onRangeChanged not called on Nougat and earlier #227

Closed RemiNV closed 3 years ago

RemiNV commented 3 years ago

Describe the bug When scrolling horizontally, Adapter#onRangeChanged is not called on Nougat (Android 7.1) and earlier

To Reproduce Steps to reproduce the behavior:

  1. Create a WeekView with a SimpleAdapter
  2. Scroll horizontally

Expected behavior onRangeChanged is called

Actual behavior onRangeChanged is not called

Additional context Until Android 8, ValueAnimator set mRunning to false after calling the onAnimationEnd callback. See Android 7.1: https://cs.android.com/android/platform/superproject/+/android-7.1.1_r58:frameworks/base/core/java/android/animation/ValueAnimator.java;l=1144-1157

And Android 8.0: https://cs.android.com/android/platform/superproject/+/android-8.0.0_r1:frameworks/base/core/java/android/animation/ValueAnimator.java;l=1198-1218

This was changed in this commit: https://cs.android.com/android/_/android/platform/frameworks/base/+/0eba1dfba040c096f8cd1b7b6d4c289ee78db4b8

Due to this, when WeekView#notifyRangeChangedListener is called at the end of the Navigator animation, navigator.isNotRunning is still false and the adapter callbacks are not fired.

thellmund commented 3 years ago

Nice investigation 👏 Fixed the issue and will roll this out with the next release.