temporarily show hidden folders if selected so
This commit is contained in:
parent
9de1ba808d
commit
250771f21b
5 changed files with 11 additions and 4 deletions
|
@ -158,6 +158,7 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
mCurrAsyncTask = GetDirectoriesAsynctask(applicationContext, mIsPickVideoIntent || mIsGetVideoContentIntent, mIsPickImageIntent || mIsGetImageContentIntent) {
|
mCurrAsyncTask = GetDirectoriesAsynctask(applicationContext, mIsPickVideoIntent || mIsGetVideoContentIntent, mIsPickImageIntent || mIsGetImageContentIntent) {
|
||||||
|
config.temporarilyShowHidden = false
|
||||||
gotDirectories(it)
|
gotDirectories(it)
|
||||||
}
|
}
|
||||||
mCurrAsyncTask!!.execute()
|
mCurrAsyncTask!!.execute()
|
||||||
|
@ -179,7 +180,8 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun temporarilyShowHidden() {
|
private fun temporarilyShowHidden() {
|
||||||
|
config.temporarilyShowHidden = true
|
||||||
|
getDirectories()
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun checkIfColorChanged() {
|
private fun checkIfColorChanged() {
|
||||||
|
|
|
@ -71,7 +71,7 @@ class GetDirectoriesAsynctask(val context: Context, val isPickVideo: Boolean, va
|
||||||
private fun groupDirectories(media: ArrayList<Medium>): Map<String, Directory> {
|
private fun groupDirectories(media: ArrayList<Medium>): Map<String, Directory> {
|
||||||
val hidden = context.resources.getString(R.string.hidden)
|
val hidden = context.resources.getString(R.string.hidden)
|
||||||
val directories = LinkedHashMap<String, Directory>()
|
val directories = LinkedHashMap<String, Directory>()
|
||||||
val showHidden = config.showHiddenFolders
|
val showHidden = config.showHiddenFolders || config.temporarilyShowHidden
|
||||||
for ((name, path, isVideo, dateModified, dateTaken, size) in media) {
|
for ((name, path, isVideo, dateModified, dateTaken, size) in media) {
|
||||||
if (shouldStop)
|
if (shouldStop)
|
||||||
cancel(true)
|
cancel(true)
|
||||||
|
|
|
@ -70,7 +70,7 @@ fun Context.getParents(): ArrayList<String> {
|
||||||
|
|
||||||
val noMediaFolders = getNoMediaFolders()
|
val noMediaFolders = getNoMediaFolders()
|
||||||
val parents = ArrayList<String>()
|
val parents = ArrayList<String>()
|
||||||
if (config.showHiddenFolders) {
|
if (config.showHiddenFolders || config.temporarilyShowHidden) {
|
||||||
parentsSet.addAll(noMediaFolders)
|
parentsSet.addAll(noMediaFolders)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -79,7 +79,7 @@ fun Context.getParents(): ArrayList<String> {
|
||||||
parentsSet.filterTo(parents, {
|
parentsSet.filterTo(parents, {
|
||||||
val file = File(it)
|
val file = File(it)
|
||||||
if (file.isDirectory && file.canonicalFile == file.absoluteFile) { // filter out symbolic links too
|
if (file.isDirectory && file.canonicalFile == file.absoluteFile) { // filter out symbolic links too
|
||||||
if (!config.showHiddenFolders) {
|
if (!config.showHiddenFolders && !config.temporarilyShowHidden) {
|
||||||
isFolderVisible(it, noMediaFolders)
|
isFolderVisible(it, noMediaFolders)
|
||||||
} else
|
} else
|
||||||
true
|
true
|
||||||
|
|
|
@ -44,6 +44,10 @@ class Config(context: Context) : BaseConfig(context) {
|
||||||
get() = prefs.getBoolean(SHOW_HIDDEN_FOLDERS, false)
|
get() = prefs.getBoolean(SHOW_HIDDEN_FOLDERS, false)
|
||||||
set(showHiddenFolders) = prefs.edit().putBoolean(SHOW_HIDDEN_FOLDERS, showHiddenFolders).apply()
|
set(showHiddenFolders) = prefs.edit().putBoolean(SHOW_HIDDEN_FOLDERS, showHiddenFolders).apply()
|
||||||
|
|
||||||
|
var temporarilyShowHidden: Boolean
|
||||||
|
get() = prefs.getBoolean(TEMPORARILY_SHOW_HIDDEN, false)
|
||||||
|
set(temporarilyShowHidden) = prefs.edit().putBoolean(TEMPORARILY_SHOW_HIDDEN, temporarilyShowHidden).apply()
|
||||||
|
|
||||||
var pinnedFolders: Set<String>
|
var pinnedFolders: Set<String>
|
||||||
get() = prefs.getStringSet(PINNED_FOLDERS, HashSet<String>())
|
get() = prefs.getStringSet(PINNED_FOLDERS, HashSet<String>())
|
||||||
set(pinnedFolders) = prefs.edit().putStringSet(PINNED_FOLDERS, pinnedFolders).apply()
|
set(pinnedFolders) = prefs.edit().putStringSet(PINNED_FOLDERS, pinnedFolders).apply()
|
||||||
|
|
|
@ -5,6 +5,7 @@ val SORT_ORDER = "sort_order"
|
||||||
val DIRECTORY_SORT_ORDER = "directory_sort_order"
|
val DIRECTORY_SORT_ORDER = "directory_sort_order"
|
||||||
val SORT_FOLDER_PREFIX = "sort_folder_"
|
val SORT_FOLDER_PREFIX = "sort_folder_"
|
||||||
val SHOW_HIDDEN_FOLDERS = "show_hidden_folders"
|
val SHOW_HIDDEN_FOLDERS = "show_hidden_folders"
|
||||||
|
val TEMPORARILY_SHOW_HIDDEN = "temporarily_show_hidden"
|
||||||
val AUTOPLAY_VIDEOS = "autoplay_videos"
|
val AUTOPLAY_VIDEOS = "autoplay_videos"
|
||||||
val LOOP_VIDEOS = "loop_videos"
|
val LOOP_VIDEOS = "loop_videos"
|
||||||
val ANIMATE_GIFS = "animate_gifs"
|
val ANIMATE_GIFS = "animate_gifs"
|
||||||
|
|
Loading…
Reference in a new issue