mirror of
https://github.com/SchildiChat/SchildiChat-android.git
synced 2025-03-17 19:58:57 +03:00
Uploads: load element until loader not displayed anymore
This commit is contained in:
parent
e3ed3e5b05
commit
907a786b1a
2 changed files with 9 additions and 3 deletions
|
@ -51,6 +51,8 @@ class UploadsFileController @Inject constructor(
|
|||
|
||||
var listener: Listener? = null
|
||||
|
||||
private var idx = 0
|
||||
|
||||
init {
|
||||
setData(null)
|
||||
}
|
||||
|
@ -92,7 +94,8 @@ class UploadsFileController @Inject constructor(
|
|||
|
||||
if (data.hasMore) {
|
||||
loadingItem {
|
||||
id("loadMore")
|
||||
// Always use a different id, because we can be notified several times of visibility state changed
|
||||
id("loadMore${idx++}")
|
||||
onVisibilityStateChanged { _, _, visibilityState ->
|
||||
if (visibilityState == VisibilityState.VISIBLE) {
|
||||
listener?.loadMore()
|
||||
|
|
|
@ -58,7 +58,9 @@ class UploadsMediaController @Inject constructor(
|
|||
|
||||
var listener: Listener? = null
|
||||
|
||||
private val itemSize = dimensionConverter.dpToPx(64)
|
||||
private var idx = 0
|
||||
|
||||
private val itemSize = dimensionConverter.dpToPx(IMAGE_SIZE_DP)
|
||||
|
||||
init {
|
||||
setData(null)
|
||||
|
@ -101,7 +103,8 @@ class UploadsMediaController @Inject constructor(
|
|||
|
||||
if (data.hasMore) {
|
||||
squareLoadingItem {
|
||||
id("loadMore")
|
||||
// Always use a different id, because we can be notified several times of visibility state changed
|
||||
id("loadMore${idx++}")
|
||||
onVisibilityStateChanged { _, _, visibilityState ->
|
||||
if (visibilityState == VisibilityState.VISIBLE) {
|
||||
listener?.loadMore()
|
||||
|
|
Loading…
Add table
Reference in a new issue