|
|
@ -19,7 +19,6 @@
|
|
|
|
|
|
|
|
|
|
|
|
package org.isoron.uhabits.views;
|
|
|
|
package org.isoron.uhabits.views;
|
|
|
|
|
|
|
|
|
|
|
|
import android.annotation.SuppressLint;
|
|
|
|
|
|
|
|
import android.content.Context;
|
|
|
|
import android.content.Context;
|
|
|
|
import android.graphics.Bitmap;
|
|
|
|
import android.graphics.Bitmap;
|
|
|
|
import android.graphics.Canvas;
|
|
|
|
import android.graphics.Canvas;
|
|
|
@ -41,22 +40,22 @@ public class RingView extends View
|
|
|
|
public static final PorterDuffXfermode XFERMODE_CLEAR =
|
|
|
|
public static final PorterDuffXfermode XFERMODE_CLEAR =
|
|
|
|
new PorterDuffXfermode(PorterDuff.Mode.CLEAR);
|
|
|
|
new PorterDuffXfermode(PorterDuff.Mode.CLEAR);
|
|
|
|
|
|
|
|
|
|
|
|
private float precision;
|
|
|
|
|
|
|
|
private boolean enableFontAwesome;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int color;
|
|
|
|
private int color;
|
|
|
|
|
|
|
|
private float precision;
|
|
|
|
private float percentage;
|
|
|
|
private float percentage;
|
|
|
|
private TextPaint pRing;
|
|
|
|
|
|
|
|
private RectF rect;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private int diameter;
|
|
|
|
private int diameter;
|
|
|
|
private float textSize;
|
|
|
|
|
|
|
|
private float thickness;
|
|
|
|
private float thickness;
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
private RectF rect;
|
|
|
|
|
|
|
|
private TextPaint pRing;
|
|
|
|
|
|
|
|
|
|
|
|
private Integer backgroundColor;
|
|
|
|
private Integer backgroundColor;
|
|
|
|
private Integer inactiveColor;
|
|
|
|
private Integer inactiveColor;
|
|
|
|
|
|
|
|
|
|
|
|
private float em;
|
|
|
|
private float em;
|
|
|
|
private String text;
|
|
|
|
private String text;
|
|
|
|
|
|
|
|
private float textSize;
|
|
|
|
|
|
|
|
private boolean enableFontAwesome;
|
|
|
|
|
|
|
|
|
|
|
|
private Bitmap drawingCache;
|
|
|
|
private Bitmap drawingCache;
|
|
|
|
private Canvas cacheCanvas;
|
|
|
|
private Canvas cacheCanvas;
|
|
|
@ -65,6 +64,14 @@ public class RingView extends View
|
|
|
|
public RingView(Context context)
|
|
|
|
public RingView(Context context)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
super(context);
|
|
|
|
super(context);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
percentage = 0.0f;
|
|
|
|
|
|
|
|
precision = 0.01f;
|
|
|
|
|
|
|
|
color = ColorHelper.CSV_PALETTE[0];
|
|
|
|
|
|
|
|
thickness = UIHelper.dpToPixels(getContext(), 2);
|
|
|
|
|
|
|
|
text = "";
|
|
|
|
|
|
|
|
textSize = context.getResources().getDimension(R.dimen.smallTextSize);
|
|
|
|
|
|
|
|
|
|
|
|
init();
|
|
|
|
init();
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
@ -149,7 +156,6 @@ public class RingView extends View
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
@Override
|
|
|
|
@Override
|
|
|
|
@SuppressLint("DrawAllocation")
|
|
|
|
|
|
|
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
|
|
|
|
protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
|
|
|
super.onMeasure(widthMeasureSpec, heightMeasureSpec);
|
|
|
|