android-components / mozilla.components.feature.downloads / SimpleDownloadDialogFragment

# SimpleDownloadDialogFragment

`class SimpleDownloadDialogFragment : DownloadDialogFragment` (source)

A confirmation dialog to be called before a download is triggered. Meant to be used in collaboration with DownloadsFeature

SimpleDownloadDialogFragment is the default dialog use by DownloadsFeature if you don't provide a value. It is composed by a title, a negative and a positive bottoms. When the positive button is clicked the download it triggered.

Consumers must implement the DownloadDialogListener interface on their Activity/Fragment to ensure that they will get notified on positiveButtonClick and negativeButtonClick events after activity/fragment is recreated.

If you are using this class from a android.support.v4.app.Fragment you must use a childFragmentManager or you will get a ClassCastException.

### Types

DownloadDialogListener | `interface DownloadDialogListener`

### Constructors

<init> | `SimpleDownloadDialogFragment()` A confirmation dialog to be called before a download is triggered. Meant to be used in collaboration with DownloadsFeature

### Inherited Properties

onStartDownload | `var onStartDownload: () -> Unit` A callback to trigger a download, call it when you are ready to start a download. For instance, a valid use case can be in confirmation dialog, after the positive button is clicked, this callback must be called.

### Functions

onAttach | `fun onAttach(context: Context): Unit`
onCreateDialog | `fun onCreateDialog(savedInstanceState: Bundle?): Dialog`

### Inherited Functions

setDownload | `fun setDownload(download: Download): Unit` add the metadata of this download object to the arguments of this fragment.

### Companion Object Properties

KEY_CANCELABLE | `const val KEY_CANCELABLE: String`
KEY_NEGATIVE_TEXT | `const val KEY_NEGATIVE_TEXT: String`
KEY_POSITIVE_TEXT | `const val KEY_POSITIVE_TEXT: String`
KEY_THEME_ID | `const val KEY_THEME_ID: String`
KEY_TITLE_TEXT | `const val KEY_TITLE_TEXT: String`

### Companion Object Functions

newInstance | `fun newInstance(dialogTitleText: Int = mozac_feature_downloads_dialog_download, positiveButtonText: Int = mozac_feature_downloads_dialog_download, negativeButtonText: Int = mozac_feature_downloads_dialog_cancel, themeResId: Int = 0, cancelable: Boolean = false): SimpleDownloadDialogFragment` A builder method for creating a SimpleDownloadDialogFragment