ongoing notification integration

This commit is contained in:
AdrianLxM 2016-12-28 00:03:08 +01:00
parent 4afd2295f8
commit 6ac889cecd
3 changed files with 9 additions and 24 deletions

View file

@ -39,6 +39,7 @@ import info.nightscout.androidaps.plugins.TempBasals.TempBasalsFragment;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsFragment;
import info.nightscout.androidaps.plugins.VirtualPump.VirtualPumpFragment;
import info.nightscout.androidaps.plugins.Wear.WearFragment;
import info.nightscout.androidaps.plugins.persistentnotification.PersistentNotificationPlugin;
import info.nightscout.androidaps.receivers.KeepAliveReceiver;
import io.fabric.sdk.android.Fabric;
@ -93,6 +94,7 @@ public class MainApp extends Application {
pluginsList.add(SmsCommunicatorFragment.getPlugin());
if (Config.WEAR) pluginsList.add(WearFragment.getPlugin(this));
pluginsList.add(new PersistentNotificationPlugin(this));
pluginsList.add(sConfigBuilder = ConfigBuilderFragment.getPlugin());

View file

@ -59,7 +59,7 @@ public class PersistentNotificationPlugin implements PluginBase{
@Override
public String getName() {
return "Persistent Notification";
return ctx.getString(R.string.ongoingnotificaction);
}
@Override
@ -112,7 +112,9 @@ public class PersistentNotificationPlugin implements PluginBase{
line1 += " Δ" + deltastring(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, profile.getUnits())
+ " avgΔ" + deltastring(glucoseStatus.avgdelta, glucoseStatus.avgdelta * Constants.MGDL_TO_MMOLL, profile.getUnits());
} else {
// line1 += " OLD DATA ";
line1 += " " +
ctx.getString(R.string.old_data) +
" ";
}
PumpInterface pump = MainApp.getConfigBuilder();
@ -139,9 +141,7 @@ public class PersistentNotificationPlugin implements PluginBase{
if (profile != null && profile.getActiveProfile() != null)
line3 += " - " + profile.getActiveProfile();
NotificationCompat.Builder builder = new NotificationCompat.Builder(ctx);
builder.setOngoing(true);
@ -185,25 +185,6 @@ public class PersistentNotificationPlugin implements PluginBase{
//no visible fragment
}
private String slopeArrow(double delta) {
if (delta <= (-3.5*5)) {
return "\u21ca";
} else if (delta <= (-2*5)) {
return "\u2193";
} else if (delta <= (-1*5)) {
return "\u2198";
} else if (delta <= (1*5)) {
return "\u2192";
} else if (delta <= (2*5)) {
return "\u2197";
} else if (delta <= (3.5*5)) {
return "\u2191";
} else {
return "\u21c8";
}
}
private String deltastring(double deltaMGDL, double deltaMMOL, String units) {
String deltastring = "";
if (deltaMGDL >=0){

View file

@ -387,4 +387,6 @@
<string name="actualbg">BG:</string>
<string name="lastbg">Last BG:</string>
<string name="mdi">MDI</string>
<string name="ongoingnotificaction">Ongoing Notification</string>
<string name="old_data">OLD DATA</string>
</resources>