try setting higher thread priority at fetching cached folders

This commit is contained in:
tibbi 2021-03-08 22:59:08 +01:00
parent 95a8c327ee
commit f4c788fa94
1 changed files with 6 additions and 0 deletions

View File

@ -8,6 +8,7 @@ import android.database.Cursor
import android.graphics.Bitmap
import android.graphics.drawable.PictureDrawable
import android.media.AudioManager
import android.os.Process
import android.provider.MediaStore.Files
import android.provider.MediaStore.Images
import android.widget.ImageView
@ -587,6 +588,11 @@ fun Context.tryLoadingWithPicasso(path: String, view: MySquareImageView, cropThu
fun Context.getCachedDirectories(getVideosOnly: Boolean = false, getImagesOnly: Boolean = false, forceShowHidden: Boolean = false, callback: (ArrayList<Directory>) -> Unit) {
ensureBackgroundThread {
try {
Process.setThreadPriority(Process.THREAD_PRIORITY_MORE_FAVORABLE)
} catch (ignored: Exception) {
}
val directories = try {
directoryDao.getAll() as ArrayList<Directory>
} catch (e: Exception) {