diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt index f4d1e1da5..965250340 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/pro/adapters/DirectoryAdapter.kt @@ -23,6 +23,7 @@ import com.simplemobiletools.commons.views.FastScroller import com.simplemobiletools.commons.views.MyRecyclerView import com.simplemobiletools.gallery.pro.R import com.simplemobiletools.gallery.pro.activities.MediaActivity +import com.simplemobiletools.gallery.pro.dialogs.ConfirmDeleteFolderDialog import com.simplemobiletools.gallery.pro.dialogs.ExcludeFolderDialog import com.simplemobiletools.gallery.pro.dialogs.PickMediumDialog import com.simplemobiletools.gallery.pro.extensions.* @@ -399,10 +400,9 @@ class DirectoryAdapter(activity: BaseSimpleActivity, var dirs: ArrayList Unit) { + var dialog: AlertDialog + + init { + val view = activity.layoutInflater.inflate(R.layout.dialog_confirm_delete_folder, null) + view.message.text = message + view.message_warning.text = warningMessage + + val builder = AlertDialog.Builder(activity) + .setPositiveButton(R.string.yes) { dialog, which -> dialogConfirmed() } + + builder.setNegativeButton(R.string.no, null) + + dialog = builder.create().apply { + activity.setupDialogStuff(view, this) + } + } + + private fun dialogConfirmed() { + dialog.dismiss() + callback() + } +} diff --git a/app/src/main/res/layout/dialog_confirm_delete_folder.xml b/app/src/main/res/layout/dialog_confirm_delete_folder.xml new file mode 100644 index 000000000..220c36f09 --- /dev/null +++ b/app/src/main/res/layout/dialog_confirm_delete_folder.xml @@ -0,0 +1,29 @@ + + + + + + + +