mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
try setting higher thread priority at fetching cached folders
This commit is contained in:
parent
95a8c327ee
commit
f4c788fa94
1 changed files with 6 additions and 0 deletions
|
@ -8,6 +8,7 @@ import android.database.Cursor
|
||||||
import android.graphics.Bitmap
|
import android.graphics.Bitmap
|
||||||
import android.graphics.drawable.PictureDrawable
|
import android.graphics.drawable.PictureDrawable
|
||||||
import android.media.AudioManager
|
import android.media.AudioManager
|
||||||
|
import android.os.Process
|
||||||
import android.provider.MediaStore.Files
|
import android.provider.MediaStore.Files
|
||||||
import android.provider.MediaStore.Images
|
import android.provider.MediaStore.Images
|
||||||
import android.widget.ImageView
|
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) {
|
fun Context.getCachedDirectories(getVideosOnly: Boolean = false, getImagesOnly: Boolean = false, forceShowHidden: Boolean = false, callback: (ArrayList<Directory>) -> Unit) {
|
||||||
ensureBackgroundThread {
|
ensureBackgroundThread {
|
||||||
|
try {
|
||||||
|
Process.setThreadPriority(Process.THREAD_PRIORITY_MORE_FAVORABLE)
|
||||||
|
} catch (ignored: Exception) {
|
||||||
|
}
|
||||||
|
|
||||||
val directories = try {
|
val directories = try {
|
||||||
directoryDao.getAll() as ArrayList<Directory>
|
directoryDao.getAll() as ArrayList<Directory>
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
|
|
Loading…
Reference in a new issue