fix: download button orientation
This commit is contained in:
parent
b093b5f979
commit
0758241e06
4 changed files with 12 additions and 10 deletions
|
@ -372,18 +372,18 @@ class EpisodeAdapter(
|
|||
if (activeDownloads.contains(episodeNumber)) {
|
||||
// Show spinner
|
||||
binding.itemDownload.setImageResource(R.drawable.ic_sync)
|
||||
startOrContinueRotation(episodeNumber)
|
||||
startOrContinueRotation(episodeNumber) {
|
||||
binding.itemDownload.rotation = 0f
|
||||
}
|
||||
binding.itemEpisodeDesc.visibility = View.GONE
|
||||
} else if (downloadedEpisodes.contains(episodeNumber)) {
|
||||
binding.itemEpisodeDesc.visibility = View.GONE
|
||||
binding.itemDownloadStatus.visibility = View.VISIBLE
|
||||
// Show checkmark
|
||||
binding.itemDownload.setImageResource(R.drawable.ic_circle_check)
|
||||
//binding.itemDownload.setColorFilter(typedValue2.data) //TODO: colors go to wrong places
|
||||
binding.itemDownload.postDelayed({
|
||||
binding.itemDownload.setImageResource(R.drawable.ic_round_delete_24)
|
||||
binding.itemDownload.rotation = 0f
|
||||
//binding.itemDownload.setColorFilter(typedValue2.data)
|
||||
}, 1000)
|
||||
} else {
|
||||
binding.itemDownloadStatus.visibility = View.GONE
|
||||
|
@ -396,7 +396,7 @@ class EpisodeAdapter(
|
|||
|
||||
}
|
||||
|
||||
private fun startOrContinueRotation(episodeNumber: String) {
|
||||
private fun startOrContinueRotation(episodeNumber: String, resetRotation: () -> Unit) {
|
||||
if (!isRotationCoroutineRunningFor(episodeNumber)) {
|
||||
val scope = fragment.lifecycle.coroutineScope
|
||||
scope.launch {
|
||||
|
@ -411,6 +411,7 @@ class EpisodeAdapter(
|
|||
}
|
||||
// Remove chapter number from active coroutines set
|
||||
activeCoroutines.remove(episodeNumber)
|
||||
resetRotation()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -154,15 +154,15 @@ class MangaChapterAdapter(
|
|||
if (activeDownloads.contains(chapterNumber)) {
|
||||
// Show spinner
|
||||
binding.itemDownload.setImageResource(R.drawable.ic_sync)
|
||||
startOrContinueRotation(chapterNumber)
|
||||
startOrContinueRotation(chapterNumber) {
|
||||
binding.itemDownload.rotation = 0f
|
||||
}
|
||||
} else if (downloadedChapters.contains(chapterNumber)) {
|
||||
// Show checkmark
|
||||
binding.itemDownload.setImageResource(R.drawable.ic_circle_check)
|
||||
//binding.itemDownload.setColorFilter(typedValue2.data) //TODO: colors go to wrong places
|
||||
binding.itemDownload.postDelayed({
|
||||
binding.itemDownload.setImageResource(R.drawable.ic_round_delete_24)
|
||||
binding.itemDownload.rotation = 0f
|
||||
//binding.itemDownload.setColorFilter(typedValue2.data)
|
||||
}, 1000)
|
||||
} else {
|
||||
// Show download icon
|
||||
|
@ -172,7 +172,7 @@ class MangaChapterAdapter(
|
|||
|
||||
}
|
||||
|
||||
private fun startOrContinueRotation(chapterNumber: String) {
|
||||
private fun startOrContinueRotation(chapterNumber: String, resetRotation: () -> Unit) {
|
||||
if (!isRotationCoroutineRunningFor(chapterNumber)) {
|
||||
val scope = fragment.lifecycle.coroutineScope
|
||||
scope.launch {
|
||||
|
@ -187,6 +187,7 @@ class MangaChapterAdapter(
|
|||
}
|
||||
// Remove chapter number from active coroutines set
|
||||
activeCoroutines.remove(chapterNumber)
|
||||
resetRotation()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue