mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-29 21:32:57 +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);
|
||||
}
|
||||
|
||||
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,8 +861,11 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
||||
}
|
||||
|
||||
this.lastPostedApp = null;
|
||||
|
||||
if (isNotificationWidgetVisible()) {
|
||||
renderWidgets();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSetCallState(CallSpec callSpec) {
|
||||
|
Loading…
Reference in New Issue
Block a user