Merge branch 'master' into dev

pull/605/head
Alinson S. Xavier 5 years ago
commit 6d48b53861

1
.gitignore vendored

@ -6,6 +6,7 @@
*~.nib
*.hprof
.DS_Store
._.DS_Store
.externalNativeBuild
.gradle
.idea

@ -1,5 +1,10 @@
# Changelog
### 1.8.8 (June 21, 2020)
* Make small changes to the habit scheduling algorithm, so that "1 time every x days" habits work more predictably.
* Fix crash when saving habit
### 1.8.0 (Jan 1, 2020)
* New bar chart showing number of repetitions performed in each week, month, quarter or year.

@ -181,8 +181,8 @@ fetch_images() {
}
accept_images() {
find tmp/test-screenshots -name '*.expected*' -delete
rsync -av tmp/test-screenshots/ uhabits-android/src/androidTest/assets/
find $OUTPUTS_DIR/test-screenshots -name '*.expected*' -delete
rsync -av $OUTPUTS_DIR/test-screenshots/ uhabits-android/src/androidTest/assets/
}
run_tests() {

@ -1,5 +1,5 @@
VERSION_CODE = 50
VERSION_NAME = 1.8.7
VERSION_CODE = 51
VERSION_NAME = 1.8.8
MIN_SDK_VERSION = 21
TARGET_SDK_VERSION = 29

Binary file not shown.

Before

Width:  |  Height:  |  Size: 61 KiB

After

Width:  |  Height:  |  Size: 61 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 58 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 31 KiB

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 56 KiB

After

Width:  |  Height:  |  Size: 57 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 20 KiB

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 15 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 19 KiB

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 17 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 10 KiB

After

Width:  |  Height:  |  Size: 11 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.9 KiB

After

Width:  |  Height:  |  Size: 2.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 14 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 31 KiB

@ -1,11 +1,12 @@
1.8.7
* Fix issue causing multiple notifications to be dismissed at once
1.8.8
* Small tweaks to the habit scheduling algorithm
* Fix some crashes
1.8:
* New bar chart showing number of repetitions performed each week, month or year
* Performing habits on irregular weekdays will no longer break your streak
* More colors to choose from (now 20 in total)
* Ability to customize how transparent the widgets are
* Ability to customize the first day of the week
* Yes/No buttons on notifications instead of just "Check"
* Customize how transparent the widgets are
* Customize the first day of the week
* Yes/No buttons on notifications
* Automatic dark theme (Android 10)
* Smaller APK and backup files

@ -122,22 +122,28 @@ public abstract class CheckmarkList
}
/**
* Starting from the oldest interval, this function tries to slide the
* Starting from the second newest interval, this function tries to slide the
* intervals backwards into the past, so that gaps are eliminated and
* streaks are maximized. When it detects that sliding an interval
* would not help fixing any gap, it leaves the interval unchanged.
* streaks are maximized.
*/
static void snapIntervalsTogether(@NonNull ArrayList<Interval> intervals)
{
for (int i = 1; i < intervals.size(); i++)
int n = intervals.size();
for (int i = n - 2; i >= 0; i--)
{
Interval curr = intervals.get(i);
Interval prev = intervals.get(i - 1);
Interval next = intervals.get(i + 1);
int gap = prev.end.daysUntil(curr.begin) - 1;
if (gap <= 0 || curr.end.minus(gap).isOlderThan(curr.center)) continue;
intervals.set(i, new Interval(curr.begin.minus(gap), curr.center,
curr.end.minus(gap)));
int gapNextToCurrent = next.begin.daysUntil(curr.end);
int gapCenterToEnd = curr.center.daysUntil(curr.end);
if (gapNextToCurrent >= 0)
{
int shift = Math.min(gapCenterToEnd, gapNextToCurrent + 1);
intervals.set(i, new Interval(curr.begin.minus(shift),
curr.center,
curr.end.minus(shift)));
}
}
}

@ -319,16 +319,31 @@ public class CheckmarkListTest extends BaseUnitTest
public void test_snapIntervalsTogether_1() throws Exception
{
ArrayList<CheckmarkList.Interval> original = new ArrayList<>();
original.add(new CheckmarkList.Interval(day(40), day(40), day(34)));
original.add(new CheckmarkList.Interval(day(25), day(25), day(19)));
original.add(new CheckmarkList.Interval(day(16), day(16), day(10)));
original.add(new CheckmarkList.Interval(day(27), day(27), day(21)));
original.add(new CheckmarkList.Interval(day(20), day(20), day(14)));
original.add(new CheckmarkList.Interval(day(12), day(12), day(6)));
original.add(new CheckmarkList.Interval(day(8), day(8), day(2)));
ArrayList<CheckmarkList.Interval> expected = new ArrayList<>();
expected.add(new CheckmarkList.Interval(day(40), day(40), day(34)));
expected.add(new CheckmarkList.Interval(day(25), day(25), day(19)));
expected.add(new CheckmarkList.Interval(day(18), day(16), day(12)));
expected.add(new CheckmarkList.Interval(day(11), day(8), day(5)));
expected.add(new CheckmarkList.Interval(day(29), day(27), day(23)));
expected.add(new CheckmarkList.Interval(day(22), day(20), day(16)));
expected.add(new CheckmarkList.Interval(day(15), day(12), day(9)));
expected.add(new CheckmarkList.Interval(day(8), day(8), day(2)));
CheckmarkList.snapIntervalsTogether(original);
assertThat(original, equalTo(expected));
}
@Test
public void test_snapIntervalsTogether_2() throws Exception
{
ArrayList<CheckmarkList.Interval> original = new ArrayList<>();
original.add(new CheckmarkList.Interval(day(11), day(8), day(5)));
original.add(new CheckmarkList.Interval(day(6), day(4), day(0)));
ArrayList<CheckmarkList.Interval> expected = new ArrayList<>();
expected.add(new CheckmarkList.Interval(day(13), day(8), day(7)));
expected.add(new CheckmarkList.Interval(day(6), day(4), day(0)));
CheckmarkList.snapIntervalsTogether(original);
assertThat(original, equalTo(expected));

@ -153,9 +153,9 @@ public class ScoreListTest extends BaseUnitTest
habit.getScores().groupBy(DateUtils.TruncateField.MONTH, Calendar.SATURDAY);
assertThat(list.size(), equalTo(5));
assertThat(list.get(0).getValue(), closeTo(0.653659, E));
assertThat(list.get(1).getValue(), closeTo(0.622715, E));
assertThat(list.get(2).getValue(), closeTo(0.520997, E));
assertThat(list.get(0).getValue(), closeTo(0.687724, E));
assertThat(list.get(1).getValue(), closeTo(0.636747, E));
assertThat(list.get(2).getValue(), closeTo(0.533860, E));
}
@Test

Loading…
Cancel
Save