Apply suggestions for ProgressImageView (#942)

This commit is contained in:
Ivan Kupalov 2018-12-03 11:02:07 +01:00 committed by Konrad Pozniak
parent 5b196556e1
commit 19783c5aed

View file

@ -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);
}