From b4e1e0c0971ed44dc9fb2ccd646e14d5b952d2a3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Tue, 24 Apr 2018 09:42:13 +0200 Subject: [PATCH] remove mDirs from the MainActivity --- .../gallery/activities/MainActivity.kt | 17 ++++------------- .../gallery/adapters/DirectoryAdapter.kt | 8 ++++---- 2 files changed, 8 insertions(+), 17 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index ffc071dcd..f64d84277 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -42,8 +42,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private val LAST_MEDIA_CHECK_PERIOD = 3000L private val NEW_APP_PACKAGE = "com.simplemobiletools.clock" - lateinit var mDirs: ArrayList - private var mIsPickImageIntent = false private var mIsPickVideoIntent = false private var mIsGetImageContentIntent = false @@ -86,7 +84,6 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { removeTempFolder() directories_refresh_layout.setOnRefreshListener { getDirectories() } - mDirs = ArrayList() storeStateVariables() checkWhatsNewDialog() @@ -287,7 +284,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { if (config.directorySorting and SORT_BY_DATE_MODIFIED > 0 || config.directorySorting and SORT_BY_DATE_TAKEN > 0) { getDirectories() } else { - gotDirectories(mDirs) + gotDirectories(getCurrentlyDisplayedDirs()) } } } @@ -417,7 +414,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { FilePickerDialog(this, internalStoragePath, false, config.shouldShowHidden) { CreateNewFolderDialog(this, it) { config.tempFolderPath = it - gotDirectories(addTempFolderIfNeeded(mDirs)) + gotDirectories(addTempFolderIfNeeded(getCurrentlyDisplayedDirs())) } } } @@ -757,16 +754,10 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { } override fun recheckPinnedFolders() { - gotDirectories(movePinnedDirectoriesToFront(mDirs)) + gotDirectories(movePinnedDirectoriesToFront(getCurrentlyDisplayedDirs())) } - override fun updateDirectories(directories: ArrayList, refreshList: Boolean) { - if (refreshList) { - gotDirectories(directories) - } else { - mDirs = directories - } - + override fun updateDirectories(directories: ArrayList) { Thread { storeDirectoryItems(directories) removeInvalidDirectories() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index 1d0529e1c..2da3bc1b3 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -171,7 +171,7 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList, refreshList: Boolean) + fun updateDirectories(directories: ArrayList) } }