Make skips equivalent to implicit checks; make their visual representation consistent
|
Before Width: | Height: | Size: 543 B After Width: | Height: | Size: 217 B |
|
Before Width: | Height: | Size: 1.4 KiB After Width: | Height: | Size: 1.3 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 1.4 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 4.8 KiB |
|
Before Width: | Height: | Size: 5.1 KiB After Width: | Height: | Size: 4.9 KiB |
@@ -85,6 +85,8 @@ public class HistoryChart extends ScrollableChart
|
|||||||
|
|
||||||
private int reverseTextColor;
|
private int reverseTextColor;
|
||||||
|
|
||||||
|
private int backgroundColor;
|
||||||
|
|
||||||
private boolean isEditable;
|
private boolean isEditable;
|
||||||
|
|
||||||
private String previousMonth;
|
private String previousMonth;
|
||||||
@@ -383,7 +385,7 @@ public class HistoryChart extends ScrollableChart
|
|||||||
pSquareBg.setColor(colors[0]);
|
pSquareBg.setColor(colors[0]);
|
||||||
pSquareFg.setColor(textColors[1]);
|
pSquareFg.setColor(textColors[1]);
|
||||||
}
|
}
|
||||||
else if(checkmark < target)
|
else if ((isNumerical && checkmark < target) || checkmark != CHECKED_EXPLICITLY)
|
||||||
{
|
{
|
||||||
pSquareBg.setColor(colors[1]);
|
pSquareBg.setColor(colors[1]);
|
||||||
pSquareFg.setColor(textColors[2]);
|
pSquareFg.setColor(textColors[2]);
|
||||||
@@ -400,7 +402,7 @@ public class HistoryChart extends ScrollableChart
|
|||||||
|
|
||||||
if (!isNumerical && checkmark == SKIPPED)
|
if (!isNumerical && checkmark == SKIPPED)
|
||||||
{
|
{
|
||||||
pSquareBg.setColor(textColors[2]);
|
pSquareBg.setColor(backgroundColor);
|
||||||
pSquareBg.setStrokeWidth(columnWidth * 0.025f);
|
pSquareBg.setStrokeWidth(columnWidth * 0.025f);
|
||||||
|
|
||||||
canvas.save();
|
canvas.save();
|
||||||
@@ -457,6 +459,8 @@ public class HistoryChart extends ScrollableChart
|
|||||||
int green = Color.green(primaryColor);
|
int green = Color.green(primaryColor);
|
||||||
int blue = Color.blue(primaryColor);
|
int blue = Color.blue(primaryColor);
|
||||||
|
|
||||||
|
backgroundColor = res.getColor(R.attr.cardBgColor);
|
||||||
|
|
||||||
if (isBackgroundTransparent)
|
if (isBackgroundTransparent)
|
||||||
{
|
{
|
||||||
colors = new int[3];
|
colors = new int[3];
|
||||||
|
|||||||
@@ -109,6 +109,7 @@ class CheckmarkButtonView(
|
|||||||
}
|
}
|
||||||
val id = when (value) {
|
val id = when (value) {
|
||||||
SKIPPED -> R.string.fa_skipped
|
SKIPPED -> R.string.fa_skipped
|
||||||
|
CHECKED_IMPLICITLY -> R.string.fa_skipped
|
||||||
UNCHECKED -> R.string.fa_times
|
UNCHECKED -> R.string.fa_times
|
||||||
else -> R.string.fa_check
|
else -> R.string.fa_check
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -116,8 +116,8 @@ public class CheckmarkWidgetView extends HabitWidgetView {
|
|||||||
if (isNumerical) return NumberButtonViewKt.toShortString(checkmarkValue / 1000.0);
|
if (isNumerical) return NumberButtonViewKt.toShortString(checkmarkValue / 1000.0);
|
||||||
switch (checkmarkState) {
|
switch (checkmarkState) {
|
||||||
case Checkmark.CHECKED_EXPLICITLY:
|
case Checkmark.CHECKED_EXPLICITLY:
|
||||||
case Checkmark.CHECKED_IMPLICITLY:
|
|
||||||
return getResources().getString(R.string.fa_check);
|
return getResources().getString(R.string.fa_check);
|
||||||
|
case Checkmark.CHECKED_IMPLICITLY:
|
||||||
case Checkmark.SKIPPED:
|
case Checkmark.SKIPPED:
|
||||||
return getResources().getString(R.string.fa_skipped);
|
return getResources().getString(R.string.fa_skipped);
|
||||||
case Checkmark.UNCHECKED:
|
case Checkmark.UNCHECKED:
|
||||||
|
|||||||
@@ -100,14 +100,19 @@ public abstract class CheckmarkList
|
|||||||
static ArrayList<Interval> buildIntervals(@NonNull Frequency freq,
|
static ArrayList<Interval> buildIntervals(@NonNull Frequency freq,
|
||||||
@NonNull Repetition[] reps)
|
@NonNull Repetition[] reps)
|
||||||
{
|
{
|
||||||
|
ArrayList<Repetition> filteredReps = new ArrayList<>();
|
||||||
|
for (Repetition r : reps)
|
||||||
|
if (r.getValue() == CHECKED_EXPLICITLY)
|
||||||
|
filteredReps.add(r);
|
||||||
|
|
||||||
int num = freq.getNumerator();
|
int num = freq.getNumerator();
|
||||||
int den = freq.getDenominator();
|
int den = freq.getDenominator();
|
||||||
|
|
||||||
ArrayList<Interval> intervals = new ArrayList<>();
|
ArrayList<Interval> intervals = new ArrayList<>();
|
||||||
for (int i = 0; i < reps.length - num + 1; i++)
|
for (int i = 0; i < filteredReps.size() - num + 1; i++)
|
||||||
{
|
{
|
||||||
Repetition first = reps[i];
|
Repetition first = filteredReps.get(i);
|
||||||
Repetition last = reps[i + num - 1];
|
Repetition last = filteredReps.get(i + num - 1);
|
||||||
|
|
||||||
long distance = first.getTimestamp().daysUntil(last.getTimestamp());
|
long distance = first.getTimestamp().daysUntil(last.getTimestamp());
|
||||||
if (distance >= den) continue;
|
if (distance >= den) continue;
|
||||||
|
|||||||
@@ -176,6 +176,25 @@ public class CheckmarkListTest extends BaseUnitTest
|
|||||||
assertThat(actual, equalTo(expected));
|
assertThat(actual, equalTo(expected));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void test_buildIntervals_4() throws Exception
|
||||||
|
{
|
||||||
|
Repetition[] reps = new Repetition[]{
|
||||||
|
new Repetition(day(30), CHECKED_EXPLICITLY),
|
||||||
|
new Repetition(day(20), SKIPPED),
|
||||||
|
new Repetition(day(10), CHECKED_EXPLICITLY),
|
||||||
|
};
|
||||||
|
|
||||||
|
ArrayList<CheckmarkList.Interval> expected = new ArrayList<>();
|
||||||
|
expected.add(new CheckmarkList.Interval(day(30), day(30), day(28)));
|
||||||
|
expected.add(new CheckmarkList.Interval(day(10), day(10), day(8)));
|
||||||
|
|
||||||
|
ArrayList<CheckmarkList.Interval> actual;
|
||||||
|
actual = CheckmarkList.buildIntervals(new Frequency(1, 3), reps);
|
||||||
|
assertThat(actual, equalTo(expected));
|
||||||
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void test_getAllValues_moveBackwardsInTime()
|
public void test_getAllValues_moveBackwardsInTime()
|
||||||
{
|
{
|
||||||
|
|||||||