From f40543ae3bfbda361b5c0201bcc1828a8436fffc Mon Sep 17 00:00:00 2001 From: tibbi Date: Wed, 8 Aug 2018 12:54:59 +0200 Subject: [PATCH] shorten some code at PicassoRegionDecoder --- .../gallery/helpers/PicassoRegionDecoder.kt | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/PicassoRegionDecoder.kt b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/PicassoRegionDecoder.kt index 077508770..778b380b6 100644 --- a/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/PicassoRegionDecoder.kt +++ b/app/src/main/kotlin/com/simplemobiletools/gallery/helpers/PicassoRegionDecoder.kt @@ -11,23 +11,23 @@ class PicassoRegionDecoder : ImageRegionDecoder { override fun init(context: Context, uri: Uri): Point { val inputStream = context.contentResolver.openInputStream(uri) - this.decoder = BitmapRegionDecoder.newInstance(inputStream, false) - return Point(this.decoder!!.width, this.decoder!!.height) + decoder = BitmapRegionDecoder.newInstance(inputStream, false) + return Point(decoder!!.width, decoder!!.height) } override fun decodeRegion(rect: Rect, sampleSize: Int): Bitmap { - synchronized(this.decoderLock) { + synchronized(decoderLock) { val options = BitmapFactory.Options() options.inSampleSize = sampleSize options.inPreferredConfig = Bitmap.Config.ARGB_8888 - val bitmap = this.decoder!!.decodeRegion(rect, options) + val bitmap = decoder!!.decodeRegion(rect, options) return bitmap ?: throw RuntimeException("Region decoder returned null bitmap - image format may not be supported") } } - override fun isReady() = this.decoder != null && !this.decoder!!.isRecycled + override fun isReady() = decoder != null && !decoder!!.isRecycled override fun recycle() { - this.decoder!!.recycle() + decoder!!.recycle() } }