diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt index 45c3eeb64..df67d2b61 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/extensions/Context.kt @@ -42,7 +42,6 @@ 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 @@ -565,23 +564,20 @@ fun Context.getCachedMedia(path: String, getVideosOnly: Boolean = false, getImag val grouped = mediaFetcher.groupMedia(media, pathToUse) callback(grouped.clone() as ArrayList) - val value = Random.nextInt(5) - if (value == 1) { - val mediaToDelete = ArrayList() - media.filter { !File(it.path).exists() }.forEach { - if (it.path.startsWith(recycleBinPath)) { - deleteDBPath(mediumDao, it.path) - } else { - mediaToDelete.add(it) - } + val mediaToDelete = ArrayList() + media.filter { !File(it.path).exists() }.forEach { + if (it.path.startsWith(recycleBinPath)) { + deleteDBPath(mediumDao, it.path) + } else { + mediaToDelete.add(it) } + } - try { - if (mediaToDelete.isNotEmpty()) { - mediumDao.deleteMedia(*mediaToDelete.toTypedArray()) - } - } catch (ignored: Exception) { + try { + if (mediaToDelete.isNotEmpty()) { + mediumDao.deleteMedia(*mediaToDelete.toTypedArray()) } + } catch (ignored: Exception) { } }.start() }