Added functions for snoozing and unsnoozing
This commit is contained in:
parent
a8b17a1f22
commit
82541a50e4
1 changed files with 17 additions and 2 deletions
|
@ -15,7 +15,8 @@ import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
import info.nightscout.androidaps.Services.AlarmSoundService;
|
import info.nightscout.androidaps.Services.AlarmSoundService;
|
||||||
import info.nightscout.androidaps.plugins.Wear.WearPlugin;
|
import info.nightscout.androidaps.plugins.Wear.WearPlugin;
|
||||||
|
//Added by Rumen for snooze time
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Created by mike on 03.12.2016.
|
* Created by mike on 03.12.2016.
|
||||||
|
@ -24,7 +25,7 @@ import info.nightscout.androidaps.plugins.Wear.WearPlugin;
|
||||||
public class NotificationStore {
|
public class NotificationStore {
|
||||||
private static Logger log = LoggerFactory.getLogger(NotificationStore.class);
|
private static Logger log = LoggerFactory.getLogger(NotificationStore.class);
|
||||||
public List<Notification> store = new ArrayList<Notification>();
|
public List<Notification> store = new ArrayList<Notification>();
|
||||||
|
public long snoozedUntil = 0L;
|
||||||
public NotificationStore() {
|
public NotificationStore() {
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -86,4 +87,18 @@ public class NotificationStore {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void snoozeTo(long timeToSnooze){
|
||||||
|
log.debug("Snoozing alarm until: "+timeToSnooze);
|
||||||
|
SP.putLong("snoozedTo", timeToSnooze);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void unSnooze(){
|
||||||
|
if(Notification.isAlarmForStaleData()){
|
||||||
|
Notification notification = new Notification(Notification.NSALARM, MainApp.sResources.getString(R.string.nsalarm_staledata), Notification.URGENT);
|
||||||
|
SP.putLong("snoozedTo", System.currentTimeMillis());
|
||||||
|
add(notification);
|
||||||
|
log.debug("Snoozed to current time and added back notification!");
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue