class DownloadsFeature : SelectionAwareSessionObserver
(source)
Feature implementation for proving download functionality for the selected session. It will subscribe to the selected session and will listening for downloads.
DownloadsFeature(applicationContext: Context, onNeedToRequestPermissions: OnNeedToRequestPermissions = { _, _ -> }, onDownloadCompleted: OnDownloadCompleted = { _, _ -> }, downloadManager: DownloadManager = DownloadManager(applicationContext, onDownloadCompleted), sessionManager: SessionManager, fragmentManager: FragmentManager? = null, dialog: DownloadDialogFragment = SimpleDownloadDialogFragment.newInstance())
Feature implementation for proving download functionality for the selected session. It will subscribe to the selected session and will listening for downloads. |
var onDownloadCompleted: OnDownloadCompleted
a callback to be notified when a download is completed. |
|
var onNeedToRequestPermissions: OnNeedToRequestPermissions
it will be call when you need to request permission, before a download can be performed. |
open var activeSession: Session?
the currently observed session |
fun onDownload(session: Session, download: Download): Boolean
Notifies to the DownloadManager that a new download must be processed. |
|
fun onPermissionsGranted(): Unit
Call this method to notify the feature download that the permissions where granted. If so it will automatically trigger the pending download. |
|
fun start(): Unit
Starts observing any download on the selected session and send it to the DownloadManager to be processed. |
|
fun stop(): Unit
Stops observing any download on the selected session. |
fun observeFixed(session: Session): Unit
Starts observing changes to the specified session. |
|
fun observeSelected(): Unit
Starts observing changes to the selected session (see SessionManager.selectedSession). If a different session is selected the observer will automatically be switched over and only notified of changes to the newly selected session. |
|
open fun onSessionSelected(session: Session): Unit
The selection has changed and the given session is now the selected session. |