recheck folder content if we notice that it changed
This commit is contained in:
parent
5c0f33f38f
commit
e68392b1e4
3 changed files with 22 additions and 1 deletions
|
@ -573,7 +573,9 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
|
||||
private fun gotDirectories(newDirs: ArrayList<Directory>, isFromCache: Boolean) {
|
||||
if (!isFromCache) {
|
||||
setupLatestMediaId()
|
||||
Thread {
|
||||
checkFolderContentChange(newDirs)
|
||||
}.start()
|
||||
}
|
||||
|
||||
val dirs = getSortedDirectories(newDirs)
|
||||
|
@ -600,6 +602,18 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
|||
}
|
||||
}
|
||||
|
||||
private fun checkFolderContentChange(newDirs: ArrayList<Directory>) {
|
||||
newDirs.forEach {
|
||||
val storedShortDirValue = config.loadFolderMediaShort(it.path)
|
||||
if (storedShortDirValue != it.toString()) {
|
||||
config.saveFolderMediaShort(it.path, it.toString())
|
||||
if (storedShortDirValue.isNotEmpty()) {
|
||||
updateStoredFolderItems(it.path)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private fun storeDirectories() {
|
||||
if (!config.temporarilyShowHidden && config.tempFolderPath.isEmpty()) {
|
||||
val subList = mDirs.subList(0, Math.min(SAVE_DIRS_CNT, mDirs.size))
|
||||
|
|
|
@ -124,6 +124,12 @@ class Config(context: Context) : BaseConfig(context) {
|
|||
|
||||
fun loadFolderMedia(path: String) = prefs.getString(SAVE_FOLDER_PREFIX + path, "")
|
||||
|
||||
fun saveFolderMediaShort(path: String, value: String) {
|
||||
prefs.edit().putString(SAVE_FOLDER_SHORT_PREFIX + path, value).apply()
|
||||
}
|
||||
|
||||
fun loadFolderMediaShort(path: String) = prefs.getString(SAVE_FOLDER_SHORT_PREFIX + path, "")
|
||||
|
||||
var autoplayVideos: Boolean
|
||||
get() = prefs.getBoolean(AUTOPLAY_VIDEOS, false)
|
||||
set(autoplay) = prefs.edit().putBoolean(AUTOPLAY_VIDEOS, autoplay).apply()
|
||||
|
|
|
@ -26,6 +26,7 @@ const val MEDIA_HORIZONTAL_COLUMN_CNT = "media_horizontal_column_cnt"
|
|||
const val MEDIA_LANDSCAPE_HORIZONTAL_COLUMN_CNT = "media_landscape_horizontal_column_cnt"
|
||||
const val SHOW_ALL = "show_all" // display images and videos from all folders together
|
||||
const val SAVE_FOLDER_PREFIX = "folder2_"
|
||||
const val SAVE_FOLDER_SHORT_PREFIX = "folder_short_"
|
||||
const val HIDE_FOLDER_TOOLTIP_SHOWN = "hide_folder_tooltip_shown"
|
||||
const val EXCLUDED_FOLDERS = "excluded_folders"
|
||||
const val INCLUDED_FOLDERS = "included_folders"
|
||||
|
|
Loading…
Reference in a new issue