Merge remote-tracking branch 'origin/dev' into watchfaces
This commit is contained in:
commit
c43afd9d28
100 changed files with 1541 additions and 651 deletions
|
@ -188,4 +188,6 @@ dependencies {
|
|||
compile 'com.google.code.gson:gson:2.7'
|
||||
compile 'com.google.guava:guava:20.0'
|
||||
|
||||
compile 'net.danlew:android.joda:2.9.9.1'
|
||||
testCompile 'joda-time:joda-time:2.9.4.2'
|
||||
}
|
||||
|
|
|
@ -15,6 +15,8 @@ import com.squareup.otto.Bus;
|
|||
import com.squareup.otto.LoggingBus;
|
||||
import com.squareup.otto.ThreadEnforcer;
|
||||
|
||||
import net.danlew.android.joda.JodaTimeAndroid;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -96,6 +98,7 @@ public class MainApp extends Application {
|
|||
super.onCreate();
|
||||
Fabric.with(this, new Crashlytics());
|
||||
Fabric.with(this, new Answers());
|
||||
JodaTimeAndroid.init(this);
|
||||
Crashlytics.setString("BUILDVERSION", BuildConfig.BUILDVERSION);
|
||||
log.info("Version: " + BuildConfig.VERSION_NAME);
|
||||
log.info("BuildVersion: " + BuildConfig.BUILDVERSION);
|
||||
|
@ -213,7 +216,7 @@ public class MainApp extends Application {
|
|||
|
||||
public void stopKeepAliveService() {
|
||||
if (keepAliveReceiver != null)
|
||||
keepAliveReceiver.cancelAlarm(this);
|
||||
KeepAliveReceiver.cancelAlarm(this);
|
||||
}
|
||||
|
||||
public static Bus bus() {
|
||||
|
|
|
@ -149,10 +149,6 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
|||
addPreferencesFromResourceIfEnabled(SensitivityWeightedAveragePlugin.getPlugin(), PluginBase.SENSITIVITY);
|
||||
addPreferencesFromResourceIfEnabled(SensitivityOref0Plugin.getPlugin(), PluginBase.SENSITIVITY);
|
||||
|
||||
if (!Config.NSCLIENT && !Config.G5UPLOADER) {
|
||||
addPreferencesFromResource(R.xml.pref_profile);
|
||||
}
|
||||
|
||||
if (Config.DANAR) {
|
||||
addPreferencesFromResourceIfEnabled(DanaRPlugin.getPlugin(), PluginBase.PUMP);
|
||||
addPreferencesFromResourceIfEnabled(DanaRKoreanPlugin.getPlugin(), PluginBase.PUMP);
|
||||
|
|
|
@ -117,10 +117,8 @@ public class DataService extends IntentService {
|
|||
handleNewDataFromDexcomG5(intent);
|
||||
}
|
||||
} else if (Intents.ACTION_NEW_SGV.equals(action)) {
|
||||
// always handle SGV if NS-Client is the source
|
||||
if (nsClientEnabled) {
|
||||
handleNewDataFromNSClient(intent);
|
||||
}
|
||||
// always backfill SGV from NS
|
||||
handleNewDataFromNSClient(intent);
|
||||
// Objectives 0
|
||||
ObjectivesPlugin.bgIsAvailableInNS = true;
|
||||
ObjectivesPlugin.saveProgress();
|
||||
|
@ -301,7 +299,7 @@ public class DataService extends IntentService {
|
|||
log.error("Unhandled exception", e);
|
||||
}
|
||||
if (ConfigBuilderPlugin.nightscoutVersionCode < Config.SUPPORTEDNSVERSION) {
|
||||
Notification notification = new Notification(Notification.OLD_NS, MainApp.sResources.getString(R.string.unsupportednsversion), Notification.URGENT);
|
||||
Notification notification = new Notification(Notification.OLD_NS, MainApp.sResources.getString(R.string.unsupportednsversion), Notification.NORMAL);
|
||||
MainApp.bus().post(new EventNewNotification(notification));
|
||||
} else {
|
||||
MainApp.bus().post(new EventDismissNotification(Notification.OLD_NS));
|
||||
|
|
|
@ -17,6 +17,9 @@ import java.util.TimeZone;
|
|||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||
|
@ -327,8 +330,27 @@ public class Profile {
|
|||
}
|
||||
|
||||
public Double getBasal(Integer timeAsSeconds) {
|
||||
if (basal_v == null)
|
||||
if (basal_v == null) {
|
||||
basal_v = convertToSparseArray(basal);
|
||||
// Check for minimal basal value
|
||||
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
||||
if (pump != null) {
|
||||
PumpDescription description = pump.getPumpDescription();
|
||||
for (int i = 0; i < basal_v.size(); i++) {
|
||||
if (basal_v.valueAt(i) < description.basalMinimumRate) {
|
||||
basal_v.setValueAt(i, description.basalMinimumRate);
|
||||
MainApp.bus().post(new EventNewNotification(new Notification(Notification.MINIMAL_BASAL_VALUE_REPLACED, MainApp.sResources.getString(R.string.minimalbasalvaluereplaced), Notification.NORMAL)));
|
||||
}
|
||||
}
|
||||
return getValueToTime(basal_v, timeAsSeconds);
|
||||
} else {
|
||||
// if pump not available (at start)
|
||||
// do not store converted array
|
||||
Double value = getValueToTime(basal_v, timeAsSeconds);
|
||||
basal_v = null;
|
||||
return value;
|
||||
}
|
||||
}
|
||||
return getValueToTime(basal_v, timeAsSeconds);
|
||||
}
|
||||
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
package info.nightscout.androidaps.plugins.Overview;
|
||||
package info.nightscout.androidaps.data;
|
||||
|
||||
import android.content.SharedPreferences;
|
||||
import android.preference.PreferenceManager;
|
||||
|
@ -9,11 +9,7 @@ import org.json.JSONObject;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
|
||||
/**
|
||||
* Created by mike on 12.10.2016.
|
||||
|
@ -22,84 +18,7 @@ import info.nightscout.utils.DateUtil;
|
|||
public class QuickWizard {
|
||||
private static Logger log = LoggerFactory.getLogger(QuickWizard.class);
|
||||
|
||||
public class QuickWizardEntry {
|
||||
public JSONObject storage;
|
||||
public int position;
|
||||
|
||||
/*
|
||||
{
|
||||
buttonText: "Meal",
|
||||
carbs: 36,
|
||||
validFrom: 8 * 60 * 60, // seconds from midnight
|
||||
validTo: 9 * 60 * 60, // seconds from midnight
|
||||
}
|
||||
*/
|
||||
public QuickWizardEntry() {
|
||||
String emptyData = "{\"buttonText\":\"\",\"carbs\":0,\"validFrom\":0,\"validTo\":86340}";
|
||||
try {
|
||||
storage = new JSONObject(emptyData);
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
position = -1;
|
||||
}
|
||||
|
||||
public QuickWizardEntry(JSONObject entry, int position) {
|
||||
storage = entry;
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
public Boolean isActive() {
|
||||
return Profile.secondsFromMidnight() >= validFrom() && Profile.secondsFromMidnight() <= validTo();
|
||||
}
|
||||
|
||||
public String buttonText() {
|
||||
try {
|
||||
return storage.getString("buttonText");
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public Integer carbs() {
|
||||
try {
|
||||
return storage.getInt("carbs");
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Date validFromDate() {
|
||||
return DateUtil.toDate(validFrom());
|
||||
}
|
||||
|
||||
public Date validToDate() {
|
||||
return DateUtil.toDate(validTo());
|
||||
}
|
||||
|
||||
public Integer validFrom() {
|
||||
try {
|
||||
return storage.getInt("validFrom");
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Integer validTo() {
|
||||
try {
|
||||
return storage.getInt("validTo");
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
JSONArray storage = new JSONArray();
|
||||
private JSONArray storage = new JSONArray();
|
||||
|
||||
public void setData(JSONArray newData) {
|
||||
storage = newData;
|
|
@ -0,0 +1,242 @@
|
|||
package info.nightscout.androidaps.data;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.db.BgReading;
|
||||
import info.nightscout.androidaps.db.TempTarget;
|
||||
import info.nightscout.androidaps.interfaces.TreatmentsInterface;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.AutosensData;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
|
||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||
import info.nightscout.utils.BolusWizard;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.SP;
|
||||
|
||||
/**
|
||||
* Created by mike on 25.12.2017.
|
||||
*/
|
||||
|
||||
public class QuickWizardEntry {
|
||||
private static Logger log = LoggerFactory.getLogger(QuickWizardEntry.class);
|
||||
|
||||
public JSONObject storage;
|
||||
public int position;
|
||||
|
||||
public static final int YES = 0;
|
||||
public static final int NO = 1;
|
||||
public static final int POSITIVE_ONLY = 2;
|
||||
public static final int NEGATIVE_ONLY = 3;
|
||||
|
||||
/*
|
||||
{
|
||||
buttonText: "Meal",
|
||||
carbs: 36,
|
||||
validFrom: 8 * 60 * 60, // seconds from midnight
|
||||
validTo: 9 * 60 * 60, // seconds from midnight
|
||||
useBG: 0,
|
||||
useCOB: 0,
|
||||
useBolusIOB: 0,
|
||||
useBasalIOB: 0,
|
||||
useTrend: 0,
|
||||
useSuperBolus: 0,
|
||||
useTemptarget: 0
|
||||
}
|
||||
*/
|
||||
public QuickWizardEntry() {
|
||||
String emptyData = "{\"buttonText\":\"\",\"carbs\":0,\"validFrom\":0,\"validTo\":86340}";
|
||||
try {
|
||||
storage = new JSONObject(emptyData);
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
position = -1;
|
||||
}
|
||||
|
||||
public QuickWizardEntry(JSONObject entry, int position) {
|
||||
storage = entry;
|
||||
this.position = position;
|
||||
}
|
||||
|
||||
public Boolean isActive() {
|
||||
return Profile.secondsFromMidnight() >= validFrom() && Profile.secondsFromMidnight() <= validTo();
|
||||
}
|
||||
|
||||
public BolusWizard doCalc(Profile profile, TempTarget tempTarget, BgReading lastBG) {
|
||||
BolusWizard wizard = new BolusWizard();
|
||||
|
||||
//BG
|
||||
double bg = 0;
|
||||
if (lastBG != null && useBG() == YES) {
|
||||
bg = lastBG.valueToUnits(profile.getUnits());
|
||||
}
|
||||
|
||||
// COB
|
||||
double cob = 0d;
|
||||
AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(System.currentTimeMillis());
|
||||
if (autosensData != null && useCOB() == YES) {
|
||||
cob = autosensData.cob;
|
||||
}
|
||||
|
||||
// Temp target
|
||||
if (useTempTarget() == NO) {
|
||||
tempTarget = null;
|
||||
}
|
||||
|
||||
// Bolus IOB
|
||||
boolean bolusIOB = false;
|
||||
if (useBolusIOB() == YES) {
|
||||
bolusIOB = true;
|
||||
}
|
||||
|
||||
// Basal IOB
|
||||
TreatmentsInterface treatments = MainApp.getConfigBuilder();
|
||||
treatments.updateTotalIOBTempBasals();
|
||||
IobTotal basalIob = treatments.getLastCalculationTempBasals().round();
|
||||
boolean basalIOB = false;
|
||||
if (useBasalIOB() == YES) {
|
||||
basalIOB = true;
|
||||
} else if (useBasalIOB() == POSITIVE_ONLY && basalIob.iob > 0) {
|
||||
basalIOB = true;
|
||||
} else if (useBasalIOB() == NEGATIVE_ONLY && basalIob.iob < 0) {
|
||||
basalIOB = true;
|
||||
}
|
||||
|
||||
// SuperBolus
|
||||
boolean superBolus = false;
|
||||
if (useSuperBolus() == YES && SP.getBoolean(R.string.key_usesuperbolus, false)) {
|
||||
superBolus = true;
|
||||
}
|
||||
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
|
||||
if (activeloop != null && activeloop.isEnabled(activeloop.getType()) && activeloop.isSuperBolus())
|
||||
superBolus = false;
|
||||
|
||||
// Trend
|
||||
GlucoseStatus glucoseStatus = GlucoseStatus.getGlucoseStatusData();
|
||||
boolean trend = false;
|
||||
if (useTrend() == YES) {
|
||||
trend = true;
|
||||
} else if (useTrend() == POSITIVE_ONLY && glucoseStatus != null && glucoseStatus.short_avgdelta > 0) {
|
||||
trend = true;
|
||||
} else if (useTrend() == NEGATIVE_ONLY && glucoseStatus != null && glucoseStatus.short_avgdelta < 0) {
|
||||
trend = true;
|
||||
}
|
||||
|
||||
wizard.doCalc(profile, tempTarget, carbs(), cob, bg, 0d, bolusIOB, basalIOB, superBolus, trend);
|
||||
return wizard;
|
||||
}
|
||||
|
||||
public String buttonText() {
|
||||
try {
|
||||
return storage.getString("buttonText");
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
return "";
|
||||
}
|
||||
|
||||
public Integer carbs() {
|
||||
try {
|
||||
return storage.getInt("carbs");
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Date validFromDate() {
|
||||
return DateUtil.toDate(validFrom());
|
||||
}
|
||||
|
||||
public Date validToDate() {
|
||||
return DateUtil.toDate(validTo());
|
||||
}
|
||||
|
||||
public Integer validFrom() {
|
||||
try {
|
||||
return storage.getInt("validFrom");
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Integer validTo() {
|
||||
try {
|
||||
return storage.getInt("validTo");
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public int useBG() {
|
||||
try {
|
||||
return storage.getInt("useBG");
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
public int useCOB() {
|
||||
try {
|
||||
return storage.getInt("useCOB");
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
public int useBolusIOB() {
|
||||
try {
|
||||
return storage.getInt("useBolusIOB");
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
public int useBasalIOB() {
|
||||
try {
|
||||
return storage.getInt("useBasalIOB");
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
return YES;
|
||||
}
|
||||
|
||||
public int useTrend() {
|
||||
try {
|
||||
return storage.getInt("useTrend");
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
public int useSuperBolus() {
|
||||
try {
|
||||
return storage.getInt("useSuperBolus");
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
|
||||
public int useTempTarget() {
|
||||
try {
|
||||
return storage.getInt("useTempTarget");
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
return NO;
|
||||
}
|
||||
}
|
|
@ -53,6 +53,7 @@ public class BgReading implements DataPointWithLabelInterface {
|
|||
value = sgv.getMgdl();
|
||||
raw = sgv.getFiltered() != null ? sgv.getFiltered() : value;
|
||||
direction = sgv.getDirection();
|
||||
_id = sgv.getId();
|
||||
}
|
||||
|
||||
public Double valueToUnits(String units) {
|
||||
|
|
|
@ -46,6 +46,7 @@ import info.nightscout.androidaps.events.EventTreatmentChange;
|
|||
import info.nightscout.androidaps.plugins.IobCobCalculator.events.EventNewHistoryData;
|
||||
import info.nightscout.androidaps.plugins.PumpDanaR.activities.DanaRNSHistorySync;
|
||||
import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
|
||||
import info.nightscout.utils.PercentageSplitter;
|
||||
|
||||
public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
||||
private static Logger log = LoggerFactory.getLogger(DatabaseHelper.class);
|
||||
|
@ -367,6 +368,15 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
return false;
|
||||
}
|
||||
|
||||
public void update(BgReading bgReading) {
|
||||
bgReading.date = roundDateToSec(bgReading.date);
|
||||
try {
|
||||
getDaoBgReadings().update(bgReading);
|
||||
} catch (SQLException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private static void scheduleBgChange() {
|
||||
class PostRunnable implements Runnable {
|
||||
public void run() {
|
||||
|
@ -397,7 +407,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
QueryBuilder<BgReading, Long> queryBuilder = daoBgReadings.queryBuilder();
|
||||
queryBuilder.orderBy("date", false);
|
||||
queryBuilder.limit(1L);
|
||||
queryBuilder.where().gt("value", 38);
|
||||
queryBuilder.where().gt("value", 38).and().eq("isValid", true);
|
||||
PreparedQuery<BgReading> preparedQuery = queryBuilder.prepare();
|
||||
bgList = daoBgReadings.query(preparedQuery);
|
||||
|
||||
|
@ -435,7 +445,24 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
QueryBuilder<BgReading, Long> queryBuilder = daoBgreadings.queryBuilder();
|
||||
queryBuilder.orderBy("date", ascending);
|
||||
Where where = queryBuilder.where();
|
||||
where.ge("date", mills).and().gt("value", 38);
|
||||
where.ge("date", mills).and().gt("value", 38).and().eq("isValid", true);
|
||||
PreparedQuery<BgReading> preparedQuery = queryBuilder.prepare();
|
||||
bgReadings = daoBgreadings.query(preparedQuery);
|
||||
return bgReadings;
|
||||
} catch (SQLException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
return new ArrayList<BgReading>();
|
||||
}
|
||||
|
||||
public List<BgReading> getAllBgreadingsDataFromTime(long mills, boolean ascending) {
|
||||
try {
|
||||
Dao<BgReading, Long> daoBgreadings = getDaoBgReadings();
|
||||
List<BgReading> bgReadings;
|
||||
QueryBuilder<BgReading, Long> queryBuilder = daoBgreadings.queryBuilder();
|
||||
queryBuilder.orderBy("date", ascending);
|
||||
Where where = queryBuilder.where();
|
||||
where.ge("date", mills);
|
||||
PreparedQuery<BgReading> preparedQuery = queryBuilder.prepare();
|
||||
bgReadings = daoBgreadings.query(preparedQuery);
|
||||
return bgReadings;
|
||||
|
@ -1572,6 +1599,8 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
|
|||
}
|
||||
}
|
||||
}
|
||||
// look for already added percentage from NS
|
||||
profileSwitch.profileName = PercentageSplitter.pureName(profileSwitch.profileName);
|
||||
getDaoProfileSwitch().create(profileSwitch);
|
||||
log.debug("PROFILESWITCH: New record from: " + Source.getString(profileSwitch.source) + " " + profileSwitch.toString());
|
||||
scheduleProfileSwitchChange();
|
||||
|
|
|
@ -21,5 +21,5 @@ public interface InsulinInterface {
|
|||
String getFriendlyName();
|
||||
String getComment();
|
||||
double getDia();
|
||||
public Iob iobCalcForTreatment(Treatment treatment, long time, Double dia);
|
||||
public Iob iobCalcForTreatment(Treatment treatment, long time, double dia);
|
||||
}
|
||||
|
|
|
@ -36,7 +36,7 @@ public interface PumpInterface {
|
|||
PumpEnactResult deliverTreatment(DetailedBolusInfo detailedBolusInfo);
|
||||
void stopBolusDelivering();
|
||||
PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes, boolean enforceNew);
|
||||
PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes);
|
||||
PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, boolean enforceNew);
|
||||
PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes);
|
||||
//some pumps might set a very short temp close to 100% as cancelling a temp can be noisy
|
||||
//when the cancel request is requested by the user (forced), the pump should always do a real cancel
|
||||
|
|
|
@ -8,7 +8,6 @@ import android.support.v4.app.FragmentManager;
|
|||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.Button;
|
||||
|
||||
import com.crashlytics.android.Crashlytics;
|
||||
import com.crashlytics.android.answers.Answers;
|
||||
|
@ -33,6 +32,7 @@ import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialo
|
|||
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.utils.SingleClickButton;
|
||||
|
||||
/**
|
||||
* A simple {@link Fragment} subclass.
|
||||
|
@ -45,13 +45,13 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
|||
return actionsPlugin;
|
||||
}
|
||||
|
||||
Button profileSwitch;
|
||||
Button tempTarget;
|
||||
Button extendedBolus;
|
||||
Button extendedBolusCancel;
|
||||
Button tempBasal;
|
||||
Button tempBasalCancel;
|
||||
Button fill;
|
||||
SingleClickButton profileSwitch;
|
||||
SingleClickButton tempTarget;
|
||||
SingleClickButton extendedBolus;
|
||||
SingleClickButton extendedBolusCancel;
|
||||
SingleClickButton tempBasal;
|
||||
SingleClickButton tempBasalCancel;
|
||||
SingleClickButton fill;
|
||||
|
||||
public ActionsFragment() {
|
||||
super();
|
||||
|
@ -64,13 +64,13 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
|||
try {
|
||||
View view = inflater.inflate(R.layout.actions_fragment, container, false);
|
||||
|
||||
profileSwitch = (Button) view.findViewById(R.id.actions_profileswitch);
|
||||
tempTarget = (Button) view.findViewById(R.id.actions_temptarget);
|
||||
extendedBolus = (Button) view.findViewById(R.id.actions_extendedbolus);
|
||||
extendedBolusCancel = (Button) view.findViewById(R.id.actions_extendedbolus_cancel);
|
||||
tempBasal = (Button) view.findViewById(R.id.actions_settempbasal);
|
||||
tempBasalCancel = (Button) view.findViewById(R.id.actions_canceltempbasal);
|
||||
fill = (Button) view.findViewById(R.id.actions_fill);
|
||||
profileSwitch = (SingleClickButton) view.findViewById(R.id.actions_profileswitch);
|
||||
tempTarget = (SingleClickButton) view.findViewById(R.id.actions_temptarget);
|
||||
extendedBolus = (SingleClickButton) view.findViewById(R.id.actions_extendedbolus);
|
||||
extendedBolusCancel = (SingleClickButton) view.findViewById(R.id.actions_extendedbolus_cancel);
|
||||
tempBasal = (SingleClickButton) view.findViewById(R.id.actions_settempbasal);
|
||||
tempBasalCancel = (SingleClickButton) view.findViewById(R.id.actions_canceltempbasal);
|
||||
fill = (SingleClickButton) view.findViewById(R.id.actions_fill);
|
||||
|
||||
profileSwitch.setOnClickListener(this);
|
||||
tempTarget.setOnClickListener(this);
|
||||
|
@ -127,8 +127,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
|
|||
return;
|
||||
}
|
||||
final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
||||
boolean allowProfileSwitch = MainApp.getConfigBuilder().getActiveProfileInterface().getProfile().getProfileList().size() > 1;
|
||||
if (!pump.getPumpDescription().isSetBasalProfileCapable || !pump.isInitialized() || pump.isSuspended() || !allowProfileSwitch)
|
||||
if (!pump.getPumpDescription().isSetBasalProfileCapable || !pump.isInitialized() || pump.isSuspended())
|
||||
profileSwitch.setVisibility(View.GONE);
|
||||
else
|
||||
profileSwitch.setVisibility(View.VISIBLE);
|
||||
|
|
|
@ -100,6 +100,8 @@ public class FillDialog extends DialogFragment implements OnClickListener {
|
|||
if (button1.getVisibility() == View.GONE && button2.getVisibility() == View.GONE && button3.getVisibility() == View.GONE) {
|
||||
divider.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
setCancelable(false);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
|
|
@ -54,14 +54,9 @@ public class NewExtendedBolusDialog extends DialogFragment implements View.OnCli
|
|||
|
||||
view.findViewById(R.id.ok).setOnClickListener(this);
|
||||
view.findViewById(R.id.cancel).setOnClickListener(this);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if (getDialog() != null)
|
||||
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
|
||||
setCancelable(false);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -102,6 +102,8 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
|
|||
view.findViewById(R.id.ok).setOnClickListener(this);
|
||||
view.findViewById(R.id.cancel).setOnClickListener(this);
|
||||
basalTypeRadioGroup.setOnCheckedChangeListener(this);
|
||||
|
||||
setCancelable(false);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -155,7 +157,7 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
|
|||
}
|
||||
};
|
||||
if (setAsPercent) {
|
||||
ConfigBuilderPlugin.getCommandQueue().tempBasalPercent(finalBasalPercent, finalDurationInMinutes, callback);
|
||||
ConfigBuilderPlugin.getCommandQueue().tempBasalPercent(finalBasalPercent, finalDurationInMinutes, true, callback);
|
||||
} else {
|
||||
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(finalBasal, finalDurationInMinutes, true, callback);
|
||||
}
|
||||
|
|
|
@ -175,7 +175,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
|||
profileSpinner.setAdapter(adapter);
|
||||
// set selected to actual profile
|
||||
for (int p = 0; p < profileList.size(); p++) {
|
||||
if (profileList.get(p).equals(MainApp.getConfigBuilder().getProfileName()))
|
||||
if (profileList.get(p).equals(MainApp.getConfigBuilder().getProfileName(false)))
|
||||
profileSpinner.setSelection(p);
|
||||
}
|
||||
|
||||
|
@ -360,6 +360,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
|
|||
showOrHide((ViewGroup) view.findViewById(R.id.careportal_newnstreatment_reuse_layout), options.profile && ps != null && ps.isCPP);
|
||||
showOrHide((ViewGroup) view.findViewById(R.id.careportal_newnstreatment_temptarget_layout), options.tempTarget);
|
||||
|
||||
setCancelable(false);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
|
|
@ -736,6 +736,10 @@ public class ConfigBuilderPlugin implements PluginBase, ConstraintsInterface, Tr
|
|||
return getProfileName(System.currentTimeMillis());
|
||||
}
|
||||
|
||||
public String getProfileName(boolean customized) {
|
||||
return getProfileName(System.currentTimeMillis(), customized);
|
||||
}
|
||||
|
||||
public String getProfileName(long time) {
|
||||
return getProfileName(time, true);
|
||||
}
|
||||
|
|
|
@ -107,7 +107,7 @@ public class InsulinFastactingPlugin implements PluginBase, InsulinInterface {
|
|||
}
|
||||
|
||||
@Override
|
||||
public Iob iobCalcForTreatment(Treatment treatment, long time, Double dia) {
|
||||
public Iob iobCalcForTreatment(Treatment treatment, long time, double dia) {
|
||||
Iob result = new Iob();
|
||||
|
||||
double scaleFactor = 3.0 / dia;
|
||||
|
|
|
@ -107,7 +107,7 @@ public class InsulinFastactingProlongedPlugin implements PluginBase, InsulinInte
|
|||
}
|
||||
|
||||
@Override
|
||||
public Iob iobCalcForTreatment(Treatment treatment, long time, Double dia) {
|
||||
public Iob iobCalcForTreatment(Treatment treatment, long time, double dia) {
|
||||
Iob result = new Iob();
|
||||
|
||||
//Double scaleFactor = 3.0 / dia;
|
||||
|
|
|
@ -64,7 +64,7 @@ public abstract class InsulinOrefBasePlugin implements PluginBase, InsulinInterf
|
|||
}
|
||||
|
||||
@Override
|
||||
public Iob iobCalcForTreatment(Treatment treatment, long time, Double dia) {
|
||||
public Iob iobCalcForTreatment(Treatment treatment, long time, double dia) {
|
||||
Iob result = new Iob();
|
||||
|
||||
int peak = getPeak();
|
||||
|
|
|
@ -364,6 +364,8 @@ public class IobCobCalculatorPlugin implements PluginBase {
|
|||
// check if data already exists
|
||||
long bgTime = bucketed_data.get(i).date;
|
||||
bgTime = roundUpTime(bgTime);
|
||||
if (bgTime > System.currentTimeMillis())
|
||||
continue;
|
||||
Profile profile = MainApp.getConfigBuilder().getProfile(bgTime);
|
||||
|
||||
AutosensData existing;
|
||||
|
|
|
@ -96,6 +96,8 @@ public class UploadQueue {
|
|||
}
|
||||
|
||||
public static void removeID(final String action, final String _id) {
|
||||
if (_id == null || _id.equals(""))
|
||||
return;
|
||||
startService();
|
||||
if (NSClientService.handler != null) {
|
||||
NSClientService.handler.post(new Runnable() {
|
||||
|
|
|
@ -1,10 +1,7 @@
|
|||
package info.nightscout.androidaps.plugins.NSClientInternal.broadcasts;
|
||||
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ResolveInfo;
|
||||
import android.os.Bundle;
|
||||
import android.os.TransactionTooLargeException;
|
||||
import android.support.v4.content.LocalBroadcastManager;
|
||||
|
||||
import org.json.JSONArray;
|
||||
|
@ -19,9 +16,7 @@ import java.util.List;
|
|||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.Services.Intents;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSTreatment;
|
||||
import info.nightscout.utils.SP;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
/**
|
||||
* Created by mike on 20.02.2016.
|
||||
|
@ -29,31 +24,31 @@ import info.nightscout.utils.ToastUtils;
|
|||
public class BroadcastTreatment {
|
||||
private static Logger log = LoggerFactory.getLogger(BroadcastTreatment.class);
|
||||
|
||||
public static void handleNewTreatment(NSTreatment treatment, Context context, boolean isDelta) {
|
||||
public static void handleNewTreatment(JSONObject treatment, boolean isDelta) {
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("treatment", treatment.getData().toString());
|
||||
bundle.putString("treatment", treatment.toString());
|
||||
bundle.putBoolean("delta", isDelta);
|
||||
Intent intent = new Intent(Intents.ACTION_NEW_TREATMENT);
|
||||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
|
||||
|
||||
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
|
||||
if (SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
|
||||
bundle = new Bundle();
|
||||
bundle.putString("treatment", treatment.getData().toString());
|
||||
bundle.putString("treatment", treatment.toString());
|
||||
bundle.putBoolean("delta", isDelta);
|
||||
intent = new Intent(Intents.ACTION_NEW_TREATMENT);
|
||||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
context.sendBroadcast(intent);
|
||||
MainApp.instance().getApplicationContext().sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
|
||||
public static void handleNewTreatment(JSONArray treatments, Context context, boolean isDelta) {
|
||||
public static void handleNewTreatment(JSONArray treatments, boolean isDelta) {
|
||||
|
||||
List<JSONArray> splitted = splitArray(treatments);
|
||||
for (JSONArray part: splitted) {
|
||||
for (JSONArray part : splitted) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("treatments", part.toString());
|
||||
bundle.putBoolean("delta", isDelta);
|
||||
|
@ -63,21 +58,21 @@ public class BroadcastTreatment {
|
|||
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
|
||||
}
|
||||
|
||||
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)){
|
||||
if (SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
|
||||
splitted = splitArray(treatments);
|
||||
for (JSONArray part: splitted) {
|
||||
for (JSONArray part : splitted) {
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("treatments", part.toString());
|
||||
bundle.putBoolean("delta", isDelta);
|
||||
Intent intent = new Intent(Intents.ACTION_NEW_TREATMENT);
|
||||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
context.sendBroadcast(intent);
|
||||
MainApp.instance().getApplicationContext().sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void handleChangedTreatment(JSONObject treatment, Context context, boolean isDelta) {
|
||||
public void handleChangedTreatment(JSONObject treatment, boolean isDelta) {
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("treatment", treatment.toString());
|
||||
|
@ -88,18 +83,18 @@ public class BroadcastTreatment {
|
|||
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
|
||||
|
||||
|
||||
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
|
||||
if (SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
|
||||
bundle = new Bundle();
|
||||
bundle.putString("treatment", treatment.toString());
|
||||
bundle.putBoolean("delta", isDelta);
|
||||
intent = new Intent(Intents.ACTION_CHANGED_TREATMENT);
|
||||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
context.sendBroadcast(intent);
|
||||
MainApp.instance().getApplicationContext().sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
|
||||
public static void handleChangedTreatment(JSONArray treatments, Context context, boolean isDelta) {
|
||||
public static void handleChangedTreatment(JSONArray treatments, boolean isDelta) {
|
||||
|
||||
List<JSONArray> splitted = splitArray(treatments);
|
||||
for (JSONArray part : splitted) {
|
||||
|
@ -112,7 +107,7 @@ public class BroadcastTreatment {
|
|||
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
|
||||
}
|
||||
|
||||
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
|
||||
if (SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
|
||||
splitted = splitArray(treatments);
|
||||
for (JSONArray part : splitted) {
|
||||
Bundle bundle = new Bundle();
|
||||
|
@ -121,12 +116,12 @@ public class BroadcastTreatment {
|
|||
Intent intent = new Intent(Intents.ACTION_CHANGED_TREATMENT);
|
||||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
context.sendBroadcast(intent);
|
||||
MainApp.instance().getApplicationContext().sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void handleRemovedTreatment(JSONObject treatment, Context context, boolean isDelta) {
|
||||
public static void handleRemovedTreatment(JSONObject treatment, boolean isDelta) {
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("treatment", treatment.toString());
|
||||
|
@ -137,18 +132,18 @@ public class BroadcastTreatment {
|
|||
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
|
||||
|
||||
|
||||
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
|
||||
if (SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
|
||||
bundle = new Bundle();
|
||||
bundle.putString("treatment", treatment.toString());
|
||||
bundle.putBoolean("delta", isDelta);
|
||||
intent = new Intent(Intents.ACTION_REMOVED_TREATMENT);
|
||||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
context.sendBroadcast(intent);
|
||||
MainApp.instance().getApplicationContext().sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
|
||||
public static void handleRemovedTreatment(JSONArray treatments, Context context, boolean isDelta) {
|
||||
public static void handleRemovedTreatment(JSONArray treatments, boolean isDelta) {
|
||||
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("treatments", treatments.toString());
|
||||
|
@ -159,14 +154,14 @@ public class BroadcastTreatment {
|
|||
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
|
||||
|
||||
|
||||
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
|
||||
if (SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
|
||||
bundle = new Bundle();
|
||||
bundle.putString("treatments", treatments.toString());
|
||||
bundle.putBoolean("delta", isDelta);
|
||||
intent = new Intent(Intents.ACTION_REMOVED_TREATMENT);
|
||||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
context.sendBroadcast(intent);
|
||||
MainApp.instance().getApplicationContext().sendBroadcast(intent);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -63,5 +63,6 @@ public class NSSgv {
|
|||
public Long getMills () { return getLongOrNull("mills"); }
|
||||
public String getDevice () { return getStringOrNull("device"); }
|
||||
public String getDirection () { return getStringOrNull("direction"); }
|
||||
public String getId () { return getStringOrNull("_id"); }
|
||||
|
||||
}
|
||||
|
|
|
@ -11,16 +11,14 @@ import org.json.JSONObject;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.db.DbRequest;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientInternalPlugin;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
|
||||
import info.nightscout.androidaps.db.DbRequest;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.data.AlarmAck;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.services.NSClientService;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.broadcasts.BroadcastTreatment;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.SP;
|
||||
|
||||
public class DBAccessReceiver extends BroadcastReceiver {
|
||||
|
@ -89,7 +87,12 @@ public class DBAccessReceiver extends BroadcastReceiver {
|
|||
UploadQueue.add(dbr);
|
||||
} else {
|
||||
DbRequest dbr = new DbRequest(action, collection, nsclientid.toString(), data);
|
||||
// this is not used as mongo _id but only for searching in UploadQueue database
|
||||
// if record has to be removed from queue before upload
|
||||
dbr._id = nsclientid.toString();
|
||||
UploadQueue.add(dbr);
|
||||
if (collection.equals("treatments"))
|
||||
genereateTreatmentOfflineBroadcast(dbr);
|
||||
}
|
||||
|
||||
} finally {
|
||||
|
@ -98,6 +101,19 @@ public class DBAccessReceiver extends BroadcastReceiver {
|
|||
|
||||
}
|
||||
|
||||
public void genereateTreatmentOfflineBroadcast(DbRequest request) {
|
||||
if (request.action.equals("dbAdd")) {
|
||||
try {
|
||||
JSONObject data = new JSONObject(request.data);
|
||||
data.put("mills", DateUtil.fromISODateString(data.getString("created_at")).getTime());
|
||||
data.put("_id", data.get("NSCLIENT_ID")); // this is only fake id
|
||||
BroadcastTreatment.handleNewTreatment(data, false);
|
||||
} catch (Exception e) {
|
||||
log.error("Unhadled exception", e);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isAllowedCollection(String collection) {
|
||||
// "treatments" || "entries" || "devicestatus" || "profile" || "food"
|
||||
if (collection.equals("treatments")) return true;
|
||||
|
|
|
@ -52,15 +52,15 @@ import info.nightscout.androidaps.plugins.NSClientInternal.broadcasts.BroadcastS
|
|||
import info.nightscout.androidaps.plugins.NSClientInternal.broadcasts.BroadcastTreatment;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.broadcasts.BroadcastUrgentAlarm;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.data.AlarmAck;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSSgv;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSSettingsStatus;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSSgv;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSTreatment;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientNewLog;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientRestart;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.events.EventNSClientStatus;
|
||||
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.SP;
|
||||
import io.socket.client.IO;
|
||||
|
@ -310,17 +310,17 @@ public class NSClientService extends Service {
|
|||
};
|
||||
|
||||
private Emitter.Listener onAnnouncement = new Emitter.Listener() {
|
||||
/*
|
||||
{
|
||||
"level":0,
|
||||
"title":"Announcement",
|
||||
"message":"test",
|
||||
"plugin":{"name":"treatmentnotify","label":"Treatment Notifications","pluginType":"notification","enabled":true},
|
||||
"group":"Announcement",
|
||||
"isAnnouncement":true,
|
||||
"key":"9ac46ad9a1dcda79dd87dae418fce0e7955c68da"
|
||||
}
|
||||
*/
|
||||
/*
|
||||
{
|
||||
"level":0,
|
||||
"title":"Announcement",
|
||||
"message":"test",
|
||||
"plugin":{"name":"treatmentnotify","label":"Treatment Notifications","pluginType":"notification","enabled":true},
|
||||
"group":"Announcement",
|
||||
"isAnnouncement":true,
|
||||
"key":"9ac46ad9a1dcda79dd87dae418fce0e7955c68da"
|
||||
}
|
||||
*/
|
||||
@Override
|
||||
public void call(final Object... args) {
|
||||
JSONObject data;
|
||||
|
@ -342,19 +342,19 @@ public class NSClientService extends Service {
|
|||
};
|
||||
|
||||
private Emitter.Listener onAlarm = new Emitter.Listener() {
|
||||
/*
|
||||
{
|
||||
"level":1,
|
||||
"title":"Warning HIGH",
|
||||
"message":"BG Now: 5 -0.2 → mmol\/L\nRaw BG: 4.8 mmol\/L Čistý\nBG 15m: 4.8 mmol\/L\nIOB: -0.02U\nCOB: 0g",
|
||||
"eventName":"high",
|
||||
"plugin":{"name":"simplealarms","label":"Simple Alarms","pluginType":"notification","enabled":true},
|
||||
"pushoverSound":"climb",
|
||||
"debug":{"lastSGV":5,"thresholds":{"bgHigh":180,"bgTargetTop":75,"bgTargetBottom":72,"bgLow":70}},
|
||||
"group":"default",
|
||||
"key":"simplealarms_1"
|
||||
}
|
||||
*/
|
||||
/*
|
||||
{
|
||||
"level":1,
|
||||
"title":"Warning HIGH",
|
||||
"message":"BG Now: 5 -0.2 → mmol\/L\nRaw BG: 4.8 mmol\/L Čistý\nBG 15m: 4.8 mmol\/L\nIOB: -0.02U\nCOB: 0g",
|
||||
"eventName":"high",
|
||||
"plugin":{"name":"simplealarms","label":"Simple Alarms","pluginType":"notification","enabled":true},
|
||||
"pushoverSound":"climb",
|
||||
"debug":{"lastSGV":5,"thresholds":{"bgHigh":180,"bgTargetTop":75,"bgTargetBottom":72,"bgLow":70}},
|
||||
"group":"default",
|
||||
"key":"simplealarms_1"
|
||||
}
|
||||
*/
|
||||
@Override
|
||||
public void call(final Object... args) {
|
||||
if (Config.detailedLog)
|
||||
|
@ -372,19 +372,19 @@ public class NSClientService extends Service {
|
|||
};
|
||||
|
||||
private Emitter.Listener onUrgentAlarm = new Emitter.Listener() {
|
||||
/*
|
||||
{
|
||||
"level":2,
|
||||
"title":"Urgent HIGH",
|
||||
"message":"BG Now: 5.2 -0.1 → mmol\/L\nRaw BG: 5 mmol\/L Čistý\nBG 15m: 5 mmol\/L\nIOB: 0.00U\nCOB: 0g",
|
||||
"eventName":"high",
|
||||
"plugin":{"name":"simplealarms","label":"Simple Alarms","pluginType":"notification","enabled":true},
|
||||
"pushoverSound":"persistent",
|
||||
"debug":{"lastSGV":5.2,"thresholds":{"bgHigh":80,"bgTargetTop":75,"bgTargetBottom":72,"bgLow":70}},
|
||||
"group":"default",
|
||||
"key":"simplealarms_2"
|
||||
}
|
||||
*/
|
||||
/*
|
||||
{
|
||||
"level":2,
|
||||
"title":"Urgent HIGH",
|
||||
"message":"BG Now: 5.2 -0.1 → mmol\/L\nRaw BG: 5 mmol\/L Čistý\nBG 15m: 5 mmol\/L\nIOB: 0.00U\nCOB: 0g",
|
||||
"eventName":"high",
|
||||
"plugin":{"name":"simplealarms","label":"Simple Alarms","pluginType":"notification","enabled":true},
|
||||
"pushoverSound":"persistent",
|
||||
"debug":{"lastSGV":5.2,"thresholds":{"bgHigh":80,"bgTargetTop":75,"bgTargetBottom":72,"bgLow":70}},
|
||||
"group":"default",
|
||||
"key":"simplealarms_2"
|
||||
}
|
||||
*/
|
||||
@Override
|
||||
public void call(final Object... args) {
|
||||
JSONObject data;
|
||||
|
@ -402,14 +402,14 @@ public class NSClientService extends Service {
|
|||
};
|
||||
|
||||
private Emitter.Listener onClearAlarm = new Emitter.Listener() {
|
||||
/*
|
||||
{
|
||||
"clear":true,
|
||||
"title":"All Clear",
|
||||
"message":"default - Urgent was ack'd",
|
||||
"group":"default"
|
||||
}
|
||||
*/
|
||||
/*
|
||||
{
|
||||
"clear":true,
|
||||
"title":"All Clear",
|
||||
"message":"default - Urgent was ack'd",
|
||||
"group":"default"
|
||||
}
|
||||
*/
|
||||
@Override
|
||||
public void call(final Object... args) {
|
||||
JSONObject data;
|
||||
|
@ -520,17 +520,17 @@ public class NSClientService extends Service {
|
|||
updatedTreatments.put(jsonTreatment);
|
||||
} else if (treatment.getAction().equals("remove")) {
|
||||
if (treatment.getMills() != null && treatment.getMills() > System.currentTimeMillis() - 24 * 60 * 60 * 1000L) // handle 1 day old deletions only
|
||||
removedTreatments.put(jsonTreatment);
|
||||
removedTreatments.put(jsonTreatment);
|
||||
}
|
||||
}
|
||||
if (removedTreatments.length() > 0) {
|
||||
BroadcastTreatment.handleRemovedTreatment(removedTreatments, MainApp.instance().getApplicationContext(), isDelta);
|
||||
BroadcastTreatment.handleRemovedTreatment(removedTreatments, isDelta);
|
||||
}
|
||||
if (updatedTreatments.length() > 0) {
|
||||
BroadcastTreatment.handleChangedTreatment(updatedTreatments, MainApp.instance().getApplicationContext(), isDelta);
|
||||
BroadcastTreatment.handleChangedTreatment(updatedTreatments, isDelta);
|
||||
}
|
||||
if (addedTreatments.length() > 0) {
|
||||
BroadcastTreatment.handleNewTreatment(addedTreatments, MainApp.instance().getApplicationContext(), isDelta);
|
||||
BroadcastTreatment.handleNewTreatment(addedTreatments, isDelta);
|
||||
}
|
||||
}
|
||||
if (data.has("devicestatus")) {
|
||||
|
@ -634,12 +634,12 @@ public class NSClientService extends Service {
|
|||
}
|
||||
// Was that sgv more less 15 mins ago ?
|
||||
boolean lessThan15MinAgo = false;
|
||||
if((System.currentTimeMillis()-latestDateInReceivedData)/(60 * 1000L) < 15L )
|
||||
if ((System.currentTimeMillis() - latestDateInReceivedData) / (60 * 1000L) < 15L)
|
||||
lessThan15MinAgo = true;
|
||||
if(Notification.isAlarmForStaleData() && lessThan15MinAgo){
|
||||
if (Notification.isAlarmForStaleData() && lessThan15MinAgo) {
|
||||
MainApp.bus().post(new EventDismissNotification(Notification.NSALARM));
|
||||
}
|
||||
BroadcastSgvs.handleNewSgv(sgvs, MainApp.instance().getApplicationContext(), isDelta);
|
||||
}
|
||||
BroadcastSgvs.handleNewSgv(sgvs, MainApp.instance().getApplicationContext(), isDelta);
|
||||
}
|
||||
MainApp.bus().post(new EventNSClientNewLog("LAST", DateUtil.dateAndTimeString(latestDateInReceivedData)));
|
||||
} catch (JSONException e) {
|
||||
|
@ -757,7 +757,7 @@ public class NSClientService extends Service {
|
|||
public void run() {
|
||||
if (mSocket == null || !mSocket.connected()) return;
|
||||
|
||||
if (lastResendTime > System.currentTimeMillis() - 10 * 1000L) {
|
||||
if (lastResendTime > System.currentTimeMillis() - 10 * 1000L) {
|
||||
log.debug("Skipping resend by lastResendTime: " + ((System.currentTimeMillis() - lastResendTime) / 1000L) + " sec");
|
||||
return;
|
||||
}
|
||||
|
|
|
@ -76,6 +76,7 @@ public class CalibrationDialog extends DialogFragment implements View.OnClickLis
|
|||
unitsView = (TextView) view.findViewById(R.id.overview_calibration_units);
|
||||
unitsView.setText(units);
|
||||
|
||||
setCancelable(false);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
|
|
@ -9,7 +9,6 @@ import android.view.ViewGroup;
|
|||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.Spinner;
|
||||
|
||||
|
@ -17,13 +16,13 @@ import org.json.JSONException;
|
|||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.ArrayList;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.QuickWizard;
|
||||
import info.nightscout.androidaps.data.QuickWizardEntry;
|
||||
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
|
||||
import info.nightscout.androidaps.plugins.Overview.QuickWizard;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventQuickWizardChange;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.SafeParse;
|
||||
|
@ -31,19 +30,25 @@ import info.nightscout.utils.SafeParse;
|
|||
public class EditQuickWizardDialog extends DialogFragment implements View.OnClickListener {
|
||||
private static Logger log = LoggerFactory.getLogger(EditQuickWizardDialog.class);
|
||||
|
||||
QuickWizard.QuickWizardEntry entry = new QuickWizard().newEmptyItem();
|
||||
QuickWizardEntry entry = new QuickWizard().newEmptyItem();
|
||||
QuickWizard quickWizard = MainApp.getSpecificPlugin(OverviewPlugin.class).quickWizard;
|
||||
|
||||
EditText buttonEdit;
|
||||
EditText carbsEdit;
|
||||
Spinner fromSpinner;
|
||||
Spinner toSpinner;
|
||||
Button okButton;
|
||||
Spinner useBGSpinner;
|
||||
Spinner useCOBSpinner;
|
||||
Spinner useBolusIOBSpinner;
|
||||
Spinner useBasalIOBSpinner;
|
||||
Spinner useTrendSpinner;
|
||||
Spinner useSuperBolusSpinner;
|
||||
Spinner useTempTargetSpinner;
|
||||
|
||||
public EditQuickWizardDialog() {
|
||||
}
|
||||
|
||||
public void setData(QuickWizard.QuickWizardEntry data) {
|
||||
public void setData(QuickWizardEntry data) {
|
||||
entry = data;
|
||||
}
|
||||
|
||||
|
@ -58,8 +63,16 @@ public class EditQuickWizardDialog extends DialogFragment implements View.OnClic
|
|||
carbsEdit = (EditText) view.findViewById(R.id.overview_editquickwizard_carbs_edit);
|
||||
fromSpinner = (Spinner) view.findViewById(R.id.overview_editquickwizard_from_spinner);
|
||||
toSpinner = (Spinner) view.findViewById(R.id.overview_editquickwizard_to_spinner);
|
||||
okButton = (Button) view.findViewById(R.id.overview_editquickwizard_ok_button);
|
||||
okButton.setOnClickListener(this);
|
||||
useBGSpinner = (Spinner) view.findViewById(R.id.overview_editquickwizard_usebg_spinner);
|
||||
useCOBSpinner = (Spinner) view.findViewById(R.id.overview_editquickwizard_usecob_spinner);
|
||||
useBolusIOBSpinner = (Spinner) view.findViewById(R.id.overview_editquickwizard_usebolusiob_spinner);
|
||||
useBasalIOBSpinner = (Spinner) view.findViewById(R.id.overview_editquickwizard_usebasaliob_spinner);
|
||||
useTrendSpinner = (Spinner) view.findViewById(R.id.overview_editquickwizard_usetrend_spinner);
|
||||
useSuperBolusSpinner = (Spinner) view.findViewById(R.id.overview_editquickwizard_usesuperbolus_spinner);
|
||||
useTempTargetSpinner = (Spinner) view.findViewById(R.id.overview_editquickwizard_usetemptarget_spinner);
|
||||
|
||||
view.findViewById(R.id.ok).setOnClickListener(this);
|
||||
view.findViewById(R.id.cancel).setOnClickListener(this);
|
||||
|
||||
int posFrom = 0;
|
||||
int posTo = 95;
|
||||
|
@ -83,6 +96,14 @@ public class EditQuickWizardDialog extends DialogFragment implements View.OnClic
|
|||
fromSpinner.setSelection(posFrom);
|
||||
toSpinner.setSelection(posTo);
|
||||
|
||||
setSelection(useBGSpinner, entry.useBG());
|
||||
setSelection(useCOBSpinner, entry.useCOB());
|
||||
setSelection(useBolusIOBSpinner, entry.useBolusIOB());
|
||||
setSelection(useBasalIOBSpinner, entry.useBasalIOB());
|
||||
setSelection(useTrendSpinner, entry.useTrend());
|
||||
setSelection(useSuperBolusSpinner, entry.useSuperBolus());
|
||||
setSelection(useTempTargetSpinner, entry.useTempTarget());
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -96,7 +117,7 @@ public class EditQuickWizardDialog extends DialogFragment implements View.OnClic
|
|||
@Override
|
||||
public void onClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.overview_editquickwizard_ok_button:
|
||||
case R.id.ok:
|
||||
if (fromSpinner.getSelectedItem() == null) return;
|
||||
if (toSpinner.getSelectedItem() == null) return;
|
||||
try {
|
||||
|
@ -106,13 +127,64 @@ public class EditQuickWizardDialog extends DialogFragment implements View.OnClic
|
|||
entry.storage.put("validFrom", validFromInt);
|
||||
int validToInt = DateUtil.toSeconds(toSpinner.getSelectedItem().toString());
|
||||
entry.storage.put("validTo", validToInt);
|
||||
entry.storage.put("useBG", getSelection(useBGSpinner));
|
||||
entry.storage.put("useCOB", getSelection(useCOBSpinner));
|
||||
entry.storage.put("useBolusIOB", getSelection(useBolusIOBSpinner));
|
||||
entry.storage.put("useBasalIOB", getSelection(useBasalIOBSpinner));
|
||||
entry.storage.put("useTrend", getSelection(useTrendSpinner));
|
||||
entry.storage.put("useSuperBolus", getSelection(useSuperBolusSpinner));
|
||||
entry.storage.put("useTempTarget", getSelection(useTempTargetSpinner));
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
quickWizard.addOrUpdate(entry);
|
||||
dismiss();
|
||||
MainApp.bus().post(new EventQuickWizardChange());
|
||||
break;
|
||||
break;
|
||||
case R.id.cancel:
|
||||
dismiss();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
int getSelection(Spinner spinner) {
|
||||
String value = spinner.getSelectedItem().toString();
|
||||
if (value.equals(MainApp.sResources.getString(R.string.yes)))
|
||||
return QuickWizardEntry.YES;
|
||||
if (value.equals(MainApp.sResources.getString(R.string.no)))
|
||||
return QuickWizardEntry.NO;
|
||||
if (value.equals(MainApp.sResources.getString(R.string.positiveonly)))
|
||||
return QuickWizardEntry.POSITIVE_ONLY;
|
||||
if (value.equals(MainApp.sResources.getString(R.string.negativeonly)))
|
||||
return QuickWizardEntry.NEGATIVE_ONLY;
|
||||
return QuickWizardEntry.NO;
|
||||
}
|
||||
|
||||
void setSelection(Spinner spinner, int value) {
|
||||
String selection;
|
||||
switch (value) {
|
||||
case QuickWizardEntry.YES:
|
||||
selection = MainApp.sResources.getString(R.string.yes);
|
||||
break;
|
||||
case QuickWizardEntry.NO:
|
||||
selection = MainApp.sResources.getString(R.string.no);
|
||||
break;
|
||||
case QuickWizardEntry.POSITIVE_ONLY:
|
||||
selection = MainApp.sResources.getString(R.string.positiveonly);
|
||||
break;
|
||||
case QuickWizardEntry.NEGATIVE_ONLY:
|
||||
selection = MainApp.sResources.getString(R.string.negativeonly);
|
||||
break;
|
||||
default:
|
||||
selection = MainApp.sResources.getString(R.string.no);
|
||||
break;
|
||||
}
|
||||
|
||||
for (int i = 0; i < spinner.getCount(); i++) {
|
||||
if (spinner.getItemAtPosition(i).toString().equalsIgnoreCase(selection)) {
|
||||
spinner.setSelection(i);
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -102,6 +102,7 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
|||
editCarbs.setParams(0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false, textWatcher);
|
||||
editInsulin.setParams(0d, 0d, maxInsulin, ConfigBuilderPlugin.getActivePump().getPumpDescription().bolusStep, new DecimalFormat("0.00"), false, textWatcher);
|
||||
|
||||
setCancelable(false);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
|
|
@ -53,6 +53,8 @@ import info.nightscout.androidaps.db.TempTarget;
|
|||
import info.nightscout.androidaps.events.EventNewBG;
|
||||
import info.nightscout.androidaps.events.EventRefreshOverview;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.AutosensData;
|
||||
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
|
||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAPlugin;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui;
|
||||
|
@ -102,7 +104,6 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
Integer calculatedCarbs = 0;
|
||||
Double calculatedTotalInsulin = 0d;
|
||||
JSONObject boluscalcJSON;
|
||||
boolean cobAvailable = false;
|
||||
|
||||
Context context;
|
||||
|
||||
|
@ -138,25 +139,6 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
MainApp.bus().unregister(this);
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventOpenAPSUpdateGui e) {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (ConfigBuilderPlugin.getActiveAPS() instanceof OpenAPSAMAPlugin && ConfigBuilderPlugin.getActiveAPS().getLastAPSResult() != null && ConfigBuilderPlugin.getActiveAPS().getLastAPSRun().after(new Date(System.currentTimeMillis() - 11 * 60 * 1000L))) {
|
||||
cobLayout.setVisibility(View.VISIBLE);
|
||||
cobAvailable = true;
|
||||
} else {
|
||||
cobLayout.setVisibility(View.GONE);
|
||||
cobAvailable = false;
|
||||
}
|
||||
calculateInsulin();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventNewBG e) {
|
||||
Activity activity = getActivity();
|
||||
|
@ -251,6 +233,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
editCarbTime.setParams(0d, -60d, 60d, 5d, new DecimalFormat("0"), false);
|
||||
initDialog();
|
||||
|
||||
setCancelable(false);
|
||||
return view;
|
||||
}
|
||||
|
||||
|
@ -344,7 +327,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
activeloop.superBolusTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000);
|
||||
MainApp.bus().post(new EventRefreshOverview("WizardDialog"));
|
||||
}
|
||||
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(0d, 120, true, new Callback() {
|
||||
ConfigBuilderPlugin.getCommandQueue().tempBasalPercent(0, 120, true, new Callback() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!result.success) {
|
||||
|
@ -438,14 +421,6 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
bolusIobInsulin.setText(DecimalFormatter.to2Decimal(-bolusIob.iob) + "U");
|
||||
basalIobInsulin.setText(DecimalFormatter.to2Decimal(-basalIob.basaliob) + "U");
|
||||
|
||||
// COB only if AMA is selected
|
||||
if (ConfigBuilderPlugin.getActiveAPS() instanceof OpenAPSAMAPlugin && ConfigBuilderPlugin.getActiveAPS().getLastAPSResult() != null && ConfigBuilderPlugin.getActiveAPS().getLastAPSRun().after(new Date(System.currentTimeMillis() - 11 * 60 * 1000L))) {
|
||||
cobLayout.setVisibility(View.VISIBLE);
|
||||
cobAvailable = true;
|
||||
} else {
|
||||
cobLayout.setVisibility(View.GONE);
|
||||
cobAvailable = false;
|
||||
}
|
||||
calculateInsulin();
|
||||
}
|
||||
|
||||
|
@ -482,13 +457,11 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
|
||||
// COB
|
||||
Double c_cob = 0d;
|
||||
if (cobAvailable && cobCheckbox.isChecked()) {
|
||||
if (ConfigBuilderPlugin.getActiveAPS().getLastAPSResult() != null && ConfigBuilderPlugin.getActiveAPS().getLastAPSRun().after(new Date(System.currentTimeMillis() - 11 * 60 * 1000L))) {
|
||||
try {
|
||||
c_cob = SafeParse.stringToDouble(ConfigBuilderPlugin.getActiveAPS().getLastAPSResult().json().getString("COB"));
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
if (cobCheckbox.isChecked()) {
|
||||
AutosensData autosensData = IobCobCalculatorPlugin.getAutosensData(System.currentTimeMillis());
|
||||
|
||||
if(autosensData != null && autosensData.time > System.currentTimeMillis() - 11 * 60 * 1000L) {
|
||||
c_cob = autosensData.cob;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -530,7 +503,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
bgTrendInsulin.setText(DecimalFormatter.to2Decimal(wizard.insulinFromTrend) + "U");
|
||||
|
||||
// COB
|
||||
if (cobAvailable && cobCheckbox.isChecked()) {
|
||||
if (cobCheckbox.isChecked()) {
|
||||
cob.setText(DecimalFormatter.to2Decimal(c_cob) + "g IC: " + DecimalFormatter.to1Decimal(wizard.ic));
|
||||
cobInsulin.setText(DecimalFormatter.to2Decimal(wizard.insulinFromCOB) + "U");
|
||||
} else {
|
||||
|
|
|
@ -52,7 +52,6 @@ import java.util.concurrent.ScheduledExecutorService;
|
|||
import java.util.concurrent.ScheduledFuture;
|
||||
import java.util.concurrent.TimeUnit;
|
||||
|
||||
import info.nightscout.androidaps.BuildConfig;
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
|
@ -61,6 +60,7 @@ import info.nightscout.androidaps.data.DetailedBolusInfo;
|
|||
import info.nightscout.androidaps.data.GlucoseStatus;
|
||||
import info.nightscout.androidaps.data.IobTotal;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.data.QuickWizardEntry;
|
||||
import info.nightscout.androidaps.db.BgReading;
|
||||
import info.nightscout.androidaps.db.CareportalEvent;
|
||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||
|
@ -78,6 +78,7 @@ import info.nightscout.androidaps.events.EventTempBasalChange;
|
|||
import info.nightscout.androidaps.events.EventTempTargetChange;
|
||||
import info.nightscout.androidaps.events.EventTreatmentChange;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
|
||||
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
||||
|
@ -97,6 +98,7 @@ import info.nightscout.androidaps.plugins.Overview.Dialogs.CalibrationDialog;
|
|||
import info.nightscout.androidaps.plugins.Overview.Dialogs.ErrorHelperActivity;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.NewTreatmentDialog;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.WizardDialog;
|
||||
import info.nightscout.androidaps.plugins.Overview.activities.QuickWizardListActivity;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventSetWakeLock;
|
||||
import info.nightscout.androidaps.plugins.Overview.graphData.GraphData;
|
||||
|
@ -112,9 +114,10 @@ import info.nightscout.utils.NSUpload;
|
|||
import info.nightscout.utils.OKDialog;
|
||||
import info.nightscout.utils.Profiler;
|
||||
import info.nightscout.utils.SP;
|
||||
import info.nightscout.utils.SingleClickButton;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
public class OverviewFragment extends Fragment implements View.OnClickListener, CompoundButton.OnCheckedChangeListener {
|
||||
public class OverviewFragment extends Fragment implements View.OnClickListener, CompoundButton.OnCheckedChangeListener, View.OnLongClickListener {
|
||||
private static Logger log = LoggerFactory.getLogger(OverviewFragment.class);
|
||||
|
||||
TextView timeView;
|
||||
|
@ -155,11 +158,11 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
LinearLayoutManager llm;
|
||||
|
||||
LinearLayout acceptTempLayout;
|
||||
Button treatmentButton;
|
||||
Button wizardButton;
|
||||
Button calibrationButton;
|
||||
Button acceptTempButton;
|
||||
Button quickWizardButton;
|
||||
SingleClickButton treatmentButton;
|
||||
SingleClickButton wizardButton;
|
||||
SingleClickButton calibrationButton;
|
||||
SingleClickButton acceptTempButton;
|
||||
SingleClickButton quickWizardButton;
|
||||
|
||||
CheckBox lockScreen;
|
||||
|
||||
|
@ -243,16 +246,17 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
bgGraph = (GraphView) view.findViewById(R.id.overview_bggraph);
|
||||
iobGraph = (GraphView) view.findViewById(R.id.overview_iobgraph);
|
||||
|
||||
treatmentButton = (Button) view.findViewById(R.id.overview_treatmentbutton);
|
||||
treatmentButton = (SingleClickButton) view.findViewById(R.id.overview_treatmentbutton);
|
||||
treatmentButton.setOnClickListener(this);
|
||||
wizardButton = (Button) view.findViewById(R.id.overview_wizardbutton);
|
||||
wizardButton = (SingleClickButton) view.findViewById(R.id.overview_wizardbutton);
|
||||
wizardButton.setOnClickListener(this);
|
||||
acceptTempButton = (Button) view.findViewById(R.id.overview_accepttempbutton);
|
||||
acceptTempButton = (SingleClickButton) view.findViewById(R.id.overview_accepttempbutton);
|
||||
if (acceptTempButton != null)
|
||||
acceptTempButton.setOnClickListener(this);
|
||||
quickWizardButton = (Button) view.findViewById(R.id.overview_quickwizardbutton);
|
||||
quickWizardButton = (SingleClickButton) view.findViewById(R.id.overview_quickwizardbutton);
|
||||
quickWizardButton.setOnClickListener(this);
|
||||
calibrationButton = (Button) view.findViewById(R.id.overview_calibrationbutton);
|
||||
quickWizardButton.setOnLongClickListener(this);
|
||||
calibrationButton = (SingleClickButton) view.findViewById(R.id.overview_calibrationbutton);
|
||||
if (calibrationButton != null)
|
||||
calibrationButton.setOnClickListener(this);
|
||||
|
||||
|
@ -319,6 +323,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
return view;
|
||||
} catch (Exception e) {
|
||||
Crashlytics.logException(e);
|
||||
log.debug("Runtime Exception", e);
|
||||
}
|
||||
|
||||
return null;
|
||||
|
@ -330,6 +335,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
super.onCreateContextMenu(menu, v, menuInfo);
|
||||
if (v == apsModeView) {
|
||||
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
|
||||
final PumpDescription pumpDescription = ConfigBuilderPlugin.getActivePump().getPumpDescription();
|
||||
if (activeloop == null)
|
||||
return;
|
||||
menu.setHeaderTitle(MainApp.sResources.getString(R.string.loop));
|
||||
|
@ -340,7 +346,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
menu.add(MainApp.sResources.getString(R.string.suspendloopfor2h));
|
||||
menu.add(MainApp.sResources.getString(R.string.suspendloopfor3h));
|
||||
menu.add(MainApp.sResources.getString(R.string.suspendloopfor10h));
|
||||
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor30m));
|
||||
if (pumpDescription.tempDurationStep <= 30)
|
||||
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor30m));
|
||||
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor1h));
|
||||
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor2h));
|
||||
menu.add(MainApp.sResources.getString(R.string.disconnectpumpfor3h));
|
||||
|
@ -479,7 +486,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor30m))) {
|
||||
activeloop.disconnectTo(System.currentTimeMillis() + 30L * 60 * 1000);
|
||||
updateGUI("suspendmenu");
|
||||
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(0d, 30, true, new Callback() {
|
||||
ConfigBuilderPlugin.getCommandQueue().tempBasalPercent(0, 30, true, new Callback() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!result.success) {
|
||||
|
@ -492,7 +499,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor1h))) {
|
||||
activeloop.disconnectTo(System.currentTimeMillis() + 1 * 60L * 60 * 1000);
|
||||
updateGUI("suspendmenu");
|
||||
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(0d, 60, true, new Callback() {
|
||||
ConfigBuilderPlugin.getCommandQueue().tempBasalPercent(0, 60, true, new Callback() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!result.success) {
|
||||
|
@ -505,7 +512,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor2h))) {
|
||||
activeloop.disconnectTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000);
|
||||
updateGUI("suspendmenu");
|
||||
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(0d, 2 * 60, true, new Callback() {
|
||||
ConfigBuilderPlugin.getCommandQueue().tempBasalPercent(0, 2 * 60, true, new Callback() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!result.success) {
|
||||
|
@ -518,7 +525,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
} else if (item.getTitle().equals(MainApp.sResources.getString(R.string.disconnectpumpfor3h))) {
|
||||
activeloop.disconnectTo(System.currentTimeMillis() + 3 * 60L * 60 * 1000);
|
||||
updateGUI("suspendmenu");
|
||||
ConfigBuilderPlugin.getCommandQueue().tempBasalAbsolute(0d, 3 * 60, true, new Callback() {
|
||||
ConfigBuilderPlugin.getCommandQueue().tempBasalPercent(0, 3 * 60, true, new Callback() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!result.success) {
|
||||
|
@ -573,6 +580,17 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onLongClick(View v) {
|
||||
switch (v.getId()) {
|
||||
case R.id.overview_quickwizardbutton:
|
||||
Intent i = new Intent(v.getContext(), QuickWizardListActivity.class);
|
||||
startActivity(i);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
private void onClickAcceptTemp() {
|
||||
if (ConfigBuilderPlugin.getActiveLoop() != null) {
|
||||
ConfigBuilderPlugin.getActiveLoop().invoke("Accept temp button", false);
|
||||
|
@ -616,11 +634,10 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
final Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||
final TempTarget tempTarget = MainApp.getConfigBuilder().getTempTargetFromHistory();
|
||||
|
||||
QuickWizard.QuickWizardEntry quickWizardEntry = OverviewPlugin.getPlugin().quickWizard.getActive();
|
||||
final QuickWizardEntry quickWizardEntry = OverviewPlugin.getPlugin().quickWizard.getActive();
|
||||
if (quickWizardEntry != null && actualBg != null) {
|
||||
quickWizardButton.setVisibility(View.VISIBLE);
|
||||
BolusWizard wizard = new BolusWizard();
|
||||
wizard.doCalc(profile, tempTarget, quickWizardEntry.carbs(), 0d, actualBg.valueToUnits(profile.getUnits()), 0d, true, true, false, false);
|
||||
final BolusWizard wizard = quickWizardEntry.doCalc(profile, tempTarget, actualBg);
|
||||
|
||||
final JSONObject boluscalcJSON = new JSONObject();
|
||||
try {
|
||||
|
@ -679,6 +696,26 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
}
|
||||
accepted = true;
|
||||
if (finalInsulinAfterConstraints > 0 || finalCarbsAfterConstraints > 0) {
|
||||
if (wizard.superBolus) {
|
||||
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
|
||||
if (activeloop != null) {
|
||||
activeloop.superBolusTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000);
|
||||
MainApp.bus().post(new EventRefreshOverview("WizardDialog"));
|
||||
}
|
||||
ConfigBuilderPlugin.getCommandQueue().tempBasalPercent(0, 120, true, new Callback() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (!result.success) {
|
||||
Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class);
|
||||
i.putExtra("soundid", R.raw.boluserror);
|
||||
i.putExtra("status", result.comment);
|
||||
i.putExtra("title", MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
MainApp.instance().startActivity(i);
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
DetailedBolusInfo detailedBolusInfo = new DetailedBolusInfo();
|
||||
detailedBolusInfo.eventType = CareportalEvent.BOLUSWIZARD;
|
||||
detailedBolusInfo.insulin = finalInsulinAfterConstraints;
|
||||
|
@ -1083,12 +1120,11 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
|||
tempTargetView.setLongClickable(true);
|
||||
|
||||
// QuickWizard button
|
||||
QuickWizard.QuickWizardEntry quickWizardEntry = OverviewPlugin.getPlugin().quickWizard.getActive();
|
||||
QuickWizardEntry quickWizardEntry = OverviewPlugin.getPlugin().quickWizard.getActive();
|
||||
if (quickWizardEntry != null && lastBG != null && pump.isInitialized() && !pump.isSuspended()) {
|
||||
quickWizardButton.setVisibility(View.VISIBLE);
|
||||
String text = quickWizardEntry.buttonText() + "\n" + DecimalFormatter.to0Decimal(quickWizardEntry.carbs()) + "g";
|
||||
BolusWizard wizard = new BolusWizard();
|
||||
wizard.doCalc(profile, tempTarget, quickWizardEntry.carbs(), 0d, lastBG.valueToUnits(units), 0d, true, true, false, false);
|
||||
BolusWizard wizard = quickWizardEntry.doCalc(profile, tempTarget, lastBG);
|
||||
text += " " + DecimalFormatter.to2Decimal(wizard.calculatedTotalInsulin) + "U";
|
||||
quickWizardButton.setText(text);
|
||||
if (wizard.calculatedTotalInsulin <= 0)
|
||||
|
|
|
@ -9,6 +9,7 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.QuickWizard;
|
||||
import info.nightscout.androidaps.events.EventRefreshOverview;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
package info.nightscout.androidaps.plugins.Overview.activities;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.widget.CardView;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
|
@ -15,13 +15,11 @@ import android.widget.TextView;
|
|||
|
||||
import com.squareup.otto.Subscribe;
|
||||
|
||||
import java.text.SimpleDateFormat;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.QuickWizard;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.EditQuickWizardDialog;
|
||||
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
|
||||
import info.nightscout.androidaps.plugins.Overview.QuickWizard;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventQuickWizardChange;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
|
@ -153,6 +151,7 @@ public class QuickWizardListActivity extends AppCompatActivity implements View.O
|
|||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventQuickWizardChange ev) {
|
||||
updateGUI();
|
||||
|
|
|
@ -56,6 +56,7 @@ public class Notification {
|
|||
public static final int PUMP_UNREACHABLE = 26;
|
||||
public static final int BG_READINGS_MISSED = 27;
|
||||
public static final int UNSUPPORTED_FIRMWARE = 28;
|
||||
public static final int MINIMAL_BASAL_VALUE_REPLACED = 29;
|
||||
|
||||
public int id;
|
||||
public Date date;
|
||||
|
|
|
@ -182,9 +182,6 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
|
|||
if (timeshift < 0 || timeshift > 23) {
|
||||
msg += String.format(MainApp.sResources.getString(R.string.openapsma_valueoutofrange), "Profile-Timeshift") + "\n";
|
||||
}
|
||||
if (!SP.getBoolean("syncprofiletopump", false)) {
|
||||
msg += MainApp.sResources.getString(R.string.syncprofiletopump_title) + " " + MainApp.sResources.getString(R.string.cpp_sync_setting_missing) + "\n";
|
||||
}
|
||||
final Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||
|
||||
if (profile == null || profile.getBasal() == null) {
|
||||
|
|
|
@ -23,6 +23,7 @@ import java.text.DecimalFormat;
|
|||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.events.EventInitializationChanged;
|
||||
import info.nightscout.androidaps.interfaces.PumpDescription;
|
||||
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
|
||||
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
||||
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
|
||||
|
@ -84,15 +85,17 @@ public class LocalProfileFragment extends SubscriberFragment {
|
|||
}
|
||||
};
|
||||
|
||||
PumpDescription pumpDescription = ConfigBuilderPlugin.getActivePump().getPumpDescription();
|
||||
|
||||
View layout = inflater.inflate(R.layout.localprofile_fragment, container, false);
|
||||
diaView = (NumberPicker) layout.findViewById(R.id.localprofile_dia);
|
||||
diaView.setParams(localProfilePlugin.dia, 2d, 48d, 0.1d, new DecimalFormat("0.0"), false, textWatch);
|
||||
mgdlView = (RadioButton) layout.findViewById(R.id.localprofile_mgdl);
|
||||
mmolView = (RadioButton) layout.findViewById(R.id.localprofile_mmol);
|
||||
icView = new TimeListEdit(getContext(), layout, R.id.localprofile_ic, MainApp.sResources.getString(R.string.nsprofileview_ic_label) + ":", getPlugin().ic, null, 0.1d, new DecimalFormat("0.0"), save);
|
||||
isfView = new TimeListEdit(getContext(), layout, R.id.localprofile_isf, MainApp.sResources.getString(R.string.nsprofileview_isf_label) + ":", getPlugin().isf, null, 0.1d, new DecimalFormat("0.0"), save);
|
||||
basalView = new TimeListEdit(getContext(), layout, R.id.localprofile_basal, MainApp.sResources.getString(R.string.nsprofileview_basal_label) + ": " + getSumLabel(), getPlugin().basal, null, 0.01d, new DecimalFormat("0.00"), save);
|
||||
targetView = new TimeListEdit(getContext(), layout, R.id.localprofile_target, MainApp.sResources.getString(R.string.nsprofileview_target_label) + ":", getPlugin().targetLow, getPlugin().targetHigh, 0.1d, new DecimalFormat("0.0"), save);
|
||||
icView = new TimeListEdit(getContext(), layout, R.id.localprofile_ic, MainApp.sResources.getString(R.string.nsprofileview_ic_label) + ":", getPlugin().ic, null, 0.5, 50d, 0.1d, new DecimalFormat("0.0"), save);
|
||||
isfView = new TimeListEdit(getContext(), layout, R.id.localprofile_isf, MainApp.sResources.getString(R.string.nsprofileview_isf_label) + ":", getPlugin().isf, null, 0.5, 500d, 0.1d, new DecimalFormat("0.0"), save);
|
||||
basalView = new TimeListEdit(getContext(), layout, R.id.localprofile_basal, MainApp.sResources.getString(R.string.nsprofileview_basal_label) + ": " + getSumLabel(), getPlugin().basal, null, pumpDescription.basalMinimumRate, 10, 0.01d, new DecimalFormat("0.00"), save);
|
||||
targetView = new TimeListEdit(getContext(), layout, R.id.localprofile_target, MainApp.sResources.getString(R.string.nsprofileview_target_label) + ":", getPlugin().targetLow, getPlugin().targetHigh, 3d, 200, 0.1d, new DecimalFormat("0.0"), save);
|
||||
profileswitchButton = (Button) layout.findViewById(R.id.localprofile_profileswitch);
|
||||
|
||||
if (!ConfigBuilderPlugin.getActivePump().getPumpDescription().isTempBasalCapable) {
|
||||
|
|
|
@ -120,19 +120,17 @@ public class NSProfilePlugin implements PluginBase, ProfileInterface {
|
|||
profile = new ProfileStore(newProfile.getData());
|
||||
storeNSProfile();
|
||||
MainApp.bus().post(new EventNSProfileUpdateGUI());
|
||||
if (SP.getBoolean("syncprofiletopump", false)) {
|
||||
ConfigBuilderPlugin.getCommandQueue().setProfile(MainApp.getConfigBuilder().getProfile(), new Callback() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (result.enacted) {
|
||||
SmsCommunicatorPlugin smsCommunicatorPlugin = MainApp.getSpecificPlugin(SmsCommunicatorPlugin.class);
|
||||
if (smsCommunicatorPlugin != null && smsCommunicatorPlugin.isEnabled(PluginBase.GENERAL)) {
|
||||
smsCommunicatorPlugin.sendNotificationToAllNumbers(MainApp.sResources.getString(R.string.profile_set_ok));
|
||||
}
|
||||
ConfigBuilderPlugin.getCommandQueue().setProfile(MainApp.getConfigBuilder().getProfile(), new Callback() {
|
||||
@Override
|
||||
public void run() {
|
||||
if (result.enacted) {
|
||||
SmsCommunicatorPlugin smsCommunicatorPlugin = MainApp.getSpecificPlugin(SmsCommunicatorPlugin.class);
|
||||
if (smsCommunicatorPlugin != null && smsCommunicatorPlugin.isEnabled(PluginBase.GENERAL)) {
|
||||
smsCommunicatorPlugin.sendNotificationToAllNumbers(MainApp.sResources.getString(R.string.profile_set_ok));
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
private static void storeNSProfile() {
|
||||
|
|
|
@ -434,7 +434,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
|
|||
// Convert duration from minutes to hours
|
||||
if (Config.logPumpActions)
|
||||
log.debug("setTempBasalAbsolute: Setting temp basal " + percentRate + "% for " + durationInMinutes + " mins (doLowTemp || doHighTemp)");
|
||||
return setTempBasalPercent(percentRate, durationInMinutes);
|
||||
return setTempBasalPercent(percentRate, durationInMinutes, false);
|
||||
}
|
||||
if (doExtendedTemp) {
|
||||
// Check if some temp is already in progress
|
||||
|
@ -499,7 +499,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
|
|||
}
|
||||
|
||||
@Override
|
||||
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes) {
|
||||
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, boolean enforceNew) {
|
||||
PumpEnactResult result = new PumpEnactResult();
|
||||
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
|
||||
percent = configBuilderPlugin.applyBasalConstraints(percent);
|
||||
|
@ -514,7 +514,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
|
|||
if (percent > getPumpDescription().maxTempPercent)
|
||||
percent = getPumpDescription().maxTempPercent;
|
||||
TemporaryBasal runningTB = MainApp.getConfigBuilder().getRealTempBasalFromHistory(System.currentTimeMillis());
|
||||
if (runningTB != null && runningTB.percentRate == percent) {
|
||||
if (runningTB != null && runningTB.percentRate == percent && !enforceNew) {
|
||||
result.enacted = false;
|
||||
result.success = true;
|
||||
result.isTempCancel = false;
|
||||
|
|
|
@ -436,7 +436,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
|
|||
// Convert duration from minutes to hours
|
||||
if (Config.logPumpActions)
|
||||
log.debug("setTempBasalAbsolute: Setting temp basal " + percentRate + "% for " + durationInMinutes + " mins (doLowTemp || doHighTemp)");
|
||||
return setTempBasalPercent(percentRate, durationInMinutes);
|
||||
return setTempBasalPercent(percentRate, durationInMinutes, false);
|
||||
}
|
||||
if (doExtendedTemp) {
|
||||
// Check if some temp is already in progress
|
||||
|
@ -501,7 +501,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
|
|||
}
|
||||
|
||||
@Override
|
||||
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes) {
|
||||
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, boolean enforceNew) {
|
||||
PumpEnactResult result = new PumpEnactResult();
|
||||
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
|
||||
percent = configBuilderPlugin.applyBasalConstraints(percent);
|
||||
|
@ -516,7 +516,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
|
|||
if (percent > getPumpDescription().maxTempPercent)
|
||||
percent = getPumpDescription().maxTempPercent;
|
||||
TemporaryBasal runningTB = MainApp.getConfigBuilder().getRealTempBasalFromHistory(System.currentTimeMillis());
|
||||
if (runningTB != null && runningTB.percentRate == percent) {
|
||||
if (runningTB != null && runningTB.percentRate == percent && enforceNew) {
|
||||
result.enacted = false;
|
||||
result.success = true;
|
||||
result.isTempCancel = false;
|
||||
|
|
|
@ -580,7 +580,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
|
|||
}
|
||||
|
||||
@Override
|
||||
public synchronized PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes) {
|
||||
public synchronized PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, boolean enforceNew) {
|
||||
PumpEnactResult result = new PumpEnactResult();
|
||||
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
|
||||
percent = configBuilderPlugin.applyBasalConstraints(percent);
|
||||
|
@ -595,7 +595,7 @@ public class DanaRSPlugin implements PluginBase, PumpInterface, DanaRInterface,
|
|||
if (percent > getPumpDescription().maxTempPercent)
|
||||
percent = getPumpDescription().maxTempPercent;
|
||||
TemporaryBasal runningTB = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis());
|
||||
if (runningTB != null && runningTB.percentRate == percent) {
|
||||
if (runningTB != null && runningTB.percentRate == percent && !enforceNew) {
|
||||
result.enacted = false;
|
||||
result.success = true;
|
||||
result.isTempCancel = false;
|
||||
|
|
|
@ -7,8 +7,10 @@ import android.bluetooth.le.BluetoothLeScanner;
|
|||
import android.bluetooth.le.ScanCallback;
|
||||
import android.bluetooth.le.ScanResult;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.os.Bundle;
|
||||
import android.os.Handler;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.app.AppCompatActivity;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
@ -31,7 +33,6 @@ import info.nightscout.utils.SP;
|
|||
public class BLEScanActivity extends AppCompatActivity {
|
||||
private static Logger log = LoggerFactory.getLogger(BLEScanActivity.class);
|
||||
|
||||
private Context mContext = null;
|
||||
|
||||
private ListView listView = null;
|
||||
private ListAdapter mListAdapter = null;
|
||||
|
@ -53,26 +54,20 @@ public class BLEScanActivity extends AppCompatActivity {
|
|||
listView.setEmptyView(findViewById(R.id.danars_blescanner_nodevice));
|
||||
listView.setAdapter(mListAdapter);
|
||||
|
||||
initView();
|
||||
}
|
||||
|
||||
private void initView() {
|
||||
mContext = getApplicationContext();
|
||||
|
||||
BluetoothManager bluetoothManager = (BluetoothManager) mContext.getSystemService(Context.BLUETOOTH_SERVICE);
|
||||
mBluetoothAdapter = bluetoothManager.getAdapter();
|
||||
mBluetoothLeScanner = mBluetoothAdapter.getBluetoothLeScanner();
|
||||
|
||||
// MIKE: test mBluetoothLeScanner for null (bt disabled)
|
||||
|
||||
mListAdapter.notifyDataSetChanged();
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
|
||||
mBluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||
mBluetoothLeScanner = mBluetoothAdapter.getBluetoothLeScanner();
|
||||
|
||||
if (mBluetoothLeScanner == null) {
|
||||
mBluetoothAdapter.enable();
|
||||
mBluetoothLeScanner = mBluetoothAdapter.getBluetoothLeScanner();
|
||||
}
|
||||
startScan();
|
||||
}
|
||||
|
||||
|
@ -138,7 +133,7 @@ public class BLEScanActivity extends AppCompatActivity {
|
|||
ViewHolder holder;
|
||||
|
||||
if (v == null) {
|
||||
v = View.inflate(mContext, R.layout.danars_blescanner_item, null);
|
||||
v = View.inflate(getApplicationContext(), R.layout.danars_blescanner_item, null);
|
||||
holder = new ViewHolder(v);
|
||||
v.setTag(holder);
|
||||
} else {
|
||||
|
@ -167,6 +162,7 @@ public class BLEScanActivity extends AppCompatActivity {
|
|||
public void onClick(View v) {
|
||||
SP.putString(R.string.key_danars_address, item.device.getAddress());
|
||||
SP.putString(R.string.key_danars_name, mName.getText().toString());
|
||||
item.device.createBond();
|
||||
MainApp.bus().post(new EventDanaRSDeviceChange());
|
||||
finish();
|
||||
}
|
||||
|
|
|
@ -118,7 +118,7 @@ public class PairingProgressDialog extends DialogFragment implements View.OnClic
|
|||
|
||||
@Override
|
||||
public void dismiss() {
|
||||
super.dismiss();
|
||||
super.dismissAllowingStateLoss();
|
||||
if (helperActivity != null) {
|
||||
helperActivity.finish();
|
||||
}
|
||||
|
|
|
@ -185,7 +185,10 @@ public class DanaRSService extends Service {
|
|||
while (!msg.done && bleComm.isConnected()) {
|
||||
SystemClock.sleep(100);
|
||||
}
|
||||
lastHistoryFetched = DanaRS_Packet_APS_History_Events.lastEventTimeLoaded - 45 * 60 * 1000L; // always load last 45 min
|
||||
if (DanaRS_Packet_APS_History_Events.lastEventTimeLoaded != 0)
|
||||
lastHistoryFetched = DanaRS_Packet_APS_History_Events.lastEventTimeLoaded - 45 * 60 * 1000L; // always load last 45 min
|
||||
else
|
||||
lastHistoryFetched = 0;
|
||||
log.debug("Events loaded");
|
||||
return new PumpEnactResult().success(true);
|
||||
}
|
||||
|
|
|
@ -437,7 +437,7 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
|
|||
}
|
||||
|
||||
@Override
|
||||
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes) {
|
||||
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, boolean enforceNew) {
|
||||
PumpEnactResult result = new PumpEnactResult();
|
||||
ConfigBuilderPlugin configBuilderPlugin = MainApp.getConfigBuilder();
|
||||
percent = configBuilderPlugin.applyBasalConstraints(percent);
|
||||
|
@ -452,7 +452,7 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
|
|||
if (percent > getPumpDescription().maxTempPercent)
|
||||
percent = getPumpDescription().maxTempPercent;
|
||||
TemporaryBasal runningTB = MainApp.getConfigBuilder().getRealTempBasalFromHistory(System.currentTimeMillis());
|
||||
if (runningTB != null && runningTB.percentRate == percent) {
|
||||
if (runningTB != null && runningTB.percentRate == percent && !enforceNew) {
|
||||
result.enacted = false;
|
||||
result.success = true;
|
||||
result.isTempCancel = false;
|
||||
|
|
|
@ -527,7 +527,10 @@ public class DanaRv2ExecutionService extends Service {
|
|||
waitMsec(100);
|
||||
}
|
||||
waitMsec(200);
|
||||
lastHistoryFetched = MsgHistoryEvents_v2.lastEventTimeLoaded - 45 * 60 * 1000L; //always load last 45 min;
|
||||
if (MsgHistoryEvents_v2.lastEventTimeLoaded != 0)
|
||||
lastHistoryFetched = MsgHistoryEvents_v2.lastEventTimeLoaded - 45 * 60 * 1000L; //always load last 45 min;
|
||||
else
|
||||
lastHistoryFetched = 0;
|
||||
return new PumpEnactResult().success(true);
|
||||
}
|
||||
|
||||
|
|
|
@ -204,7 +204,7 @@ public class MDIPlugin implements PluginBase, PumpInterface {
|
|||
}
|
||||
|
||||
@Override
|
||||
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes) {
|
||||
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, boolean enforceNew) {
|
||||
PumpEnactResult result = new PumpEnactResult();
|
||||
result.success = false;
|
||||
result.comment = MainApp.instance().getString(R.string.pumperror);
|
||||
|
|
|
@ -304,7 +304,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
|
|||
}
|
||||
|
||||
@Override
|
||||
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes) {
|
||||
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes, boolean enforceNew) {
|
||||
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
|
||||
PumpEnactResult result = new PumpEnactResult();
|
||||
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
|
||||
|
|
|
@ -0,0 +1,172 @@
|
|||
package info.nightscout.androidaps.plugins.SourceDexcomG5;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.DialogInterface;
|
||||
import android.graphics.Paint;
|
||||
import android.os.Bundle;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.support.v7.widget.LinearLayoutManager;
|
||||
import android.support.v7.widget.RecyclerView;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.crashlytics.android.Crashlytics;
|
||||
import com.squareup.otto.Subscribe;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.db.BgReading;
|
||||
import info.nightscout.androidaps.events.EventNewBG;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.NSUpload;
|
||||
|
||||
/**
|
||||
* Created by mike on 16.10.2017.
|
||||
*/
|
||||
|
||||
public class BGSourceFragment extends SubscriberFragment {
|
||||
private static Logger log = LoggerFactory.getLogger(BGSourceFragment.class);
|
||||
|
||||
RecyclerView recyclerView;
|
||||
|
||||
Profile profile;
|
||||
|
||||
final long MILLS_TO_THE_PAST = 12 * 60 * 60 * 1000L;
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
try {
|
||||
View view = inflater.inflate(R.layout.bgsource_fragment, container, false);
|
||||
|
||||
recyclerView = (RecyclerView) view.findViewById(R.id.bgsource_recyclerview);
|
||||
recyclerView.setHasFixedSize(true);
|
||||
LinearLayoutManager llm = new LinearLayoutManager(view.getContext());
|
||||
recyclerView.setLayoutManager(llm);
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
RecyclerViewAdapter adapter = new RecyclerViewAdapter(MainApp.getDbHelper().getAllBgreadingsDataFromTime(now - MILLS_TO_THE_PAST, false));
|
||||
recyclerView.setAdapter(adapter);
|
||||
|
||||
profile = ConfigBuilderPlugin.getActiveProfileInterface().getProfile().getDefaultProfile();
|
||||
|
||||
return view;
|
||||
} catch (Exception e) {
|
||||
Crashlytics.logException(e);
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@Subscribe
|
||||
@SuppressWarnings("unused")
|
||||
public void onStatusEvent(final EventNewBG ev) {
|
||||
updateGUI();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void updateGUI() {
|
||||
Activity activity = getActivity();
|
||||
if (activity != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
long now = System.currentTimeMillis();
|
||||
recyclerView.swapAdapter(new BGSourceFragment.RecyclerViewAdapter(MainApp.getDbHelper().getAllBgreadingsDataFromTime(now - MILLS_TO_THE_PAST, false)), true);
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.BgReadingsViewHolder> {
|
||||
|
||||
List<BgReading> bgReadings;
|
||||
|
||||
RecyclerViewAdapter(List<BgReading> bgReadings) {
|
||||
this.bgReadings = bgReadings;
|
||||
}
|
||||
|
||||
@Override
|
||||
public BgReadingsViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
|
||||
View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.bgsource_item, viewGroup, false);
|
||||
return new BgReadingsViewHolder(v);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(BgReadingsViewHolder holder, int position) {
|
||||
BgReading bgReading = bgReadings.get(position);
|
||||
holder.ns.setVisibility(NSUpload.isIdValid(bgReading._id) ? View.VISIBLE : View.GONE);
|
||||
holder.invalid.setVisibility(!bgReading.isValid ? View.VISIBLE : View.GONE);
|
||||
holder.date.setText(DateUtil.dateAndTimeString(bgReading.date));
|
||||
holder.value.setText(bgReading.valueToUnitsToString(profile.getUnits()));
|
||||
holder.direction.setText(bgReading.directionToSymbol());
|
||||
holder.remove.setTag(bgReading);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return bgReadings.size();
|
||||
}
|
||||
|
||||
class BgReadingsViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
|
||||
TextView date;
|
||||
TextView value;
|
||||
TextView direction;
|
||||
TextView invalid;
|
||||
TextView ns;
|
||||
TextView remove;
|
||||
|
||||
BgReadingsViewHolder(View itemView) {
|
||||
super(itemView);
|
||||
date = (TextView) itemView.findViewById(R.id.bgsource_date);
|
||||
value = (TextView) itemView.findViewById(R.id.bgsource_value);
|
||||
direction = (TextView) itemView.findViewById(R.id.bgsource_direction);
|
||||
invalid = (TextView) itemView.findViewById(R.id.invalid_sign);
|
||||
ns = (TextView) itemView.findViewById(R.id.ns_sign);
|
||||
remove = (TextView) itemView.findViewById(R.id.bgsource_remove);
|
||||
remove.setOnClickListener(this);
|
||||
remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
final BgReading bgReading = (BgReading) v.getTag();
|
||||
switch (v.getId()) {
|
||||
|
||||
case R.id.bgsource_remove:
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
builder.setTitle(MainApp.sResources.getString(R.string.confirmation));
|
||||
builder.setMessage(MainApp.sResources.getString(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(bgReading.date) + "\n" + bgReading.valueToUnitsToString(profile.getUnits()));
|
||||
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
final String _id = bgReading._id;
|
||||
if (NSUpload.isIdValid(_id)) {
|
||||
NSUpload.removeFoodFromNS(_id);
|
||||
} else {
|
||||
UploadQueue.removeID("dbAdd", _id);
|
||||
}
|
||||
bgReading.isValid = false;
|
||||
MainApp.getDbHelper().update(bgReading);
|
||||
updateGUI();
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null);
|
||||
builder.show();
|
||||
break;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
|
@ -12,6 +12,7 @@ import info.nightscout.androidaps.interfaces.PluginBase;
|
|||
|
||||
public class SourceDexcomG5Plugin implements PluginBase, BgSourceInterface {
|
||||
private boolean fragmentEnabled = false;
|
||||
private boolean fragmentVisible = false;
|
||||
|
||||
private static SourceDexcomG5Plugin plugin = null;
|
||||
|
||||
|
@ -23,7 +24,7 @@ public class SourceDexcomG5Plugin implements PluginBase, BgSourceInterface {
|
|||
|
||||
@Override
|
||||
public String getFragmentClass() {
|
||||
return null;
|
||||
return BGSourceFragment.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,7 +50,7 @@ public class SourceDexcomG5Plugin implements PluginBase, BgSourceInterface {
|
|||
|
||||
@Override
|
||||
public boolean isVisibleInTabs(int type) {
|
||||
return false;
|
||||
return Config.G5UPLOADER || type == BGSOURCE && fragmentVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +60,7 @@ public class SourceDexcomG5Plugin implements PluginBase, BgSourceInterface {
|
|||
|
||||
@Override
|
||||
public boolean hasFragment() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -74,7 +75,7 @@ public class SourceDexcomG5Plugin implements PluginBase, BgSourceInterface {
|
|||
|
||||
@Override
|
||||
public void setFragmentVisible(int type, boolean fragmentVisible) {
|
||||
|
||||
if (type == BGSOURCE) this.fragmentVisible = fragmentVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,12 +4,14 @@ import info.nightscout.androidaps.MainApp;
|
|||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.interfaces.BgSourceInterface;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.plugins.SourceDexcomG5.BGSourceFragment;
|
||||
|
||||
/**
|
||||
* Created by mike on 05.08.2016.
|
||||
*/
|
||||
public class SourceGlimpPlugin implements PluginBase, BgSourceInterface {
|
||||
private boolean fragmentEnabled = false;
|
||||
private boolean fragmentVisible = false;
|
||||
|
||||
private static SourceGlimpPlugin plugin = null;
|
||||
|
||||
|
@ -21,7 +23,7 @@ public class SourceGlimpPlugin implements PluginBase, BgSourceInterface {
|
|||
|
||||
@Override
|
||||
public String getFragmentClass() {
|
||||
return null;
|
||||
return BGSourceFragment.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -47,7 +49,7 @@ public class SourceGlimpPlugin implements PluginBase, BgSourceInterface {
|
|||
|
||||
@Override
|
||||
public boolean isVisibleInTabs(int type) {
|
||||
return false;
|
||||
return type == BGSOURCE && fragmentVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,7 +59,7 @@ public class SourceGlimpPlugin implements PluginBase, BgSourceInterface {
|
|||
|
||||
@Override
|
||||
public boolean hasFragment() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -72,7 +74,7 @@ public class SourceGlimpPlugin implements PluginBase, BgSourceInterface {
|
|||
|
||||
@Override
|
||||
public void setFragmentVisible(int type, boolean fragmentVisible) {
|
||||
|
||||
if (type == BGSOURCE) this.fragmentVisible = fragmentVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,12 +4,14 @@ import info.nightscout.androidaps.MainApp;
|
|||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.interfaces.BgSourceInterface;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.plugins.SourceDexcomG5.BGSourceFragment;
|
||||
|
||||
/**
|
||||
* Created by mike on 05.08.2016.
|
||||
*/
|
||||
public class SourceMM640gPlugin implements PluginBase, BgSourceInterface {
|
||||
private boolean fragmentEnabled = false;
|
||||
private boolean fragmentVisible = false;
|
||||
|
||||
private static SourceMM640gPlugin plugin = null;
|
||||
|
||||
|
@ -21,7 +23,7 @@ public class SourceMM640gPlugin implements PluginBase, BgSourceInterface {
|
|||
|
||||
@Override
|
||||
public String getFragmentClass() {
|
||||
return null;
|
||||
return BGSourceFragment.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -47,7 +49,7 @@ public class SourceMM640gPlugin implements PluginBase, BgSourceInterface {
|
|||
|
||||
@Override
|
||||
public boolean isVisibleInTabs(int type) {
|
||||
return false;
|
||||
return type == BGSOURCE && fragmentVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -57,7 +59,7 @@ public class SourceMM640gPlugin implements PluginBase, BgSourceInterface {
|
|||
|
||||
@Override
|
||||
public boolean hasFragment() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -72,7 +74,7 @@ public class SourceMM640gPlugin implements PluginBase, BgSourceInterface {
|
|||
|
||||
@Override
|
||||
public void setFragmentVisible(int type, boolean fragmentVisible) {
|
||||
|
||||
if (type == BGSOURCE) this.fragmentVisible = fragmentVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -5,12 +5,14 @@ import info.nightscout.androidaps.MainApp;
|
|||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.interfaces.BgSourceInterface;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.plugins.SourceDexcomG5.BGSourceFragment;
|
||||
|
||||
/**
|
||||
* Created by mike on 05.08.2016.
|
||||
*/
|
||||
public class SourceNSClientPlugin implements PluginBase, BgSourceInterface {
|
||||
private boolean fragmentEnabled = true;
|
||||
private boolean fragmentVisible = false;
|
||||
|
||||
private static SourceNSClientPlugin plugin = null;
|
||||
|
||||
|
@ -22,7 +24,7 @@ public class SourceNSClientPlugin implements PluginBase, BgSourceInterface {
|
|||
|
||||
@Override
|
||||
public String getFragmentClass() {
|
||||
return null;
|
||||
return BGSourceFragment.class.getName();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -32,7 +34,7 @@ public class SourceNSClientPlugin implements PluginBase, BgSourceInterface {
|
|||
|
||||
@Override
|
||||
public String getName() {
|
||||
return MainApp.instance().getString(R.string.nsclient);
|
||||
return MainApp.instance().getString(R.string.nsclientbg);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,7 +51,7 @@ public class SourceNSClientPlugin implements PluginBase, BgSourceInterface {
|
|||
|
||||
@Override
|
||||
public boolean isVisibleInTabs(int type) {
|
||||
return false;
|
||||
return type == BGSOURCE && fragmentVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -59,7 +61,7 @@ public class SourceNSClientPlugin implements PluginBase, BgSourceInterface {
|
|||
|
||||
@Override
|
||||
public boolean hasFragment() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -74,7 +76,7 @@ public class SourceNSClientPlugin implements PluginBase, BgSourceInterface {
|
|||
|
||||
@Override
|
||||
public void setFragmentVisible(int type, boolean fragmentVisible) {
|
||||
|
||||
if (type == BGSOURCE) this.fragmentVisible = fragmentVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -4,12 +4,16 @@ import info.nightscout.androidaps.MainApp;
|
|||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.interfaces.BgSourceInterface;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.plugins.SourceDexcomG5.BGSourceFragment;
|
||||
|
||||
/**
|
||||
* Created by mike on 05.08.2016.
|
||||
*/
|
||||
public class SourceXdripPlugin implements PluginBase, BgSourceInterface {
|
||||
|
||||
private boolean fragmentEnabled = false;
|
||||
private boolean fragmentVisible = false;
|
||||
|
||||
private static SourceXdripPlugin plugin = null;
|
||||
|
||||
public static SourceXdripPlugin getPlugin() {
|
||||
|
@ -20,11 +24,9 @@ public class SourceXdripPlugin implements PluginBase, BgSourceInterface {
|
|||
|
||||
@Override
|
||||
public String getFragmentClass() {
|
||||
return null;
|
||||
return BGSourceFragment.class.getName();
|
||||
}
|
||||
|
||||
private boolean fragmentEnabled = false;
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return PluginBase.BGSOURCE;
|
||||
|
@ -48,7 +50,7 @@ public class SourceXdripPlugin implements PluginBase, BgSourceInterface {
|
|||
|
||||
@Override
|
||||
public boolean isVisibleInTabs(int type) {
|
||||
return false;
|
||||
return type == BGSOURCE && fragmentVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -58,7 +60,7 @@ public class SourceXdripPlugin implements PluginBase, BgSourceInterface {
|
|||
|
||||
@Override
|
||||
public boolean hasFragment() {
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -73,6 +75,7 @@ public class SourceXdripPlugin implements PluginBase, BgSourceInterface {
|
|||
|
||||
@Override
|
||||
public void setFragmentVisible(int type, boolean fragmentVisible) {
|
||||
if (type == BGSOURCE) this.fragmentVisible = fragmentVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
|
|
@ -36,6 +36,7 @@ import info.nightscout.androidaps.db.Treatment;
|
|||
import info.nightscout.androidaps.events.EventNewBG;
|
||||
import info.nightscout.androidaps.events.EventTreatmentChange;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
|
||||
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
|
@ -82,7 +83,7 @@ public class TreatmentsBolusFragment extends SubscriberFragment implements View.
|
|||
holder.activity.setText(DecimalFormatter.to3Decimal(iob.activityContrib) + " U");
|
||||
holder.mealOrCorrection.setText(t.mealBolus ? MainApp.sResources.getString(R.string.mealbolus) : MainApp.sResources.getString(R.string.correctionbous));
|
||||
holder.ph.setVisibility(t.source == Source.PUMP ? View.VISIBLE : View.GONE);
|
||||
holder.ns.setVisibility(t._id != null ? View.VISIBLE : View.GONE);
|
||||
holder.ns.setVisibility(NSUpload.isIdValid(t._id) ? View.VISIBLE : View.GONE);
|
||||
holder.invalid.setVisibility(t.isValid ? View.GONE : View.VISIBLE);
|
||||
if (iob.iobContrib != 0)
|
||||
holder.iob.setTextColor(ContextCompat.getColor(MainApp.instance(), R.color.colorActive));
|
||||
|
@ -146,8 +147,10 @@ public class TreatmentsBolusFragment extends SubscriberFragment implements View.
|
|||
treatment.isValid = false;
|
||||
MainApp.getDbHelper().update(treatment);
|
||||
} else {
|
||||
if (_id != null && !_id.equals("")) {
|
||||
if (NSUpload.isIdValid(_id)) {
|
||||
NSUpload.removeCareportalEntryFromNS(_id);
|
||||
} else {
|
||||
UploadQueue.removeID("dbAdd", _id);
|
||||
}
|
||||
MainApp.getDbHelper().delete(treatment);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import info.nightscout.androidaps.db.Source;
|
|||
import info.nightscout.androidaps.events.EventExtendedBolusChange;
|
||||
import info.nightscout.androidaps.events.EventNewBG;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.NSUpload;
|
||||
|
@ -63,7 +64,7 @@ public class TreatmentsExtendedBolusesFragment extends SubscriberFragment {
|
|||
public void onBindViewHolder(ExtendedBolusesViewHolder holder, int position) {
|
||||
ExtendedBolus extendedBolus = extendedBolusList.getReversed(position);
|
||||
holder.ph.setVisibility(extendedBolus.source == Source.PUMP ? View.VISIBLE : View.GONE);
|
||||
holder.ns.setVisibility(extendedBolus._id != null ? View.VISIBLE : View.GONE);
|
||||
holder.ns.setVisibility(NSUpload.isIdValid(extendedBolus._id) ? View.VISIBLE : View.GONE);
|
||||
if (extendedBolus.isEndingEvent()) {
|
||||
holder.date.setText(DateUtil.dateAndTimeString(extendedBolus.date));
|
||||
holder.duration.setText(MainApp.sResources.getString(R.string.cancel));
|
||||
|
@ -148,8 +149,10 @@ public class TreatmentsExtendedBolusesFragment extends SubscriberFragment {
|
|||
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
final String _id = extendedBolus._id;
|
||||
if (_id != null && !_id.equals("")) {
|
||||
if (NSUpload.isIdValid(_id)) {
|
||||
NSUpload.removeCareportalEntryFromNS(_id);
|
||||
} else {
|
||||
UploadQueue.removeID("dbAdd", _id);
|
||||
}
|
||||
MainApp.getDbHelper().delete(extendedBolus);
|
||||
Answers.getInstance().logCustom(new CustomEvent("RemoveExtendedBolus"));
|
||||
|
|
|
@ -29,6 +29,7 @@ import info.nightscout.androidaps.db.ProfileSwitch;
|
|||
import info.nightscout.androidaps.db.Source;
|
||||
import info.nightscout.androidaps.events.EventProfileSwitchChange;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.NSUpload;
|
||||
|
@ -66,7 +67,7 @@ public class TreatmentsProfileSwitchFragment extends SubscriberFragment implemen
|
|||
if (profile == null) return;
|
||||
ProfileSwitch profileSwitch = profileSwitchList.getReversed(position);
|
||||
holder.ph.setVisibility(profileSwitch.source == Source.PUMP ? View.VISIBLE : View.GONE);
|
||||
holder.ns.setVisibility(profileSwitch._id != null ? View.VISIBLE : View.GONE);
|
||||
holder.ns.setVisibility(NSUpload.isIdValid(profileSwitch._id) ? View.VISIBLE : View.GONE);
|
||||
|
||||
holder.date.setText(DateUtil.dateAndTimeString(profileSwitch.date));
|
||||
if (!profileSwitch.isEndingEvent()) {
|
||||
|
@ -131,8 +132,10 @@ public class TreatmentsProfileSwitchFragment extends SubscriberFragment implemen
|
|||
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
final String _id = profileSwitch._id;
|
||||
if (_id != null && !_id.equals("")) {
|
||||
if (NSUpload.isIdValid(_id)) {
|
||||
NSUpload.removeCareportalEntryFromNS(_id);
|
||||
} else {
|
||||
UploadQueue.removeID("dbAdd", _id);
|
||||
}
|
||||
MainApp.getDbHelper().delete(profileSwitch);
|
||||
}
|
||||
|
|
|
@ -27,6 +27,7 @@ import info.nightscout.androidaps.db.Source;
|
|||
import info.nightscout.androidaps.db.TempTarget;
|
||||
import info.nightscout.androidaps.events.EventTempTargetChange;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.NSUpload;
|
||||
|
@ -67,7 +68,7 @@ public class TreatmentsTempTargetFragment extends SubscriberFragment implements
|
|||
String units = MainApp.getConfigBuilder().getProfileUnits();
|
||||
TempTarget tempTarget = tempTargetList.getReversed(position);
|
||||
holder.ph.setVisibility(tempTarget.source == Source.PUMP ? View.VISIBLE : View.GONE);
|
||||
holder.ns.setVisibility(tempTarget._id != null ? View.VISIBLE : View.GONE);
|
||||
holder.ns.setVisibility(NSUpload.isIdValid(tempTarget._id) ? View.VISIBLE : View.GONE);
|
||||
if (!tempTarget.isEndingEvent()) {
|
||||
holder.date.setText(DateUtil.dateAndTimeString(tempTarget.date) + " - " + DateUtil.timeString(tempTarget.originalEnd()));
|
||||
holder.duration.setText(DecimalFormatter.to0Decimal(tempTarget.durationInMinutes) + " min");
|
||||
|
@ -149,8 +150,10 @@ public class TreatmentsTempTargetFragment extends SubscriberFragment implements
|
|||
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
final String _id = tempTarget._id;
|
||||
if (_id != null && !_id.equals("")) {
|
||||
if (NSUpload.isIdValid(_id)) {
|
||||
NSUpload.removeCareportalEntryFromNS(_id);
|
||||
} else {
|
||||
UploadQueue.removeID("dbAdd", _id);
|
||||
}
|
||||
MainApp.getDbHelper().delete(tempTarget);
|
||||
}
|
||||
|
|
|
@ -31,6 +31,7 @@ import info.nightscout.androidaps.db.TemporaryBasal;
|
|||
import info.nightscout.androidaps.events.EventNewBG;
|
||||
import info.nightscout.androidaps.events.EventTempBasalChange;
|
||||
import info.nightscout.androidaps.plugins.Common.SubscriberFragment;
|
||||
import info.nightscout.androidaps.plugins.NSClientInternal.UploadQueue;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.NSUpload;
|
||||
|
@ -65,7 +66,7 @@ public class TreatmentsTemporaryBasalsFragment extends SubscriberFragment {
|
|||
public void onBindViewHolder(TempBasalsViewHolder holder, int position) {
|
||||
TemporaryBasal tempBasal = tempBasalList.getReversed(position);
|
||||
holder.ph.setVisibility(tempBasal.source == Source.PUMP ? View.VISIBLE : View.GONE);
|
||||
holder.ns.setVisibility(tempBasal._id != null ? View.VISIBLE : View.GONE);
|
||||
holder.ns.setVisibility(NSUpload.isIdValid(tempBasal._id) ? View.VISIBLE : View.GONE);
|
||||
if (tempBasal.isEndingEvent()) {
|
||||
holder.date.setText(DateUtil.dateAndTimeString(tempBasal.date));
|
||||
holder.duration.setText(MainApp.sResources.getString(R.string.cancel));
|
||||
|
@ -165,8 +166,10 @@ public class TreatmentsTemporaryBasalsFragment extends SubscriberFragment {
|
|||
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
final String _id = tempBasal._id;
|
||||
if (_id != null && !_id.equals("")) {
|
||||
if (NSUpload.isIdValid(_id)) {
|
||||
NSUpload.removeCareportalEntryFromNS(_id);
|
||||
} else {
|
||||
UploadQueue.removeID("dbAdd", _id);
|
||||
}
|
||||
MainApp.getDbHelper().delete(tempBasal);
|
||||
Answers.getInstance().logCustom(new CustomEvent("RemoveTempBasal"));
|
||||
|
|
|
@ -579,9 +579,6 @@ public class ActionStringHandler {
|
|||
if (timeshift < 0 || timeshift > 23) {
|
||||
msg += String.format(MainApp.sResources.getString(R.string.openapsma_valueoutofrange), "Profile-Timeshift") + "\n";
|
||||
}
|
||||
if (!SP.getBoolean("syncprofiletopump", false)) {
|
||||
msg += MainApp.sResources.getString(R.string.syncprofiletopump_title) + " " + MainApp.sResources.getString(R.string.cpp_sync_setting_missing) + "\n";
|
||||
}
|
||||
final Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||
|
||||
if (profile == null || profile.getBasal() == null) {
|
||||
|
|
|
@ -215,6 +215,8 @@ public class WearPlugin implements PluginBase {
|
|||
|
||||
@Subscribe
|
||||
public void onStatusEvent(final EventDismissBolusprogressIfRunning ev) {
|
||||
if(ev.result == null) return;
|
||||
|
||||
String status;
|
||||
if(ev.result.success){
|
||||
status = MainApp.sResources.getString(R.string.success);
|
||||
|
|
|
@ -535,7 +535,7 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
String iobSum = DecimalFormatter.to2Decimal(bolusIob.iob + basalIob.basaliob);
|
||||
String iobDetail = "(" + DecimalFormatter.to2Decimal(bolusIob.iob) + "|" + DecimalFormatter.to2Decimal(basalIob.basaliob) + ")";
|
||||
String cobString = generateCOBString();
|
||||
String tempBasal = generateBasalString(treatmentsInterface);
|
||||
String currentBasal = generateBasalString(treatmentsInterface);
|
||||
|
||||
//bgi
|
||||
String bgiString = "";
|
||||
|
@ -545,7 +545,7 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
bgiString = "" + ((bgi >= 0) ? "+" : "") + DecimalFormatter.to1Decimal(bgi);
|
||||
}
|
||||
|
||||
String status = generateStatusString(profile, tempBasal,iobSum, iobDetail, bgiString);
|
||||
String status = generateStatusString(profile, currentBasal,iobSum, iobDetail, bgiString);
|
||||
|
||||
//batteries
|
||||
int phoneBattery = getBatteryLevel(getApplicationContext());
|
||||
|
@ -569,7 +569,7 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
dataMapRequest.getDataMap().putString("iobDetail", iobDetail);
|
||||
dataMapRequest.getDataMap().putBoolean("detailedIob", mPrefs.getBoolean("wear_detailediob", false));
|
||||
dataMapRequest.getDataMap().putString("cob", cobString);
|
||||
dataMapRequest.getDataMap().putString("tempBasal", tempBasal);
|
||||
dataMapRequest.getDataMap().putString("currentBasal", currentBasal);
|
||||
dataMapRequest.getDataMap().putString("battery", "" + phoneBattery);
|
||||
dataMapRequest.getDataMap().putString("rigBattery", rigBattery);
|
||||
dataMapRequest.getDataMap().putLong("openApsStatus", openApsStatus);
|
||||
|
@ -600,7 +600,7 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
}
|
||||
|
||||
@NonNull
|
||||
private String generateStatusString(Profile profile, String tempBasal, String iobSum, String iobDetail, String bgiString) {
|
||||
private String generateStatusString(Profile profile, String currentBasal, String iobSum, String iobDetail, String bgiString) {
|
||||
|
||||
String status = "";
|
||||
|
||||
|
@ -625,7 +625,7 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
iobString = iobSum + "U";
|
||||
}
|
||||
|
||||
status += tempBasal + " " + iobString;
|
||||
status += currentBasal + " " + iobString;
|
||||
|
||||
//add BGI if shown, otherwise return
|
||||
if (mPrefs.getBoolean("wear_showbgi", false)) {
|
||||
|
@ -638,10 +638,16 @@ public class WatchUpdaterService extends WearableListenerService implements
|
|||
@NonNull
|
||||
private String generateBasalString(TreatmentsInterface treatmentsInterface) {
|
||||
|
||||
String basalStringResult = "-.--U/h";
|
||||
String basalStringResult;
|
||||
TemporaryBasal activeTemp = treatmentsInterface.getTempBasalFromHistory(System.currentTimeMillis());
|
||||
if (activeTemp != null) {
|
||||
basalStringResult = activeTemp.toStringShort();
|
||||
} else {
|
||||
if (SP.getBoolean(R.string.key_danar_visualizeextendedaspercentage, false)) {
|
||||
basalStringResult = "100%";
|
||||
} else {
|
||||
basalStringResult = DecimalFormatter.to2Decimal(MainApp.getConfigBuilder().getProfile().getBasal()) + "U/h";
|
||||
}
|
||||
}
|
||||
return basalStringResult;
|
||||
}
|
||||
|
|
|
@ -153,6 +153,10 @@ public class CommandQueue {
|
|||
// remove all unfinished boluses
|
||||
removeAll(Command.CommandType.BOLUS);
|
||||
|
||||
// apply constraints
|
||||
detailedBolusInfo.insulin = MainApp.getConfigBuilder().applyBolusConstraints(detailedBolusInfo.insulin);
|
||||
detailedBolusInfo.carbs = MainApp.getConfigBuilder().applyCarbsConstraints((int) detailedBolusInfo.carbs);
|
||||
|
||||
// add new command to queue
|
||||
add(new CommandBolus(detailedBolusInfo, callback));
|
||||
|
||||
|
@ -162,12 +166,8 @@ public class CommandQueue {
|
|||
MainApp.bus().post(new EventBolusRequested(detailedBolusInfo.insulin));
|
||||
|
||||
// Bring up bolus progress dialog
|
||||
detailedBolusInfo.insulin = MainApp.getConfigBuilder().applyBolusConstraints(detailedBolusInfo.insulin);
|
||||
detailedBolusInfo.carbs = MainApp.getConfigBuilder().applyCarbsConstraints((int) detailedBolusInfo.carbs);
|
||||
|
||||
BolusProgressDialog bolusProgressDialog = null;
|
||||
if (detailedBolusInfo.context != null) {
|
||||
bolusProgressDialog = new BolusProgressDialog();
|
||||
BolusProgressDialog bolusProgressDialog = new BolusProgressDialog();
|
||||
bolusProgressDialog.setInsulin(detailedBolusInfo.insulin);
|
||||
bolusProgressDialog.show(((AppCompatActivity) detailedBolusInfo.context).getSupportFragmentManager(), "BolusProgress");
|
||||
} else {
|
||||
|
@ -203,7 +203,7 @@ public class CommandQueue {
|
|||
}
|
||||
|
||||
// returns true if command is queued
|
||||
public boolean tempBasalPercent(int percent, int durationInMinutes, Callback callback) {
|
||||
public boolean tempBasalPercent(int percent, int durationInMinutes, boolean enforceNew, Callback callback) {
|
||||
if (isRunning(Command.CommandType.TEMPBASAL)) {
|
||||
if (callback != null)
|
||||
callback.result(executingNowError()).run();
|
||||
|
@ -216,7 +216,7 @@ public class CommandQueue {
|
|||
Integer percentAfterConstraints = MainApp.getConfigBuilder().applyBasalConstraints(percent);
|
||||
|
||||
// add new command to queue
|
||||
add(new CommandTempBasalPercent(percentAfterConstraints, durationInMinutes, callback));
|
||||
add(new CommandTempBasalPercent(percentAfterConstraints, durationInMinutes, enforceNew, callback));
|
||||
|
||||
notifyAboutNewCommand();
|
||||
|
||||
|
@ -326,14 +326,14 @@ public class CommandQueue {
|
|||
|
||||
// returns true if command is queued
|
||||
public boolean readStatus(String reason, Callback callback) {
|
||||
if (isRunning(Command.CommandType.READSTATUS)) {
|
||||
if (callback != null)
|
||||
callback.result(executingNowError()).run();
|
||||
return false;
|
||||
}
|
||||
//if (isRunning(Command.CommandType.READSTATUS)) {
|
||||
// if (callback != null)
|
||||
// callback.result(executingNowError()).run();
|
||||
// return false;
|
||||
//}
|
||||
|
||||
// remove all unfinished
|
||||
removeAll(Command.CommandType.READSTATUS);
|
||||
//removeAll(Command.CommandType.READSTATUS);
|
||||
|
||||
// add new command to queue
|
||||
add(new CommandReadStatus(reason, callback));
|
||||
|
|
|
@ -29,6 +29,7 @@ public class QueueThread extends Thread {
|
|||
CommandQueue queue;
|
||||
|
||||
private long connectionStartTime = 0;
|
||||
private long lastCommandTime = 0;
|
||||
private boolean connectLogged = false;
|
||||
|
||||
private PowerManager.WakeLock mWakeLock;
|
||||
|
@ -45,7 +46,7 @@ public class QueueThread extends Thread {
|
|||
public final void run() {
|
||||
mWakeLock.acquire();
|
||||
MainApp.bus().post(new EventQueueChanged());
|
||||
connectionStartTime = System.currentTimeMillis();
|
||||
connectionStartTime = lastCommandTime = System.currentTimeMillis();
|
||||
|
||||
try {
|
||||
while (true) {
|
||||
|
@ -59,7 +60,7 @@ public class QueueThread extends Thread {
|
|||
}
|
||||
|
||||
if (!pump.isConnected() && secondsElapsed > Constants.PUMP_MAX_CONNECTION_TIME_IN_SECONDS) {
|
||||
MainApp.bus().post(new EventDismissBolusprogressIfRunning(new PumpEnactResult()));
|
||||
MainApp.bus().post(new EventDismissBolusprogressIfRunning(null));
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.connectiontimedout)));
|
||||
log.debug("QUEUE: timed out");
|
||||
pump.stopConnecting();
|
||||
|
@ -79,7 +80,7 @@ public class QueueThread extends Thread {
|
|||
mBluetoothAdapter.enable();
|
||||
SystemClock.sleep(1000);
|
||||
//start over again once after watchdog barked
|
||||
connectionStartTime = System.currentTimeMillis();
|
||||
connectionStartTime = lastCommandTime = System.currentTimeMillis();
|
||||
} else {
|
||||
queue.clear();
|
||||
return;
|
||||
|
@ -107,17 +108,24 @@ public class QueueThread extends Thread {
|
|||
queue.performing().execute();
|
||||
queue.resetPerforming();
|
||||
MainApp.bus().post(new EventQueueChanged());
|
||||
lastCommandTime = System.currentTimeMillis();
|
||||
SystemClock.sleep(100);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
if (queue.size() == 0 && queue.performing() == null) {
|
||||
log.debug("QUEUE: queue empty. disconnect");
|
||||
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTING));
|
||||
pump.disconnect("Queue empty");
|
||||
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTED));
|
||||
return;
|
||||
long secondsFromLastCommand = (System.currentTimeMillis() - lastCommandTime) / 1000;
|
||||
if (secondsFromLastCommand >= 5) {
|
||||
log.debug("QUEUE: queue empty. disconnect");
|
||||
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTING));
|
||||
pump.disconnect("Queue empty");
|
||||
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTED));
|
||||
return;
|
||||
} else {
|
||||
log.debug("QUEUE: waiting for disconnect");
|
||||
SystemClock.sleep(1000);
|
||||
}
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
|
|
|
@ -1,8 +1,8 @@
|
|||
package info.nightscout.androidaps.queue.commands;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.queue.Callback;
|
||||
import info.nightscout.utils.LocalAlertUtils;
|
||||
|
||||
/**
|
||||
* Created by mike on 09.11.2017.
|
||||
|
@ -20,6 +20,7 @@ public class CommandReadStatus extends Command {
|
|||
@Override
|
||||
public void execute() {
|
||||
ConfigBuilderPlugin.getActivePump().getPumpStatus();
|
||||
LocalAlertUtils.notifyPumpStatusRead();
|
||||
if (callback != null)
|
||||
callback.result(null).run();
|
||||
}
|
||||
|
|
|
@ -18,17 +18,19 @@ public class CommandTempBasalPercent extends Command {
|
|||
|
||||
int durationInMinutes;
|
||||
int percent;
|
||||
boolean enforceNew;
|
||||
|
||||
public CommandTempBasalPercent(int percent, int durationInMinutes, Callback callback) {
|
||||
public CommandTempBasalPercent(int percent, int durationInMinutes, boolean enforceNew, Callback callback) {
|
||||
commandType = CommandType.TEMPBASAL;
|
||||
this.percent = percent;
|
||||
this.durationInMinutes = durationInMinutes;
|
||||
this.enforceNew = enforceNew;
|
||||
this.callback = callback;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void execute() {
|
||||
PumpEnactResult r = ConfigBuilderPlugin.getActivePump().setTempBasalPercent(percent, durationInMinutes);
|
||||
PumpEnactResult r = ConfigBuilderPlugin.getActivePump().setTempBasalPercent(percent, durationInMinutes, enforceNew);
|
||||
if (Config.logCongigBuilderActions)
|
||||
log.debug("setTempBasalPercent percent: " + percent + " durationInMinutes: " + durationInMinutes + " success: " + r.success + " enacted: " + r.enacted);
|
||||
if (callback != null)
|
||||
|
|
|
@ -16,61 +16,39 @@ import org.slf4j.LoggerFactory;
|
|||
|
||||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.db.BgReading;
|
||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||
import info.nightscout.utils.LocalAlertUtils;
|
||||
import info.nightscout.utils.SP;
|
||||
|
||||
public class KeepAliveReceiver extends BroadcastReceiver {
|
||||
private static Logger log = LoggerFactory.getLogger(KeepAliveReceiver.class);
|
||||
public static final long STATUS_UPDATE_FREQUENCY = 15 * 60 * 1000L;
|
||||
|
||||
// TODO consider moving this into an Alarms plugin that works offline and can be configured
|
||||
// (e.g. override silent mode at night only)
|
||||
|
||||
private static int missedReadingsThreshold() {
|
||||
return SP.getInt(MainApp.sResources.getString(R.string.key_missed_bg_readings_threshold), 30) * 60 * 1000;
|
||||
public static void cancelAlarm(Context context) {
|
||||
Intent intent = new Intent(context, KeepAliveReceiver.class);
|
||||
PendingIntent sender = PendingIntent.getBroadcast(context, 0, intent, 0);
|
||||
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
||||
alarmManager.cancel(sender);
|
||||
}
|
||||
|
||||
private static int pumpUnreachableThreshold() {
|
||||
return SP.getInt(MainApp.sResources.getString(R.string.key_pump_unreachable_threshold), 30) * 60 * 1000;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onReceive(Context context, Intent rIntent) {
|
||||
PowerManager pm = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
|
||||
PowerManager.WakeLock wl = pm.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK, "");
|
||||
wl.acquire();
|
||||
|
||||
shortenSnoozeInterval();
|
||||
checkBg();
|
||||
LocalAlertUtils.shortenSnoozeInterval();
|
||||
LocalAlertUtils.checkStaleBGAlert();
|
||||
checkPump();
|
||||
|
||||
log.debug("KeepAlive received");
|
||||
wl.release();
|
||||
}
|
||||
|
||||
private void checkBg() {
|
||||
BgReading bgReading = DatabaseHelper.lastBg();
|
||||
if (SP.getBoolean(MainApp.sResources.getString(R.string.key_enable_missed_bg_readings_alert), false)
|
||||
&& bgReading != null && bgReading.date + missedReadingsThreshold() < System.currentTimeMillis()
|
||||
&& SP.getLong("nextMissedReadingsAlarm", 0l) < System.currentTimeMillis()) {
|
||||
Notification n = new Notification(Notification.BG_READINGS_MISSED, MainApp.sResources.getString(R.string.missed_bg_readings), Notification.URGENT);
|
||||
n.soundId = R.raw.alarm;
|
||||
SP.putLong("nextMissedReadingsAlarm", System.currentTimeMillis() + missedReadingsThreshold());
|
||||
MainApp.bus().post(new EventNewNotification(n));
|
||||
}
|
||||
}
|
||||
|
||||
private void checkPump() {
|
||||
final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
||||
final Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||
|
@ -79,18 +57,9 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
|||
boolean isStatusOutdated = lastConnection.getTime() + STATUS_UPDATE_FREQUENCY < System.currentTimeMillis();
|
||||
boolean isBasalOutdated = Math.abs(profile.getBasal() - pump.getBaseBasalRate()) > pump.getPumpDescription().basalStep;
|
||||
|
||||
boolean alarmTimeoutExpired = lastConnection.getTime() + pumpUnreachableThreshold() < System.currentTimeMillis();
|
||||
boolean nextAlarmOccurrenceReached = SP.getLong("nextPumpDisconnectedAlarm", 0l) < System.currentTimeMillis();
|
||||
LocalAlertUtils.checkPumpUnreachableAlarm(lastConnection, isStatusOutdated);
|
||||
|
||||
if (Config.APS && SP.getBoolean(MainApp.sResources.getString(R.string.key_enable_pump_unreachable_alert), true)
|
||||
&& isStatusOutdated && alarmTimeoutExpired && nextAlarmOccurrenceReached && !ConfigBuilderPlugin.getActiveLoop().isDisconnected()) {
|
||||
Notification n = new Notification(Notification.PUMP_UNREACHABLE, MainApp.sResources.getString(R.string.pump_unreachable), Notification.URGENT);
|
||||
n.soundId = R.raw.alarm;
|
||||
SP.putLong("nextPumpDisconnectedAlarm", System.currentTimeMillis() + pumpUnreachableThreshold());
|
||||
MainApp.bus().post(new EventNewNotification(n));
|
||||
}
|
||||
|
||||
if (SP.getBoolean("syncprofiletopump", false) && !pump.isThisProfileSet(profile)) {
|
||||
if (!pump.isThisProfileSet(profile)) {
|
||||
MainApp.getConfigBuilder().getCommandQueue().setProfile(profile, null);
|
||||
} else if (isStatusOutdated && !pump.isBusy()) {
|
||||
MainApp.getConfigBuilder().getCommandQueue().readStatus("KeepAlive. Status outdated.", null);
|
||||
|
@ -103,8 +72,8 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
|||
//called by MainApp at first app start
|
||||
public void setAlarm(Context context) {
|
||||
|
||||
shortenSnoozeInterval();
|
||||
presnoozeAlarms();
|
||||
LocalAlertUtils.shortenSnoozeInterval();
|
||||
LocalAlertUtils.presnoozeAlarms();
|
||||
|
||||
AlarmManager am = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
||||
Intent i = new Intent(context, KeepAliveReceiver.class);
|
||||
|
@ -117,33 +86,4 @@ public class KeepAliveReceiver extends BroadcastReceiver {
|
|||
am.setInexactRepeating(AlarmManager.RTC_WAKEUP, System.currentTimeMillis(), Constants.keepAliveMsecs, pi);
|
||||
}
|
||||
|
||||
/*Presnoozes the alarms with 5 minutes if no snooze exists.
|
||||
* Call only at startup!
|
||||
*/
|
||||
public void presnoozeAlarms() {
|
||||
if (SP.getLong("nextMissedReadingsAlarm", 0l) < System.currentTimeMillis()) {
|
||||
SP.putLong("nextMissedReadingsAlarm", System.currentTimeMillis() + 5 * 60 * 1000);
|
||||
}
|
||||
if (SP.getLong("nextPumpDisconnectedAlarm", 0l) < System.currentTimeMillis()) {
|
||||
SP.putLong("nextPumpDisconnectedAlarm", System.currentTimeMillis() + 5 * 60 * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
public void cancelAlarm(Context context) {
|
||||
Intent intent = new Intent(context, KeepAliveReceiver.class);
|
||||
PendingIntent sender = PendingIntent.getBroadcast(context, 0, intent, 0);
|
||||
AlarmManager alarmManager = (AlarmManager) context.getSystemService(Context.ALARM_SERVICE);
|
||||
alarmManager.cancel(sender);
|
||||
}
|
||||
|
||||
static void shortenSnoozeInterval() {
|
||||
//shortens alarm times in case of setting changes or future data
|
||||
long nextMissedReadingsAlarm = SP.getLong("nextMissedReadingsAlarm", 0L);
|
||||
nextMissedReadingsAlarm = Math.min(System.currentTimeMillis() + missedReadingsThreshold(), nextMissedReadingsAlarm);
|
||||
SP.putLong("nextMissedReadingsAlarm", nextMissedReadingsAlarm);
|
||||
|
||||
long nextPumpDisconnectedAlarm = SP.getLong("nextPumpDisconnectedAlarm", 0L);
|
||||
nextPumpDisconnectedAlarm = Math.min(System.currentTimeMillis() + pumpUnreachableThreshold(), nextPumpDisconnectedAlarm);
|
||||
SP.putLong("nextPumpDisconnectedAlarm", nextPumpDisconnectedAlarm);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -14,15 +14,15 @@ import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
|||
|
||||
public class BolusWizard {
|
||||
// Inputs
|
||||
Profile specificProfile = null;
|
||||
TempTarget tempTarget;
|
||||
private Profile specificProfile = null;
|
||||
private TempTarget tempTarget;
|
||||
public Integer carbs = 0;
|
||||
Double bg = 0d;
|
||||
Double correction;
|
||||
Boolean includeBolusIOB = true;
|
||||
Boolean includeBasalIOB = true;
|
||||
Boolean superBolus = false;
|
||||
Boolean trend = false;
|
||||
private Double bg = 0d;
|
||||
private Double correction;
|
||||
private Boolean includeBolusIOB = true;
|
||||
private Boolean includeBasalIOB = true;
|
||||
public Boolean superBolus = false;
|
||||
private Boolean trend = false;
|
||||
|
||||
// Intermediate
|
||||
public Double sens = 0d;
|
||||
|
@ -71,7 +71,9 @@ public class BolusWizard {
|
|||
targetBGLow = Profile.fromMgdlToUnits(tempTarget.low, specificProfile.getUnits());
|
||||
targetBGHigh = Profile.fromMgdlToUnits(tempTarget.high, specificProfile.getUnits());
|
||||
}
|
||||
if (bg <= targetBGLow) {
|
||||
if (bg >= targetBGLow && bg <= targetBGHigh) {
|
||||
bgDiff = 0d;
|
||||
} else if (bg <= targetBGLow) {
|
||||
bgDiff = bg - targetBGLow;
|
||||
} else {
|
||||
bgDiff = bg - targetBGHigh;
|
||||
|
|
|
@ -2,10 +2,12 @@ package info.nightscout.utils;
|
|||
|
||||
import android.support.v4.util.LongSparseArray;
|
||||
import android.text.format.DateUtils;
|
||||
import android.util.SparseIntArray;
|
||||
|
||||
import org.joda.time.DateTime;
|
||||
import org.joda.time.format.DateTimeFormatter;
|
||||
import org.joda.time.format.ISODateTimeFormat;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.ParseException;
|
||||
import java.text.SimpleDateFormat;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
@ -27,9 +29,7 @@ public class DateUtil {
|
|||
/**
|
||||
* The date format in iso.
|
||||
*/
|
||||
private static String FORMAT_DATE_ISO = "yyyy-MM-dd'T'HH:mm:ssZ";
|
||||
private static String FORMAT_DATE_ISO_MSEC = "yyyy-MM-dd'T'HH:mm:ss.SSSZ";
|
||||
private static String FORMAT_DATE_ISO_MSEC_UTC = "yyyy-MM-dd'T'HH:mm:ss.SSS'Z'";
|
||||
private static String FORMAT_DATE_ISO_OUT = "yyyy-MM-dd'T'HH:mm:ss'Z'";
|
||||
|
||||
/**
|
||||
* Takes in an ISO date string of the following format:
|
||||
|
@ -41,33 +41,10 @@ public class DateUtil {
|
|||
*/
|
||||
public static Date fromISODateString(String isoDateString)
|
||||
throws Exception {
|
||||
SimpleDateFormat f = new SimpleDateFormat(FORMAT_DATE_ISO, Locale.getDefault());
|
||||
Date date;
|
||||
|
||||
f.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
try {
|
||||
date = f.parse(isoDateString);
|
||||
return date;
|
||||
} catch (ParseException e) {
|
||||
}
|
||||
|
||||
f = new SimpleDateFormat(FORMAT_DATE_ISO_MSEC, Locale.getDefault());
|
||||
f.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
try {
|
||||
date = f.parse(isoDateString);
|
||||
return date;
|
||||
} catch (ParseException e) {
|
||||
}
|
||||
|
||||
f = new SimpleDateFormat(FORMAT_DATE_ISO_MSEC_UTC, Locale.getDefault());
|
||||
f.setTimeZone(TimeZone.getTimeZone("UTC"));
|
||||
try {
|
||||
date = f.parse(isoDateString);
|
||||
return date;
|
||||
} catch (ParseException e) {
|
||||
}
|
||||
|
||||
throw new ParseException("Unparseable date: " + isoDateString, 0);
|
||||
DateTimeFormatter parser = ISODateTimeFormat.dateTimeParser();
|
||||
DateTime dateTime = DateTime.parse(isoDateString, parser);
|
||||
return dateTime.toDate();
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -79,7 +56,7 @@ public class DateUtil {
|
|||
* @return the iso-formatted date string
|
||||
*/
|
||||
public static String toISOString(Date date, String format, TimeZone tz) {
|
||||
if (format == null) format = FORMAT_DATE_ISO;
|
||||
if (format == null) format = FORMAT_DATE_ISO_OUT;
|
||||
if (tz == null) tz = TimeZone.getDefault();
|
||||
DateFormat f = new SimpleDateFormat(format, Locale.getDefault());
|
||||
f.setTimeZone(tz);
|
||||
|
@ -87,21 +64,18 @@ public class DateUtil {
|
|||
}
|
||||
|
||||
public static String toISOString(Date date) {
|
||||
return toISOString(date, FORMAT_DATE_ISO, TimeZone.getTimeZone("UTC"));
|
||||
return toISOString(date, FORMAT_DATE_ISO_OUT, TimeZone.getTimeZone("UTC"));
|
||||
}
|
||||
|
||||
public static String toISOString(long date) {
|
||||
return toISOString(new Date(date), FORMAT_DATE_ISO, TimeZone.getTimeZone("UTC"));
|
||||
return toISOString(new Date(date), FORMAT_DATE_ISO_OUT, TimeZone.getTimeZone("UTC"));
|
||||
}
|
||||
|
||||
public static Date toDate(Integer seconds) {
|
||||
Calendar calendar = new GregorianCalendar();
|
||||
calendar.set(Calendar.HOUR_OF_DAY, seconds / 60 / 60);
|
||||
String a = calendar.getTime().toString();
|
||||
calendar.set(Calendar.MINUTE, (seconds / 60) % 60);
|
||||
String b = calendar.getTime().toString();
|
||||
calendar.set(Calendar.SECOND, 0);
|
||||
String c = calendar.getTime().toString();
|
||||
return calendar.getTime();
|
||||
}
|
||||
|
||||
|
|
96
app/src/main/java/info/nightscout/utils/LocalAlertUtils.java
Normal file
96
app/src/main/java/info/nightscout/utils/LocalAlertUtils.java
Normal file
|
@ -0,0 +1,96 @@
|
|||
package info.nightscout.utils;
|
||||
|
||||
import android.app.AlarmManager;
|
||||
import android.app.PendingIntent;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
|
||||
import java.util.Date;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.data.Profile;
|
||||
import info.nightscout.androidaps.db.BgReading;
|
||||
import info.nightscout.androidaps.db.DatabaseHelper;
|
||||
import info.nightscout.androidaps.interfaces.PumpInterface;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||
import info.nightscout.androidaps.plugins.Overview.notifications.Notification;
|
||||
import info.nightscout.androidaps.receivers.KeepAliveReceiver;
|
||||
|
||||
/**
|
||||
* Created by adrian on 17/12/17.
|
||||
*/
|
||||
|
||||
public class LocalAlertUtils {
|
||||
public static int missedReadingsThreshold() {
|
||||
return SP.getInt(MainApp.sResources.getString(R.string.key_missed_bg_readings_threshold), 30) * 60 * 1000;
|
||||
}
|
||||
|
||||
private static int pumpUnreachableThreshold() {
|
||||
return SP.getInt(MainApp.sResources.getString(R.string.key_pump_unreachable_threshold), 30) * 60 * 1000;
|
||||
}
|
||||
|
||||
public static void checkPumpUnreachableAlarm(Date lastConnection, boolean isStatusOutdated) {
|
||||
boolean alarmTimeoutExpired = lastConnection.getTime() + pumpUnreachableThreshold() < System.currentTimeMillis();
|
||||
boolean nextAlarmOccurrenceReached = SP.getLong("nextPumpDisconnectedAlarm", 0l) < System.currentTimeMillis();
|
||||
|
||||
if (Config.APS && SP.getBoolean(MainApp.sResources.getString(R.string.key_enable_pump_unreachable_alert), true)
|
||||
&& isStatusOutdated && alarmTimeoutExpired && nextAlarmOccurrenceReached && !ConfigBuilderPlugin.getActiveLoop().isDisconnected()) {
|
||||
Notification n = new Notification(Notification.PUMP_UNREACHABLE, MainApp.sResources.getString(R.string.pump_unreachable), Notification.URGENT);
|
||||
n.soundId = R.raw.alarm;
|
||||
SP.putLong("nextPumpDisconnectedAlarm", System.currentTimeMillis() + pumpUnreachableThreshold());
|
||||
MainApp.bus().post(new EventNewNotification(n));
|
||||
}
|
||||
}
|
||||
|
||||
/*Presnoozes the alarms with 5 minutes if no snooze exists.
|
||||
* Call only at startup!
|
||||
*/
|
||||
public static void presnoozeAlarms() {
|
||||
if (SP.getLong("nextMissedReadingsAlarm", 0l) < System.currentTimeMillis()) {
|
||||
SP.putLong("nextMissedReadingsAlarm", System.currentTimeMillis() + 5 * 60 * 1000);
|
||||
}
|
||||
if (SP.getLong("nextPumpDisconnectedAlarm", 0l) < System.currentTimeMillis()) {
|
||||
SP.putLong("nextPumpDisconnectedAlarm", System.currentTimeMillis() + 5 * 60 * 1000);
|
||||
}
|
||||
}
|
||||
|
||||
public static void shortenSnoozeInterval() {
|
||||
//shortens alarm times in case of setting changes or future data
|
||||
long nextMissedReadingsAlarm = SP.getLong("nextMissedReadingsAlarm", 0L);
|
||||
nextMissedReadingsAlarm = Math.min(System.currentTimeMillis() + missedReadingsThreshold(), nextMissedReadingsAlarm);
|
||||
SP.putLong("nextMissedReadingsAlarm", nextMissedReadingsAlarm);
|
||||
|
||||
long nextPumpDisconnectedAlarm = SP.getLong("nextPumpDisconnectedAlarm", 0L);
|
||||
nextPumpDisconnectedAlarm = Math.min(System.currentTimeMillis() + pumpUnreachableThreshold(), nextPumpDisconnectedAlarm);
|
||||
SP.putLong("nextPumpDisconnectedAlarm", nextPumpDisconnectedAlarm);
|
||||
}
|
||||
|
||||
public static void notifyPumpStatusRead(){
|
||||
//TODO: persist the actual time the pump is read and simplify the whole logic when to alarm
|
||||
|
||||
final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
||||
final Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||
if (pump != null && profile != null && profile.getBasal() != null) {
|
||||
Date lastConnection = pump.lastDataTime();
|
||||
long earliestAlarmTime = lastConnection.getTime() + pumpUnreachableThreshold();
|
||||
if (SP.getLong("nextPumpDisconnectedAlarm", 0l) < earliestAlarmTime) {
|
||||
SP.putLong("nextPumpDisconnectedAlarm", earliestAlarmTime);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public static void checkStaleBGAlert() {
|
||||
BgReading bgReading = DatabaseHelper.lastBg();
|
||||
if (SP.getBoolean(MainApp.sResources.getString(R.string.key_enable_missed_bg_readings_alert), false)
|
||||
&& bgReading != null && bgReading.date + missedReadingsThreshold() < System.currentTimeMillis()
|
||||
&& SP.getLong("nextMissedReadingsAlarm", 0l) < System.currentTimeMillis()) {
|
||||
Notification n = new Notification(Notification.BG_READINGS_MISSED, MainApp.sResources.getString(R.string.missed_bg_readings), Notification.URGENT);
|
||||
n.soundId = R.raw.alarm;
|
||||
SP.putLong("nextMissedReadingsAlarm", System.currentTimeMillis() + missedReadingsThreshold());
|
||||
MainApp.bus().post(new EventNewNotification(n));
|
||||
}
|
||||
}
|
||||
}
|
|
@ -493,4 +493,11 @@ public class NSUpload {
|
|||
|
||||
}
|
||||
|
||||
public static boolean isIdValid(String _id) {
|
||||
if (_id == null)
|
||||
return false;
|
||||
if (_id.length() == 24)
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -0,0 +1,21 @@
|
|||
package info.nightscout.utils;
|
||||
|
||||
import java.util.regex.Matcher;
|
||||
import java.util.regex.Pattern;
|
||||
|
||||
/**
|
||||
* Created by mike on 22.12.2017.
|
||||
*/
|
||||
|
||||
public class PercentageSplitter {
|
||||
public static String pureName(String name) {
|
||||
String newName = name;
|
||||
String s = "(.*)\\((\\d+)\\%\\)";
|
||||
Pattern r = Pattern.compile(s);
|
||||
Matcher m = r.matcher(name);
|
||||
if (m.find()) {
|
||||
newName = m.group(1);
|
||||
}
|
||||
return newName;
|
||||
}
|
||||
}
|
|
@ -0,0 +1,67 @@
|
|||
package info.nightscout.utils;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.SystemClock;
|
||||
import android.support.annotation.Nullable;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
/**
|
||||
* Created by mike on 22.12.2017.
|
||||
*/
|
||||
|
||||
public class SingleClickButton extends android.support.v7.widget.AppCompatButton implements View.OnClickListener {
|
||||
private static Logger log = LoggerFactory.getLogger(SingleClickButton.class);
|
||||
|
||||
Context context;
|
||||
OnClickListener listener = null;
|
||||
|
||||
public SingleClickButton(Context context) {
|
||||
super(context);
|
||||
this.context = context;
|
||||
super.setOnClickListener(this);
|
||||
}
|
||||
|
||||
public SingleClickButton(Context context, AttributeSet attrs) {
|
||||
super(context, attrs);
|
||||
this.context = context;
|
||||
super.setOnClickListener(this);
|
||||
}
|
||||
|
||||
public SingleClickButton(Context context, AttributeSet attrs, int defStyleAttr) {
|
||||
super(context, attrs, defStyleAttr);
|
||||
this.context = context;
|
||||
super.setOnClickListener(this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOnClickListener(@Nullable OnClickListener l) {
|
||||
listener = l;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(final View v) {
|
||||
setEnabled(false);
|
||||
new Thread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
SystemClock.sleep(3000);
|
||||
Activity activity = (Activity) context;
|
||||
if (activity != null)
|
||||
activity.runOnUiThread(new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
setEnabled(true);
|
||||
log.debug("Button enabled");
|
||||
}
|
||||
});
|
||||
}
|
||||
}).start();
|
||||
if (listener != null)
|
||||
listener.onClick(v);
|
||||
}
|
||||
}
|
|
@ -52,6 +52,8 @@ public class TimeListEdit {
|
|||
private JSONArray data1;
|
||||
private JSONArray data2;
|
||||
private double step;
|
||||
private double min;
|
||||
private double max;
|
||||
private NumberFormat formatter;
|
||||
private Runnable save;
|
||||
private LinearLayout layout;
|
||||
|
@ -59,7 +61,7 @@ public class TimeListEdit {
|
|||
private int inflatedUntil = -1;
|
||||
|
||||
|
||||
public TimeListEdit(Context context, View view, int resLayoutId, String label, JSONArray data1, JSONArray data2, double step, NumberFormat formatter, Runnable save) {
|
||||
public TimeListEdit(Context context, View view, int resLayoutId, String label, JSONArray data1, JSONArray data2, double min, double max, double step, NumberFormat formatter, Runnable save) {
|
||||
this.context = context;
|
||||
this.view = view;
|
||||
this.resLayoutId = resLayoutId;
|
||||
|
@ -67,6 +69,8 @@ public class TimeListEdit {
|
|||
this.data1 = data1;
|
||||
this.data2 = data2;
|
||||
this.step = step;
|
||||
this.min = min;
|
||||
this.max = max;
|
||||
this.formatter = formatter;
|
||||
this.save = save;
|
||||
buildView();
|
||||
|
@ -239,8 +243,8 @@ public class TimeListEdit {
|
|||
if (i == 0) next = ONEHOURINSECONDS;
|
||||
fillSpinner(timeSpinner, secondFromMidnight(i), previous, next);
|
||||
|
||||
editText1.setParams(value1(i), 0.1d, 100d, step, formatter, false);
|
||||
editText2.setParams(value2(i), 0.1d, 100d, step, formatter, false);
|
||||
editText1.setParams(value1(i), min, max, step, formatter, false);
|
||||
editText2.setParams(value2(i), min, max, step, formatter, false);
|
||||
|
||||
if (data2 == null) {
|
||||
editText2.setVisibility(View.GONE);
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/actions_profileswitch"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -26,7 +26,7 @@
|
|||
android:drawableTop="@drawable/icon_actions_profileswitch"
|
||||
android:text="@string/careportal_profileswitch" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/actions_temptarget"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -39,7 +39,7 @@
|
|||
android:drawableTop="@drawable/icon_actions_temptarget"
|
||||
android:text="@string/careportal_temporarytarget" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/actions_settempbasal"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -52,7 +52,7 @@
|
|||
android:drawableTop="@drawable/icon_actions_starttempbasal"
|
||||
android:text="@string/overview_tempbasal_button" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/actions_canceltempbasal"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -65,7 +65,7 @@
|
|||
android:drawableTop="@drawable/icon_cancelbasal"
|
||||
android:text="Cancel temp basal" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/actions_extendedbolus"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -78,7 +78,7 @@
|
|||
android:drawableTop="@drawable/icon_actions_startextbolus"
|
||||
android:text="@string/overview_extendedbolus_button" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/actions_extendedbolus_cancel"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -91,7 +91,7 @@
|
|||
android:drawableTop="@drawable/icon_actions_cancelextbolus"
|
||||
android:text="@string/overview_extendedbolus_cancel_button" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/actions_fill"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="fill_parent"
|
||||
|
|
22
app/src/main/res/layout/bgsource_fragment.xml
Normal file
22
app/src/main/res/layout/bgsource_fragment.xml
Normal file
|
@ -0,0 +1,22 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
tools:context="info.nightscout.androidaps.plugins.SourceDexcomG5.BGSourceFragment">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<android.support.v7.widget.RecyclerView
|
||||
android:id="@+id/bgsource_recyclerview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</android.support.v7.widget.RecyclerView>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</FrameLayout>
|
78
app/src/main/res/layout/bgsource_item.xml
Normal file
78
app/src/main/res/layout/bgsource_item.xml
Normal file
|
@ -0,0 +1,78 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:card_view="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/bgsource_cardview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
card_view:cardBackgroundColor="@color/cardColorBackground"
|
||||
card_view:cardCornerRadius="6dp"
|
||||
card_view:cardUseCompatPadding="true"
|
||||
card_view:contentPadding="6dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bgsource_date"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="16:55"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bgsource_value"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="10dp"
|
||||
android:text="Name"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bgsource_direction"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:paddingStart="10dp"
|
||||
android:text="-" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/ns_sign"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="10dp"
|
||||
android:text="NS"
|
||||
android:textAlignment="viewEnd"
|
||||
android:textColor="@color/colorSetTempButton" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/invalid_sign"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingStart="10dp"
|
||||
android:text="@string/invalid"
|
||||
android:textColor="@android:color/holo_red_light" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/bgsource_remove"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:paddingEnd="5dp"
|
||||
android:paddingStart="10dp"
|
||||
android:text="@string/overview_quickwizard_item_remove_button"
|
||||
android:textAlignment="viewEnd"
|
||||
android:textColor="@android:color/holo_orange_light" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
</android.support.v7.widget.CardView>
|
|
@ -51,7 +51,7 @@
|
|||
android:padding="10dip"
|
||||
app:columnCount="3">
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/careportal_bgcheck"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -66,7 +66,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="0" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/careportal_exercise"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -80,7 +80,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="0" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/careportal_temporarytarget"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -111,7 +111,7 @@
|
|||
android:padding="10dip"
|
||||
app:columnCount="3">
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/careportal_snackbolus"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -125,7 +125,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="1" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/careportal_mealbolus"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -139,7 +139,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="1" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/careportal_correctionbolus"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -153,7 +153,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="1" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/careportal_carbscorrection"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -167,7 +167,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="2" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/careportal_combobolus"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -181,7 +181,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="2" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/careportal_tempbasalstart"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -195,7 +195,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="2" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/careportal_tempbasalend"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -225,7 +225,7 @@
|
|||
android:padding="10dip"
|
||||
app:columnCount="3">
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/careportal_cgmsensorstart"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -240,7 +240,7 @@
|
|||
app:layout_row="1" />
|
||||
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/careportal_cgmsensorinsert"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -255,7 +255,7 @@
|
|||
app:layout_row="1" />
|
||||
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/careportal_openapsoffline"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -270,7 +270,7 @@
|
|||
app:layout_row="1" />
|
||||
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/careportal_announcement"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -284,7 +284,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="4" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/careportal_question"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -298,7 +298,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="4" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/careportal_note"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -328,7 +328,7 @@
|
|||
android:padding="10dip"
|
||||
app:columnCount="3">
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/careportal_pumpsitechange"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -342,7 +342,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="0" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/careportal_insulincartridgechange"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -356,7 +356,7 @@
|
|||
app:layout_gravity="fill"
|
||||
app:layout_row="0" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/careportal_profileswitch"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
@ -371,7 +371,7 @@
|
|||
app:layout_row="0" />
|
||||
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/careportal_pumpbatterychange"
|
||||
style="@style/ButtonSmallFontStyle"
|
||||
android:layout_width="0dp"
|
||||
|
|
|
@ -4,70 +4,157 @@
|
|||
android:layout_height="match_parent"
|
||||
tools:context="info.nightscout.androidaps.plugins.Overview.Dialogs.EditQuickWizardDialog">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="vertical"
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="15dp">
|
||||
|
||||
<TextView
|
||||
android:text="@string/overview_editquickwizard_buttontext"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Medium" />
|
||||
|
||||
<EditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="text"
|
||||
android:ems="10"
|
||||
android:id="@+id/overview_editquickwizard_button_edit" />
|
||||
|
||||
<TextView
|
||||
android:text="@string/overview_editquickwizard_carbs"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Medium" />
|
||||
|
||||
<EditText
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:inputType="numberDecimal"
|
||||
android:ems="10"
|
||||
android:id="@+id/overview_editquickwizard_carbs_edit" />
|
||||
|
||||
<TextView
|
||||
android:text="@string/overview_editquickwizard_valid"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Medium" />
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<LinearLayout
|
||||
android:orientation="horizontal"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
android:layout_height="match_parent"
|
||||
android:layout_margin="15dp"
|
||||
android:orientation="vertical">
|
||||
|
||||
<Spinner
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/overview_editquickwizard_from_spinner"
|
||||
android:layout_weight="1" />
|
||||
android:text="@string/overview_editquickwizard_buttontext"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Medium" />
|
||||
|
||||
<Spinner
|
||||
<EditText
|
||||
android:id="@+id/overview_editquickwizard_button_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/overview_editquickwizard_to_spinner"
|
||||
android:layout_weight="1" />
|
||||
android:ems="10"
|
||||
android:inputType="text" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/overview_editquickwizard_carbs"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Medium" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/overview_editquickwizard_carbs_edit"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:ems="10"
|
||||
android:inputType="numberDecimal" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/overview_editquickwizard_valid"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Medium" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/overview_editquickwizard_from_spinner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/overview_editquickwizard_to_spinner"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/overview_editquickwizard_usebg"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Medium" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/overview_editquickwizard_usebg_spinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:entries="@array/quickWizardUseBGArray" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/overview_editquickwizard_usebolusiob"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Medium" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/overview_editquickwizard_usebolusiob_spinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:entries="@array/quickWizardUseBolusIOBArray" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/overview_editquickwizard_usebasaliob"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Medium" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/overview_editquickwizard_usebasaliob_spinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:entries="@array/quickWizardUseBasalOBArray" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/overview_editquickwizard_usecob"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Medium" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/overview_editquickwizard_usecob_spinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:entries="@array/quickWizardUseCOBArray" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/overview_editquickwizard_usetrend"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Medium" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/overview_editquickwizard_usetrend_spinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:entries="@array/quickWizardUseTrendArray" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_editquickwizard_usesuperbolus_label"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/overview_editquickwizard_usesuperbolus"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Medium" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/overview_editquickwizard_usesuperbolus_spinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:entries="@array/quickWizardUseSuperBolusArray" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/overview_editquickwizard_usetemptarget"
|
||||
android:textAppearance="@android:style/TextAppearance.Material.Medium" />
|
||||
|
||||
<Spinner
|
||||
android:id="@+id/overview_editquickwizard_usetemptarget_spinner"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:entries="@array/quickWizardUseTempTargetArray" />
|
||||
|
||||
<include layout="@layout/mdtp_done_button" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<Button
|
||||
android:text="@string/ok"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/overview_editquickwizard_ok_button"
|
||||
android:layout_weight="1" />
|
||||
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
|
||||
</FrameLayout>
|
||||
|
|
|
@ -381,7 +381,7 @@
|
|||
android:orientation="horizontal"
|
||||
android:visibility="gone">
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/overview_accepttempbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="match_parent"
|
||||
|
@ -398,7 +398,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/overview_treatmentbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -413,7 +413,7 @@
|
|||
android:textSize="10sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/overview_wizardbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -428,7 +428,7 @@
|
|||
android:textSize="10sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/overview_calibrationbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -443,7 +443,7 @@
|
|||
android:textSize="10sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/overview_quickwizardbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
|
|
@ -593,7 +593,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/overview_treatmentbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -607,7 +607,7 @@
|
|||
android:textColor="@color/colorTreatmentButton"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/overview_wizardbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -622,7 +622,7 @@
|
|||
android:textSize="10sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/overview_quickwizardbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
|
|
@ -691,7 +691,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/overview_treatmentbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -705,7 +705,7 @@
|
|||
android:textColor="@color/colorTreatmentButton"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/overview_wizardbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -720,7 +720,7 @@
|
|||
android:textSize="10sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/overview_calibrationbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -735,7 +735,7 @@
|
|||
android:textSize="10sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/overview_quickwizardbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
|
|
@ -360,7 +360,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/overview_accepttempbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="fill_parent"
|
||||
|
@ -377,7 +377,7 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/overview_treatmentbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -391,7 +391,7 @@
|
|||
android:textColor="@color/colorTreatmentButton"
|
||||
android:textSize="10sp" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/overview_wizardbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -406,7 +406,7 @@
|
|||
android:textSize="10sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/overview_calibrationbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
@ -421,7 +421,7 @@
|
|||
android:textSize="10sp"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
<info.nightscout.utils.SingleClickButton
|
||||
android:id="@+id/overview_quickwizardbutton"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="0px"
|
||||
|
|
|
@ -8,6 +8,14 @@
|
|||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:paddingBottom="10dp"
|
||||
android:text="@string/virtualpump_extendedbolus_label"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/careportal_newnstreatment_insulin_layout"
|
||||
android:layout_width="match_parent"
|
||||
|
|
|
@ -212,7 +212,6 @@
|
|||
<string name="connecting">Свързване</string>
|
||||
<string name="connected">Свързана</string>
|
||||
<string name="disconnected">Не е сврзана</string>
|
||||
<string name="syncprofiletopump_title">Синхронизирай помпата с профила</string>
|
||||
<string name="danar_pump_settings">DanaR настройки</string>
|
||||
<string name="nightscout">Nightscout</string>
|
||||
<string name="end_user_license_agreement">End User License Agreement</string>
|
||||
|
|
|
@ -192,7 +192,6 @@
|
|||
<string name="disconnected">Odpojeno</string>
|
||||
<string name="danar_bt_name_title">DanaR Bluetooth zařízení</string>
|
||||
<string name="danar_pump_settings">DanaR nastavení</string>
|
||||
<string name="syncprofiletopump_title">Synchronizovat profil do pumpy</string>
|
||||
<string name="nightscout">Nightscout</string>
|
||||
<string name="absolute">Absolutní</string>
|
||||
<string name="comment">Komentář</string>
|
||||
|
|
|
@ -226,7 +226,6 @@
|
|||
<string name="hoursago">vor h </string>
|
||||
<string name="smscommunicator">SMS Kommunikator</string>
|
||||
<string name="smscommunicator_allowednumbers">erlaubte Telefonnummern</string>
|
||||
<string name="syncprofiletopump_title">Profil zur Pumpe synchronisieren</string>
|
||||
<string name="waitingforpumpresult">auf Pumpenergebnis warten</string>
|
||||
<string name="nobtadapter">Kein Bluetoothadapter gefunden</string>
|
||||
<string name="smscommunicator_remotebolusnotallowed">Remote Bolus ist nicht erlaubt</string>
|
||||
|
|
|
@ -208,7 +208,6 @@
|
|||
<string name="connecting">Σύνδεση</string>
|
||||
<string name="connected">Συνδέθηκε</string>
|
||||
<string name="disconnected">Αποσύνδεση</string>
|
||||
<string name="syncprofiletopump_title">Συγχρονισμός προφίλ στην αντλία</string>
|
||||
<string name="danar_pump_settings">Ρυθμίσεις αντλίας DanaR</string>
|
||||
<string name="nightscout">Nightscout</string>
|
||||
<string name="end_user_license_agreement">Άδεια χρήσης τελικού χρήστη</string>
|
||||
|
@ -675,4 +674,4 @@
|
|||
<string name="localalertsettings_title">Τοπικές Ειδοποιήσεις</string>
|
||||
<string name="enable_missed_bg_readings_alert">Ειδοποίησε αν δεν ληφθούν δεδομένα μετρήσεων BG</string>
|
||||
<string name="btwatchdog_summary">Απενεργοποιεί το bluetooth του τηλεφώνου για ένα δευτερόλεπτο αν δεν είναι δυνατή η σύνδεση με την αντλία.Αυτό μπορεί να βοηθήσει σε ορισμένα τηλέφωνα όπου το bluetooth παγώνει</string>
|
||||
</resources>
|
||||
</resources>
|
||||
|
|
|
@ -201,7 +201,6 @@
|
|||
<string name="connecting">Conectando</string>
|
||||
<string name="connected">Conectado</string>
|
||||
<string name="disconnected">Desconectado</string>
|
||||
<string name="syncprofiletopump_title">Sincronizar perfil a bomba</string>
|
||||
<string name="danar_pump_settings">Ajustes de la bomba DanaR</string>
|
||||
<string name="nightscout">Nightscout</string>
|
||||
<string name="end_user_license_agreement">Acuerdo de licencia de usuario final</string>
|
||||
|
|
|
@ -372,7 +372,6 @@
|
|||
<string name="suspendloopfor1h">Sospendi loop per 1h</string>
|
||||
<string name="suspendloopfor2h">Sospendi loop per 2h</string>
|
||||
<string name="suspendloopfor3h">Sospendi loop per 3h</string>
|
||||
<string name="syncprofiletopump_title">Sincronizza profilo sul micro</string>
|
||||
<string name="target_range">Target range:</string>
|
||||
<string name="teenage">Adolescente</string>
|
||||
<string name="tempbasals_iob_label_string">IOB:</string>
|
||||
|
|
|
@ -213,7 +213,6 @@
|
|||
<string name="connecting">연결중</string>
|
||||
<string name="connected">연결됨</string>
|
||||
<string name="disconnected">연결 끊김</string>
|
||||
<string name="syncprofiletopump_title">프로파일을 펌프에 동기화하기</string>
|
||||
<string name="danar_pump_settings">다나R 펌프 설정</string>
|
||||
<string name="nightscout">Nightscout</string>
|
||||
<string name="end_user_license_agreement">최종 사용자 라이선스 동의서</string>
|
||||
|
|
|
@ -626,7 +626,6 @@
|
|||
<string name="openapsama_bolussnooze_dia_divisor_summary">Standaard waarde: 2 Bolus snooze is actief nadat je een maaltijd bolus toegediend hebt, zodat de loop geen tegenvoorstel met een verlaagd tijdelijk basaal doet nadat je gegeten hebt. Het voorbeeld hier van van standaard 2; dus een 3 u DIA betekent dat de bolus snooze gemiddeld 1.5u actief is (3DIA/2).</string>
|
||||
<string name="openapsama_current_basal_safety_multiplier_summary">Standaard waarde: 4 Dit is een combinatie van enerzijds het OpenAPS veiligheid limieten en anderzijds van “3 x max dagelijks basaal ; 4x actueel”. Dit betekent dat het basaal niet hoger kan ingesteld worden dan het ingestelde nummer keer het actueel basaal waarbij de limiet in de pomp geen invloed heeft.Dit is een veiligheidsmaatregel om te vermijden dat patiënten in gevaarlijke laag bereik komen zonder te snappen hoe het algoritme werkt. Nogmaals de standaard waarde is 4x; de meeste zullen deze waarde nooit moeten aanpassen maar zullen eerder andere waardes moeten aanpassen als ze tegen een limiet aanstoten.</string>
|
||||
<string name="objectives_5_gate">Gedurende 1 week succesvol closed loop met KH ingave</string>
|
||||
<string name="syncprofiletopump_title">Synchroniseer profiel met de pomp</string>
|
||||
<string name="careportal_activity_label">ACTIVITIJD & FEEDBACK</string>
|
||||
<string name="danar_model" formatted="false">Model: %02X Protokoll: %02X Code: %02X</string>
|
||||
<string name="danar_history_connectingfor">Verbonden gedurende %d s</string>
|
||||
|
|
|
@ -486,7 +486,6 @@
|
|||
<string name="suspendloopfor1h">приостановить цикл на 1 час</string>
|
||||
<string name="suspendloopfor2h">приостановить цикл на 2 часа</string>
|
||||
<string name="suspendloopfor3h">приостановить цикл на 3 часа</string>
|
||||
<string name="syncprofiletopump_title">синхронизировать профиль с помпой</string>
|
||||
<string name="target_range">целевой диапазон</string>
|
||||
<string name="teenage">подросток</string>
|
||||
<string name="tempbasaldeliveryerror">ошибка доставки врем базала</string>
|
||||
|
|
|
@ -362,7 +362,6 @@
|
|||
<string name="teenage">Tonåring</string>
|
||||
<string name="targetmissing">Mål saknas i profil. Använder grundinställning</string>
|
||||
<string name="target_range">Mål gränser:</string>
|
||||
<string name="syncprofiletopump_title">Uppdatera profil till pump</string>
|
||||
<string name="suspendloopfor3h">Stäng av loop i 3 h</string>
|
||||
<string name="suspendloopfor2h">Stäng av loop i 2 h</string>
|
||||
<string name="suspendloopfor1h">Stäng av loop i 1 h</string>
|
||||
|
|
|
@ -59,4 +59,43 @@
|
|||
<item>2</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="quickWizardUseBGArray">
|
||||
<item>@string/yes</item>
|
||||
<item>@string/no</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="quickWizardUseCOBArray">
|
||||
<item>@string/yes</item>
|
||||
<item>@string/no</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="quickWizardUseBolusIOBArray">
|
||||
<item>@string/yes</item>
|
||||
<item>@string/no</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="quickWizardUseBasalOBArray">
|
||||
<item>@string/yes</item>
|
||||
<item>@string/no</item>
|
||||
<item>@string/positiveonly</item>
|
||||
<item>@string/negativeonly</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="quickWizardUseTrendArray">
|
||||
<item>@string/no</item>
|
||||
<item>@string/yes</item>
|
||||
<item>@string/positiveonly</item>
|
||||
<item>@string/negativeonly</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="quickWizardUseSuperBolusArray">
|
||||
<item>@string/no</item>
|
||||
<item>@string/yes</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="quickWizardUseTempTargetArray">
|
||||
<item>@string/no</item>
|
||||
<item>@string/yes</item>
|
||||
</string-array>
|
||||
|
||||
</resources>
|
|
@ -223,7 +223,6 @@
|
|||
<string name="connecting">Connecting</string>
|
||||
<string name="connected">Connected</string>
|
||||
<string name="disconnected">Disconnected</string>
|
||||
<string name="syncprofiletopump_title">Sync profile to pump</string>
|
||||
<string name="danar_pump_settings">DanaR pump settings</string>
|
||||
<string name="nightscout">Nightscout</string>
|
||||
<string name="end_user_license_agreement">End User License Agreement</string>
|
||||
|
@ -788,5 +787,18 @@
|
|||
<string name="dexcomg5_xdripupload_title">Send BG data to xDrip+</string>
|
||||
<string name="key_dexcomg5_xdripupload" translatable="false">dexcomg5_xdripupload</string>
|
||||
<string name="dexcomg5_xdripupload_summary">In xDrip+ select 640g/Eversense data source</string>
|
||||
<string name="nsclientbg">NSClient BG</string>
|
||||
<string name="minimalbasalvaluereplaced">Basal value replaced by minimal supported value</string>
|
||||
<string name="overview_editquickwizard_usebg">BG calculation</string>
|
||||
<string name="overview_editquickwizard_usebolusiob">Bolus IOB calculation</string>
|
||||
<string name="overview_editquickwizard_usebasaliob">Basal IOB calculation</string>
|
||||
<string name="overview_editquickwizard_usetrend">Trend calculation</string>
|
||||
<string name="overview_editquickwizard_usesuperbolus">Superbolus calculation</string>
|
||||
<string name="yes">Yes</string>
|
||||
<string name="no">No</string>
|
||||
<string name="positiveonly">Positive only</string>
|
||||
<string name="negativeonly">Negative only</string>
|
||||
<string name="overview_editquickwizard_usecob">COB calculation</string>
|
||||
<string name="overview_editquickwizard_usetemptarget">Temporary target calculation</string>
|
||||
</resources>
|
||||
|
||||
|
|
|
@ -1,13 +0,0 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceCategory
|
||||
android:key="profile"
|
||||
android:title="@string/profile">
|
||||
|
||||
<SwitchPreference
|
||||
android:defaultValue="false"
|
||||
android:key="syncprofiletopump"
|
||||
android:title="@string/syncprofiletopump_title" />
|
||||
</PreferenceCategory>
|
||||
|
||||
</PreferenceScreen>
|
|
@ -3,7 +3,9 @@ package info.nightscout.utils;
|
|||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import java.util.Date;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Created by mike on 20.11.2017.
|
||||
|
@ -17,10 +19,15 @@ public class DateUtilTest {
|
|||
|
||||
@Test
|
||||
public void fromISODateStringTest() throws Exception {
|
||||
assertEquals( 1511124634417L, DateUtil.fromISODateString("2017-11-19T22:50:34.417+0200").getTime());
|
||||
assertEquals( 1511124634000L, DateUtil.fromISODateString("2017-11-19T22:50:34+0200").getTime());
|
||||
assertEquals( 1512317365000L, DateUtil.fromISODateString("2017-12-03T16:09:25.000Z").getTime());
|
||||
assertEquals(1511124634417L, DateUtil.fromISODateString("2017-11-19T22:50:34.417+0200").getTime());
|
||||
assertEquals(1511124634000L, DateUtil.fromISODateString("2017-11-19T22:50:34+0200").getTime());
|
||||
assertEquals(1512317365000L, DateUtil.fromISODateString("2017-12-03T16:09:25.000Z").getTime());
|
||||
assertEquals(1513902750000L, DateUtil.fromISODateString("2017-12-22T00:32:30Z").getTime());
|
||||
}
|
||||
|
||||
@Test
|
||||
public void toISOStringTest() throws Exception {
|
||||
assertEquals("2017-12-22T00:32:30Z", DateUtil.toISOString(new Date(1513902750000L)));
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -0,0 +1,20 @@
|
|||
package info.nightscout.utils;
|
||||
|
||||
import org.junit.Test;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
|
||||
/**
|
||||
* Created by mike on 22.12.2017.
|
||||
*/
|
||||
|
||||
public class PercentageSplitterTest {
|
||||
public PercentageSplitterTest() {
|
||||
super();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void pureNameTest() throws Exception {
|
||||
assertEquals("Fiasp", PercentageSplitter.pureName("Fiasp(101%)"));
|
||||
}
|
||||
}
|
|
@ -57,10 +57,11 @@ allprojects {
|
|||
dependencies {
|
||||
compile fileTree(include: ['*.jar'], dir: 'libs')
|
||||
//compile 'com.ustwo.android:clockwise-wearable:1.0.2'
|
||||
compile 'com.google.android.support:wearable:1.4.0'
|
||||
provided 'com.google.android.wearable:wearable:2.0.1'
|
||||
compile 'com.google.android.support:wearable:2.0.1'
|
||||
compile 'com.google.android.gms:play-services-wearable:7.3.0'
|
||||
compile files('libs/hellocharts-library-1.5.5.jar')
|
||||
compile(name:'ustwo-clockwise-debug', ext:'aar')
|
||||
compile 'com.android.support:support-v4:23.0.1'
|
||||
compile 'me.denley.wearpreferenceactivity:wearpreferenceactivity:0.5.0'
|
||||
}
|
||||
}
|
||||
|
|
|
@ -269,7 +269,7 @@ public abstract class BaseWatchFace extends WatchFace implements SharedPreferen
|
|||
if (layoutSet && bundle != null) {
|
||||
DataMap dataMap = DataMap.fromBundle(bundle);
|
||||
wakeLock.acquire(50);
|
||||
sBasalRate = dataMap.getString("tempBasal");
|
||||
sBasalRate = dataMap.getString("currentBasal");
|
||||
sUploaderBattery = dataMap.getString("battery");
|
||||
sRigBattery = dataMap.getString("rigBattery");
|
||||
detailedIOB = dataMap.getBoolean("detailedIob");
|
||||
|
|
Loading…
Reference in a new issue