|
|
@ -240,22 +240,20 @@ class CircleImageView : AppCompatImageView { |
|
|
|
return drawable.bitmap |
|
|
|
return drawable.bitmap |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
try { |
|
|
|
return try { |
|
|
|
val bitmap: Bitmap |
|
|
|
val bitmap: Bitmap = if (drawable is ColorDrawable) { |
|
|
|
|
|
|
|
Bitmap.createBitmap(COLORDRAWABLE_DIMENSION, COLORDRAWABLE_DIMENSION, BITMAP_CONFIG) |
|
|
|
if (drawable is ColorDrawable) { |
|
|
|
|
|
|
|
bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION, COLORDRAWABLE_DIMENSION, BITMAP_CONFIG) |
|
|
|
|
|
|
|
} else { |
|
|
|
} else { |
|
|
|
bitmap = Bitmap.createBitmap(drawable.intrinsicWidth, drawable.intrinsicHeight, BITMAP_CONFIG) |
|
|
|
Bitmap.createBitmap(drawable.intrinsicWidth, drawable.intrinsicHeight, BITMAP_CONFIG) |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
val canvas = Canvas(bitmap) |
|
|
|
val canvas = Canvas(bitmap) |
|
|
|
drawable.setBounds(0, 0, canvas.width, canvas.height) |
|
|
|
drawable.setBounds(0, 0, canvas.width, canvas.height) |
|
|
|
drawable.draw(canvas) |
|
|
|
drawable.draw(canvas) |
|
|
|
return bitmap |
|
|
|
bitmap |
|
|
|
} catch (e: Exception) { |
|
|
|
} catch (e: Exception) { |
|
|
|
e.printStackTrace() |
|
|
|
e.printStackTrace() |
|
|
|
return null |
|
|
|
null |
|
|
|
} |
|
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
} |
|
|
|
} |
|
|
|