mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-12-24 02:01:51 +01:00
Set background for pager before image loads
This commit is contained in:
parent
b791c6c2d8
commit
3067807798
@ -4,8 +4,8 @@ import android.annotation.SuppressLint
|
|||||||
import android.content.Context
|
import android.content.Context
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.BitmapFactory
|
import android.graphics.BitmapFactory
|
||||||
|
import android.graphics.Color
|
||||||
import android.graphics.PointF
|
import android.graphics.PointF
|
||||||
import android.graphics.drawable.ColorDrawable
|
|
||||||
import android.graphics.drawable.Drawable
|
import android.graphics.drawable.Drawable
|
||||||
import android.net.Uri
|
import android.net.Uri
|
||||||
import android.view.GestureDetector
|
import android.view.GestureDetector
|
||||||
@ -107,6 +107,10 @@ class PagerPageHolder(
|
|||||||
init {
|
init {
|
||||||
addView(progressBar)
|
addView(progressBar)
|
||||||
observeStatus()
|
observeStatus()
|
||||||
|
setBackgroundColor(when (val theme = viewer.config.readerTheme) {
|
||||||
|
3 -> Color.TRANSPARENT
|
||||||
|
else -> ThemeUtil.readerBackgroundColor(theme)
|
||||||
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -255,7 +259,7 @@ class PagerPageHolder(
|
|||||||
context
|
context
|
||||||
)) {
|
)) {
|
||||||
imageView.setImage(ImageSource.inputStream(openStream!!))
|
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
|
// if the user switches to automatic when pages are already cached, the bg needs to be loaded
|
||||||
else {
|
else {
|
||||||
@ -273,16 +277,12 @@ class PagerPageHolder(
|
|||||||
} else {
|
} else {
|
||||||
val imageView = initSubsamplingImageView()
|
val imageView = initSubsamplingImageView()
|
||||||
imageView.setImage(ImageSource.inputStream(openStream!!))
|
imageView.setImage(ImageSource.inputStream(openStream!!))
|
||||||
background = ColorDrawable(ThemeUtil.readerBackgroundColor(viewer.config.readerTheme))
|
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
val imageView = initImageView()
|
val imageView = initImageView()
|
||||||
imageView.setImage(openStream!!)
|
imageView.setImage(openStream!!)
|
||||||
if (viewer.config.readerTheme >= 2 && page.bg != null) {
|
if (viewer.config.readerTheme >= 2 && page.bg != null) {
|
||||||
background = page.bg
|
imageView.background = page.bg
|
||||||
} else if (viewer.config.readerTheme < 2) {
|
|
||||||
background =
|
|
||||||
ColorDrawable(ThemeUtil.readerBackgroundColor(viewer.config.readerTheme))
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user