change the way of displaying fullscreen images

This commit is contained in:
tibbi 2017-03-01 22:04:13 +01:00
parent eced6c17c2
commit 4164f6c980

View file

@ -146,6 +146,7 @@ class PhotoFragment : ViewPagerFragment() {
.transform(GlideRotateTransformation(context, degrees)) .transform(GlideRotateTransformation(context, degrees))
.format(if (medium.isPng()) DecodeFormat.PREFER_ARGB_8888 else DecodeFormat.PREFER_RGB_565) .format(if (medium.isPng()) DecodeFormat.PREFER_ARGB_8888 else DecodeFormat.PREFER_RGB_565)
.priority(if (isFragmentVisible) Priority.IMMEDIATE else Priority.NORMAL) .priority(if (isFragmentVisible) Priority.IMMEDIATE else Priority.NORMAL)
.thumbnail(0.3f)
.diskCacheStrategy(DiskCacheStrategy.NONE) .diskCacheStrategy(DiskCacheStrategy.NONE)
.listener(object : RequestListener<String, Bitmap> { .listener(object : RequestListener<String, Bitmap> {
override fun onException(e: Exception?, model: String?, target: Target<Bitmap>?, isFirstResource: Boolean): Boolean { override fun onException(e: Exception?, model: String?, target: Target<Bitmap>?, isFirstResource: Boolean): Boolean {
@ -154,7 +155,7 @@ class PhotoFragment : ViewPagerFragment() {
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(bitmap) addZoomableView()
} else { } else {
photo_view.beVisible() photo_view.beVisible()
subsampling_view.beGone() subsampling_view.beGone()
@ -168,12 +169,12 @@ class PhotoFragment : ViewPagerFragment() {
loadBitmap(degrees) loadBitmap(degrees)
} }
private fun addZoomableView(bitmap: Bitmap) { private fun addZoomableView() {
if (!medium.isPng()) { if (!medium.isPng()) {
subsamplingView.apply { subsamplingView.apply {
beVisible() beVisible()
setDoubleTapZoomScale(1.8f) setDoubleTapZoomScale(1.8f)
setImage(ImageSource.cachedBitmap(bitmap)) setImage(ImageSource.uri(medium.path))
orientation = SubsamplingScaleImageView.ORIENTATION_USE_EXIF orientation = SubsamplingScaleImageView.ORIENTATION_USE_EXIF
maxScale = 5f maxScale = 5f
setOnImageEventListener(object : SubsamplingScaleImageView.OnImageEventListener { setOnImageEventListener(object : SubsamplingScaleImageView.OnImageEventListener {