Blatzar / FetchButton

Work in progress library for Fetch downloading

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

FetchButton

[Work in progress]

Just a simple library to have a download button which works with Fetch. Mostly for personal usage.

TODO:

  • Themeable/Attributes
  • Testing with recyclerview
  • More default download buttons

Usage:

<com.lagradost.fetchbutton.ui.PieFetchButton
    android:id="@+id/download_button"
    android:layout_width="80dp"
    android:layout_height="80dp">
</com.lagradost.fetchbutton.ui.PieFetchButton>
val downloadButton = findViewById<PieFetchButton>(R.id.download_button)

// This is required to run once in the app before any fetch usage.
initFetch(this)

// Arbitrary path
val path = this.filesDir.path + "/FetchButtonTest/test.bin"

// This is just to play around with the default behavior, use
// downloadButton.pauseDownload() and such to control the download easily
// To subscribe to another download, just use downloadButton.currentRequestId = fetchRequestId
downloadButton.setDefaultClickListener {
    com.tonyodev.fetch2.Request(
        // Download url
        "https://speedtest-co.turnkeyinternet.net/1000mb.bin",
        path,
    )
}

About

Work in progress library for Fetch downloading

License:GNU General Public License v3.0


Languages

Language:Kotlin 100.0%