From 42bd31f38b40a76bdf16c4717c96d468628d61d4 Mon Sep 17 00:00:00 2001 From: tibbi Date: Thu, 15 Mar 2018 21:28:30 +0100 Subject: [PATCH] limit the cached folders size to 60 just to be sure --- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 3 ++- .../com/simplemobiletools/gallery/activities/MediaActivity.kt | 1 - .../kotlin/com/simplemobiletools/gallery/helpers/Constants.kt | 2 ++ 3 files changed, 4 insertions(+), 2 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 8ebbc88da..b0b5feecc 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -602,7 +602,8 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener { private fun storeDirectories() { if (!config.temporarilyShowHidden && config.tempFolderPath.isEmpty()) { - val directories = Gson().toJson(mDirs) + val subList = mDirs.subList(0, Math.min(SAVE_DIRS_CNT, mDirs.size)) + val directories = Gson().toJson(subList) config.directories = directories } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index dc6d589d8..92e2decf5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -45,7 +45,6 @@ import java.io.File import java.io.IOException class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { - private val SAVE_MEDIA_CNT = 80 private val LAST_MEDIA_CHECK_PERIOD = 3000L private var mPath = "" diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt index 509a5f1d5..535d6f4bf 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/Constants.kt @@ -65,6 +65,8 @@ const val MAX_COLUMN_COUNT = 20 const val SHOW_TEMP_HIDDEN_DURATION = 600000L const val CLICK_MAX_DURATION = 150 const val DRAG_THRESHOLD = 8 +const val SAVE_DIRS_CNT = 60 +const val SAVE_MEDIA_CNT = 80 const val DIRECTORY = "directory" const val MEDIUM = "medium"