Merge pull request #7495 from osmandapp/NotificationRefreshBugFix

Fix refresh notification bug
This commit is contained in:
max-klaus 2019-08-29 13:45:59 +03:00 committed by GitHub
commit 1d71154096
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -126,7 +126,7 @@ public abstract class OsmandNotification {
if (isEnabled()) {
Builder notificationBuilder = buildNotification(false);
if (notificationBuilder != null) {
Notification notification = getNotification(notificationBuilder);
Notification notification = getNotification(notificationBuilder, false);
setupNotification(notification);
notificationManager.notify(top ? TOP_NOTIFICATION_SERVICE_ID : getOsmandNotificationId(), notification);
notifyWearable(notificationManager);
@ -141,7 +141,7 @@ public abstract class OsmandNotification {
if (isEnabled()) {
Builder notificationBuilder = buildNotification(false);
if (notificationBuilder != null) {
Notification notification = getNotification(notificationBuilder);
Notification notification = getNotification(notificationBuilder, true);
setupNotification(notification);
if (top) {
//notificationManager.cancel(getOsmandNotificationId());
@ -160,9 +160,9 @@ public abstract class OsmandNotification {
return false;
}
private Notification getNotification(Builder notificationBuilder) {
private Notification getNotification(Builder notificationBuilder, boolean forceBuild) {
Notification notification = currentNotification;
if (notification == null) {
if (forceBuild || notification == null) {
notification = notificationBuilder.build();
currentNotification = notification;
}