refactor: Move stuff around

This commit is contained in:
Ahmad Ansori Palembani 2024-06-12 11:25:09 +07:00
parent 3b42210f10
commit 913f9b6b5c
Signed by: null2264
GPG key ID: BA64F8B60AF3EFB6

View file

@ -363,7 +363,8 @@ class PagerPageHolder(
val isAnimated = ImageUtil.isAnimatedAndSupported(actualSource)
val bgColor = ReaderBackgroundColor.fromPreference(viewer.config.readerTheme)
val bgType = getBGType(viewer.config.readerTheme, context)
val background = if (!isAnimated && bgColor.isSmartColor) {
val background = if (bgColor.isSmartColor) {
if (!isAnimated) {
if (page.bg != null && page.bgType == bgType) page.bg
else {
try {
@ -373,8 +374,9 @@ class PagerPageHolder(
ColorDrawable(Color.WHITE)
}
}
} else if (bgColor.isSmartColor && page.bg != null) {
} else {
page.bg
}
} else {
null
}
@ -387,9 +389,9 @@ class PagerPageHolder(
withUIContext {
val (bg, bgType) = _bg
if (bg != null) pageView?.background = bg
if (!isAnimated && page.bg == null && page.bgType != bgType) {
page.bg = pageView?.background
page.bgType = bgType
if (!isAnimated) {
if (page.bg == null) page.bg = pageView?.background
if (page.bgType != bgType) page.bgType = bgType
}
setImage(source, isAnimated, imageConfig)
}