From 19783c5aed28a9824b1f67380c1f17571528f2c5 Mon Sep 17 00:00:00 2001 From: Ivan Kupalov Date: Mon, 3 Dec 2018 11:02:07 +0100 Subject: [PATCH] Apply suggestions for ProgressImageView (#942) --- .../tusky/view/ProgressImageView.java | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/com/keylesspalace/tusky/view/ProgressImageView.java b/app/src/main/java/com/keylesspalace/tusky/view/ProgressImageView.java index 74137b3f..5fe807f7 100644 --- a/app/src/main/java/com/keylesspalace/tusky/view/ProgressImageView.java +++ b/app/src/main/java/com/keylesspalace/tusky/view/ProgressImageView.java @@ -92,8 +92,8 @@ public final class ProgressImageView extends AppCompatImageView { super.onDraw(canvas); float angle = (progress / 100f) * 360 - 90; - float halfWidth = canvas.getWidth() / 2; - float halfHeight = canvas.getHeight() / 2; + float halfWidth = getWidth() / 2; + float halfHeight = getHeight() / 2; progressRect.set(halfWidth * 0.75f, halfHeight * 0.75f, halfWidth * 1.25f, halfHeight * 1.25f); biggerRect.set(progressRect); int margin = 8; @@ -108,15 +108,15 @@ public final class ProgressImageView extends AppCompatImageView { int circleRadius = Utils.dpToPx(getContext(), 14); int circleMargin = Utils.dpToPx(getContext(), 14); - int circleY = canvas.getHeight() - circleMargin - circleRadius / 2; - int circleX = canvas.getWidth() - circleMargin - circleRadius / 2; + int circleY = getHeight() - circleMargin - circleRadius / 2; + int circleX = getWidth() - circleMargin - circleRadius / 2; canvas.drawCircle(circleX, circleY, circleRadius, markBgPaint); - captionDrawable.setBounds(canvas.getWidth() - circleMargin - circleRadius, - canvas.getHeight() - circleMargin - circleRadius, - canvas.getWidth() - circleMargin, - canvas.getHeight() - circleMargin); + captionDrawable.setBounds(getWidth() - circleMargin - circleRadius, + getHeight() - circleMargin - circleRadius, + getWidth() - circleMargin, + getHeight() - circleMargin); DrawableCompat.setTint(captionDrawable, Color.WHITE); captionDrawable.draw(canvas); }