mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 01:08:50 -06:00
Merge tag 'v1.7.5' into dev
1.7.5
This commit is contained in:
@@ -71,7 +71,8 @@ public class BaseAndroidTest extends TestCase
|
||||
|
||||
protected ModelFactory modelFactory;
|
||||
|
||||
@Override
|
||||
private boolean isDone = false;
|
||||
|
||||
@Before
|
||||
public void setUp()
|
||||
{
|
||||
@@ -137,6 +138,25 @@ public class BaseAndroidTest extends TestCase
|
||||
InterfaceUtils.setFixedResolution(r);
|
||||
}
|
||||
|
||||
protected void runConcurrently(Runnable... runnableList) throws Exception
|
||||
{
|
||||
isDone = false;
|
||||
ExecutorService executor = Executors.newFixedThreadPool(100);
|
||||
List<Future> futures = new LinkedList<>();
|
||||
for (Runnable r : runnableList)
|
||||
futures.add(executor.submit(() ->
|
||||
{
|
||||
while (!isDone) r.run();
|
||||
return null;
|
||||
}));
|
||||
|
||||
Thread.sleep(3000);
|
||||
isDone = true;
|
||||
executor.shutdown();
|
||||
for(Future f : futures) f.get();
|
||||
while (!executor.isTerminated()) Thread.sleep(50);
|
||||
}
|
||||
|
||||
protected void setTheme(@StyleRes int themeId)
|
||||
{
|
||||
targetContext.setTheme(themeId);
|
||||
|
||||
@@ -20,8 +20,8 @@
|
||||
<manifest
|
||||
package="org.isoron.uhabits"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:versionCode="31"
|
||||
android:versionName="1.7.4">
|
||||
android:versionCode="32"
|
||||
android:versionName="1.7.5">
|
||||
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
|
||||
|
||||
@@ -258,7 +258,7 @@ public class FrequencyChart extends ScrollableChart
|
||||
float scale = 1.0f/maxFreq * value;
|
||||
float radius = maxRadius * scale;
|
||||
|
||||
int colorIndex = Math.round((colors.length-1) * scale);
|
||||
int colorIndex = Math.min(colors.length - 1, Math.round((colors.length - 1) * scale));
|
||||
pGraph.setColor(colors[colorIndex]);
|
||||
canvas.drawCircle(rect.centerX(), rect.centerY(), radius, pGraph);
|
||||
}
|
||||
|
||||
@@ -29,6 +29,8 @@ import org.isoron.uhabits.core.utils.*;
|
||||
|
||||
import javax.inject.*;
|
||||
|
||||
import static org.isoron.uhabits.utils.DateUtils.*;
|
||||
|
||||
@ReceiverScope
|
||||
public class ReminderController
|
||||
{
|
||||
@@ -67,7 +69,7 @@ public class ReminderController
|
||||
{
|
||||
long snoozeInterval = preferences.getSnoozeInterval();
|
||||
|
||||
long now = DateUtils.getLocalTime();
|
||||
long now = applyTimezone(getLocalTime());
|
||||
long reminderTime = now + snoozeInterval * 60 * 1000;
|
||||
|
||||
reminderScheduler.schedule(habit, reminderTime);
|
||||
|
||||
Reference in New Issue
Block a user