From 870b8c6837268a18951609ec5644b60c8c5ef7ad Mon Sep 17 00:00:00 2001 From: tibbi Date: Sat, 14 Apr 2018 23:02:01 +0200 Subject: [PATCH] sublist directories at background update --- .../gallery/receivers/RefreshMediaReceiver.kt | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/receivers/RefreshMediaReceiver.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/receivers/RefreshMediaReceiver.kt index 589f98b45..e2c2731d5 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/receivers/RefreshMediaReceiver.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/receivers/RefreshMediaReceiver.kt @@ -6,11 +6,13 @@ import android.content.Intent import com.google.gson.Gson import com.simplemobiletools.gallery.asynctasks.GetDirectoriesAsynctask import com.simplemobiletools.gallery.extensions.config +import com.simplemobiletools.gallery.helpers.SAVE_DIRS_CNT class RefreshMediaReceiver : BroadcastReceiver() { override fun onReceive(context: Context, intent: Intent) { GetDirectoriesAsynctask(context, false, false) { - context.config.directories = Gson().toJson(it) + val subList = it.subList(0, Math.min(SAVE_DIRS_CNT, it.size)) + context.config.directories = Gson().toJson(subList) }.execute() } }