diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt index 7ac53d1e4..465425515 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/activities/MediaActivity.kt @@ -21,6 +21,7 @@ import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.adapters.MediaAdapter import com.simplemobiletools.gallery.asynctasks.GetMediaAsynctask import com.simplemobiletools.gallery.dialogs.ChangeSortingDialog +import com.simplemobiletools.gallery.dialogs.ExcludeFolderDialog import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.helpers.* import com.simplemobiletools.gallery.models.Medium @@ -193,14 +194,12 @@ class MediaActivity : SimpleActivity(), MediaAdapter.MediaOperationsListener { } private fun tryExcludeFolder() { - ConfirmationDialog(this, getString(R.string.exclude_folder_description)) { - excludeFolder() - } - } + val pathSet = HashSet(1) + pathSet.add(mPath) - private fun excludeFolder() { - config.addExcludedFolder(mPath) - finish() + ExcludeFolderDialog(this, pathSet) { + finish() + } } private fun deleteDirectoryIfEmpty() { diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt index cfd5d1652..6e9567e1a 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/adapters/DirectoryAdapter.kt @@ -19,6 +19,7 @@ import com.simplemobiletools.commons.extensions.* import com.simplemobiletools.gallery.R import com.simplemobiletools.gallery.activities.SimpleActivity import com.simplemobiletools.gallery.dialogs.CopyDialog +import com.simplemobiletools.gallery.dialogs.ExcludeFolderDialog import com.simplemobiletools.gallery.dialogs.RenameDirectoryDialog import com.simplemobiletools.gallery.extensions.* import com.simplemobiletools.gallery.models.Directory @@ -196,17 +197,12 @@ class DirectoryAdapter(val activity: SimpleActivity, val dirs: MutableList, val callback: () -> Unit) { + var dialog: AlertDialog? = null + + init { + val alternativePaths = getAlternativePaths() + val view = LayoutInflater.from(activity).inflate(R.layout.dialog_exclude_folder, null).apply { + exclude_folder_parent.beVisibleIf(alternativePaths.size > 1) + exclude_folder_radio_group.beVisibleIf(alternativePaths.size > 1) + } + + AlertDialog.Builder(activity) + .setPositiveButton(R.string.ok, { dialog, which -> dialogConfirmed() }) + .setNegativeButton(R.string.cancel, null) + .create().apply { + activity.setupDialogStuff(view, this) + } + } + + private fun dialogConfirmed() { + + } + + private fun getAlternativePaths(): ArrayList { + val parentsList = ArrayList() + if (selectedPaths.size > 1) + return parentsList + + return parentsList + } +} diff --git a/app/src/main/res/layout/dialog_exclude_folder.xml b/app/src/main/res/layout/dialog_exclude_folder.xml new file mode 100644 index 000000000..7ed43c589 --- /dev/null +++ b/app/src/main/res/layout/dialog_exclude_folder.xml @@ -0,0 +1,35 @@ + + + + + + + + + + + + + +