mirror of
https://github.com/recloudstream/cloudstream.git
synced 2024-08-15 01:53:11 +00:00
Fixes
This commit is contained in:
parent
a388c57563
commit
0e0e346bd0
4 changed files with 13 additions and 13 deletions
|
@ -130,9 +130,9 @@ class DownloadAdapter(
|
||||||
downloadButton.setProgress(card.currentBytes, card.totalBytes)
|
downloadButton.setProgress(card.currentBytes, card.totalBytes)
|
||||||
downloadButton.applyMetaData(card.child.id, card.currentBytes, card.totalBytes)
|
downloadButton.applyMetaData(card.child.id, card.currentBytes, card.totalBytes)
|
||||||
// We will let the view model handle this
|
// We will let the view model handle this
|
||||||
downloadButton.setProgressText = false
|
downloadButton.doSetProgress = false
|
||||||
downloadHeaderInfo.text = formatShortFileSize(downloadHeaderInfo.context, card.totalBytes)
|
downloadHeaderInfo.text = formatShortFileSize(downloadHeaderInfo.context, card.totalBytes)
|
||||||
} else downloadButton.setProgressText = true
|
} else downloadButton.doSetProgress = true
|
||||||
|
|
||||||
downloadButton.setDefaultClickListener(card.child, downloadHeaderInfo, mediaClickCallback)
|
downloadButton.setDefaultClickListener(card.child, downloadHeaderInfo, mediaClickCallback)
|
||||||
downloadButton.isVisible = true
|
downloadButton.isVisible = true
|
||||||
|
@ -192,9 +192,9 @@ class DownloadAdapter(
|
||||||
downloadButton.setProgress(card.currentBytes, card.totalBytes)
|
downloadButton.setProgress(card.currentBytes, card.totalBytes)
|
||||||
downloadButton.applyMetaData(d.id, card.currentBytes, card.totalBytes)
|
downloadButton.applyMetaData(d.id, card.currentBytes, card.totalBytes)
|
||||||
// We will let the view model handle this
|
// We will let the view model handle this
|
||||||
downloadButton.setProgressText = false
|
downloadButton.doSetProgress = false
|
||||||
downloadChildEpisodeTextExtra.text = formatShortFileSize(downloadChildEpisodeTextExtra.context, card.totalBytes)
|
downloadChildEpisodeTextExtra.text = formatShortFileSize(downloadChildEpisodeTextExtra.context, card.totalBytes)
|
||||||
} else downloadButton.setProgressText = true
|
} else downloadButton.doSetProgress = true
|
||||||
|
|
||||||
downloadButton.setDefaultClickListener(d, downloadChildEpisodeTextExtra, mediaClickCallback)
|
downloadButton.setDefaultClickListener(d, downloadChildEpisodeTextExtra, mediaClickCallback)
|
||||||
downloadButton.isVisible = true
|
downloadButton.isVisible = true
|
||||||
|
|
|
@ -57,23 +57,23 @@ abstract class BaseFetchButton(context: Context, attributeSet: AttributeSet) :
|
||||||
resetViewData()
|
resetViewData()
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var doSetProgress = true
|
||||||
|
|
||||||
open fun resetViewData() {
|
open fun resetViewData() {
|
||||||
// lastRequest = null
|
// lastRequest = null
|
||||||
isZeroBytes = true
|
isZeroBytes = true
|
||||||
|
doSetProgress = true
|
||||||
persistentId = null
|
persistentId = null
|
||||||
}
|
}
|
||||||
|
|
||||||
var currentMetaData: DownloadMetadata =
|
var currentMetaData: DownloadMetadata =
|
||||||
DownloadMetadata(0, 0, 0, null)
|
DownloadMetadata(0, 0, 0, null)
|
||||||
|
|
||||||
private var progressSet = false
|
|
||||||
var setProgressText = true
|
|
||||||
|
|
||||||
fun setPersistentId(id: Int) {
|
fun setPersistentId(id: Int) {
|
||||||
persistentId = id
|
persistentId = id
|
||||||
currentMetaData.id = id
|
currentMetaData.id = id
|
||||||
|
|
||||||
if (progressSet) return
|
if (!doSetProgress) return
|
||||||
|
|
||||||
ioSafe {
|
ioSafe {
|
||||||
val savedData = VideoDownloadManager.getDownloadFileInfoAndUpdateSettings(context, id)
|
val savedData = VideoDownloadManager.getDownloadFileInfoAndUpdateSettings(context, id)
|
||||||
|
@ -112,7 +112,6 @@ abstract class BaseFetchButton(context: Context, attributeSet: AttributeSet) :
|
||||||
}
|
}
|
||||||
|
|
||||||
open fun setProgress(downloadedBytes: Long, totalBytes: Long) {
|
open fun setProgress(downloadedBytes: Long, totalBytes: Long) {
|
||||||
progressSet = true
|
|
||||||
isZeroBytes = downloadedBytes == 0L
|
isZeroBytes = downloadedBytes == 0L
|
||||||
progressBar.post {
|
progressBar.post {
|
||||||
val steps = 10000L
|
val steps = 10000L
|
||||||
|
@ -137,7 +136,7 @@ abstract class BaseFetchButton(context: Context, attributeSet: AttributeSet) :
|
||||||
if (isZeroBytes) {
|
if (isZeroBytes) {
|
||||||
progressText?.isVisible = false
|
progressText?.isVisible = false
|
||||||
} else {
|
} else {
|
||||||
if (setProgressText) {
|
if (doSetProgress) {
|
||||||
progressText?.apply {
|
progressText?.apply {
|
||||||
val currentMbString =
|
val currentMbString =
|
||||||
Formatter.formatShortFileSize(context, downloadedBytes)
|
Formatter.formatShortFileSize(context, downloadedBytes)
|
||||||
|
|
|
@ -301,6 +301,7 @@ open class PieFetchButton(context: Context, attributeSet: AttributeSet) :
|
||||||
setStatus(null)
|
setStatus(null)
|
||||||
currentMetaData = DownloadMetadata(0, 0, 0, null)
|
currentMetaData = DownloadMetadata(0, 0, 0, null)
|
||||||
isZeroBytes = true
|
isZeroBytes = true
|
||||||
|
doSetProgress = true
|
||||||
progressBar.progress = 0
|
progressBar.progress = 0
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -339,9 +339,9 @@
|
||||||
<string name="livestreams">Livestreams</string>
|
<string name="livestreams">Livestreams</string>
|
||||||
<string name="nsfw">NSFW</string>
|
<string name="nsfw">NSFW</string>
|
||||||
<string name="others">Others</string>
|
<string name="others">Others</string>
|
||||||
<plurals name="episodes">
|
<plurals name="episodes" translatable="false">
|
||||||
<item quantity="one">Episode</item>
|
<item quantity="one">@string/episode</item>
|
||||||
<item quantity="other">Episodes</item>
|
<item quantity="other">@string/episodes</item>
|
||||||
</plurals>
|
</plurals>
|
||||||
<!--singular-->
|
<!--singular-->
|
||||||
<string name="movies_singular">Movie</string>
|
<string name="movies_singular">Movie</string>
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue