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

DownloadDialogFragment

abstract class DownloadDialogFragment : DialogFragment (source)

This is a general representation of a dialog meant to be used in collaboration with DownloadsFeature to show a dialog before a download is triggered. If SimpleDownloadDialogFragment is not flexible enough for your use case you should inherit for this class. Be mindful to call onStartDownload when you want to start the download.

Constructors

<init>

DownloadDialogFragment()

This is a general representation of a dialog meant to be used in collaboration with DownloadsFeature to show a dialog before a download is triggered. If SimpleDownloadDialogFragment is not flexible enough for your use case you should inherit for this class. Be mindful to call onStartDownload when you want to start the download.

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

setDownload

fun setDownload(download: Download): Unit

add the metadata of this download object to the arguments of this fragment.

Companion Object Properties

FRAGMENT_TAG

const val FRAGMENT_TAG: String

KEY_CONTENT_LENGTH

const val KEY_CONTENT_LENGTH: String

Key for finding the content length in the arguments.

KEY_FILE_NAME

const val KEY_FILE_NAME: String

Key for finding the file name in the arguments.

KEY_URL

const val KEY_URL: String

Key for finding the url in the arguments.

Inheritors

SimpleDownloadDialogFragment

class SimpleDownloadDialogFragment : DownloadDialogFragment

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