From 30678077989834ea4d17d0f8a16bef18c3564eee Mon Sep 17 00:00:00 2001 From: Jay Date: Thu, 21 May 2020 01:17:39 -0400 Subject: [PATCH] Set background for pager before image loads --- .../ui/reader/viewer/pager/PagerPageHolder.kt | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt index 7a9213da06..1fb9c833fd 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/reader/viewer/pager/PagerPageHolder.kt @@ -4,8 +4,8 @@ import android.annotation.SuppressLint import android.content.Context import android.content.Intent import android.graphics.BitmapFactory +import android.graphics.Color import android.graphics.PointF -import android.graphics.drawable.ColorDrawable import android.graphics.drawable.Drawable import android.net.Uri import android.view.GestureDetector @@ -107,6 +107,10 @@ class PagerPageHolder( init { addView(progressBar) observeStatus() + setBackgroundColor(when (val theme = viewer.config.readerTheme) { + 3 -> Color.TRANSPARENT + else -> ThemeUtil.readerBackgroundColor(theme) + }) } /** @@ -255,7 +259,7 @@ class PagerPageHolder( context )) { imageView.setImage(ImageSource.inputStream(openStream!!)) - background = page.bg + imageView.background = page.bg } // if the user switches to automatic when pages are already cached, the bg needs to be loaded else { @@ -273,16 +277,12 @@ class PagerPageHolder( } else { val imageView = initSubsamplingImageView() imageView.setImage(ImageSource.inputStream(openStream!!)) - background = ColorDrawable(ThemeUtil.readerBackgroundColor(viewer.config.readerTheme)) } } else { val imageView = initImageView() imageView.setImage(openStream!!) if (viewer.config.readerTheme >= 2 && page.bg != null) { - background = page.bg - } else if (viewer.config.readerTheme < 2) { - background = - ColorDrawable(ThemeUtil.readerBackgroundColor(viewer.config.readerTheme)) + imageView.background = page.bg } } }