do not always check invalid db files, only in 20%
This commit is contained in:
parent
bf4d53f14d
commit
3272398f49
1 changed files with 15 additions and 11 deletions
|
@ -42,6 +42,7 @@ import java.util.HashSet
|
|||
import java.util.LinkedHashSet
|
||||
import kotlin.Comparator
|
||||
import kotlin.collections.ArrayList
|
||||
import kotlin.random.Random
|
||||
|
||||
val Context.portrait get() = resources.configuration.orientation == Configuration.ORIENTATION_PORTRAIT
|
||||
val Context.audioManager get() = getSystemService(Context.AUDIO_SERVICE) as AudioManager
|
||||
|
@ -564,6 +565,8 @@ fun Context.getCachedMedia(path: String, getVideosOnly: Boolean = false, getImag
|
|||
val grouped = mediaFetcher.groupMedia(media, pathToUse)
|
||||
callback(grouped.clone() as ArrayList<ThumbnailItem>)
|
||||
|
||||
val value = Random.nextInt(5)
|
||||
if (value == 1) {
|
||||
val mediaToDelete = ArrayList<Medium>()
|
||||
media.filter { !File(it.path).exists() }.forEach {
|
||||
if (it.path.startsWith(recycleBinPath)) {
|
||||
|
@ -579,6 +582,7 @@ fun Context.getCachedMedia(path: String, getVideosOnly: Boolean = false, getImag
|
|||
}
|
||||
} catch (ignored: Exception) {
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue