Uploads: load element until loader not displayed anymore
This commit is contained in:
parent
e3ed3e5b05
commit
907a786b1a
@ -51,6 +51,8 @@ class UploadsFileController @Inject constructor(
|
|||||||
|
|
||||||
var listener: Listener? = null
|
var listener: Listener? = null
|
||||||
|
|
||||||
|
private var idx = 0
|
||||||
|
|
||||||
init {
|
init {
|
||||||
setData(null)
|
setData(null)
|
||||||
}
|
}
|
||||||
@ -92,7 +94,8 @@ class UploadsFileController @Inject constructor(
|
|||||||
|
|
||||||
if (data.hasMore) {
|
if (data.hasMore) {
|
||||||
loadingItem {
|
loadingItem {
|
||||||
id("loadMore")
|
// Always use a different id, because we can be notified several times of visibility state changed
|
||||||
|
id("loadMore${idx++}")
|
||||||
onVisibilityStateChanged { _, _, visibilityState ->
|
onVisibilityStateChanged { _, _, visibilityState ->
|
||||||
if (visibilityState == VisibilityState.VISIBLE) {
|
if (visibilityState == VisibilityState.VISIBLE) {
|
||||||
listener?.loadMore()
|
listener?.loadMore()
|
||||||
|
@ -58,7 +58,9 @@ class UploadsMediaController @Inject constructor(
|
|||||||
|
|
||||||
var listener: Listener? = null
|
var listener: Listener? = null
|
||||||
|
|
||||||
private val itemSize = dimensionConverter.dpToPx(64)
|
private var idx = 0
|
||||||
|
|
||||||
|
private val itemSize = dimensionConverter.dpToPx(IMAGE_SIZE_DP)
|
||||||
|
|
||||||
init {
|
init {
|
||||||
setData(null)
|
setData(null)
|
||||||
@ -101,7 +103,8 @@ class UploadsMediaController @Inject constructor(
|
|||||||
|
|
||||||
if (data.hasMore) {
|
if (data.hasMore) {
|
||||||
squareLoadingItem {
|
squareLoadingItem {
|
||||||
id("loadMore")
|
// Always use a different id, because we can be notified several times of visibility state changed
|
||||||
|
id("loadMore${idx++}")
|
||||||
onVisibilityStateChanged { _, _, visibilityState ->
|
onVisibilityStateChanged { _, _, visibilityState ->
|
||||||
if (visibilityState == VisibilityState.VISIBLE) {
|
if (visibilityState == VisibilityState.VISIBLE) {
|
||||||
listener?.loadMore()
|
listener?.loadMore()
|
||||||
|
Loading…
x
Reference in New Issue
Block a user