adding a "Show Hidden" button to every filepicker, when appropriate

This commit is contained in:
tibbi 2018-10-19 23:56:53 +02:00
parent 23b8ec36c7
commit 13c00c1b17
7 changed files with 11 additions and 10 deletions

View file

@ -48,7 +48,7 @@ android {
} }
dependencies { 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 'com.theartofdev.edmodo:android-image-cropper:2.7.0'
implementation 'androidx.multidex:multidex:2.0.0' implementation 'androidx.multidex:multidex:2.0.0'
implementation 'it.sephiroth.android.exif:library:1.0.1' implementation 'it.sephiroth.android.exif:library:1.0.1'

View file

@ -20,7 +20,7 @@ class ExcludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener {
private fun updateFolders() { private fun updateFolders() {
val folders = ArrayList<String>() val folders = ArrayList<String>()
config.excludedFolders.mapTo(folders, { it }) config.excludedFolders.mapTo(folders) { it }
manage_folders_placeholder.apply { manage_folders_placeholder.apply {
text = getString(R.string.excluded_activity_placeholder) text = getString(R.string.excluded_activity_placeholder)
beVisibleIf(folders.isEmpty()) beVisibleIf(folders.isEmpty())
@ -49,7 +49,7 @@ class ExcludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener {
} }
private fun addFolder() { private fun addFolder() {
FilePickerDialog(this, config.lastFilepickerPath, false, config.shouldShowHidden) { FilePickerDialog(this, config.lastFilepickerPath, false, config.shouldShowHidden, false, true) {
config.lastFilepickerPath = it config.lastFilepickerPath = it
config.addExcludedFolder(it) config.addExcludedFolder(it)
updateFolders() updateFolders()

View file

@ -53,7 +53,7 @@ class HiddenFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener {
} }
private fun addFolder() { private fun addFolder() {
FilePickerDialog(this, config.lastFilepickerPath, false, config.shouldShowHidden) { FilePickerDialog(this, config.lastFilepickerPath, false, config.shouldShowHidden, false, true) {
config.lastFilepickerPath = it config.lastFilepickerPath = it
Thread { Thread {
addNoMedia(it) { addNoMedia(it) {

View file

@ -21,7 +21,7 @@ class IncludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener {
private fun updateFolders() { private fun updateFolders() {
val folders = ArrayList<String>() val folders = ArrayList<String>()
config.includedFolders.mapTo(folders, { it }) config.includedFolders.mapTo(folders) { it }
manage_folders_placeholder.apply { manage_folders_placeholder.apply {
text = getString(R.string.included_activity_placeholder) text = getString(R.string.included_activity_placeholder)
beVisibleIf(folders.isEmpty()) beVisibleIf(folders.isEmpty())
@ -50,7 +50,7 @@ class IncludedFoldersActivity : SimpleActivity(), RefreshRecyclerViewListener {
} }
private fun addFolder() { private fun addFolder() {
FilePickerDialog(this, config.lastFilepickerPath, false, config.shouldShowHidden) { FilePickerDialog(this, config.lastFilepickerPath, false, config.shouldShowHidden, false, true) {
config.lastFilepickerPath = it config.lastFilepickerPath = it
config.addIncludedFolder(it) config.addIncludedFolder(it)
updateFolders() updateFolders()

View file

@ -604,7 +604,7 @@ class MainActivity : SimpleActivity(), DirectoryOperationsListener {
} }
private fun createNewFolder() { private fun createNewFolder() {
FilePickerDialog(this, internalStoragePath, false, config.shouldShowHidden) { FilePickerDialog(this, internalStoragePath, false, config.shouldShowHidden, false, true) {
CreateNewFolderDialog(this, it) { CreateNewFolderDialog(this, it) {
config.tempFolderPath = it config.tempFolderPath = it
Thread { Thread {

View file

@ -21,6 +21,7 @@ class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: Stri
var shownDirectories = ArrayList<Directory>() var shownDirectories = ArrayList<Directory>()
var view = activity.layoutInflater.inflate(R.layout.dialog_directory_picker, null) var view = activity.layoutInflater.inflate(R.layout.dialog_directory_picker, null)
var isGridViewType = activity.config.viewTypeFolders == VIEW_TYPE_GRID var isGridViewType = activity.config.viewTypeFolders == VIEW_TYPE_GRID
var showHidden = activity.config.shouldShowHidden
init { init {
(view.directories_grid.layoutManager as MyGridLayoutManager).apply { (view.directories_grid.layoutManager as MyGridLayoutManager).apply {
@ -38,6 +39,7 @@ class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: Stri
view.directories_show_hidden.setOnClickListener { view.directories_show_hidden.setOnClickListener {
activity.handleHiddenFolderPasswordProtection { activity.handleHiddenFolderPasswordProtection {
view.directories_show_hidden.beGone() view.directories_show_hidden.beGone()
showHidden = true
fetchDirectories(true) fetchDirectories(true)
} }
} }
@ -58,8 +60,7 @@ class PickDirectoryDialog(val activity: BaseSimpleActivity, val sourcePath: Stri
} }
private fun showOtherFolder() { private fun showOtherFolder() {
val showHidden = activity.config.shouldShowHidden FilePickerDialog(activity, sourcePath, false, showHidden, true, true) {
FilePickerDialog(activity, sourcePath, false, showHidden, true) {
callback(it) callback(it)
} }
} }

View file

@ -32,7 +32,7 @@ class SaveAsDialog(val activity: BaseSimpleActivity, val path: String, val appen
save_as_name.setText(name) save_as_name.setText(name)
save_as_path.setOnClickListener { save_as_path.setOnClickListener {
FilePickerDialog(activity, realPath, false, false, true) { FilePickerDialog(activity, realPath, false, false, true, true) {
save_as_path.text = activity.humanizePath(it) save_as_path.text = activity.humanizePath(it)
realPath = it realPath = it
} }