Merge pull request #288 from AdrianLxM/wear-overviewnotification
This commit is contained in:
commit
26ebceb4d9
|
@ -14,6 +14,7 @@ import java.util.List;
|
|||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.Services.AlarmSoundService;
|
||||
import info.nightscout.androidaps.plugins.Wear.WearPlugin;
|
||||
|
||||
|
||||
/**
|
||||
|
@ -53,6 +54,12 @@ public class NotificationStore {
|
|||
MainApp.instance().startService(alarm);
|
||||
}
|
||||
store.add(n);
|
||||
|
||||
WearPlugin wearPlugin = (WearPlugin) MainApp.getSpecificPlugin(WearPlugin.class);
|
||||
if(wearPlugin!= null && wearPlugin.isEnabled()) {
|
||||
wearPlugin.overviewNotification(n.id, "OverviewNotification:\n" + n.text);
|
||||
}
|
||||
|
||||
Collections.sort(store, new NotificationComparator());
|
||||
}
|
||||
|
||||
|
|
|
@ -24,6 +24,7 @@ import info.nightscout.androidaps.plugins.Actions.dialogs.FillDialog;
|
|||
import info.nightscout.androidaps.plugins.Loop.APSResult;
|
||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
||||
import info.nightscout.androidaps.plugins.ProfileCircadianPercentage.CircadianPercentageProfilePlugin;
|
||||
import info.nightscout.utils.BolusWizard;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
|
@ -415,6 +416,8 @@ public class ActionStringHandler {
|
|||
int timeshift = SafeParse.stringToInt(act[1]);
|
||||
int percentage = SafeParse.stringToInt(act[2]);
|
||||
setCPP(percentage, timeshift);
|
||||
} else if ("dismissoverviewnotification".equals(act[0])){
|
||||
MainApp.bus().post(new EventDismissNotification(SafeParse.stringToInt(act[1])));
|
||||
}
|
||||
lastBolusWizard = null;
|
||||
}
|
||||
|
@ -502,4 +505,12 @@ public class ActionStringHandler {
|
|||
lastConfirmActionString = null;
|
||||
lastBolusWizard = null;
|
||||
}
|
||||
|
||||
public synchronized static void expectNotificationAction(String message, int id) {
|
||||
String actionstring = "dismissoverviewnotification " + id;
|
||||
WearFragment.getPlugin(MainApp.instance()).requestActionConfirmation("DISMISS", message, actionstring);
|
||||
lastSentTimestamp = System.currentTimeMillis();
|
||||
lastConfirmActionString = actionstring;
|
||||
lastBolusWizard = null;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,6 +21,7 @@ import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
|||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissBolusprogressIfRunning;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventOverviewBolusProgress;
|
||||
import info.nightscout.androidaps.plugins.Wear.wearintegration.WatchUpdaterService;
|
||||
import info.nightscout.utils.SP;
|
||||
|
||||
/**
|
||||
* Created by adrian on 17/11/16.
|
||||
|
@ -228,5 +229,10 @@ public class WearPlugin implements PluginBase {
|
|||
watchUS = null;
|
||||
}
|
||||
|
||||
public void overviewNotification(int id, String message) {
|
||||
if(SP.getBoolean("wear_overview_notification", false)){
|
||||
ActionStringHandler.expectNotificationAction(message, id);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -683,4 +683,6 @@
|
|||
<string name="cpp_sync_setting_missing">needs to be activated to send values to the pump!</string>
|
||||
<string name="cpp_notloadedplugins">Not all profiles loaded!</string>
|
||||
<string name="cpp_valuesnotstored">Values not stored!</string>
|
||||
<string name="wear_overviewnotifications">Overview Notifications</string>
|
||||
<string name="wear_overviewnotifications_summary">Pass the Overview Notifications through as wear confirmation messages.</string>
|
||||
</resources>
|
||||
|
|
|
@ -15,6 +15,13 @@
|
|||
android:key="wear_showbgi"
|
||||
android:title="@string/wear_showbgi_title"
|
||||
android:summary="@string/wear_showbgi_summary"/>
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="wear_overview_notification"
|
||||
android:title="@string/wear_overviewnotifications"
|
||||
android:summary="@string/wear_overviewnotifications_summary"/>
|
||||
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
Loading…
Reference in a new issue