Skip to content

Instantly share code, notes, and snippets.

View AsadLeo1995's full-sized avatar
🎯
Focusing

Asad Mahmood AsadLeo1995

🎯
Focusing
View GitHub Profile
private fun downloadMedia(){
//the download request
val helper = context?.let { DownloadHelper.forProgressive(it, the URI of the media) }
helper?.prepare(object : DownloadHelper.Callback {
override fun onPrepared(helper: DownloadHelper) {
val json = JSONObject()
//extra data about the download like title, artist e.tc below is an example
json.put("title" "Download like youtube")
fun withId(id: Int) = onView(ViewMatchers.withId(id))
fun ViewInteraction.isDisplayed() = check(matches(ViewMatchers.isDisplayed()))
fun ViewInteraction.isNotDisplayed() = check(matches(not(ViewMatchers.isDisplayed())))
fun ViewInteraction.hasText(text: Int) = check(matches(ViewMatchers.withText(text)))
fun ViewInteraction.hasText(text: String) = check(matches(ViewMatchers.withText(text)))