mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Add support for progress on header downloads (#1238)
This commit is contained in:
parent
f6a65f38db
commit
77dc9f7484
2 changed files with 23 additions and 1 deletions
|
@ -156,6 +156,16 @@ class DownloadAdapter(
|
||||||
card.child ?: return
|
card.child ?: return
|
||||||
downloadHeaderGotoChild.isVisible = false
|
downloadHeaderGotoChild.isVisible = false
|
||||||
|
|
||||||
|
val posDur = getViewPos(card.data.id)
|
||||||
|
downloadHeaderEpisodeProgress.apply {
|
||||||
|
isVisible = posDur != null
|
||||||
|
posDur?.let {
|
||||||
|
val visualPos = it.fixVisual()
|
||||||
|
max = (visualPos.duration / 1000).toInt()
|
||||||
|
progress = (visualPos.position / 1000).toInt()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
val status = downloadButton.getStatus(card.child.id, card.currentBytes, card.totalBytes)
|
val status = downloadButton.getStatus(card.child.id, card.currentBytes, card.totalBytes)
|
||||||
if (status == DownloadStatusTell.IsDone) {
|
if (status == DownloadStatusTell.IsDone) {
|
||||||
// We do this here instead if we are finished downloading
|
// We do this here instead if we are finished downloading
|
||||||
|
@ -205,6 +215,7 @@ class DownloadAdapter(
|
||||||
formattedSize: String
|
formattedSize: String
|
||||||
) {
|
) {
|
||||||
downloadButton.isVisible = false
|
downloadButton.isVisible = false
|
||||||
|
downloadHeaderEpisodeProgress.isVisible = false
|
||||||
downloadHeaderGotoChild.isVisible = !isMultiDeleteState
|
downloadHeaderGotoChild.isVisible = !isMultiDeleteState
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
@ -218,7 +229,7 @@ class DownloadAdapter(
|
||||||
formattedSize
|
formattedSize
|
||||||
)
|
)
|
||||||
} catch (e: Exception) {
|
} catch (e: Exception) {
|
||||||
downloadHeaderInfo.text = ""
|
downloadHeaderInfo.text = null
|
||||||
logError(e)
|
logError(e)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -14,6 +14,17 @@
|
||||||
app:cardBackgroundColor="?attr/boxItemBackground"
|
app:cardBackgroundColor="?attr/boxItemBackground"
|
||||||
app:cardCornerRadius="@dimen/rounded_image_radius">
|
app:cardCornerRadius="@dimen/rounded_image_radius">
|
||||||
|
|
||||||
|
<androidx.core.widget.ContentLoadingProgressBar
|
||||||
|
android:id="@+id/download_header_episode_progress"
|
||||||
|
style="@android:style/Widget.Material.ProgressBar.Horizontal"
|
||||||
|
android:layout_width="match_parent"
|
||||||
|
android:layout_height="5dp"
|
||||||
|
android:layout_gravity="bottom"
|
||||||
|
android:layout_marginBottom="-1.5dp"
|
||||||
|
android:progressBackgroundTint="?attr/colorPrimary"
|
||||||
|
android:progressTint="?attr/colorPrimary"
|
||||||
|
tools:progress="50" />
|
||||||
|
|
||||||
<LinearLayout
|
<LinearLayout
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
|
|
Loading…
Reference in a new issue