mirror of
https://github.com/FossifyOrg/Gallery.git
synced 2024-11-26 22:47:59 +01:00
check if hidden folders are temporarily shown in a couple more places
This commit is contained in:
parent
785a8bf589
commit
bc73f0d807
10 changed files with 18 additions and 12 deletions
|
@ -56,7 +56,7 @@ class ExcludedFoldersActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addExcludedFolder() {
|
private fun addExcludedFolder() {
|
||||||
FilePickerDialog(this, pickFile = false, showHidden = config.showHiddenFolders) {
|
FilePickerDialog(this, pickFile = false, showHidden = config.shouldShowHidden) {
|
||||||
config.addExcludedFolder(it)
|
config.addExcludedFolder(it)
|
||||||
updateExcludedFolders()
|
updateExcludedFolders()
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,7 +57,7 @@ class IncludedFoldersActivity : SimpleActivity() {
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun addIncludedFolder() {
|
private fun addIncludedFolder() {
|
||||||
FilePickerDialog(this, pickFile = false, showHidden = config.showHiddenFolders) {
|
FilePickerDialog(this, pickFile = false, showHidden = config.shouldShowHidden) {
|
||||||
config.addIncludedFolder(it)
|
config.addIncludedFolder(it)
|
||||||
updateIncludedFolders()
|
updateIncludedFolders()
|
||||||
scanPath(it) {}
|
scanPath(it) {}
|
||||||
|
|
|
@ -113,6 +113,11 @@ class MainActivity : SimpleActivity(), DirectoryAdapter.DirOperationsListener {
|
||||||
mStoredAnimateGifs = config.animateGifs
|
mStoredAnimateGifs = config.animateGifs
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onStop() {
|
||||||
|
super.onStop()
|
||||||
|
config.temporarilyShowHidden = false
|
||||||
|
}
|
||||||
|
|
||||||
override fun onDestroy() {
|
override fun onDestroy() {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
config.isFirstRun = false
|
config.isFirstRun = false
|
||||||
|
@ -158,7 +163,6 @@ 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()
|
||||||
|
|
|
@ -177,7 +177,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
|
||||||
private fun hideFolder() {
|
private fun hideFolder() {
|
||||||
addNoMedia(mPath) {
|
addNoMedia(mPath) {
|
||||||
runOnUiThread {
|
runOnUiThread {
|
||||||
if (!config.showHiddenFolders)
|
if (!config.shouldShowHidden)
|
||||||
finish()
|
finish()
|
||||||
else
|
else
|
||||||
invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
|
|
|
@ -149,11 +149,11 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
|
||||||
private fun showProperties() {
|
private fun showProperties() {
|
||||||
val selections = multiSelector.selectedPositions
|
val selections = multiSelector.selectedPositions
|
||||||
if (selections.size <= 1) {
|
if (selections.size <= 1) {
|
||||||
PropertiesDialog(activity, dirs[selections[0]].path, config.showHiddenFolders)
|
PropertiesDialog(activity, dirs[selections[0]].path, config.shouldShowHidden)
|
||||||
} else {
|
} else {
|
||||||
val paths = ArrayList<String>()
|
val paths = ArrayList<String>()
|
||||||
selections.forEach { paths.add(dirs[it].path) }
|
selections.forEach { paths.add(dirs[it].path) }
|
||||||
PropertiesDialog(activity, paths, config.showHiddenFolders)
|
PropertiesDialog(activity, paths, config.shouldShowHidden)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -108,11 +108,11 @@ class MediaAdapter(val activity: SimpleActivity, var media: MutableList<Medium>,
|
||||||
private fun showProperties() {
|
private fun showProperties() {
|
||||||
val selections = multiSelector.selectedPositions
|
val selections = multiSelector.selectedPositions
|
||||||
if (selections.size <= 1) {
|
if (selections.size <= 1) {
|
||||||
PropertiesDialog(activity, media[selections[0]].path, config.showHiddenFolders)
|
PropertiesDialog(activity, media[selections[0]].path, config.shouldShowHidden)
|
||||||
} else {
|
} else {
|
||||||
val paths = ArrayList<String>()
|
val paths = ArrayList<String>()
|
||||||
selections.forEach { paths.add(media[it].path) }
|
selections.forEach { paths.add(media[it].path) }
|
||||||
PropertiesDialog(activity, paths, config.showHiddenFolders)
|
PropertiesDialog(activity, paths, config.shouldShowHidden)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -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 || config.temporarilyShowHidden
|
val showHidden = config.shouldShowHidden
|
||||||
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)
|
||||||
|
|
|
@ -43,7 +43,7 @@ class PickAlbumDialog(val activity: SimpleActivity, val sourcePath: String, val
|
||||||
}
|
}
|
||||||
|
|
||||||
fun showOtherFolder() {
|
fun showOtherFolder() {
|
||||||
val showHidden = activity.config.showHiddenFolders
|
val showHidden = activity.config.shouldShowHidden
|
||||||
FilePickerDialog(activity, sourcePath, false, showHidden, true) {
|
FilePickerDialog(activity, sourcePath, false, showHidden, true) {
|
||||||
callback.invoke(it)
|
callback.invoke(it)
|
||||||
}
|
}
|
||||||
|
|
|
@ -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 || config.temporarilyShowHidden) {
|
if (config.shouldShowHidden) {
|
||||||
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 && !config.temporarilyShowHidden) {
|
if (!config.shouldShowHidden) {
|
||||||
isFolderVisible(it, noMediaFolders)
|
isFolderVisible(it, noMediaFolders)
|
||||||
} else
|
} else
|
||||||
true
|
true
|
||||||
|
|
|
@ -40,6 +40,8 @@ class Config(context: Context) : BaseConfig(context) {
|
||||||
get() = prefs.getBoolean(HIDE_FOLDER_TOOLTIP_SHOWN, false)
|
get() = prefs.getBoolean(HIDE_FOLDER_TOOLTIP_SHOWN, false)
|
||||||
set(wasShown) = prefs.edit().putBoolean(HIDE_FOLDER_TOOLTIP_SHOWN, wasShown).apply()
|
set(wasShown) = prefs.edit().putBoolean(HIDE_FOLDER_TOOLTIP_SHOWN, wasShown).apply()
|
||||||
|
|
||||||
|
var shouldShowHidden = showHiddenFolders || temporarilyShowHidden
|
||||||
|
|
||||||
var showHiddenFolders: Boolean
|
var showHiddenFolders: Boolean
|
||||||
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()
|
||||||
|
|
Loading…
Reference in a new issue