remove Trashbin items after 30 days
This commit is contained in:
parent
9d4913d575
commit
6c85b43930
|
@ -120,6 +120,8 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
config.wasRecycleBinPinned = true
|
||||
config.saveFolderGrouping(SHOW_ALL, GROUP_BY_DATE_TAKEN or GROUP_DESCENDING)
|
||||
}
|
||||
|
||||
checkRecycleBinItems()
|
||||
}
|
||||
|
||||
override fun onStart() {
|
||||
|
@ -925,6 +927,20 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
}, LAST_MEDIA_CHECK_PERIOD)
|
||||
}
|
||||
|
||||
private fun checkRecycleBinItems() {
|
||||
if (config.useRecycleBin) {
|
||||
Thread {
|
||||
val mediumDao = galleryDB.MediumDao()
|
||||
val deletedMedia = mediumDao.getDeletedMedia()
|
||||
deletedMedia.forEach {
|
||||
if (System.currentTimeMillis() > it.deletedTS + MONTH_MILLISECONDS) {
|
||||
mediumDao.deleteMediumPath(it.path)
|
||||
}
|
||||
}
|
||||
}.start()
|
||||
}
|
||||
}
|
||||
|
||||
override fun refreshItems() {
|
||||
getDirectories()
|
||||
}
|
||||
|
|
|
@ -1,5 +1,7 @@
|
|||
package com.simplemobiletools.gallery.helpers
|
||||
|
||||
import com.simplemobiletools.commons.helpers.MONTH_SECONDS
|
||||
|
||||
// shared preferences
|
||||
const val DIRECTORY_SORT_ORDER = "directory_sort_order"
|
||||
const val SORT_FOLDER_PREFIX = "sort_folder_"
|
||||
|
@ -76,6 +78,7 @@ const val MAX_COLUMN_COUNT = 20
|
|||
const val SHOW_TEMP_HIDDEN_DURATION = 300000L
|
||||
const val CLICK_MAX_DURATION = 150
|
||||
const val DRAG_THRESHOLD = 8
|
||||
const val MONTH_MILLISECONDS = MONTH_SECONDS * 1000L
|
||||
|
||||
const val DIRECTORY = "directory"
|
||||
const val MEDIUM = "medium"
|
||||
|
|
Loading…
Reference in New Issue