1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-28 03:25:49 +01:00

Improve notification removal

This commit is contained in:
Andreas Böhler 2020-11-16 22:14:32 +01:00 committed by Gitea
parent 4ad8eaab89
commit 5edac523f0

View File

@ -68,6 +68,7 @@ public class CasioGBX100DeviceSupport extends AbstractBTLEDeviceSupport {
private MusicStateSpec mBufferMusicStateSpec = null; private MusicStateSpec mBufferMusicStateSpec = null;
private BluetoothGatt mBtGatt = null; private BluetoothGatt mBtGatt = null;
private boolean mFirstConnect = false; private boolean mFirstConnect = false;
private ArrayList<Integer> mSyncedNotificationIDs = new ArrayList<>();
public CasioGBX100DeviceSupport() { public CasioGBX100DeviceSupport() {
super(LOG); super(LOG);
@ -237,12 +238,17 @@ public class CasioGBX100DeviceSupport extends AbstractBTLEDeviceSupport {
} }
LOG.info("onNotification id=" + notificationSpec.getId()); LOG.info("onNotification id=" + notificationSpec.getId());
showNotification(icon, notificationSpec.sender, notificationSpec.title, notificationSpec.body, notificationSpec.getId(), false); showNotification(icon, notificationSpec.sender, notificationSpec.title, notificationSpec.body, notificationSpec.getId(), false);
mSyncedNotificationIDs.add(new Integer(notificationSpec.getId()));
} }
@Override @Override
public void onDeleteNotification(int id) { public void onDeleteNotification(int id) {
LOG.info("onDeleteNofication id=" + id); LOG.info("onDeleteNofication id=" + id);
showNotification(CasioConstants.CATEGORY_OTHER, null, null, null, id, true); Integer idInt = new Integer(id);
if(mSyncedNotificationIDs.contains(idInt)) {
showNotification(CasioConstants.CATEGORY_OTHER, null, null, null, id, true);
mSyncedNotificationIDs.remove(idInt);
}
} }
public void writeCurrentTime(TransactionBuilder builder) { public void writeCurrentTime(TransactionBuilder builder) {