android-times-square icon indicating copy to clipboard operation
android-times-square copied to clipboard

Android 10 (API 28) - ScrollToDate(Date) & ScrollTo(0, position): don't work

Open DarkDvr opened this issue 5 years ago • 1 comments

ScrollToDate(Date oneOfSelectedDates) doesn't do anything. Calendar stays at scroll position 0, at the earliest date. Android 9 and earlier - works fine.

SmoothScrollToPosition does work, but if your earliest date is, say 5 years ago, scroll animation takes a long time.

Reproduction steps (just a sample, assume undeclared variables having valid values):

CalendarPickerView tsCal = findViewById(R.id.tsCal);

Calendar earliestDate = Calendar.getInstance();
Calendar latestDate = Calendar.getInstance();
earliestDate.add(Calendar.YEAR, -5);
latestDate.add(Calendar.HOUR, 1);

tsCal.init(earliestDate.getTime(), latestDate.getTime())
                .inMode(mode)
                .withSelectedDates(someArrayListOfDates);

// works only in Android 9 and earlier:
tsCal.scrollTo(0, intAnyValidPosition);
tsCal.scrollBy(0, intAnyValidPosition);
tsCal.scrollToDate(someArrayListOfDates.get(0))

// works on any version I've tested, but isn't a valid solution due to time spent scrolling:
tsCal.smoothScrollToPosition(intAnyValidPosition);

DarkDvr avatar Aug 01 '20 14:08 DarkDvr

Nobody actively works on ATS anymore, maybe try adding this to the sample app and submitting a PR that shows the brokenness? That would make it as easy as possible for somebody to jump in and figure out a fix.

edenman avatar Aug 01 '20 21:08 edenman