remove the file cleanup

This commit is contained in:
tibbi 2018-01-31 19:08:18 +01:00
parent 5a24c92c96
commit 96b93c4cb2
3 changed files with 0 additions and 18 deletions

View file

@ -316,8 +316,4 @@ class Config(context: Context) : BaseConfig(context) {
var extendedDetails: Int
get() = prefs.getInt(EXTENDED_DETAILS, EXT_RESOLUTION or EXT_LAST_MODIFIED or EXT_EXIF_PROPERTIES)
set(extendedDetails) = prefs.edit().putInt(EXTENDED_DETAILS, extendedDetails).apply()
var lastFileCleanup: Long
get() = prefs.getLong(LAST_FILE_CLEANUP, 0L)
set(lastFileCleanup) = prefs.edit().putLong(LAST_FILE_CLEANUP, lastFileCleanup).apply()
}

View file

@ -43,7 +43,6 @@ const val VIEW_TYPE_FILES = "view_type_files"
const val SHOW_EXTENDED_DETAILS = "show_extended_details"
const val EXTENDED_DETAILS = "extended_details"
const val HIDE_EXTENDED_DETAILS = "hide_extended_details"
const val LAST_FILE_CLEANUP = "last_file_cleanup"
const val ONE_FINGER_ZOOM = "one_finger_zoom"
const val ALLOW_INSTANT_CHANGE = "allow_instant_change"
const val REPLACE_ZOOMABLE_IMAGES = "replace_zoomable_images"

View file

@ -40,19 +40,6 @@ class MediaFetcher(val context: Context) {
directories.remove(it)
}
Thread {
val ONE_WEEK = 7 * 24 * 60 * 60 * 1000
if (System.currentTimeMillis() - context.config.lastFileCleanup > ONE_WEEK) {
media.forEach {
val file = File(it.path)
if (!it.path.contains("/.thumbnails") && !file.exists() && file.length() == 0L) {
context.deleteFromMediaStore(file)
}
}
context.config.lastFileCleanup = System.currentTimeMillis()
}
}.start()
return directories
}