fix: Paged reading mode failing if "Smart Background" is enabled

This commit is contained in:
Ahmad Ansori Palembani 2024-05-30 17:51:31 +07:00
parent f4a0264cf0
commit 179680b0d4
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6

View file

@ -504,17 +504,18 @@ class PagerPageHolder(
} }
// if the user switches to automatic when pages are already cached, the bg needs to be loaded // if the user switches to automatic when pages are already cached, the bg needs to be loaded
else { else {
val background =
try {
setBG(actualSource.peek().inputStream())
} catch (e: Exception) {
Timber.e(e.localizedMessage)
ColorDrawable(Color.WHITE)
}
setImage(actualSource, false, imageConfig) setImage(actualSource, false, imageConfig)
try { pageView?.background = background
pageView?.background = setBG(actualSource.inputStream()) page.bg = pageView?.background
} catch (e: Exception) { page.bgType = bgType
Timber.e(e.localizedMessage)
pageView?.background = ColorDrawable(Color.WHITE)
} finally {
page.bg = pageView?.background
page.bgType = bgType
}
} }
} else { } else {
setImage(actualSource, false, imageConfig) setImage(actualSource, false, imageConfig)