mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Small changes to the layout of NumberButtonView
This commit is contained in:
@@ -326,7 +326,7 @@ public class HistoryChart extends ScrollableChart
|
||||
else
|
||||
{
|
||||
int checkmark = checkmarks[checkmarkOffset];
|
||||
pSquareBg.setColor(colors[Integer.min(2, checkmark)]);
|
||||
pSquareBg.setColor(colors[Math.min(2, checkmark)]);
|
||||
}
|
||||
|
||||
pSquareFg.setColor(reverseTextColor);
|
||||
|
||||
@@ -58,10 +58,12 @@ public class NumberButtonView extends View
|
||||
|
||||
private TextPaint pBold;
|
||||
|
||||
private int grey;
|
||||
private int lightGrey;
|
||||
|
||||
private float em;
|
||||
|
||||
private int darkGrey;
|
||||
|
||||
public NumberButtonView(@Nullable Context context)
|
||||
{
|
||||
super(context);
|
||||
@@ -137,16 +139,12 @@ public class NumberButtonView extends View
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas)
|
||||
{
|
||||
if(value < threshold)
|
||||
{
|
||||
pRegular.setColor(grey);
|
||||
pBold.setColor(grey);
|
||||
}
|
||||
else
|
||||
{
|
||||
pRegular.setColor(color);
|
||||
pBold.setColor(color);
|
||||
}
|
||||
int activeColor = lightGrey;
|
||||
if(value > 0 && value < threshold) activeColor = darkGrey;
|
||||
if(value >= threshold) activeColor = color;
|
||||
|
||||
pRegular.setColor(activeColor);
|
||||
pBold.setColor(activeColor);
|
||||
|
||||
String fv = formatValue(value);
|
||||
|
||||
@@ -184,6 +182,7 @@ public class NumberButtonView extends View
|
||||
pBold.setTextAlign(Paint.Align.CENTER);
|
||||
|
||||
em = pBold.measureText("m");
|
||||
grey = sr.getColor(R.attr.lowContrastTextColor);
|
||||
lightGrey = sr.getColor(R.attr.lowContrastTextColor);
|
||||
darkGrey = sr.getColor(R.attr.mediumContrastTextColor);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -62,7 +62,7 @@
|
||||
android:layout_height="wrap_content"
|
||||
app:button_count="8"
|
||||
app:color="6"
|
||||
app:threshold="10"
|
||||
app:threshold="2"
|
||||
app:unit="min"
|
||||
/>
|
||||
|
||||
|
||||
Reference in New Issue
Block a user