1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-07-21 22:31:16 +02:00

Prevent unnecessary widget refresh on notification removal

This commit is contained in:
Hasan Ammar 2021-01-08 17:49:53 -05:00 committed by Gitea
parent 86d3ba5bc4
commit 894102e45a

View File

@ -802,6 +802,15 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
// super.setActivityHand(progress);
}
private boolean isNotificationWidgetVisible() {
for (Widget widget : widgets) {
if (widget.getWidgetType() == Widget.WidgetType.LAST_NOTIFICATION) {
return true;
}
}
return false;
}
public boolean playRawNotification(NotificationSpec notificationSpec) {
String sourceAppId = notificationSpec.sourceAppId;
@ -819,16 +828,7 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
e.printStackTrace();
}
boolean showNotificationIcon = false;
for(Widget widget : widgets){
if(widget.getWidgetType() == Widget.WidgetType.LAST_NOTIFICATION){
showNotificationIcon = true;
break;
}
}
if (showNotificationIcon && sourceAppId != null) {
if (isNotificationWidgetVisible() && sourceAppId != null) {
if (!sourceAppId.equals(this.lastPostedApp)) {
if (appIconCache.get(sourceAppId) == null) {
try {
@ -861,7 +861,10 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
}
this.lastPostedApp = null;
renderWidgets();
if (isNotificationWidgetVisible()) {
renderWidgets();
}
}
@Override