mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 00:17:58 +01:00
avoid refetching mediastore items unnecessarily
This commit is contained in:
parent
dae13c0261
commit
24efdebb86
2 changed files with 3 additions and 6 deletions
|
@ -2,14 +2,12 @@ package com.simplemobiletools.gallery.pro.extensions
|
|||
|
||||
import android.appwidget.AppWidgetManager
|
||||
import android.content.ComponentName
|
||||
import android.content.ContentUris
|
||||
import android.content.Context
|
||||
import android.content.Intent
|
||||
import android.database.Cursor
|
||||
import android.graphics.Bitmap
|
||||
import android.graphics.drawable.PictureDrawable
|
||||
import android.media.AudioManager
|
||||
import android.net.Uri
|
||||
import android.os.Process
|
||||
import android.provider.MediaStore.Files
|
||||
import android.provider.MediaStore.Images
|
||||
|
@ -29,7 +27,6 @@ import com.bumptech.glide.request.target.Target
|
|||
import com.bumptech.glide.signature.ObjectKey
|
||||
import com.simplemobiletools.commons.extensions.*
|
||||
import com.simplemobiletools.commons.helpers.*
|
||||
import com.simplemobiletools.commons.models.FileDirItem
|
||||
import com.simplemobiletools.gallery.pro.R
|
||||
import com.simplemobiletools.gallery.pro.activities.SettingsActivity
|
||||
import com.simplemobiletools.gallery.pro.asynctasks.GetMediaAsynctask
|
||||
|
@ -403,7 +400,7 @@ fun Context.storeDirectoryItems(items: ArrayList<Directory>) {
|
|||
|
||||
fun Context.checkAppendingHidden(path: String, hidden: String, includedFolders: MutableSet<String>, noMediaFolders: ArrayList<String>): String {
|
||||
val dirName = getFolderNameFromPath(path)
|
||||
val folderNoMediaStatuses = java.util.HashMap<String, Boolean>()
|
||||
val folderNoMediaStatuses = HashMap<String, Boolean>()
|
||||
noMediaFolders.forEach { folder ->
|
||||
folderNoMediaStatuses["$folder/$NOMEDIA"] = true
|
||||
}
|
||||
|
@ -646,7 +643,7 @@ fun Context.getCachedDirectories(
|
|||
val directories = try {
|
||||
directoryDao.getAll() as ArrayList<Directory>
|
||||
} catch (e: Exception) {
|
||||
ArrayList<Directory>()
|
||||
ArrayList()
|
||||
}
|
||||
|
||||
if (!config.showRecycleBinAtFolders) {
|
||||
|
|
|
@ -46,7 +46,7 @@ class MediaFetcher(val context: Context) {
|
|||
if (isRPlus() && curPath != FAVORITES && curPath != RECYCLE_BIN) {
|
||||
if (android11Files?.containsKey(curPath.toLowerCase()) == true) {
|
||||
curMedia.addAll(android11Files[curPath.toLowerCase()]!!)
|
||||
} else {
|
||||
} else if (android11Files == null) {
|
||||
val files = getAndroid11FolderMedia(isPickImage, isPickVideo, favoritePaths)
|
||||
if (files.containsKey(curPath.toLowerCase())) {
|
||||
curMedia.addAll(files[curPath.toLowerCase()]!!)
|
||||
|
|
Loading…
Reference in a new issue