Skip to content

Commit b5ce3be

Browse files
committed
fix footer
Signed-off-by: alperozturk96 <alper_ozturk@proton.me>
1 parent 9c0ea05 commit b5ce3be

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

app/src/main/java/com/owncloud/android/ui/adapter/localFileList/LocalFileListAdapter.kt

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -278,9 +278,15 @@ class LocalFileListAdapter(
278278
addToFooterEntries(insertedEntries)
279279
Log_OC.d(TAG, "appendPage, item size: ${loadedEntries.size}")
280280

281-
if (insertedEntries.isNotEmpty()) {
282-
notifyItemRangeInserted(startPositionInAdapter, insertedEntries.size)
281+
if (insertedEntries.isEmpty()) {
282+
return
283283
}
284+
285+
notifyItemRangeInserted(startPositionInAdapter, insertedEntries.size)
286+
287+
// inserting in front of the footer only shifts it down, it has to be rebound to show the
288+
// counts of the page that just arrived
289+
notifyItemChanged(itemCount - 1, PAYLOAD_FOOTER_COUNTS)
284290
}
285291

286292
fun setSortOrder(sortOrder: FileSortOrder) {
@@ -379,6 +385,9 @@ class LocalFileListAdapter(
379385
private const val HEADER_ID = Long.MIN_VALUE
380386
private const val FOOTER_ID = Long.MIN_VALUE + 1
381387

388+
/** Rebinds the footer in place, without the change animation of a payload free update. */
389+
private val PAYLOAD_FOOTER_COUNTS = Any()
390+
382391
@VisibleForTesting
383392
fun getStableItemId(position: Int, headerOffset: Int, files: List<File>): Long {
384393
if (headerOffset == HEADER_ITEM_COUNT && position == 0) {

0 commit comments

Comments
 (0)