android-coroutines / nl.adaptivity.android.coroutines / DownloadFragment

DownloadFragment

class DownloadFragment : Fragment

Fragment that encapsulates the state of downloading a file.

TODO Actually handle the case where download completed when the activity is in the background.

Constructors

<init>

DownloadFragment()

Fragment that encapsulates the state of downloading a file.

Properties

downloadReference

var downloadReference: Long

Functions

onCreate

fun onCreate(savedInstanceState: Bundle?): Unit

onSaveInstanceState

fun onSaveInstanceState(outState: Bundle): Unit

Companion Object Functions

download

suspend fun download(activity: Activity, downloadUri: Uri): URI

Download the resource at downloadUri and return a URI of the local location

fun download(activity: Activity, downloadUri: Uri, callback: (Maybe<URI>) -> Unit): Unit

Async version of download that has a callback instead of being a suspend function.

newInstance

fun newInstance(continuation: Continuation<URI>): DownloadFragment