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)
// Download icon
val downloadDrawable = when (downloaded) {
true -> R.drawable.ic_download_filled
false -> R.drawable.ic_download
}
binding.downloadButton.setImageResource(downloadDrawable)
when (canDownload) {
true -> {
binding.downloadButtonWrapper.isVisible = true
binding.downloadButton.isEnabled = !downloaded
// 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(
getString(R.string.episode_name_extended),

View file

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