feed the Glide bitmap to subsamplingScaleImageview

This commit is contained in:
tibbi 2017-02-27 18:57:17 +01:00
parent a94d027388
commit 609e341b81

View file

@ -153,9 +153,9 @@ class PhotoFragment : ViewPagerFragment() {
return false return false
} }
override fun onResourceReady(bitmap: Bitmap?, model: String?, target: Target<Bitmap>?, isFromMemoryCache: Boolean, isFirstResource: Boolean): Boolean { override fun onResourceReady(bitmap: Bitmap, model: String?, target: Target<Bitmap>?, isFromMemoryCache: Boolean, isFirstResource: Boolean): Boolean {
if (degrees == 0f) { if (degrees == 0f) {
addZoomableView() addZoomableView(bitmap)
} else { } else {
photo_view.beVisible() photo_view.beVisible()
subsampling_view.beGone() subsampling_view.beGone()
@ -169,12 +169,12 @@ class PhotoFragment : ViewPagerFragment() {
loadBitmap(degrees) loadBitmap(degrees)
} }
private fun addZoomableView() { private fun addZoomableView(bitmap: Bitmap) {
if (!medium.isPng()) { if (!medium.isPng()) {
subsamplingView.apply { subsamplingView.apply {
beVisible() beVisible()
setDoubleTapZoomScale(1.2f) setDoubleTapZoomScale(1.2f)
setImage(ImageSource.uri(medium.path)) setImage(ImageSource.cachedBitmap(bitmap))
orientation = SubsamplingScaleImageView.ORIENTATION_USE_EXIF orientation = SubsamplingScaleImageView.ORIENTATION_USE_EXIF
maxScale = 5f maxScale = 5f
setOnImageEventListener(object : SubsamplingScaleImageView.OnImageEventListener { setOnImageEventListener(object : SubsamplingScaleImageView.OnImageEventListener {