mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
Make bars round
This commit is contained in:
@@ -269,16 +269,22 @@ public class BarChart extends ScrollableChart
|
||||
private void drawBar(Canvas canvas, RectF rect, double value)
|
||||
{
|
||||
float margin = baseSize * 0.225f;
|
||||
float round = dpToPixels(getContext(), 2);
|
||||
|
||||
int color = textColor;
|
||||
if (value / 1000 >= target) color = primaryColor;
|
||||
|
||||
rect.inset(-margin, 0);
|
||||
setModeOrColor(pGraph, XFERMODE_CLEAR, backgroundColor);
|
||||
canvas.drawRect(rect, pGraph);
|
||||
canvas.drawRoundRect(rect, round, round, pGraph);
|
||||
|
||||
rect.inset(margin, 0);
|
||||
setModeOrColor(pGraph, XFERMODE_SRC, color);
|
||||
canvas.drawRoundRect(rect, round, round, pGraph);
|
||||
rect.set(rect.left,
|
||||
rect.top + rect.height() / 2.0f,
|
||||
rect.right,
|
||||
rect.bottom);
|
||||
canvas.drawRect(rect, pGraph);
|
||||
|
||||
if (isTransparencyEnabled) pGraph.setXfermode(XFERMODE_SRC);
|
||||
|
||||
@@ -375,7 +375,8 @@ public class HistoryChart extends ScrollableChart
|
||||
}
|
||||
|
||||
pSquareFg.setColor(reverseTextColor);
|
||||
canvas.drawRect(location, pSquareBg);
|
||||
float round = dpToPixels(getContext(), 2);
|
||||
canvas.drawRoundRect(location, round, round, pSquareBg);
|
||||
String text = Integer.toString(date.get(Calendar.DAY_OF_MONTH));
|
||||
canvas.drawText(text, location.centerX(),
|
||||
location.centerY() + squareTextOffset, pSquareFg);
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.text.*;
|
||||
import java.util.*;
|
||||
|
||||
import static android.view.View.MeasureSpec.*;
|
||||
import static org.isoron.androidbase.utils.InterfaceUtils.getDimension;
|
||||
import static org.isoron.androidbase.utils.InterfaceUtils.*;
|
||||
|
||||
public class StreakChart extends View
|
||||
{
|
||||
@@ -202,8 +202,14 @@ public class StreakChart extends View
|
||||
|
||||
paint.setColor(percentageToColor(percentage));
|
||||
|
||||
canvas.drawRect(rect.left + gap, rect.top + paddingTopBottom,
|
||||
rect.right - gap, rect.bottom - paddingTopBottom, paint);
|
||||
float round = dpToPixels(getContext(), 2);
|
||||
canvas.drawRoundRect(rect.left + gap,
|
||||
rect.top + paddingTopBottom,
|
||||
rect.right - gap,
|
||||
rect.bottom - paddingTopBottom,
|
||||
round,
|
||||
round,
|
||||
paint);
|
||||
|
||||
float yOffset = rect.centerY() + 0.3f * em;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user