mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-26 03:46:49 +01:00
Prevent unnecessary widget refresh on notification removal
This commit is contained in:
parent
86d3ba5bc4
commit
894102e45a
@ -802,6 +802,15 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
// super.setActivityHand(progress);
|
// 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) {
|
public boolean playRawNotification(NotificationSpec notificationSpec) {
|
||||||
String sourceAppId = notificationSpec.sourceAppId;
|
String sourceAppId = notificationSpec.sourceAppId;
|
||||||
|
|
||||||
@ -819,16 +828,7 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean showNotificationIcon = false;
|
if (isNotificationWidgetVisible() && sourceAppId != null) {
|
||||||
|
|
||||||
for(Widget widget : widgets){
|
|
||||||
if(widget.getWidgetType() == Widget.WidgetType.LAST_NOTIFICATION){
|
|
||||||
showNotificationIcon = true;
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showNotificationIcon && sourceAppId != null) {
|
|
||||||
if (!sourceAppId.equals(this.lastPostedApp)) {
|
if (!sourceAppId.equals(this.lastPostedApp)) {
|
||||||
if (appIconCache.get(sourceAppId) == null) {
|
if (appIconCache.get(sourceAppId) == null) {
|
||||||
try {
|
try {
|
||||||
@ -861,7 +861,10 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
this.lastPostedApp = null;
|
this.lastPostedApp = null;
|
||||||
renderWidgets();
|
|
||||||
|
if (isNotificationWidgetVisible()) {
|
||||||
|
renderWidgets();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
Loading…
Reference in New Issue
Block a user