diff --git a/app/build.gradle b/app/build.gradle index 72c03e94..26ac63c8 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -152,7 +152,7 @@ dependencies { implementation "pl.droidsonroids.retrofit2:converter-jspoon:1.3.2" // Szkolny.eu libraries/forks - implementation "eu.szkolny:agendacalendarview:1799f8ef47" + implementation "eu.szkolny:agendacalendarview:5431f03098" implementation "eu.szkolny:cafebar:5bf0c618de" implementation "eu.szkolny.fslogin:lib:2.0.0" implementation "eu.szkolny:material-about-library:1d5ebaf47c" diff --git a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaFragmentDefault.kt b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaFragmentDefault.kt index 1aee0ab7..eb6f74fb 100644 --- a/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaFragmentDefault.kt +++ b/app/src/main/java/pl/szczodrzynski/edziennik/ui/modules/agenda/AgendaFragmentDefault.kt @@ -59,18 +59,28 @@ class AgendaFragmentDefault( private val manager get() = CalendarManager.getInstance() - // TODO: 2021-04-11 find a way to attach the OnScrollListener automatically - // then set this to IDLE by default - // the FAB also needs the original listener, though - private var scrollState = OnScrollListener.SCROLL_STATE_TOUCH_SCROLL + private var scrollState = OnScrollListener.SCROLL_STATE_IDLE private var updatePending = false private var notifyPending = false override fun onScrollStateChanged(view: AbsListView?, newScrollState: Int) { + b.agendaDefaultView.agendaScrollListener.onScrollStateChanged(view, scrollState) scrollState = newScrollState if (updatePending) updateData() if (notifyPending) notifyDataSetChanged() } + override fun onScroll( + view: AbsListView?, + firstVisibleItem: Int, + visibleItemCount: Int, + totalItemCount: Int + ) = b.agendaDefaultView.agendaScrollListener.onScroll( + view, + firstVisibleItem, + visibleItemCount, + totalItemCount + ) + /** * Mark the data as needing update, either after 1 second (when * not scrolling) or 1 second after scrolling stops. @@ -94,13 +104,6 @@ class AgendaFragmentDefault( } else notifyPending = true } - override fun onScroll( - view: AbsListView?, - firstVisibleItem: Int, - visibleItemCount: Int, - totalItemCount: Int - ) = Unit - suspend fun initView(fragment: AgendaFragment) { isInitialized = false @@ -183,6 +186,8 @@ class AgendaFragmentDefault( TeacherAbsenceEventRenderer() ) + listView.setOnScrollListener(this) + isInitialized = true b.progressBar.isVisible = false }