From 21c02f08d2aebb50d0082a8a422f53ea04ce6f41 Mon Sep 17 00:00:00 2001 From: kunfei Date: Wed, 21 Aug 2019 13:32:11 +0800 Subject: [PATCH] up --- .../legado/app/ui/widget/image/CircleImageView.kt | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/io/legado/app/ui/widget/image/CircleImageView.kt b/app/src/main/java/io/legado/app/ui/widget/image/CircleImageView.kt index fd737e162..965236486 100644 --- a/app/src/main/java/io/legado/app/ui/widget/image/CircleImageView.kt +++ b/app/src/main/java/io/legado/app/ui/widget/image/CircleImageView.kt @@ -240,22 +240,20 @@ class CircleImageView : AppCompatImageView { return drawable.bitmap } - try { - val bitmap: Bitmap - - if (drawable is ColorDrawable) { - bitmap = Bitmap.createBitmap(COLORDRAWABLE_DIMENSION, COLORDRAWABLE_DIMENSION, BITMAP_CONFIG) + return try { + val bitmap: Bitmap = if (drawable is ColorDrawable) { + Bitmap.createBitmap(COLORDRAWABLE_DIMENSION, COLORDRAWABLE_DIMENSION, BITMAP_CONFIG) } else { - bitmap = Bitmap.createBitmap(drawable.intrinsicWidth, drawable.intrinsicHeight, BITMAP_CONFIG) + Bitmap.createBitmap(drawable.intrinsicWidth, drawable.intrinsicHeight, BITMAP_CONFIG) } val canvas = Canvas(bitmap) drawable.setBounds(0, 0, canvas.width, canvas.height) drawable.draw(canvas) - return bitmap + bitmap } catch (e: Exception) { e.printStackTrace() - return null + null } }