ProgressTextView: fix circle drawing

main
Alibek Omarov 5 years ago
parent b7db21d8d4
commit ff89f698c8
  1. 6
      app/src/main/java/com/keylesspalace/tusky/components/compose/view/ProgressTextView.java

@ -23,6 +23,7 @@ import android.graphics.PorterDuff;
import android.graphics.PorterDuffXfermode;
import android.graphics.RectF;
import android.graphics.drawable.Drawable;
import android.widget.TextView;
import androidx.annotation.Nullable;
import androidx.core.content.ContextCompat;
import androidx.appcompat.content.res.AppCompatResources;
@ -32,7 +33,7 @@ import android.util.AttributeSet;
import com.keylesspalace.tusky.R;
import at.connyduck.sparkbutton.helpers.Utils;
public final class ProgressTextView extends AppCompatTextView {
public final class ProgressTextView extends TextView {
private int progress = -1;
private final RectF progressRect = new RectF();
@ -85,6 +86,9 @@ public final class ProgressTextView extends AppCompatTextView {
protected void onDraw(Canvas canvas) {
super.onDraw(canvas);
// https://stackoverflow.com/questions/25501185/
canvas.translate(getScrollX(), 0);
float angle = (progress / 100f) * 360 - 90;
float halfWidth = getWidth() / 2;
float halfHeight = getHeight() / 2;

Loading…
Cancel
Save