From d3579706d3aa9b49fe027f798b9ec7033edfce65 Mon Sep 17 00:00:00 2001 From: Jay Date: Thu, 9 Apr 2020 23:29:26 -0400 Subject: [PATCH] Possibly fixing some freezes and crashes --- .../java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt | 2 +- app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt index af6448a1d0..78e81608af 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/manga/MangaDetailsPresenter.kt @@ -347,7 +347,7 @@ class MangaDetailsPresenter( * @param chapters the list of chapters to download. */ fun downloadChapters(chapters: List) { - downloadManager.downloadChapters(manga, chapters) + downloadManager.downloadChapters(manga, chapters.filter { !it.isDownloaded }) } fun restartDownloads() { diff --git a/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt b/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt index 3ab159237c..44e4a98f04 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/util/system/ImageUtil.kt @@ -55,8 +55,9 @@ object ImageUtil { return null } - fun autoSetBackground(image: Bitmap, useWhiteAlways: Boolean): Drawable { + fun autoSetBackground(image: Bitmap?, useWhiteAlways: Boolean): Drawable { val backgroundColor = if (useWhiteAlways) Color.WHITE else android.R.attr.colorBackground + if (image == null) return ColorDrawable(backgroundColor) if (image.width < 50 || image.height < 50) return ColorDrawable(backgroundColor) val top = 5