Commit 0a59cdb2 authored by Isira Seneviratne's avatar Isira Seneviratne

Use Bitmap.scale() extension function.

parent 00a92660
......@@ -24,7 +24,6 @@ import android.content.BroadcastReceiver
import android.content.Context
import android.content.Intent
import android.content.IntentFilter
import android.graphics.Bitmap
import android.graphics.Point
import android.os.Bundle
import android.os.RemoteException
......@@ -34,6 +33,7 @@ import android.util.Log
import android.view.*
import android.widget.Button
import android.widget.TextView
import androidx.core.graphics.scale
import androidx.core.net.toUri
import androidx.fragment.app.Fragment
import androidx.lifecycle.lifecycleScope
......@@ -364,9 +364,7 @@ class ProjectDetailsFragment : Fragment() {
val slideshowBinding = ProjectDetailsSlideshowImageLayoutBinding.inflate(layoutInflater)
var bitmap = image.image!!
if (scaleImages(bitmap.height, bitmap.width)) {
bitmap = Bitmap.createScaledBitmap(image.image!!,
image.image!!.width * 2,
image.image!!.height * 2, false)
bitmap = bitmap.scale(bitmap.width * 2, bitmap.height * 2, filter = false)
}
slideshowBinding.slideshowImage.setImageBitmap(bitmap)
binding.slideshowHook.addView(slideshowBinding.slideshowImage)
......
......@@ -19,13 +19,14 @@
package edu.berkeley.boinc.attach.glide
import android.graphics.Bitmap
import androidx.core.graphics.scale
import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool
import com.bumptech.glide.load.resource.bitmap.BitmapTransformation
import java.security.MessageDigest
class ScaleBitmapBy2 : BitmapTransformation() {
override fun transform(pool: BitmapPool, toTransform: Bitmap, outWidth: Int, outHeight: Int): Bitmap {
return Bitmap.createScaledBitmap(toTransform, toTransform.width * 2, toTransform.height * 2, false)
return toTransform.scale(toTransform.width * 2, toTransform.height * 2, filter = false)
}
override fun equals(other: Any?) = other is ScaleBitmapBy2
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment