mirror of
https://github.com/szkolny-eu/szkolny-android.git
synced 2024-11-24 19:04:38 -06:00
[Agenda] Update scroll listeners code.
This commit is contained in:
parent
f5ceaa9afe
commit
12619f6bde
@ -152,7 +152,7 @@ dependencies {
|
|||||||
implementation "pl.droidsonroids.retrofit2:converter-jspoon:1.3.2"
|
implementation "pl.droidsonroids.retrofit2:converter-jspoon:1.3.2"
|
||||||
|
|
||||||
// Szkolny.eu libraries/forks
|
// Szkolny.eu libraries/forks
|
||||||
implementation "eu.szkolny:agendacalendarview:1799f8ef47"
|
implementation "eu.szkolny:agendacalendarview:5431f03098"
|
||||||
implementation "eu.szkolny:cafebar:5bf0c618de"
|
implementation "eu.szkolny:cafebar:5bf0c618de"
|
||||||
implementation "eu.szkolny.fslogin:lib:2.0.0"
|
implementation "eu.szkolny.fslogin:lib:2.0.0"
|
||||||
implementation "eu.szkolny:material-about-library:1d5ebaf47c"
|
implementation "eu.szkolny:material-about-library:1d5ebaf47c"
|
||||||
|
@ -59,18 +59,28 @@ class AgendaFragmentDefault(
|
|||||||
private val manager
|
private val manager
|
||||||
get() = CalendarManager.getInstance()
|
get() = CalendarManager.getInstance()
|
||||||
|
|
||||||
// TODO: 2021-04-11 find a way to attach the OnScrollListener automatically
|
private var scrollState = OnScrollListener.SCROLL_STATE_IDLE
|
||||||
// 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 updatePending = false
|
private var updatePending = false
|
||||||
private var notifyPending = false
|
private var notifyPending = false
|
||||||
override fun onScrollStateChanged(view: AbsListView?, newScrollState: Int) {
|
override fun onScrollStateChanged(view: AbsListView?, newScrollState: Int) {
|
||||||
|
b.agendaDefaultView.agendaScrollListener.onScrollStateChanged(view, scrollState)
|
||||||
scrollState = newScrollState
|
scrollState = newScrollState
|
||||||
if (updatePending) updateData()
|
if (updatePending) updateData()
|
||||||
if (notifyPending) notifyDataSetChanged()
|
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
|
* Mark the data as needing update, either after 1 second (when
|
||||||
* not scrolling) or 1 second after scrolling stops.
|
* not scrolling) or 1 second after scrolling stops.
|
||||||
@ -94,13 +104,6 @@ class AgendaFragmentDefault(
|
|||||||
} else notifyPending = true
|
} else notifyPending = true
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onScroll(
|
|
||||||
view: AbsListView?,
|
|
||||||
firstVisibleItem: Int,
|
|
||||||
visibleItemCount: Int,
|
|
||||||
totalItemCount: Int
|
|
||||||
) = Unit
|
|
||||||
|
|
||||||
suspend fun initView(fragment: AgendaFragment) {
|
suspend fun initView(fragment: AgendaFragment) {
|
||||||
isInitialized = false
|
isInitialized = false
|
||||||
|
|
||||||
@ -183,6 +186,8 @@ class AgendaFragmentDefault(
|
|||||||
TeacherAbsenceEventRenderer()
|
TeacherAbsenceEventRenderer()
|
||||||
)
|
)
|
||||||
|
|
||||||
|
listView.setOnScrollListener(this)
|
||||||
|
|
||||||
isInitialized = true
|
isInitialized = true
|
||||||
b.progressBar.isVisible = false
|
b.progressBar.isVisible = false
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user