mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-30 00:17:58 +01:00
remove Trashbin items after 30 days
This commit is contained in:
parent
9d4913d575
commit
6c85b43930
2 changed files with 19 additions and 0 deletions
|
@ -120,6 +120,8 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
config.wasRecycleBinPinned = true
|
config.wasRecycleBinPinned = true
|
||||||
config.saveFolderGrouping(SHOW_ALL, GROUP_BY_DATE_TAKEN or GROUP_DESCENDING)
|
config.saveFolderGrouping(SHOW_ALL, GROUP_BY_DATE_TAKEN or GROUP_DESCENDING)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
checkRecycleBinItems()
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onStart() {
|
override fun onStart() {
|
||||||
|
@ -925,6 +927,20 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
}, LAST_MEDIA_CHECK_PERIOD)
|
}, 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() {
|
override fun refreshItems() {
|
||||||
getDirectories()
|
getDirectories()
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
package com.simplemobiletools.gallery.helpers
|
package com.simplemobiletools.gallery.helpers
|
||||||
|
|
||||||
|
import com.simplemobiletools.commons.helpers.MONTH_SECONDS
|
||||||
|
|
||||||
// shared preferences
|
// shared preferences
|
||||||
const val DIRECTORY_SORT_ORDER = "directory_sort_order"
|
const val DIRECTORY_SORT_ORDER = "directory_sort_order"
|
||||||
const val SORT_FOLDER_PREFIX = "sort_folder_"
|
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 SHOW_TEMP_HIDDEN_DURATION = 300000L
|
||||||
const val CLICK_MAX_DURATION = 150
|
const val CLICK_MAX_DURATION = 150
|
||||||
const val DRAG_THRESHOLD = 8
|
const val DRAG_THRESHOLD = 8
|
||||||
|
const val MONTH_MILLISECONDS = MONTH_SECONDS * 1000L
|
||||||
|
|
||||||
const val DIRECTORY = "directory"
|
const val DIRECTORY = "directory"
|
||||||
const val MEDIUM = "medium"
|
const val MEDIUM = "medium"
|
||||||
|
|
Loading…
Reference in a new issue