show a Hide folder tooltip dialog at the first usage

This commit is contained in:
tibbi 2017-02-26 22:01:28 +01:00
parent a198008c8e
commit d60ee0b387
2 changed files with 25 additions and 3 deletions

View file

@ -124,7 +124,7 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
R.id.toggle_filename -> toggleFilenameVisibility() R.id.toggle_filename -> toggleFilenameVisibility()
R.id.open_camera -> launchCamera() R.id.open_camera -> launchCamera()
R.id.folder_view -> switchToFolderView() R.id.folder_view -> switchToFolderView()
R.id.hide_folder -> hideFolder() R.id.hide_folder -> tryHideFolder()
R.id.unhide_folder -> unhideFolder() R.id.unhide_folder -> unhideFolder()
R.id.exclude_folder -> tryExcludeFolder() R.id.exclude_folder -> tryExcludeFolder()
R.id.increase_column_count -> increaseColumnCount() R.id.increase_column_count -> increaseColumnCount()
@ -153,6 +153,17 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener {
finish() finish()
} }
private fun tryHideFolder() {
if (config.wasHideFolderTooltipShown) {
hideFolder()
} else {
ConfirmationDialog(this, getString(R.string.hide_folder_description)) {
config.wasHideFolderTooltipShown = true
hideFolder()
}
}
}
private fun hideFolder() { private fun hideFolder() {
addNoMedia(mPath) { addNoMedia(mPath) {
runOnUiThread { runOnUiThread {

View file

@ -174,8 +174,13 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
val paths = getSelectedPaths() val paths = getSelectedPaths()
for (path in paths) { for (path in paths) {
if (hide) { if (hide) {
activity.addNoMedia(path) { if (config.wasHideFolderTooltipShown) {
noMediaHandled() hideFolder(path)
} else {
ConfirmationDialog(activity, activity.getString(R.string.hide_folder_description)) {
config.wasHideFolderTooltipShown = true
hideFolder(path)
}
} }
} else { } else {
activity.removeNoMedia(path) { activity.removeNoMedia(path) {
@ -185,6 +190,12 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
} }
} }
private fun hideFolder(path: String) {
activity.addNoMedia(path) {
noMediaHandled()
}
}
private fun tryExcludeFolder() { private fun tryExcludeFolder() {
if (config.wasExcludeFolderTooltipShown) { if (config.wasExcludeFolderTooltipShown) {
excludeFolder() excludeFolder()