Skip to content

Commit

Permalink
Fixed Pictures list autoscroll when coming back from Preview
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Boulongne <[email protected]>
  • Loading branch information
KevinBoulongne committed Mar 3, 2022
1 parent 0514e51 commit 0c627bf
Showing 1 changed file with 13 additions and 8 deletions.
21 changes: 13 additions & 8 deletions app/src/main/java/com/infomaniak/drive/ui/menu/PicturesFragment.kt
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,19 @@ class PicturesFragment(private val onFinish: (() -> Unit)? = null) : MultiSelect
updateMultiSelectMode = { onItemSelected() }
}

picturesAdapter = PicturesAdapter(
multiSelectManager = multiSelectManager,
onFileClicked = { file -> Utils.displayFile(mainViewModel, findNavController(), file, picturesAdapter.pictureList) },
).apply {
numberItemLoader = NUMBER_ITEMS_LOADER
stateRestorationPolicy = RecyclerView.Adapter.StateRestorationPolicy.PREVENT

adapter = this
val isPicturesAdapterInitialized = ::picturesAdapter.isInitialized
if (!isPicturesAdapterInitialized) {
picturesAdapter = PicturesAdapter(
multiSelectManager = multiSelectManager,
onFileClicked = { file ->
Utils.displayFile(mainViewModel, findNavController(), file, picturesAdapter.pictureList)
},
).apply {
numberItemLoader = NUMBER_ITEMS_LOADER
stateRestorationPolicy = RecyclerView.Adapter.StateRestorationPolicy.PREVENT

adapter = this
}
}

if (menuPicturesBinding != null) multiSelectManager.enabledMultiSelectMode = true
Expand Down

0 comments on commit 0c627bf

Please sign in to comment.