Auto background for .gif + fixes to share sheet for manga

This commit is contained in:
Jay 2019-11-03 01:49:03 -07:00
parent db50a48966
commit 5c80acacb7
3 changed files with 6 additions and 3 deletions

View File

@ -332,7 +332,7 @@ class MangaInfoController : NucleusController<MangaInfoPresenter>(),
* Called to run Intent with [Intent.ACTION_SEND], which show share dialog. * Called to run Intent with [Intent.ACTION_SEND], which show share dialog.
*/ */
private fun prepareToShareManga() { private fun prepareToShareManga() {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q && manga_cover.drawable != null)
GlideApp.with(activity!!).asBitmap().load(presenter.manga).into(object : GlideApp.with(activity!!).asBitmap().load(presenter.manga).into(object :
CustomTarget<Bitmap>() { CustomTarget<Bitmap>() {
override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) { override fun onResourceReady(resource: Bitmap, transition: Transition<in Bitmap>?) {

View File

@ -271,7 +271,10 @@ class PagerPageHolder(
initSubsamplingImageView().setImage(ImageSource.inputStream(openStream!!)) initSubsamplingImageView().setImage(ImageSource.inputStream(openStream!!))
} }
} else { } else {
initImageView().setImage(openStream!!) val imageView = initImageView()
imageView.setImage(openStream!!)
if (viewer.config.readerTheme == 2 && page.bg != null)
imageView.background = page.bg
} }
} }
// Keep the Rx stream alive to close the input stream only when unsubscribed // Keep the Rx stream alive to close the input stream only when unsubscribed

View File

@ -55,7 +55,7 @@ object ImageUtil {
fun autoSetBackground(image: Bitmap): Drawable { fun autoSetBackground(image: Bitmap): Drawable {
if (image.width < 50 || image.height < 50) if (image.width < 50 || image.height < 50)
return ColorDrawable(Color.WHITE) return ColorDrawable(android.R.attr.colorBackground)
val top = 5 val top = 5
val bot = image.height - 5 val bot = image.height - 5
val left = (image.width * 0.0275).toInt() val left = (image.width * 0.0275).toInt()