Update PagerPageHolder.kt
This commit is contained in:
parent
1e49b4543f
commit
220cdd3c05
@ -4,8 +4,10 @@ import android.annotation.SuppressLint
|
|||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
import android.graphics.BitmapFactory
|
import android.graphics.BitmapFactory
|
||||||
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.support.v4.graphics.ColorUtils
|
||||||
import android.view.GestureDetector
|
import android.view.GestureDetector
|
||||||
import android.view.Gravity
|
import android.view.Gravity
|
||||||
import android.view.MotionEvent
|
import android.view.MotionEvent
|
||||||
@ -255,9 +257,23 @@ class PagerPageHolder(
|
|||||||
|
|
||||||
launchUI {
|
launchUI {
|
||||||
val image = async { BitmapFactory.decodeByteArray(bytesArray, 0, bytesArray.size) }
|
val image = async { BitmapFactory.decodeByteArray(bytesArray, 0, bytesArray.size) }
|
||||||
imageView.background = ImageUtil.autoSetBackground(image.await())
|
val bg = ImageUtil.autoSetBackground(image.await())
|
||||||
if (!viewer.config.imageCropBorders)
|
imageView.background = bg
|
||||||
imageView.setImage(ImageSource.bitmap(image.await()))
|
if (!viewer.config.imageCropBorders) {
|
||||||
|
if (bg is ColorDrawable) {
|
||||||
|
val array = FloatArray(3)
|
||||||
|
ColorUtils.colorToHSL(bg.color, array)
|
||||||
|
if (array[1] < 0.2) {
|
||||||
|
val bytesStream = bytesArray.inputStream()
|
||||||
|
imageView.setImage(ImageSource.inputStream(bytesStream))
|
||||||
|
bytesStream.close()
|
||||||
|
}
|
||||||
|
else
|
||||||
|
imageView.setImage(ImageSource.bitmap(image.await()))
|
||||||
|
}
|
||||||
|
else
|
||||||
|
imageView.setImage(ImageSource.bitmap(image.await()))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
Loading…
Reference in New Issue
Block a user