From 13c00c1b17fbd77e75ce61f70ae9ac0b635377a3 Mon Sep 17 00:00:00 2001 From: tibbi Date: Fri, 19 Oct 2018 23:56:53 +0200 Subject: [PATCH] adding a "Show Hidden" button to every filepicker, when appropriate --- app/build.gradle | 2 +- .../gallery/activities/ExcludedFoldersActivity.kt | 4 ++-- .../gallery/activities/HiddenFoldersActivity.kt | 2 +- .../gallery/activities/IncludedFoldersActivity.kt | 4 ++-- .../com/simplemobiletools/gallery/activities/MainActivity.kt | 2 +- .../simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt | 5 +++-- .../com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt | 2 +- 7 files changed, 11 insertions(+), 10 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index fa496afab..fc23a8c8d 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -48,7 +48,7 @@ android { } dependencies { - implementation 'com.simplemobiletools:commons:5.1.4' + implementation 'com.simplemobiletools:commons:5.1.6' implementation 'com.theartofdev.edmodo:android-image-cropper:2.7.0' implementation 'androidx.multidex:multidex:2.0.0' implementation 'it.sephiroth.android.exif:library:1.0.1' diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ExcludedFoldersActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ExcludedFoldersActivity.kt index d59f0b7f4..4d3a1883a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ExcludedFoldersActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/ExcludedFoldersActivity.kt @@ -20,7 +20,7 @@ class ExcludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener { private fun updateFolders() { val folders = ArrayList() - config.excludedFolders.mapTo(folders, { it }) + config.excludedFolders.mapTo(folders) { it } manage_folders_placeholder.apply { text = getString(R.string.excluded_activity_placeholder) beVisibleIf(folders.isEmpty()) @@ -49,7 +49,7 @@ class ExcludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener { } private fun addFolder() { - FilePickerDialog(this, config.lastFilepickerPath, false, config.shouldShowHidden) { + FilePickerDialog(this, config.lastFilepickerPath, false, config.shouldShowHidden, false, true) { config.lastFilepickerPath = it config.addExcludedFolder(it) updateFolders() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/HiddenFoldersActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/HiddenFoldersActivity.kt index 598e153be..c46135c98 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/HiddenFoldersActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/HiddenFoldersActivity.kt @@ -53,7 +53,7 @@ class HiddenFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener { } private fun addFolder() { - FilePickerDialog(this, config.lastFilepickerPath, false, config.shouldShowHidden) { + FilePickerDialog(this, config.lastFilepickerPath, false, config.shouldShowHidden, false, true) { config.lastFilepickerPath = it Thread { addNoMedia(it) { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/IncludedFoldersActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/IncludedFoldersActivity.kt index ede3ab8d8..4a4d1339e 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/IncludedFoldersActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/IncludedFoldersActivity.kt @@ -21,7 +21,7 @@ class IncludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener { private fun updateFolders() { val folders = ArrayList() - config.includedFolders.mapTo(folders, { it }) + config.includedFolders.mapTo(folders) { it } manage_folders_placeholder.apply { text = getString(R.string.included_activity_placeholder) beVisibleIf(folders.isEmpty()) @@ -50,7 +50,7 @@ class IncludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener { } private fun addFolder() { - FilePickerDialog(this, config.lastFilepickerPath, false, config.shouldShowHidden) { + FilePickerDialog(this, config.lastFilepickerPath, false, config.shouldShowHidden, false, true) { config.lastFilepickerPath = it config.addIncludedFolder(it) updateFolders() diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt index 6ccdcb897..02603f098 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MainActivity.kt @@ -604,7 +604,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener { } private fun createNewFolder() { - FilePickerDialog(this, internalStoragePath, false, config.shouldShowHidden) { + FilePickerDialog(this, internalStoragePath, false, config.shouldShowHidden, false, true) { CreateNewFolderDialog(this, it) { config.tempFolderPath = it Thread { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt index 9aa0fa625..dae7ed654 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/PickDirectoryDialog.kt @@ -21,6 +21,7 @@ class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: Stri var shownDirectories = ArrayList() var view = activity.layoutInflater.inflate(R.layout.dialog_directory_picker, null) var isGridViewType = activity.config.viewTypeFolders == VIEW_TYPE_GRID + var showHidden = activity.config.shouldShowHidden init { (view.directories_grid.layoutManager as MyGridLayoutManager).apply { @@ -38,6 +39,7 @@ class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: Stri view.directories_show_hidden.setOnClickListener { activity.handleHiddenFolderPasswordProtection { view.directories_show_hidden.beGone() + showHidden = true fetchDirectories(true) } } @@ -58,8 +60,7 @@ class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: Stri } private fun showOtherFolder() { - val showHidden = activity.config.shouldShowHidden - FilePickerDialog(activity, sourcePath, false, showHidden, true) { + FilePickerDialog(activity, sourcePath, false, showHidden, true, true) { callback(it) } } diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt index 9bb1f2ea9..35dc95274 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/dialogs/SaveAsDialog.kt @@ -32,7 +32,7 @@ class SaveAsDialog(val activity: BaseSimpleActivity, val path: String, val appen save_as_name.setText(name) save_as_path.setOnClickListener { - FilePickerDialog(activity, realPath, false, false, true) { + FilePickerDialog(activity, realPath, false, false, true, true) { save_as_path.text = activity.humanizePath(it) realPath = it }