mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
run media fetcher on reboot on a background thread
This commit is contained in:
parent
3214df4065
commit
74cd554248
1 changed files with 5 additions and 2 deletions
|
@ -3,13 +3,16 @@ package com.simplemobiletools.gallery.pro.receivers
|
||||||
import android.content.BroadcastReceiver
|
import android.content.BroadcastReceiver
|
||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import com.simplemobiletools.commons.helpers.ensureBackgroundThread
|
||||||
import com.simplemobiletools.gallery.pro.extensions.updateDirectoryPath
|
import com.simplemobiletools.gallery.pro.extensions.updateDirectoryPath
|
||||||
import com.simplemobiletools.gallery.pro.helpers.MediaFetcher
|
import com.simplemobiletools.gallery.pro.helpers.MediaFetcher
|
||||||
|
|
||||||
class BootCompletedReceiver : BroadcastReceiver() {
|
class BootCompletedReceiver : BroadcastReceiver() {
|
||||||
override fun onReceive(context: Context, intent: Intent) {
|
override fun onReceive(context: Context, intent: Intent) {
|
||||||
|
ensureBackgroundThread {
|
||||||
MediaFetcher(context).getFoldersToScan().forEach {
|
MediaFetcher(context).getFoldersToScan().forEach {
|
||||||
context.updateDirectoryPath(it)
|
context.updateDirectoryPath(it)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
Loading…
Reference in a new issue