fix: download button orientation

This commit is contained in:
rebelonion 2024-02-08 00:56:14 -06:00
parent b093b5f979
commit 0758241e06
4 changed files with 12 additions and 10 deletions

View file

@ -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()
}
}
}

View file

@ -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()
}
}
}

View file

@ -48,7 +48,7 @@
android:layout_width="24dp"
android:layout_height="48dp"
android:layout_marginEnd="5dp"
android:background="?android:attr/selectableItemBackground"
android:background="@android:color/transparent"
app:srcCompat="@drawable/ic_download_24"
app:tint="?attr/colorOnBackground" />

View file

@ -150,7 +150,7 @@
android:layout_width="24dp"
android:layout_height="48dp"
android:layout_marginEnd="5dp"
android:background="?android:attr/selectableItemBackground"
android:background="@android:color/transparent"
app:srcCompat="@drawable/ic_download_24"
app:tint="?attr/colorOnBackground"
tools:ignore="ContentDescription" />