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

View file

@ -174,8 +174,13 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList<Direc
val paths = getSelectedPaths()
for (path in paths) {
if (hide) {
activity.addNoMedia(path) {
noMediaHandled()
if (config.wasHideFolderTooltipShown) {
hideFolder(path)
} else {
ConfirmationDialog(activity, activity.getString(R.string.hide_folder_description)) {
config.wasHideFolderTooltipShown = true
hideFolder(path)
}
}
} else {
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() {
if (config.wasExcludeFolderTooltipShown) {
excludeFolder()