Skip to content

Commit

Permalink
Provide stable IDs to allow retaining views
Browse files Browse the repository at this point in the history
  • Loading branch information
AbandonedCart committed Mar 5, 2024
1 parent 734dc86 commit 7204cf6
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class BrowserAdapter(
}

override fun getItemId(position: Int): Long {
return position.toLong()
return data[position]?.id?.plus(position) ?: position.toLong()
}

private fun getItem(i: Int): AmiiboFile? {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ class FoomiiboAdapter(
}

override fun getItemId(position: Int): Long {
return position.toLong()
return data[position].id + position
}

private fun getItem(i: Int): Amiibo {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ class WriteTagAdapter(private val settings: BrowserSettings?) :
}

override fun getItemId(position: Int): Long {
return position.toLong()
return amiiboFiles[position]?.id?.plus(position) ?: position.toLong()
}

private fun getItem(i: Int): AmiiboFile? {
Expand Down

0 comments on commit 7204cf6

Please sign in to comment.