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
|
||||
|
||||
### 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)
|
||||
|
||||
* Add support for adaptive icons (Oreo)
|
||||
|
||||
@@ -1,5 +1,5 @@
|
||||
VERSION_CODE = 35
|
||||
VERSION_NAME = 1.7.8
|
||||
VERSION_CODE = 39
|
||||
VERSION_NAME = 1.8.0
|
||||
|
||||
MIN_SDK_VERSION = 19
|
||||
TARGET_SDK_VERSION = 29
|
||||
|
||||
@@ -19,9 +19,7 @@
|
||||
-->
|
||||
<manifest
|
||||
package="org.isoron.uhabits"
|
||||
xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:versionCode="36"
|
||||
android:versionName="1.7.9">
|
||||
xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<uses-permission android:name="android.permission.VIBRATE"/>
|
||||
|
||||
|
||||
@@ -28,6 +28,7 @@ import android.os.Build.VERSION.*
|
||||
import android.support.annotation.*
|
||||
import android.support.v4.app.*
|
||||
import android.support.v4.app.NotificationCompat.*
|
||||
import android.util.*
|
||||
import org.isoron.androidbase.*
|
||||
import org.isoron.uhabits.R
|
||||
import org.isoron.uhabits.core.*
|
||||
@@ -71,14 +72,23 @@ class AndroidNotificationTray
|
||||
notificationManager.notify(Int.MAX_VALUE, summary)
|
||||
val notification = buildNotification(habit, reminderTime, timestamp)
|
||||
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)
|
||||
}
|
||||
|
||||
@NonNull
|
||||
fun buildNotification(@NonNull habit: Habit,
|
||||
@NonNull reminderTime: Long,
|
||||
@NonNull timestamp: Timestamp) : Notification
|
||||
@NonNull timestamp: Timestamp,
|
||||
disableSound: Boolean = false) : Notification
|
||||
{
|
||||
|
||||
val addRepetitionAction = Action(
|
||||
@@ -109,12 +119,15 @@ class AndroidNotificationTray
|
||||
.setDeleteIntent(pendingIntents.dismissNotification(habit))
|
||||
.addAction(addRepetitionAction)
|
||||
.addAction(removeRepetitionAction)
|
||||
.setSound(ringtoneManager.getURI())
|
||||
.setSound(null)
|
||||
.setWhen(reminderTime)
|
||||
.setShowWhen(true)
|
||||
.setOngoing(preferences.shouldMakeNotificationsSticky())
|
||||
.setGroup("default")
|
||||
|
||||
if (!disableSound)
|
||||
builder.setSound(ringtoneManager.getURI())
|
||||
|
||||
if (preferences.shouldMakeNotificationsLed())
|
||||
builder.setLights(Color.RED, 1000, 1000)
|
||||
|
||||
|
||||
@@ -119,7 +119,7 @@ public class HabitsCSVExporter
|
||||
{
|
||||
String sane = sanitizeFilename(h.getName());
|
||||
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() + "/";
|
||||
|
||||
new File(exportDirName + habitDirName).mkdirs();
|
||||
@@ -202,7 +202,7 @@ public class HabitsCSVExporter
|
||||
checksWriter.write(String.valueOf(checkmarks.get(j)[i]));
|
||||
checksWriter.write(DELIMITER);
|
||||
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(DELIMITER);
|
||||
}
|
||||
|
||||
@@ -172,7 +172,7 @@ public abstract class ScoreList implements Iterable<Score>
|
||||
for (Score s : this)
|
||||
{
|
||||
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));
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user