From 97c5d9b530f85a6539cfa931f41c00721079e62a Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 25 Nov 2017 20:23:56 +0100 Subject: [PATCH] do not cache config at ItemsAdapter to ensure fresh data --- .../filemanager/adapters/ItemsAdapter.kt | 10 +++++----- build.gradle | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt index 5249f597..6afaf96d 100644 --- a/app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/filemanager/adapters/ItemsAdapter.kt @@ -38,7 +38,6 @@ import java.util.zip.ZipOutputStream class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList, val listener: ItemOperationsListener?, recyclerView: MyRecyclerView, val isPickMultipleIntent: Boolean, itemClick: (Any) -> Unit) : MyRecyclerViewAdapter(activity, recyclerView, itemClick) { - private val config = activity.config lateinit private var folderDrawable: Drawable lateinit private var fileDrawable: Drawable @@ -123,11 +122,11 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList() selectedPositions.forEach { paths.add(fileDirItems[it].path) } - PropertiesDialog(activity, paths, config.shouldShowHidden) + PropertiesDialog(activity, paths, activity.config.shouldShowHidden) } } @@ -142,7 +141,8 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList) { if (file.isDirectory) { - file.listFiles()?.filter { if (config.shouldShowHidden) true else !it.isHidden }?.forEach { + val shouldShowHidden = activity.config.shouldShowHidden + file.listFiles()?.filter { if (shouldShowHidden) true else !it.isHidden }?.forEach { addFileUris(it, uris) } } else { @@ -173,7 +173,7 @@ class ItemsAdapter(activity: SimpleActivity, var fileDirItems: MutableList