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() } }