Kotlin-AgendaCalendarView icon indicating copy to clipboard operation
Kotlin-AgendaCalendarView copied to clipboard

Question and bug: making "notifyDataSetChanged" stay on same place

Open AndroidDeveloperLB opened this issue 8 years ago • 1 comments

I've noticed that whether you scroll to the top or to the bottom, after it finishes loading, you call notifyDataSetChanged , but the scrolling stay almost on same place, almost perfectly.

How did you do this?

I've written about it here: https://stackoverflow.com/q/47458429/878126

Also, found an issue about this. If I let it load, and then I scroll a bit, it doesn't stay on the current place. Attached video to show issue. device-2017-11-26-114106.zip

AndroidDeveloperLB avatar Nov 26 '17 09:11 AndroidDeveloperLB

Seems you call setSelection right after updating the data, in scrollToCurrentDate function.

This works, but:

  1. it doesn't take into account the amount of scrolling. That's probably the reason for the bug I've mentioned.
  2. it uses a linear check of the dates. You could have chosen binary search instead.
  3. Why do you call post ? Seems to work fine without it.

AndroidDeveloperLB avatar Nov 26 '17 09:11 AndroidDeveloperLB