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
|
||||
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)
|
||||
if (status == DownloadStatusTell.IsDone) {
|
||||
// We do this here instead if we are finished downloading
|
||||
|
@ -205,6 +215,7 @@ class DownloadAdapter(
|
|||
formattedSize: String
|
||||
) {
|
||||
downloadButton.isVisible = false
|
||||
downloadHeaderEpisodeProgress.isVisible = false
|
||||
downloadHeaderGotoChild.isVisible = !isMultiDeleteState
|
||||
|
||||
try {
|
||||
|
@ -218,7 +229,7 @@ class DownloadAdapter(
|
|||
formattedSize
|
||||
)
|
||||
} catch (e: Exception) {
|
||||
downloadHeaderInfo.text = ""
|
||||
downloadHeaderInfo.text = null
|
||||
logError(e)
|
||||
}
|
||||
|
||||
|
|
|
@ -14,6 +14,17 @@
|
|||
app:cardBackgroundColor="?attr/boxItemBackground"
|
||||
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
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
|
|
Loading…
Reference in a new issue