Add missing check for canDownload in episode bottom sheet

Fix #75
This commit is contained in:
Jarne Demeulemeester 2022-01-22 10:38:44 +01:00
parent 117205c74e
commit 3a41ba6882
No known key found for this signature in database
GPG key ID: 65C6006F2032DD14
2 changed files with 18 additions and 8 deletions

View file

@ -160,14 +160,23 @@ class EpisodeBottomSheetFragment : BottomSheetDialogFragment() {
} }
binding.favoriteButton.setImageResource(favoriteDrawable) binding.favoriteButton.setImageResource(favoriteDrawable)
// Download icon when (canDownload) {
val downloadDrawable = when (downloaded) { true -> {
true -> R.drawable.ic_download_filled binding.downloadButtonWrapper.isVisible = true
false -> R.drawable.ic_download binding.downloadButton.isEnabled = !downloaded
}
binding.downloadButton.setImageResource(downloadDrawable) // Download icon
val downloadDrawable = when (downloaded) {
true -> R.drawable.ic_download_filled
false -> R.drawable.ic_download
}
binding.downloadButton.setImageResource(downloadDrawable)
}
false -> {
binding.downloadButtonWrapper.isVisible = false
}
}
binding.downloadButton.isEnabled = !downloaded
binding.episodeName.text = String.format( binding.episodeName.text = String.format(
getString(R.string.episode_name_extended), getString(R.string.episode_name_extended),

View file

@ -185,7 +185,8 @@
android:id="@+id/download_button_wrapper" android:id="@+id/download_button_wrapper"
android:layout_width="wrap_content" android:layout_width="wrap_content"
android:layout_height="wrap_content" android:layout_height="wrap_content"
android:layout_marginEnd="12dp"> android:layout_marginEnd="12dp"
android:visibility="gone">
<ImageButton <ImageButton
android:id="@+id/download_button" android:id="@+id/download_button"