-
Notifications
You must be signed in to change notification settings - Fork 493
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Calendar sometimes scrolls to first month, on visibility change. #190
Comments
Kindly try reproducing this with one of the examples so I can look into it. |
@kizitonwose In your example, switching is also reproduced, just try to quickly and for a long time switch calendar modes. |
In my application, the delay between clicks is 650 ms, and the duration of animation (folding/unfolding) the calendar is 200 ms, so this is not due to the incorrect cancellation of the animation. |
I looked around the library code a bit and the method
|
@hikkidev I think I see how this could happen. Could you try using the new Something like this: val monthToWeek = monthViewCheckBox.isChecked
if (monthToWeek) {
// One row calendar for week mode
calendarView.updateMonthConfiguration(
inDateStyle = InDateStyle.ALL_MONTHS,
maxRowCount = 1,
hasBoundaries = false
)
} else {
// Six row calendar for month mode
calendarView.updateMonthConfiguration(
inDateStyle = InDateStyle.FIRST_MONTH,
maxRowCount = 6,
hasBoundaries = true
)
} |
@kizitonwose i already use it. private fun CalendarView.applyWeekMode() {
updateMonthConfiguration(
inDateStyle = InDateStyle.FIRST_MONTH,
maxRowCount = 1,
hasBoundaries = false
)
}
private fun CalendarView.applyMonthMode() {
updateMonthConfiguration(
inDateStyle = InDateStyle.ALL_MONTHS,
maxRowCount = maxWeekPerPage,
hasBoundaries = true
)
} |
Interesting, I'll investigate this when I find some time and will report back. |
@kizitonwose thanks |
I tried toggling the checkbox in Example 1 repeatedly and the best I could get was an animation-related crash. I think an easy workaround for this would be to disable the checkbox before starting the animation and enabling it afterward. binding.weekModeCheckBox.setOnCheckedChangeListener { checkBox, monthToWeek ->
animator.doOnStart {
checkBox.isEnabled = false
// Other logic
}
animator.doOnEnd {
checkBox.isEnabled = true
// Other logic
}
} |
Guess I can close this for now. |
Pretty basic setup, and when I toggle calendar visibility, the calendar sometimes scrolls to first month. It is just random. At first I thought it was some action on my end, and I've debugged it thoroughly, and followed the flow, nothing special apart from visibility change from gone to visible, and calendar just jumps to the first month set instead of staying at currently set month.
The text was updated successfully, but these errors were encountered: