mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-07 09:38:52 -06:00
Rename checkmark values to NO, YES_AUTO, YES_MANUAL and SKIP
This makes the source code consistent with the user interface.
This commit is contained in:
@@ -149,7 +149,7 @@ public class HistoryChart extends ScrollableChart
|
||||
if (timestamp == null) return false;
|
||||
|
||||
Timestamp today = DateUtils.getToday();
|
||||
int newValue = CHECKED_EXPLICITLY;
|
||||
int newValue = YES_MANUAL;
|
||||
int offset = timestamp.daysUntil(today);
|
||||
if (offset < checkmarks.length)
|
||||
{
|
||||
@@ -385,7 +385,7 @@ public class HistoryChart extends ScrollableChart
|
||||
pSquareBg.setColor(colors[0]);
|
||||
pSquareFg.setColor(textColors[1]);
|
||||
}
|
||||
else if ((isNumerical && checkmark < target) || checkmark != CHECKED_EXPLICITLY)
|
||||
else if ((isNumerical && checkmark < target) || checkmark != YES_MANUAL)
|
||||
{
|
||||
pSquareBg.setColor(colors[1]);
|
||||
pSquareFg.setColor(textColors[2]);
|
||||
@@ -400,7 +400,7 @@ public class HistoryChart extends ScrollableChart
|
||||
float round = dpToPixels(getContext(), 2);
|
||||
canvas.drawRoundRect(location, round, round, pSquareBg);
|
||||
|
||||
if (!isNumerical && checkmark == SKIPPED)
|
||||
if (!isNumerical && checkmark == SKIP)
|
||||
{
|
||||
pSquareBg.setColor(backgroundColor);
|
||||
pSquareBg.setStrokeWidth(columnWidth * 0.025f);
|
||||
|
||||
@@ -103,14 +103,14 @@ class CheckmarkButtonView(
|
||||
|
||||
fun draw(canvas: Canvas) {
|
||||
paint.color = when (value) {
|
||||
CHECKED_EXPLICITLY -> color
|
||||
SKIPPED -> color
|
||||
YES_MANUAL -> color
|
||||
SKIP -> color
|
||||
else -> lowContrastColor
|
||||
}
|
||||
val id = when (value) {
|
||||
SKIPPED -> R.string.fa_skipped
|
||||
CHECKED_IMPLICITLY -> R.string.fa_skipped
|
||||
UNCHECKED -> R.string.fa_times
|
||||
SKIP -> R.string.fa_skipped
|
||||
YES_AUTO -> R.string.fa_skipped
|
||||
NO -> R.string.fa_times
|
||||
else -> R.string.fa_check
|
||||
}
|
||||
val label = resources.getString(id)
|
||||
|
||||
@@ -62,7 +62,7 @@ class CheckmarkPanelView(
|
||||
val timestamp = today.minus(index + dataOffset)
|
||||
button.value = when {
|
||||
index + dataOffset < values.size -> values[index + dataOffset]
|
||||
else -> UNCHECKED
|
||||
else -> NO
|
||||
}
|
||||
button.color = color
|
||||
button.onToggle = { value -> onToggle(timestamp, value) }
|
||||
|
||||
@@ -67,9 +67,9 @@ open class CheckmarkWidget(
|
||||
|
||||
private fun getNumericalCheckmarkState(): Int {
|
||||
return if (habit.isCompletedToday) {
|
||||
Checkmark.CHECKED_EXPLICITLY
|
||||
Checkmark.YES_MANUAL
|
||||
} else {
|
||||
Checkmark.UNCHECKED
|
||||
Checkmark.NO
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -75,8 +75,8 @@ public class CheckmarkWidgetView extends HabitWidgetView {
|
||||
int fgColor;
|
||||
|
||||
switch (checkmarkState) {
|
||||
case Checkmark.CHECKED_EXPLICITLY:
|
||||
case Checkmark.SKIPPED:
|
||||
case Checkmark.YES_MANUAL:
|
||||
case Checkmark.SKIP:
|
||||
bgColor = activeColor;
|
||||
fgColor = res.getColor(R.attr.highContrastReverseTextColor);
|
||||
setShadowAlpha(0x4f);
|
||||
@@ -84,8 +84,8 @@ public class CheckmarkWidgetView extends HabitWidgetView {
|
||||
frame.setBackgroundDrawable(background);
|
||||
break;
|
||||
|
||||
case Checkmark.CHECKED_IMPLICITLY:
|
||||
case Checkmark.UNCHECKED:
|
||||
case Checkmark.YES_AUTO:
|
||||
case Checkmark.NO:
|
||||
default:
|
||||
getResources().getString(R.string.fa_times);
|
||||
bgColor = res.getColor(R.attr.cardBgColor);
|
||||
@@ -115,12 +115,12 @@ public class CheckmarkWidgetView extends HabitWidgetView {
|
||||
{
|
||||
if (isNumerical) return NumberButtonViewKt.toShortString(checkmarkValue / 1000.0);
|
||||
switch (checkmarkState) {
|
||||
case Checkmark.CHECKED_EXPLICITLY:
|
||||
case Checkmark.YES_MANUAL:
|
||||
return getResources().getString(R.string.fa_check);
|
||||
case Checkmark.CHECKED_IMPLICITLY:
|
||||
case Checkmark.SKIPPED:
|
||||
case Checkmark.YES_AUTO:
|
||||
case Checkmark.SKIP:
|
||||
return getResources().getString(R.string.fa_skipped);
|
||||
case Checkmark.UNCHECKED:
|
||||
case Checkmark.NO:
|
||||
default:
|
||||
return getResources().getString(R.string.fa_times);
|
||||
}
|
||||
@@ -204,7 +204,7 @@ public class CheckmarkWidgetView extends HabitWidgetView {
|
||||
percentage = 0.75f;
|
||||
name = "Wake up early";
|
||||
activeColor = PaletteUtils.getAndroidTestColor(6);
|
||||
checkmarkValue = Checkmark.CHECKED_EXPLICITLY;
|
||||
checkmarkValue = Checkmark.YES_MANUAL;
|
||||
refresh();
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user