Possibly fixing some freezes and crashes

This commit is contained in:
Jay 2020-04-09 23:29:26 -04:00
parent 1aebd3aced
commit d3579706d3
2 changed files with 3 additions and 2 deletions

View File

@ -347,7 +347,7 @@ class MangaDetailsPresenter(
* @param chapters the list of chapters to download.
*/
fun downloadChapters(chapters: List<ChapterItem>) {
downloadManager.downloadChapters(manga, chapters)
downloadManager.downloadChapters(manga, chapters.filter { !it.isDownloaded })
}
fun restartDownloads() {

View File

@ -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