mirror of
https://github.com/iSoron/uhabits.git
synced 2025-12-06 09:08:52 -06:00
Merge branch 'master' into dev
This commit is contained in:
@@ -1,5 +1,14 @@
|
|||||||
# Changelog
|
# Changelog
|
||||||
|
|
||||||
|
### 1.7.11 (Aug 10, 2019)
|
||||||
|
|
||||||
|
* Fix bug that produced corrupted CSV files in some countries
|
||||||
|
|
||||||
|
### 1.7.10 (June 15, 2019)
|
||||||
|
|
||||||
|
* Fix bug that prevented some devices from showing notifications.
|
||||||
|
* Update targetSdk to Android Pie (API level 28)
|
||||||
|
|
||||||
### 1.7.8 (April 21, 2018)
|
### 1.7.8 (April 21, 2018)
|
||||||
|
|
||||||
* Add support for adaptive icons (Oreo)
|
* Add support for adaptive icons (Oreo)
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
VERSION_CODE = 35
|
VERSION_CODE = 39
|
||||||
VERSION_NAME = 1.7.8
|
VERSION_NAME = 1.8.0
|
||||||
|
|
||||||
MIN_SDK_VERSION = 19
|
MIN_SDK_VERSION = 19
|
||||||
TARGET_SDK_VERSION = 29
|
TARGET_SDK_VERSION = 29
|
||||||
|
|||||||
@@ -19,9 +19,7 @@
|
|||||||
-->
|
-->
|
||||||
<manifest
|
<manifest
|
||||||
package="org.isoron.uhabits"
|
package="org.isoron.uhabits"
|
||||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
android:versionCode="36"
|
|
||||||
android:versionName="1.7.9">
|
|
||||||
|
|
||||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||||
|
|
||||||
|
|||||||
@@ -28,6 +28,7 @@ import android.os.Build.VERSION.*
|
|||||||
import android.support.annotation.*
|
import android.support.annotation.*
|
||||||
import android.support.v4.app.*
|
import android.support.v4.app.*
|
||||||
import android.support.v4.app.NotificationCompat.*
|
import android.support.v4.app.NotificationCompat.*
|
||||||
|
import android.util.*
|
||||||
import org.isoron.androidbase.*
|
import org.isoron.androidbase.*
|
||||||
import org.isoron.uhabits.R
|
import org.isoron.uhabits.R
|
||||||
import org.isoron.uhabits.core.*
|
import org.isoron.uhabits.core.*
|
||||||
@@ -71,14 +72,23 @@ class AndroidNotificationTray
|
|||||||
notificationManager.notify(Int.MAX_VALUE, summary)
|
notificationManager.notify(Int.MAX_VALUE, summary)
|
||||||
val notification = buildNotification(habit, reminderTime, timestamp)
|
val notification = buildNotification(habit, reminderTime, timestamp)
|
||||||
createAndroidNotificationChannel(context)
|
createAndroidNotificationChannel(context)
|
||||||
notificationManager.notify(notificationId, notification)
|
try {
|
||||||
|
notificationManager.notify(notificationId, notification)
|
||||||
|
} catch (e: RuntimeException) {
|
||||||
|
// Some Xiaomi phones produce a RuntimeException if custom notification sounds are used.
|
||||||
|
Log.i("AndroidNotificationTray", "Failed to show notification. Retrying without sound.")
|
||||||
|
val n = buildNotification(habit, reminderTime, timestamp, disableSound = true)
|
||||||
|
notificationManager.notify(notificationId, n)
|
||||||
|
|
||||||
|
}
|
||||||
active.add(notificationId)
|
active.add(notificationId)
|
||||||
}
|
}
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
fun buildNotification(@NonNull habit: Habit,
|
fun buildNotification(@NonNull habit: Habit,
|
||||||
@NonNull reminderTime: Long,
|
@NonNull reminderTime: Long,
|
||||||
@NonNull timestamp: Timestamp) : Notification
|
@NonNull timestamp: Timestamp,
|
||||||
|
disableSound: Boolean = false) : Notification
|
||||||
{
|
{
|
||||||
|
|
||||||
val addRepetitionAction = Action(
|
val addRepetitionAction = Action(
|
||||||
@@ -109,12 +119,15 @@ class AndroidNotificationTray
|
|||||||
.setDeleteIntent(pendingIntents.dismissNotification(habit))
|
.setDeleteIntent(pendingIntents.dismissNotification(habit))
|
||||||
.addAction(addRepetitionAction)
|
.addAction(addRepetitionAction)
|
||||||
.addAction(removeRepetitionAction)
|
.addAction(removeRepetitionAction)
|
||||||
.setSound(ringtoneManager.getURI())
|
.setSound(null)
|
||||||
.setWhen(reminderTime)
|
.setWhen(reminderTime)
|
||||||
.setShowWhen(true)
|
.setShowWhen(true)
|
||||||
.setOngoing(preferences.shouldMakeNotificationsSticky())
|
.setOngoing(preferences.shouldMakeNotificationsSticky())
|
||||||
.setGroup("default")
|
.setGroup("default")
|
||||||
|
|
||||||
|
if (!disableSound)
|
||||||
|
builder.setSound(ringtoneManager.getURI())
|
||||||
|
|
||||||
if (preferences.shouldMakeNotificationsLed())
|
if (preferences.shouldMakeNotificationsLed())
|
||||||
builder.setLights(Color.RED, 1000, 1000)
|
builder.setLights(Color.RED, 1000, 1000)
|
||||||
|
|
||||||
|
|||||||
@@ -119,7 +119,7 @@ public class HabitsCSVExporter
|
|||||||
{
|
{
|
||||||
String sane = sanitizeFilename(h.getName());
|
String sane = sanitizeFilename(h.getName());
|
||||||
String habitDirName =
|
String habitDirName =
|
||||||
String.format("%03d %s", allHabits.indexOf(h) + 1, sane);
|
String.format(Locale.US, "%03d %s", allHabits.indexOf(h) + 1, sane);
|
||||||
habitDirName = habitDirName.trim() + "/";
|
habitDirName = habitDirName.trim() + "/";
|
||||||
|
|
||||||
new File(exportDirName + habitDirName).mkdirs();
|
new File(exportDirName + habitDirName).mkdirs();
|
||||||
@@ -202,7 +202,7 @@ public class HabitsCSVExporter
|
|||||||
checksWriter.write(String.valueOf(checkmarks.get(j)[i]));
|
checksWriter.write(String.valueOf(checkmarks.get(j)[i]));
|
||||||
checksWriter.write(DELIMITER);
|
checksWriter.write(DELIMITER);
|
||||||
String score =
|
String score =
|
||||||
String.format("%.4f", ((float) scores.get(j)[i]));
|
String.format(Locale.US, "%.4f", ((float) scores.get(j)[i]));
|
||||||
scoresWriter.write(score);
|
scoresWriter.write(score);
|
||||||
scoresWriter.write(DELIMITER);
|
scoresWriter.write(DELIMITER);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -172,7 +172,7 @@ public abstract class ScoreList implements Iterable<Score>
|
|||||||
for (Score s : this)
|
for (Score s : this)
|
||||||
{
|
{
|
||||||
String timestamp = dateFormat.format(s.getTimestamp().getUnixTime());
|
String timestamp = dateFormat.format(s.getTimestamp().getUnixTime());
|
||||||
String score = String.format((Locale)null, "%.4f", s.getValue());
|
String score = String.format(Locale.US, "%.4f", s.getValue());
|
||||||
out.write(String.format("%s,%s\n", timestamp, score));
|
out.write(String.format("%s,%s\n", timestamp, score));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user