sublist directories at background update

This commit is contained in:
tibbi 2018-04-14 23:02:01 +02:00
parent 3fdce65fe0
commit 870b8c6837
1 changed files with 3 additions and 1 deletions

View File

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