add a button for temporarily showing excluded
This commit is contained in:
parent
b03e9dadbd
commit
284ff32771
6 changed files with 44 additions and 3 deletions
|
@ -92,6 +92,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
|
|
||||||
if (savedInstanceState == null) {
|
if (savedInstanceState == null) {
|
||||||
config.temporarilyShowHidden = false
|
config.temporarilyShowHidden = false
|
||||||
|
config.temporarilyShowExcluded = false
|
||||||
config.tempSkipDeleteConfirmation = false
|
config.tempSkipDeleteConfirmation = false
|
||||||
removeTempFolder()
|
removeTempFolder()
|
||||||
checkRecycleBinItems()
|
checkRecycleBinItems()
|
||||||
|
@ -247,9 +248,10 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
override fun onStop() {
|
override fun onStop() {
|
||||||
super.onStop()
|
super.onStop()
|
||||||
|
|
||||||
if (config.temporarilyShowHidden || config.tempSkipDeleteConfirmation) {
|
if (config.temporarilyShowHidden || config.tempSkipDeleteConfirmation || config.temporarilyShowExcluded) {
|
||||||
mTempShowHiddenHandler.postDelayed({
|
mTempShowHiddenHandler.postDelayed({
|
||||||
config.temporarilyShowHidden = false
|
config.temporarilyShowHidden = false
|
||||||
|
config.temporarilyShowExcluded = false
|
||||||
config.tempSkipDeleteConfirmation = false
|
config.tempSkipDeleteConfirmation = false
|
||||||
}, SHOW_TEMP_HIDDEN_DURATION)
|
}, SHOW_TEMP_HIDDEN_DURATION)
|
||||||
} else {
|
} else {
|
||||||
|
@ -261,6 +263,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
super.onDestroy()
|
super.onDestroy()
|
||||||
if (!isChangingConfigurations) {
|
if (!isChangingConfigurations) {
|
||||||
config.temporarilyShowHidden = false
|
config.temporarilyShowHidden = false
|
||||||
|
config.temporarilyShowExcluded = false
|
||||||
config.tempSkipDeleteConfirmation = false
|
config.tempSkipDeleteConfirmation = false
|
||||||
mTempShowHiddenHandler.removeCallbacksAndMessages(null)
|
mTempShowHiddenHandler.removeCallbacksAndMessages(null)
|
||||||
removeTempFolder()
|
removeTempFolder()
|
||||||
|
@ -306,6 +309,9 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
menu.findItem(R.id.temporarily_show_hidden).isVisible = (!isRPlus() || isExternalStorageManager()) && !config.shouldShowHidden
|
menu.findItem(R.id.temporarily_show_hidden).isVisible = (!isRPlus() || isExternalStorageManager()) && !config.shouldShowHidden
|
||||||
menu.findItem(R.id.stop_showing_hidden).isVisible = (!isRPlus() || isExternalStorageManager()) && config.temporarilyShowHidden
|
menu.findItem(R.id.stop_showing_hidden).isVisible = (!isRPlus() || isExternalStorageManager()) && config.temporarilyShowHidden
|
||||||
|
|
||||||
|
menu.findItem(R.id.temporarily_show_excluded).isVisible = !menu.findItem(R.id.temporarily_show_hidden).isVisible && !config.temporarilyShowExcluded
|
||||||
|
menu.findItem(R.id.stop_showing_excluded).isVisible = !menu.findItem(R.id.temporarily_show_hidden).isVisible && config.temporarilyShowExcluded
|
||||||
|
|
||||||
updateMenuItemColors(menu)
|
updateMenuItemColors(menu)
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
@ -319,6 +325,8 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
R.id.change_view_type -> changeViewType()
|
R.id.change_view_type -> changeViewType()
|
||||||
R.id.temporarily_show_hidden -> tryToggleTemporarilyShowHidden()
|
R.id.temporarily_show_hidden -> tryToggleTemporarilyShowHidden()
|
||||||
R.id.stop_showing_hidden -> tryToggleTemporarilyShowHidden()
|
R.id.stop_showing_hidden -> tryToggleTemporarilyShowHidden()
|
||||||
|
R.id.temporarily_show_excluded -> toggleTemporarilyShowExcluded(true)
|
||||||
|
R.id.stop_showing_excluded -> toggleTemporarilyShowExcluded(false)
|
||||||
R.id.create_new_folder -> createNewFolder()
|
R.id.create_new_folder -> createNewFolder()
|
||||||
R.id.show_the_recycle_bin -> toggleRecycleBin(true)
|
R.id.show_the_recycle_bin -> toggleRecycleBin(true)
|
||||||
R.id.hide_the_recycle_bin -> toggleRecycleBin(false)
|
R.id.hide_the_recycle_bin -> toggleRecycleBin(false)
|
||||||
|
@ -569,6 +577,14 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
|
||||||
invalidateOptionsMenu()
|
invalidateOptionsMenu()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private fun toggleTemporarilyShowExcluded(show: Boolean) {
|
||||||
|
mLoadedInitialPhotos = false
|
||||||
|
config.temporarilyShowExcluded = show
|
||||||
|
directories_grid.adapter = null
|
||||||
|
getDirectories()
|
||||||
|
invalidateOptionsMenu()
|
||||||
|
}
|
||||||
|
|
||||||
override fun deleteFolders(folders: ArrayList<File>) {
|
override fun deleteFolders(folders: ArrayList<File>) {
|
||||||
val fileDirItems =
|
val fileDirItems =
|
||||||
folders.asSequence().filter { it.isDirectory }.map { FileDirItem(it.absolutePath, it.name, true) }.toMutableList() as ArrayList<FileDirItem>
|
folders.asSequence().filter { it.isDirectory }.map { FileDirItem(it.absolutePath, it.name, true) }.toMutableList() as ArrayList<FileDirItem>
|
||||||
|
|
|
@ -656,7 +656,12 @@ fun Context.getCachedDirectories(
|
||||||
}
|
}
|
||||||
|
|
||||||
val shouldShowHidden = config.shouldShowHidden || forceShowHidden
|
val shouldShowHidden = config.shouldShowHidden || forceShowHidden
|
||||||
val excludedPaths = config.excludedFolders
|
val excludedPaths = if (config.temporarilyShowExcluded) {
|
||||||
|
HashSet()
|
||||||
|
} else {
|
||||||
|
config.excludedFolders
|
||||||
|
}
|
||||||
|
|
||||||
val includedPaths = config.includedFolders
|
val includedPaths = config.includedFolders
|
||||||
|
|
||||||
val folderNoMediaStatuses = HashMap<String, Boolean>()
|
val folderNoMediaStatuses = HashMap<String, Boolean>()
|
||||||
|
|
|
@ -74,6 +74,10 @@ class Config(context: Context) : BaseConfig(context) {
|
||||||
get() = prefs.getBoolean(TEMPORARILY_SHOW_HIDDEN, false)
|
get() = prefs.getBoolean(TEMPORARILY_SHOW_HIDDEN, false)
|
||||||
set(temporarilyShowHidden) = prefs.edit().putBoolean(TEMPORARILY_SHOW_HIDDEN, temporarilyShowHidden).apply()
|
set(temporarilyShowHidden) = prefs.edit().putBoolean(TEMPORARILY_SHOW_HIDDEN, temporarilyShowHidden).apply()
|
||||||
|
|
||||||
|
var temporarilyShowExcluded: Boolean
|
||||||
|
get() = prefs.getBoolean(TEMPORARILY_SHOW_EXCLUDED, false)
|
||||||
|
set(temporarilyShowExcluded) = prefs.edit().putBoolean(TEMPORARILY_SHOW_EXCLUDED, temporarilyShowExcluded).apply()
|
||||||
|
|
||||||
var isThirdPartyIntent: Boolean
|
var isThirdPartyIntent: Boolean
|
||||||
get() = prefs.getBoolean(IS_THIRD_PARTY_INTENT, false)
|
get() = prefs.getBoolean(IS_THIRD_PARTY_INTENT, false)
|
||||||
set(isThirdPartyIntent) = prefs.edit().putBoolean(IS_THIRD_PARTY_INTENT, isThirdPartyIntent).apply()
|
set(isThirdPartyIntent) = prefs.edit().putBoolean(IS_THIRD_PARTY_INTENT, isThirdPartyIntent).apply()
|
||||||
|
|
|
@ -9,6 +9,7 @@ const val GROUP_FOLDER_PREFIX = "group_folder_"
|
||||||
const val VIEW_TYPE_PREFIX = "view_type_folder_"
|
const val VIEW_TYPE_PREFIX = "view_type_folder_"
|
||||||
const val SHOW_HIDDEN_MEDIA = "show_hidden_media"
|
const val SHOW_HIDDEN_MEDIA = "show_hidden_media"
|
||||||
const val TEMPORARILY_SHOW_HIDDEN = "temporarily_show_hidden"
|
const val TEMPORARILY_SHOW_HIDDEN = "temporarily_show_hidden"
|
||||||
|
const val TEMPORARILY_SHOW_EXCLUDED = "temporarily_show_excluded"
|
||||||
const val IS_THIRD_PARTY_INTENT = "is_third_party_intent"
|
const val IS_THIRD_PARTY_INTENT = "is_third_party_intent"
|
||||||
const val AUTOPLAY_VIDEOS = "autoplay_videos"
|
const val AUTOPLAY_VIDEOS = "autoplay_videos"
|
||||||
const val REMEMBER_LAST_VIDEO_POSITION = "remember_last_video_position"
|
const val REMEMBER_LAST_VIDEO_POSITION = "remember_last_video_position"
|
||||||
|
|
|
@ -101,7 +101,12 @@ class MediaFetcher(val context: Context) {
|
||||||
|
|
||||||
val config = context.config
|
val config = context.config
|
||||||
val shouldShowHidden = config.shouldShowHidden
|
val shouldShowHidden = config.shouldShowHidden
|
||||||
val excludedPaths = config.excludedFolders
|
val excludedPaths = if (config.temporarilyShowExcluded) {
|
||||||
|
HashSet()
|
||||||
|
} else {
|
||||||
|
config.excludedFolders
|
||||||
|
}
|
||||||
|
|
||||||
val includedPaths = config.includedFolders
|
val includedPaths = config.includedFolders
|
||||||
|
|
||||||
val folderNoMediaStatuses = HashMap<String, Boolean>()
|
val folderNoMediaStatuses = HashMap<String, Boolean>()
|
||||||
|
|
|
@ -39,6 +39,16 @@
|
||||||
android:showAsAction="never"
|
android:showAsAction="never"
|
||||||
android:title="@string/stop_showing_hidden"
|
android:title="@string/stop_showing_hidden"
|
||||||
app:showAsAction="never" />
|
app:showAsAction="never" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/temporarily_show_excluded"
|
||||||
|
android:showAsAction="never"
|
||||||
|
android:title="@string/temporarily_show_excluded"
|
||||||
|
app:showAsAction="never" />
|
||||||
|
<item
|
||||||
|
android:id="@+id/stop_showing_excluded"
|
||||||
|
android:showAsAction="never"
|
||||||
|
android:title="@string/stop_showing_excluded"
|
||||||
|
app:showAsAction="never" />
|
||||||
<item
|
<item
|
||||||
android:id="@+id/show_all"
|
android:id="@+id/show_all"
|
||||||
android:showAsAction="never"
|
android:showAsAction="never"
|
||||||
|
|
Loading…
Reference in a new issue