Skip to content

Commit 0fd3c0c

Browse files
committed
get the display resolution when resizing bitmap
1 parent 5f4532d commit 0fd3c0c

1 file changed

Lines changed: 4 additions & 5 deletions

File tree

  • app/src/main/kotlin/com/simplemobiletools/draw

app/src/main/kotlin/com/simplemobiletools/draw/MyCanvas.kt

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,7 @@ package com.simplemobiletools.draw
22

33
import android.app.Activity
44
import android.content.Context
5-
import android.graphics.Bitmap
6-
import android.graphics.Canvas
7-
import android.graphics.Color
8-
import android.graphics.Paint
5+
import android.graphics.*
96
import android.os.Parcel
107
import android.os.Parcelable
118
import android.util.AttributeSet
@@ -94,12 +91,14 @@ class MyCanvas(context: Context, attrs: AttributeSet) : View(context, attrs) {
9491

9592
fun drawBitmap(activity: Activity, path: String) {
9693
Thread({
94+
val size = Point()
95+
activity.windowManager.defaultDisplay.getSize(size)
9796
mBackgroundBitmap = Glide.with(context)
9897
.load(path)
9998
.asBitmap()
10099
.format(DecodeFormat.PREFER_ARGB_8888)
101100
.fitCenter()
102-
.into(width, height)
101+
.into(size.x, size.y)
103102
.get()
104103
activity.runOnUiThread {
105104
invalidate()

0 commit comments

Comments
 (0)