Apply suggestions for ProgressImageView (#942)

main
Ivan Kupalov 6 years ago committed by Konrad Pozniak
parent a58388a730
commit aac934cf56
  1. 16
      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);
}

Loading…
Cancel
Save