Merge branch 'dev' into watchfaces-steampunk
This commit is contained in:
commit
144292576a
13 changed files with 214 additions and 156 deletions
|
@ -96,7 +96,12 @@ public class DataService extends IntentService {
|
||||||
|
|
||||||
boolean isNSProfile = ConfigBuilderPlugin.getActiveProfileInterface().getClass().equals(NSProfilePlugin.class);
|
boolean isNSProfile = ConfigBuilderPlugin.getActiveProfileInterface().getClass().equals(NSProfilePlugin.class);
|
||||||
|
|
||||||
boolean nsUploadOnly = SP.getBoolean(R.string.key_ns_upload_only, false);
|
boolean acceptNSData = !SP.getBoolean(R.string.key_ns_upload_only, false);
|
||||||
|
Bundle bundles = intent.getExtras();
|
||||||
|
if (bundles != null && bundles.containsKey("islocal")) {
|
||||||
|
acceptNSData = acceptNSData || bundles.getBoolean("islocal");
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
if (intent != null) {
|
if (intent != null) {
|
||||||
final String action = intent.getAction();
|
final String action = intent.getAction();
|
||||||
|
@ -125,7 +130,7 @@ public class DataService extends IntentService {
|
||||||
} else if (isNSProfile && Intents.ACTION_NEW_PROFILE.equals(action) || Intents.ACTION_NEW_DEVICESTATUS.equals(action)) {
|
} else if (isNSProfile && Intents.ACTION_NEW_PROFILE.equals(action) || Intents.ACTION_NEW_DEVICESTATUS.equals(action)) {
|
||||||
// always handle Profile if NSProfile is enabled without looking at nsUploadOnly
|
// always handle Profile if NSProfile is enabled without looking at nsUploadOnly
|
||||||
handleNewDataFromNSClient(intent);
|
handleNewDataFromNSClient(intent);
|
||||||
} else if (!nsUploadOnly &&
|
} else if (acceptNSData &&
|
||||||
(Intents.ACTION_NEW_TREATMENT.equals(action) ||
|
(Intents.ACTION_NEW_TREATMENT.equals(action) ||
|
||||||
Intents.ACTION_CHANGED_TREATMENT.equals(action) ||
|
Intents.ACTION_CHANGED_TREATMENT.equals(action) ||
|
||||||
Intents.ACTION_REMOVED_TREATMENT.equals(action) ||
|
Intents.ACTION_REMOVED_TREATMENT.equals(action) ||
|
||||||
|
|
|
@ -172,8 +172,16 @@ public class Profile {
|
||||||
tas = getShitfTimeSecs(DateUtil.toSeconds(time));
|
tas = getShitfTimeSecs(DateUtil.toSeconds(time));
|
||||||
//log.debug(">>>>>>>>>>>> Used recalculated timeAsSecons: " + time + " " + tas);
|
//log.debug(">>>>>>>>>>>> Used recalculated timeAsSecons: " + time + " " + tas);
|
||||||
}
|
}
|
||||||
Double value = o.getDouble("value") * multiplier;
|
double value = o.getDouble("value") * multiplier;
|
||||||
sparse.put(tas, value);
|
sparse.put(tas, value);
|
||||||
|
if (tas % 3600 != 0) {
|
||||||
|
Notification notification = new Notification(Notification.BASAL_PROFILE_NOT_ALIGNED_TO_HOURS, MainApp.sResources.getString(R.string.basalprofilenotaligned), Notification.URGENT);
|
||||||
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
|
}
|
||||||
|
if (value == 0) {
|
||||||
|
Notification notification = new Notification(Notification.ZERO_VALUE_IN_PROFILE, MainApp.sResources.getString(R.string.zerovalueinprofile), Notification.URGENT);
|
||||||
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
|
}
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
log.error("Unhandled exception", e);
|
log.error("Unhandled exception", e);
|
||||||
log.error(json.toString());
|
log.error(json.toString());
|
||||||
|
|
|
@ -181,7 +181,7 @@ public class QuickWizardEntry {
|
||||||
try {
|
try {
|
||||||
return storage.getInt("useBG");
|
return storage.getInt("useBG");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
log.error("Unhandled exception", e);
|
//log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -190,7 +190,7 @@ public class QuickWizardEntry {
|
||||||
try {
|
try {
|
||||||
return storage.getInt("useCOB");
|
return storage.getInt("useCOB");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
log.error("Unhandled exception", e);
|
//log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
@ -199,7 +199,7 @@ public class QuickWizardEntry {
|
||||||
try {
|
try {
|
||||||
return storage.getInt("useBolusIOB");
|
return storage.getInt("useBolusIOB");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
log.error("Unhandled exception", e);
|
//log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -208,7 +208,7 @@ public class QuickWizardEntry {
|
||||||
try {
|
try {
|
||||||
return storage.getInt("useBasalIOB");
|
return storage.getInt("useBasalIOB");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
log.error("Unhandled exception", e);
|
//log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return YES;
|
return YES;
|
||||||
}
|
}
|
||||||
|
@ -217,7 +217,7 @@ public class QuickWizardEntry {
|
||||||
try {
|
try {
|
||||||
return storage.getInt("useTrend");
|
return storage.getInt("useTrend");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
log.error("Unhandled exception", e);
|
//log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
@ -226,7 +226,7 @@ public class QuickWizardEntry {
|
||||||
try {
|
try {
|
||||||
return storage.getInt("useSuperBolus");
|
return storage.getInt("useSuperBolus");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
log.error("Unhandled exception", e);
|
//log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
@ -235,7 +235,7 @@ public class QuickWizardEntry {
|
||||||
try {
|
try {
|
||||||
return storage.getInt("useTempTarget");
|
return storage.getInt("useTempTarget");
|
||||||
} catch (JSONException e) {
|
} catch (JSONException e) {
|
||||||
log.error("Unhandled exception", e);
|
//log.error("Unhandled exception", e);
|
||||||
}
|
}
|
||||||
return NO;
|
return NO;
|
||||||
}
|
}
|
||||||
|
|
|
@ -24,11 +24,12 @@ import info.nightscout.utils.SP;
|
||||||
public class BroadcastTreatment {
|
public class BroadcastTreatment {
|
||||||
private static Logger log = LoggerFactory.getLogger(BroadcastTreatment.class);
|
private static Logger log = LoggerFactory.getLogger(BroadcastTreatment.class);
|
||||||
|
|
||||||
public static void handleNewTreatment(JSONObject treatment, boolean isDelta) {
|
public static void handleNewTreatment(JSONObject treatment, boolean isDelta, boolean isLocalBypass) {
|
||||||
|
|
||||||
Bundle bundle = new Bundle();
|
Bundle bundle = new Bundle();
|
||||||
bundle.putString("treatment", treatment.toString());
|
bundle.putString("treatment", treatment.toString());
|
||||||
bundle.putBoolean("delta", isDelta);
|
bundle.putBoolean("delta", isDelta);
|
||||||
|
bundle.putBoolean("islocal", isLocalBypass);
|
||||||
Intent intent = new Intent(Intents.ACTION_NEW_TREATMENT);
|
Intent intent = new Intent(Intents.ACTION_NEW_TREATMENT);
|
||||||
intent.putExtras(bundle);
|
intent.putExtras(bundle);
|
||||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||||
|
|
|
@ -110,7 +110,7 @@ public class DBAccessReceiver extends BroadcastReceiver {
|
||||||
JSONObject data = new JSONObject(request.data);
|
JSONObject data = new JSONObject(request.data);
|
||||||
data.put("mills", DateUtil.fromISODateString(data.getString("created_at")).getTime());
|
data.put("mills", DateUtil.fromISODateString(data.getString("created_at")).getTime());
|
||||||
data.put("_id", data.get("NSCLIENT_ID")); // this is only fake id
|
data.put("_id", data.get("NSCLIENT_ID")); // this is only fake id
|
||||||
BroadcastTreatment.handleNewTreatment(data, false);
|
BroadcastTreatment.handleNewTreatment(data, false, true);
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Unhadled exception", e);
|
log.error("Unhadled exception", e);
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import android.graphics.Paint;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.os.Handler;
|
import android.os.Handler;
|
||||||
import android.support.v4.app.Fragment;
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.support.v4.app.FragmentActivity;
|
||||||
import android.support.v4.app.FragmentManager;
|
import android.support.v4.app.FragmentManager;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.support.v7.app.AlertDialog;
|
import android.support.v7.app.AlertDialog;
|
||||||
|
@ -178,6 +179,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
Handler sLoopHandler = new Handler();
|
Handler sLoopHandler = new Handler();
|
||||||
Runnable sRefreshLoop = null;
|
Runnable sRefreshLoop = null;
|
||||||
|
|
||||||
|
final Object updateSync = new Object();
|
||||||
|
|
||||||
private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
|
private static final ScheduledExecutorService worker = Executors.newSingleThreadScheduledExecutor();
|
||||||
private static ScheduledFuture<?> scheduledUpdate = null;
|
private static ScheduledFuture<?> scheduledUpdate = null;
|
||||||
|
|
||||||
|
@ -901,9 +904,9 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
}
|
}
|
||||||
|
|
||||||
@SuppressLint("SetTextI18n")
|
@SuppressLint("SetTextI18n")
|
||||||
public void updateGUI(String from) {
|
public void updateGUI(final String from) {
|
||||||
log.debug("updateGUI entered from: " + from);
|
log.debug("updateGUI entered from: " + from);
|
||||||
Date updateGUIStart = new Date();
|
final Date updateGUIStart = new Date();
|
||||||
|
|
||||||
if (getActivity() == null)
|
if (getActivity() == null)
|
||||||
return;
|
return;
|
||||||
|
@ -925,7 +928,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
BgReading actualBG = DatabaseHelper.actualBg();
|
BgReading actualBG = DatabaseHelper.actualBg();
|
||||||
BgReading lastBG = DatabaseHelper.lastBg();
|
BgReading lastBG = DatabaseHelper.lastBg();
|
||||||
|
|
||||||
PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
final PumpInterface pump = ConfigBuilderPlugin.getActivePump();
|
||||||
|
|
||||||
Profile profile = MainApp.getConfigBuilder().getProfile();
|
Profile profile = MainApp.getConfigBuilder().getProfile();
|
||||||
String units = profile.getUnits();
|
String units = profile.getUnits();
|
||||||
|
@ -937,8 +940,16 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
double lowLine = SP.getDouble("low_mark", 0d);
|
double lowLineSetting = SP.getDouble("low_mark", Profile.fromMgdlToUnits(OverviewPlugin.bgTargetLow, units));
|
||||||
double highLine = SP.getDouble("high_mark", 0d);
|
double highLineSetting = SP.getDouble("high_mark", Profile.fromMgdlToUnits(OverviewPlugin.bgTargetHigh, units));
|
||||||
|
|
||||||
|
if (lowLineSetting < 1)
|
||||||
|
lowLineSetting = Profile.fromMgdlToUnits(76d, units);
|
||||||
|
if (highLineSetting < 1)
|
||||||
|
highLineSetting = Profile.fromMgdlToUnits(180d, units);
|
||||||
|
|
||||||
|
final double lowLine = lowLineSetting;
|
||||||
|
final double highLine = highLineSetting;
|
||||||
|
|
||||||
//Start with updating the BG as it is unaffected by loop.
|
//Start with updating the BG as it is unaffected by loop.
|
||||||
// **** BG value ****
|
// **** BG value ****
|
||||||
|
@ -1142,16 +1153,8 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
if (lowLine < 1) {
|
|
||||||
lowLine = Profile.fromMgdlToUnits(OverviewPlugin.bgTargetLow, units);
|
|
||||||
}
|
|
||||||
if (highLine < 1) {
|
|
||||||
highLine = Profile.fromMgdlToUnits(OverviewPlugin.bgTargetHigh, units);
|
|
||||||
}
|
|
||||||
|
|
||||||
// **** BG value ****
|
// **** BG value ****
|
||||||
if (lastBG == null) { //left this here as it seems you want to exit at this point if it is null...
|
if (lastBG == null) { //left this here as it seems you want to exit at this point if it is null...
|
||||||
|
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
Integer flag = bgView.getPaintFlags();
|
Integer flag = bgView.getPaintFlags();
|
||||||
|
@ -1204,7 +1207,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
cobView.setText(cobText);
|
cobView.setText(cobText);
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean showPrediction = showPredictionView.isChecked() && finalLastRun != null && finalLastRun.constraintsProcessed.getClass().equals(DetermineBasalResultAMA.class);
|
final boolean showPrediction = showPredictionView.isChecked() && finalLastRun != null && finalLastRun.constraintsProcessed.getClass().equals(DetermineBasalResultAMA.class);
|
||||||
if (MainApp.getSpecificPlugin(OpenAPSAMAPlugin.class) != null && MainApp.getSpecificPlugin(OpenAPSAMAPlugin.class).isEnabled(PluginBase.APS)) {
|
if (MainApp.getSpecificPlugin(OpenAPSAMAPlugin.class) != null && MainApp.getSpecificPlugin(OpenAPSAMAPlugin.class).isEnabled(PluginBase.APS)) {
|
||||||
showPredictionView.setVisibility(View.VISIBLE);
|
showPredictionView.setVisibility(View.VISIBLE);
|
||||||
getActivity().findViewById(R.id.overview_showprediction_label).setVisibility(View.VISIBLE);
|
getActivity().findViewById(R.id.overview_showprediction_label).setVisibility(View.VISIBLE);
|
||||||
|
@ -1248,105 +1251,121 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
|
|
||||||
// ****** GRAPH *******
|
// ****** GRAPH *******
|
||||||
|
|
||||||
// allign to hours
|
new Thread(new Runnable() {
|
||||||
Calendar calendar = Calendar.getInstance();
|
@Override
|
||||||
calendar.setTimeInMillis(System.currentTimeMillis());
|
public void run() {
|
||||||
calendar.set(Calendar.MILLISECOND, 0);
|
// allign to hours
|
||||||
calendar.set(Calendar.SECOND, 0);
|
Calendar calendar = Calendar.getInstance();
|
||||||
calendar.set(Calendar.MINUTE, 0);
|
calendar.setTimeInMillis(System.currentTimeMillis());
|
||||||
calendar.add(Calendar.HOUR, 1);
|
calendar.set(Calendar.MILLISECOND, 0);
|
||||||
|
calendar.set(Calendar.SECOND, 0);
|
||||||
|
calendar.set(Calendar.MINUTE, 0);
|
||||||
|
calendar.add(Calendar.HOUR, 1);
|
||||||
|
|
||||||
int hoursToFetch;
|
int hoursToFetch;
|
||||||
long toTime;
|
final long toTime;
|
||||||
long fromTime;
|
final long fromTime;
|
||||||
long endTime;
|
final long endTime;
|
||||||
if (showPrediction) {
|
if (showPrediction) {
|
||||||
int predHours = (int) (Math.ceil(((DetermineBasalResultAMA) finalLastRun.constraintsProcessed).getLatestPredictionsTime() - System.currentTimeMillis()) / (60 * 60 * 1000));
|
int predHours = (int) (Math.ceil(((DetermineBasalResultAMA) finalLastRun.constraintsProcessed).getLatestPredictionsTime() - System.currentTimeMillis()) / (60 * 60 * 1000));
|
||||||
predHours = Math.min(2, predHours);
|
predHours = Math.min(2, predHours);
|
||||||
predHours = Math.max(0, predHours);
|
predHours = Math.max(0, predHours);
|
||||||
hoursToFetch = rangeToDisplay - predHours;
|
hoursToFetch = rangeToDisplay - predHours;
|
||||||
toTime = calendar.getTimeInMillis() + 100000; // little bit more to avoid wrong rounding - Graphview specific
|
toTime = calendar.getTimeInMillis() + 100000; // little bit more to avoid wrong rounding - Graphview specific
|
||||||
fromTime = toTime - hoursToFetch * 60 * 60 * 1000L;
|
fromTime = toTime - hoursToFetch * 60 * 60 * 1000L;
|
||||||
endTime = toTime + predHours * 60 * 60 * 1000L;
|
endTime = toTime + predHours * 60 * 60 * 1000L;
|
||||||
} else {
|
} else {
|
||||||
hoursToFetch = rangeToDisplay;
|
hoursToFetch = rangeToDisplay;
|
||||||
toTime = calendar.getTimeInMillis() + 100000; // little bit more to avoid wrong rounding - Graphview specific
|
toTime = calendar.getTimeInMillis() + 100000; // little bit more to avoid wrong rounding - Graphview specific
|
||||||
fromTime = toTime - hoursToFetch * 60 * 60 * 1000L;
|
fromTime = toTime - hoursToFetch * 60 * 60 * 1000L;
|
||||||
endTime = toTime;
|
endTime = toTime;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
long now = System.currentTimeMillis();
|
final long now = System.currentTimeMillis();
|
||||||
|
|
||||||
// 2nd graph
|
// ------------------ 1st graph
|
||||||
// remove old data
|
Profiler.log(log, from + " - 1st graph - START", updateGUIStart);
|
||||||
iobGraph.getSeries().clear();
|
|
||||||
|
|
||||||
GraphData secondGraphData = new GraphData();
|
final GraphData graphData = new GraphData(bgGraph);
|
||||||
|
|
||||||
boolean useIobForScale = false;
|
// **** In range Area ****
|
||||||
boolean useCobForScale = false;
|
graphData.addInRangeArea(fromTime, endTime, lowLine, highLine);
|
||||||
boolean useDevForScale = false;
|
|
||||||
boolean useRatioForScale = false;
|
|
||||||
|
|
||||||
if (showIobView.isChecked()) {
|
// **** BG ****
|
||||||
useIobForScale = true;
|
if (showPrediction)
|
||||||
} else if (showCobView.isChecked()) {
|
graphData.addBgReadings(fromTime, toTime, lowLine, highLine, (DetermineBasalResultAMA) finalLastRun.constraintsProcessed);
|
||||||
useCobForScale = true;
|
else
|
||||||
} else if (showDeviationsView.isChecked()) {
|
graphData.addBgReadings(fromTime, toTime, lowLine, highLine, null);
|
||||||
useDevForScale = true;
|
|
||||||
} else if (showRatiosView.isChecked()) {
|
|
||||||
useRatioForScale = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (showIobView.isChecked())
|
// set manual x bounds to have nice steps
|
||||||
secondGraphData.addIob(iobGraph, fromTime, now, useIobForScale, 1d);
|
graphData.formatAxis(fromTime, endTime);
|
||||||
if (showCobView.isChecked())
|
|
||||||
secondGraphData.addCob(iobGraph, fromTime, now, useCobForScale, useCobForScale ? 1d : 0.5d);
|
|
||||||
if (showDeviationsView.isChecked())
|
|
||||||
secondGraphData.addDeviations(iobGraph, fromTime, now, useDevForScale, 1d);
|
|
||||||
if (showRatiosView.isChecked())
|
|
||||||
secondGraphData.addRatio(iobGraph, fromTime, now, useRatioForScale, 1d);
|
|
||||||
|
|
||||||
if (showIobView.isChecked() || showCobView.isChecked() || showDeviationsView.isChecked() || showRatiosView.isChecked()) {
|
// Treatments
|
||||||
iobGraph.setVisibility(View.VISIBLE);
|
graphData.addTreatments(fromTime, endTime);
|
||||||
} else {
|
|
||||||
iobGraph.setVisibility(View.GONE);
|
|
||||||
}
|
|
||||||
|
|
||||||
// remove old data from graph
|
// add basal data
|
||||||
bgGraph.getSeries().clear();
|
if (pump.getPumpDescription().isTempBasalCapable && showBasalsView.isChecked()) {
|
||||||
|
graphData.addBasals(fromTime, now, lowLine / graphData.maxY / 1.2d);
|
||||||
|
}
|
||||||
|
|
||||||
GraphData graphData = new GraphData();
|
// **** NOW line ****
|
||||||
|
graphData.addNowLine(now);
|
||||||
|
|
||||||
// **** In range Area ****
|
// ------------------ 2nd graph
|
||||||
graphData.addInRangeArea(bgGraph, fromTime, endTime, lowLine, highLine);
|
Profiler.log(log, from + " - 2nd graph - START", updateGUIStart);
|
||||||
|
|
||||||
// **** BG ****
|
final GraphData secondGraphData = new GraphData(iobGraph);
|
||||||
if (showPrediction)
|
|
||||||
graphData.addBgReadings(bgGraph, fromTime, toTime, lowLine, highLine, (DetermineBasalResultAMA) finalLastRun.constraintsProcessed);
|
|
||||||
else
|
|
||||||
graphData.addBgReadings(bgGraph, fromTime, toTime, lowLine, highLine, null);
|
|
||||||
|
|
||||||
// set manual x bounds to have nice steps
|
boolean useIobForScale = false;
|
||||||
graphData.formatAxis(bgGraph, fromTime, endTime);
|
boolean useCobForScale = false;
|
||||||
secondGraphData.formatAxis(iobGraph, fromTime, endTime);
|
boolean useDevForScale = false;
|
||||||
|
boolean useRatioForScale = false;
|
||||||
|
|
||||||
// Treatments
|
if (showIobView.isChecked()) {
|
||||||
graphData.addTreatments(bgGraph, fromTime, endTime);
|
useIobForScale = true;
|
||||||
|
} else if (showCobView.isChecked()) {
|
||||||
|
useCobForScale = true;
|
||||||
|
} else if (showDeviationsView.isChecked()) {
|
||||||
|
useDevForScale = true;
|
||||||
|
} else if (showRatiosView.isChecked()) {
|
||||||
|
useRatioForScale = true;
|
||||||
|
}
|
||||||
|
|
||||||
// add basal data
|
if (showIobView.isChecked())
|
||||||
if (pump.getPumpDescription().isTempBasalCapable && showBasalsView.isChecked()) {
|
secondGraphData.addIob(fromTime, now, useIobForScale, 1d);
|
||||||
graphData.addBasals(bgGraph, fromTime, now, lowLine / graphData.maxY / 1.2d);
|
if (showCobView.isChecked())
|
||||||
}
|
secondGraphData.addCob(fromTime, now, useCobForScale, useCobForScale ? 1d : 0.5d);
|
||||||
|
if (showDeviationsView.isChecked())
|
||||||
|
secondGraphData.addDeviations(fromTime, now, useDevForScale, 1d);
|
||||||
|
if (showRatiosView.isChecked())
|
||||||
|
secondGraphData.addRatio(fromTime, now, useRatioForScale, 1d);
|
||||||
|
|
||||||
// **** NOW line ****
|
// **** NOW line ****
|
||||||
graphData.addNowLine(bgGraph, now);
|
// set manual x bounds to have nice steps
|
||||||
secondGraphData.addNowLine(iobGraph, now);
|
secondGraphData.formatAxis(fromTime, endTime);
|
||||||
|
secondGraphData.addNowLine(now);
|
||||||
|
|
||||||
// finaly enforce drawing of graphs
|
// do GUI update
|
||||||
bgGraph.onDataChanged(false, false);
|
FragmentActivity activity = getActivity();
|
||||||
iobGraph.onDataChanged(false, false);
|
if (activity != null) {
|
||||||
|
activity.runOnUiThread(new Runnable() {
|
||||||
|
@Override
|
||||||
|
public void run() {
|
||||||
|
if (showIobView.isChecked() || showCobView.isChecked() || showDeviationsView.isChecked() || showRatiosView.isChecked()) {
|
||||||
|
iobGraph.setVisibility(View.VISIBLE);
|
||||||
|
} else {
|
||||||
|
iobGraph.setVisibility(View.GONE);
|
||||||
|
}
|
||||||
|
// finally enforce drawing of graphs
|
||||||
|
graphData.performUpdate();
|
||||||
|
secondGraphData.performUpdate();
|
||||||
|
Profiler.log(log, from + " - onDataChanged", updateGUIStart);
|
||||||
|
}
|
||||||
|
});
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}).start();
|
||||||
|
|
||||||
Profiler.log(log, from, updateGUIStart);
|
Profiler.log(log, from, updateGUIStart);
|
||||||
}
|
}
|
||||||
|
@ -1432,6 +1451,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void updateNotifications() {
|
void updateNotifications() {
|
||||||
|
|
|
@ -45,15 +45,18 @@ import info.nightscout.utils.Round;
|
||||||
|
|
||||||
public class GraphData {
|
public class GraphData {
|
||||||
|
|
||||||
public GraphData() {
|
private GraphView graph;
|
||||||
units = MainApp.getConfigBuilder().getProfileUnits();
|
|
||||||
}
|
|
||||||
|
|
||||||
public double maxY = 0;
|
public double maxY = 0;
|
||||||
private List<BgReading> bgReadingsArray;
|
private List<BgReading> bgReadingsArray;
|
||||||
private String units;
|
private String units;
|
||||||
|
private List<Series> series = new ArrayList<>();
|
||||||
|
|
||||||
public void addBgReadings(GraphView bgGraph, long fromTime, long toTime, double lowLine, double highLine, DetermineBasalResultAMA amaResult) {
|
public GraphData(GraphView graph) {
|
||||||
|
units = MainApp.getConfigBuilder().getProfileUnits();
|
||||||
|
this.graph = graph;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void addBgReadings(long fromTime, long toTime, double lowLine, double highLine, DetermineBasalResultAMA amaResult) {
|
||||||
double maxBgValue = 0d;
|
double maxBgValue = 0d;
|
||||||
bgReadingsArray = MainApp.getDbHelper().getBgreadingsDataFromTime(fromTime, true);
|
bgReadingsArray = MainApp.getDbHelper().getBgreadingsDataFromTime(fromTime, true);
|
||||||
List<DataPointWithLabelInterface> bgListArray = new ArrayList<>();
|
List<DataPointWithLabelInterface> bgListArray = new ArrayList<>();
|
||||||
|
@ -81,20 +84,18 @@ public class GraphData {
|
||||||
DataPointWithLabelInterface[] bg = new DataPointWithLabelInterface[bgListArray.size()];
|
DataPointWithLabelInterface[] bg = new DataPointWithLabelInterface[bgListArray.size()];
|
||||||
bg = bgListArray.toArray(bg);
|
bg = bgListArray.toArray(bg);
|
||||||
|
|
||||||
if (bg.length > 0) {
|
|
||||||
addSeriesWithoutInvalidate(bgGraph, new PointsWithLabelGraphSeries<>(bg));
|
|
||||||
}
|
|
||||||
|
|
||||||
maxY = maxBgValue;
|
maxY = maxBgValue;
|
||||||
// set manual y bounds to have nice steps
|
// set manual y bounds to have nice steps
|
||||||
bgGraph.getViewport().setMaxY(maxY);
|
graph.getViewport().setMaxY(maxY);
|
||||||
bgGraph.getViewport().setMinY(0);
|
graph.getViewport().setMinY(0);
|
||||||
bgGraph.getViewport().setYAxisBoundsManual(true);
|
graph.getViewport().setYAxisBoundsManual(true);
|
||||||
bgGraph.getGridLabelRenderer().setNumVerticalLabels(numOfVertLines);
|
graph.getGridLabelRenderer().setNumVerticalLabels(numOfVertLines);
|
||||||
|
|
||||||
|
addSeries(new PointsWithLabelGraphSeries<>(bg));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addInRangeArea(GraphView bgGraph, long fromTime, long toTime, double lowLine, double highLine) {
|
public void addInRangeArea(long fromTime, long toTime, double lowLine, double highLine) {
|
||||||
AreaGraphSeries<DoubleDataPoint> inRangeAreaSeries;
|
AreaGraphSeries<DoubleDataPoint> inRangeAreaSeries;
|
||||||
|
|
||||||
DoubleDataPoint[] inRangeAreaDataPoints = new DoubleDataPoint[]{
|
DoubleDataPoint[] inRangeAreaDataPoints = new DoubleDataPoint[]{
|
||||||
|
@ -102,14 +103,15 @@ public class GraphData {
|
||||||
new DoubleDataPoint(toTime, lowLine, highLine)
|
new DoubleDataPoint(toTime, lowLine, highLine)
|
||||||
};
|
};
|
||||||
inRangeAreaSeries = new AreaGraphSeries<>(inRangeAreaDataPoints);
|
inRangeAreaSeries = new AreaGraphSeries<>(inRangeAreaDataPoints);
|
||||||
addSeriesWithoutInvalidate(bgGraph, inRangeAreaSeries);
|
|
||||||
inRangeAreaSeries.setColor(0);
|
inRangeAreaSeries.setColor(0);
|
||||||
inRangeAreaSeries.setDrawBackground(true);
|
inRangeAreaSeries.setDrawBackground(true);
|
||||||
inRangeAreaSeries.setBackgroundColor(MainApp.sResources.getColor(R.color.inrangebackground));
|
inRangeAreaSeries.setBackgroundColor(MainApp.sResources.getColor(R.color.inrangebackground));
|
||||||
|
|
||||||
|
addSeries(inRangeAreaSeries);
|
||||||
}
|
}
|
||||||
|
|
||||||
// scale in % of vertical size (like 0.3)
|
// scale in % of vertical size (like 0.3)
|
||||||
public void addBasals(GraphView bgGraph, long fromTime, long toTime, double scale) {
|
public void addBasals(long fromTime, long toTime, double scale) {
|
||||||
LineGraphSeries<ScaledDataPoint> basalsLineSeries;
|
LineGraphSeries<ScaledDataPoint> basalsLineSeries;
|
||||||
LineGraphSeries<ScaledDataPoint> absoluteBasalsLineSeries;
|
LineGraphSeries<ScaledDataPoint> absoluteBasalsLineSeries;
|
||||||
LineGraphSeries<ScaledDataPoint> baseBasalsSeries;
|
LineGraphSeries<ScaledDataPoint> baseBasalsSeries;
|
||||||
|
@ -194,7 +196,7 @@ public class GraphData {
|
||||||
basalsLineSeries = new LineGraphSeries<>(basalLine);
|
basalsLineSeries = new LineGraphSeries<>(basalLine);
|
||||||
Paint paint = new Paint();
|
Paint paint = new Paint();
|
||||||
paint.setStyle(Paint.Style.STROKE);
|
paint.setStyle(Paint.Style.STROKE);
|
||||||
paint.setStrokeWidth(MainApp.instance().getApplicationContext().getResources().getDisplayMetrics().scaledDensity*2);
|
paint.setStrokeWidth(MainApp.instance().getApplicationContext().getResources().getDisplayMetrics().scaledDensity * 2);
|
||||||
paint.setPathEffect(new DashPathEffect(new float[]{2, 4}, 0));
|
paint.setPathEffect(new DashPathEffect(new float[]{2, 4}, 0));
|
||||||
paint.setColor(MainApp.sResources.getColor(R.color.basal));
|
paint.setColor(MainApp.sResources.getColor(R.color.basal));
|
||||||
basalsLineSeries.setCustomPaint(paint);
|
basalsLineSeries.setCustomPaint(paint);
|
||||||
|
@ -204,19 +206,19 @@ public class GraphData {
|
||||||
absoluteBasalsLineSeries = new LineGraphSeries<>(absoluteBasalLine);
|
absoluteBasalsLineSeries = new LineGraphSeries<>(absoluteBasalLine);
|
||||||
Paint absolutePaint = new Paint();
|
Paint absolutePaint = new Paint();
|
||||||
absolutePaint.setStyle(Paint.Style.STROKE);
|
absolutePaint.setStyle(Paint.Style.STROKE);
|
||||||
absolutePaint.setStrokeWidth(MainApp.instance().getApplicationContext().getResources().getDisplayMetrics().scaledDensity*2);
|
absolutePaint.setStrokeWidth(MainApp.instance().getApplicationContext().getResources().getDisplayMetrics().scaledDensity * 2);
|
||||||
absolutePaint.setColor(MainApp.sResources.getColor(R.color.basal));
|
absolutePaint.setColor(MainApp.sResources.getColor(R.color.basal));
|
||||||
absoluteBasalsLineSeries.setCustomPaint(absolutePaint);
|
absoluteBasalsLineSeries.setCustomPaint(absolutePaint);
|
||||||
|
|
||||||
basalScale.setMultiplier(maxY * scale / maxBasalValueFound);
|
basalScale.setMultiplier(maxY * scale / maxBasalValueFound);
|
||||||
|
|
||||||
addSeriesWithoutInvalidate(bgGraph, baseBasalsSeries);
|
addSeries(baseBasalsSeries);
|
||||||
addSeriesWithoutInvalidate(bgGraph, tempBasalsSeries);
|
addSeries(tempBasalsSeries);
|
||||||
addSeriesWithoutInvalidate(bgGraph, basalsLineSeries);
|
addSeries(basalsLineSeries);
|
||||||
addSeriesWithoutInvalidate(bgGraph, absoluteBasalsLineSeries);
|
addSeries(absoluteBasalsLineSeries);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void addTreatments(GraphView bgGraph, long fromTime, long endTime) {
|
public void addTreatments(long fromTime, long endTime) {
|
||||||
List<DataPointWithLabelInterface> filteredTreatments = new ArrayList<>();
|
List<DataPointWithLabelInterface> filteredTreatments = new ArrayList<>();
|
||||||
|
|
||||||
List<Treatment> treatments = MainApp.getConfigBuilder().getTreatmentsFromHistory();
|
List<Treatment> treatments = MainApp.getConfigBuilder().getTreatmentsFromHistory();
|
||||||
|
@ -262,9 +264,7 @@ public class GraphData {
|
||||||
|
|
||||||
DataPointWithLabelInterface[] treatmentsArray = new DataPointWithLabelInterface[filteredTreatments.size()];
|
DataPointWithLabelInterface[] treatmentsArray = new DataPointWithLabelInterface[filteredTreatments.size()];
|
||||||
treatmentsArray = filteredTreatments.toArray(treatmentsArray);
|
treatmentsArray = filteredTreatments.toArray(treatmentsArray);
|
||||||
if (treatmentsArray.length > 0) {
|
addSeries(new PointsWithLabelGraphSeries<>(treatmentsArray));
|
||||||
addSeriesWithoutInvalidate(bgGraph, new PointsWithLabelGraphSeries<>(treatmentsArray));
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
double getNearestBg(long date) {
|
double getNearestBg(long date) {
|
||||||
|
@ -279,7 +279,7 @@ public class GraphData {
|
||||||
}
|
}
|
||||||
|
|
||||||
// scale in % of vertical size (like 0.3)
|
// scale in % of vertical size (like 0.3)
|
||||||
public void addIob(GraphView graph, long fromTime, long toTime, boolean useForScale, double scale) {
|
public void addIob(long fromTime, long toTime, boolean useForScale, double scale) {
|
||||||
FixedLineGraphSeries<ScaledDataPoint> iobSeries;
|
FixedLineGraphSeries<ScaledDataPoint> iobSeries;
|
||||||
List<ScaledDataPoint> iobArray = new ArrayList<>();
|
List<ScaledDataPoint> iobArray = new ArrayList<>();
|
||||||
Double maxIobValueFound = 0d;
|
Double maxIobValueFound = 0d;
|
||||||
|
@ -310,11 +310,11 @@ public class GraphData {
|
||||||
|
|
||||||
iobScale.setMultiplier(maxY * scale / maxIobValueFound);
|
iobScale.setMultiplier(maxY * scale / maxIobValueFound);
|
||||||
|
|
||||||
addSeriesWithoutInvalidate(graph, iobSeries);
|
addSeries(iobSeries);
|
||||||
}
|
}
|
||||||
|
|
||||||
// scale in % of vertical size (like 0.3)
|
// scale in % of vertical size (like 0.3)
|
||||||
public void addCob(GraphView graph, long fromTime, long toTime, boolean useForScale, double scale) {
|
public void addCob(long fromTime, long toTime, boolean useForScale, double scale) {
|
||||||
FixedLineGraphSeries<ScaledDataPoint> cobSeries;
|
FixedLineGraphSeries<ScaledDataPoint> cobSeries;
|
||||||
List<ScaledDataPoint> cobArray = new ArrayList<>();
|
List<ScaledDataPoint> cobArray = new ArrayList<>();
|
||||||
Double maxCobValueFound = 0d;
|
Double maxCobValueFound = 0d;
|
||||||
|
@ -349,11 +349,11 @@ public class GraphData {
|
||||||
|
|
||||||
cobScale.setMultiplier(maxY * scale / maxCobValueFound);
|
cobScale.setMultiplier(maxY * scale / maxCobValueFound);
|
||||||
|
|
||||||
addSeriesWithoutInvalidate(graph, cobSeries);
|
addSeries(cobSeries);
|
||||||
}
|
}
|
||||||
|
|
||||||
// scale in % of vertical size (like 0.3)
|
// scale in % of vertical size (like 0.3)
|
||||||
public void addDeviations(GraphView graph, long fromTime, long toTime, boolean useForScale, double scale) {
|
public void addDeviations(long fromTime, long toTime, boolean useForScale, double scale) {
|
||||||
class DeviationDataPoint extends ScaledDataPoint {
|
class DeviationDataPoint extends ScaledDataPoint {
|
||||||
public int color;
|
public int color;
|
||||||
|
|
||||||
|
@ -396,11 +396,11 @@ public class GraphData {
|
||||||
|
|
||||||
devScale.setMultiplier(maxY * scale / maxDevValueFound);
|
devScale.setMultiplier(maxY * scale / maxDevValueFound);
|
||||||
|
|
||||||
addSeriesWithoutInvalidate(graph, devSeries);
|
addSeries(devSeries);
|
||||||
}
|
}
|
||||||
|
|
||||||
// scale in % of vertical size (like 0.3)
|
// scale in % of vertical size (like 0.3)
|
||||||
public void addRatio(GraphView graph, long fromTime, long toTime, boolean useForScale, double scale) {
|
public void addRatio(long fromTime, long toTime, boolean useForScale, double scale) {
|
||||||
LineGraphSeries<DataPoint> ratioSeries;
|
LineGraphSeries<DataPoint> ratioSeries;
|
||||||
List<DataPoint> ratioArray = new ArrayList<>();
|
List<DataPoint> ratioArray = new ArrayList<>();
|
||||||
Double maxRatioValueFound = 0d;
|
Double maxRatioValueFound = 0d;
|
||||||
|
@ -426,11 +426,11 @@ public class GraphData {
|
||||||
|
|
||||||
ratioScale.setMultiplier(maxY * scale / maxRatioValueFound);
|
ratioScale.setMultiplier(maxY * scale / maxRatioValueFound);
|
||||||
|
|
||||||
addSeriesWithoutInvalidate(graph, ratioSeries);
|
addSeries(ratioSeries);
|
||||||
}
|
}
|
||||||
|
|
||||||
// scale in % of vertical size (like 0.3)
|
// scale in % of vertical size (like 0.3)
|
||||||
public void addNowLine(GraphView graph, long now) {
|
public void addNowLine(long now) {
|
||||||
LineGraphSeries<DataPoint> seriesNow;
|
LineGraphSeries<DataPoint> seriesNow;
|
||||||
DataPoint[] nowPoints = new DataPoint[]{
|
DataPoint[] nowPoints = new DataPoint[]{
|
||||||
new DataPoint(now, 0),
|
new DataPoint(now, 0),
|
||||||
|
@ -447,10 +447,10 @@ public class GraphData {
|
||||||
paint.setColor(Color.WHITE);
|
paint.setColor(Color.WHITE);
|
||||||
seriesNow.setCustomPaint(paint);
|
seriesNow.setCustomPaint(paint);
|
||||||
|
|
||||||
addSeriesWithoutInvalidate(graph, seriesNow);
|
addSeries(seriesNow);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void formatAxis(GraphView graph, long fromTime, long endTime) {
|
public void formatAxis(long fromTime, long endTime) {
|
||||||
graph.getViewport().setMaxX(endTime);
|
graph.getViewport().setMaxX(endTime);
|
||||||
graph.getViewport().setMinX(fromTime);
|
graph.getViewport().setMinX(fromTime);
|
||||||
graph.getViewport().setXAxisBoundsManual(true);
|
graph.getViewport().setXAxisBoundsManual(true);
|
||||||
|
@ -458,11 +458,23 @@ public class GraphData {
|
||||||
graph.getGridLabelRenderer().setNumHorizontalLabels(7); // only 7 because of the space
|
graph.getGridLabelRenderer().setNumHorizontalLabels(7); // only 7 because of the space
|
||||||
}
|
}
|
||||||
|
|
||||||
private void addSeriesWithoutInvalidate(GraphView bgGraph, Series s) {
|
private void addSeries(Series s) {
|
||||||
if (!s.isEmpty()) {
|
series.add(s);
|
||||||
s.onGraphViewAttached(bgGraph);
|
|
||||||
bgGraph.getSeries().add(s);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void performUpdate() {
|
||||||
|
// clear old data
|
||||||
|
graph.getSeries().clear();
|
||||||
|
|
||||||
|
// add precalculated series
|
||||||
|
for (Series s: series) {
|
||||||
|
if (!s.isEmpty()) {
|
||||||
|
s.onGraphViewAttached(graph);
|
||||||
|
graph.getSeries().add(s);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
// draw it
|
||||||
|
graph.onDataChanged(false, false);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -57,6 +57,8 @@ public class Notification {
|
||||||
public static final int BG_READINGS_MISSED = 27;
|
public static final int BG_READINGS_MISSED = 27;
|
||||||
public static final int UNSUPPORTED_FIRMWARE = 28;
|
public static final int UNSUPPORTED_FIRMWARE = 28;
|
||||||
public static final int MINIMAL_BASAL_VALUE_REPLACED = 29;
|
public static final int MINIMAL_BASAL_VALUE_REPLACED = 29;
|
||||||
|
public static final int BASAL_PROFILE_NOT_ALIGNED_TO_HOURS = 30;
|
||||||
|
public static final int ZERO_VALUE_IN_PROFILE = 31;
|
||||||
|
|
||||||
public int id;
|
public int id;
|
||||||
public Date date;
|
public Date date;
|
||||||
|
|
|
@ -162,9 +162,6 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
|
||||||
baseic[i] = SP.getDouble(SETTINGS_PREFIX + "baseic" + i, baseic[i]);
|
baseic[i] = SP.getDouble(SETTINGS_PREFIX + "baseic" + i, baseic[i]);
|
||||||
baseisf[i] = SP.getDouble(SETTINGS_PREFIX + "baseisf" + i, baseisf[i]);
|
baseisf[i] = SP.getDouble(SETTINGS_PREFIX + "baseisf" + i, baseisf[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
createConvertedProfile();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public String externallySetParameters(int timeshift, int percentage) {
|
public String externallySetParameters(int timeshift, int percentage) {
|
||||||
|
@ -347,6 +344,9 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProfileStore getProfile() {
|
public ProfileStore getProfile() {
|
||||||
|
if (convertedProfile == null)
|
||||||
|
createConvertedProfile();
|
||||||
|
|
||||||
performLimitCheck();
|
performLimitCheck();
|
||||||
return convertedProfile;
|
return convertedProfile;
|
||||||
}
|
}
|
||||||
|
@ -358,6 +358,9 @@ public class CircadianPercentageProfilePlugin implements PluginBase, ProfileInte
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getProfileName() {
|
public String getProfileName() {
|
||||||
|
if (convertedProfile == null)
|
||||||
|
createConvertedProfile();
|
||||||
|
|
||||||
performLimitCheck();
|
performLimitCheck();
|
||||||
return convertedProfileName;
|
return convertedProfileName;
|
||||||
}
|
}
|
||||||
|
|
|
@ -178,7 +178,6 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface {
|
||||||
} catch (JSONException ignored) {
|
} catch (JSONException ignored) {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
createConvertedProfile();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -244,6 +243,8 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProfileStore getProfile() {
|
public ProfileStore getProfile() {
|
||||||
|
if (convertedProfile == null)
|
||||||
|
createConvertedProfile();
|
||||||
return convertedProfile;
|
return convertedProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -254,6 +255,8 @@ public class LocalProfilePlugin implements PluginBase, ProfileInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public String getProfileName() {
|
public String getProfileName() {
|
||||||
|
if (convertedProfile == null)
|
||||||
|
createConvertedProfile();
|
||||||
return DecimalFormatter.to2Decimal(convertedProfile.getDefaultProfile().percentageBasalSum()) + "U ";
|
return DecimalFormatter.to2Decimal(convertedProfile.getDefaultProfile().percentageBasalSum()) + "U ";
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -13,9 +13,9 @@ import info.nightscout.androidaps.Config;
|
||||||
import info.nightscout.androidaps.Constants;
|
import info.nightscout.androidaps.Constants;
|
||||||
import info.nightscout.androidaps.MainApp;
|
import info.nightscout.androidaps.MainApp;
|
||||||
import info.nightscout.androidaps.R;
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.androidaps.data.ProfileStore;
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
import info.nightscout.androidaps.interfaces.ProfileInterface;
|
import info.nightscout.androidaps.interfaces.ProfileInterface;
|
||||||
import info.nightscout.androidaps.data.ProfileStore;
|
|
||||||
import info.nightscout.utils.SP;
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -28,7 +28,7 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
|
||||||
|
|
||||||
public static SimpleProfilePlugin getPlugin() {
|
public static SimpleProfilePlugin getPlugin() {
|
||||||
if (simpleProfilePlugin == null)
|
if (simpleProfilePlugin == null)
|
||||||
simpleProfilePlugin = new SimpleProfilePlugin();
|
simpleProfilePlugin = new SimpleProfilePlugin();
|
||||||
return simpleProfilePlugin;
|
return simpleProfilePlugin;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -146,7 +146,6 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
|
||||||
basal = SP.getDouble("SimpleProfile" + "basal", 1d);
|
basal = SP.getDouble("SimpleProfile" + "basal", 1d);
|
||||||
targetLow = SP.getDouble("SimpleProfile" + "targetlow", 80d);
|
targetLow = SP.getDouble("SimpleProfile" + "targetlow", 80d);
|
||||||
targetHigh = SP.getDouble("SimpleProfile" + "targethigh", 120d);
|
targetHigh = SP.getDouble("SimpleProfile" + "targethigh", 120d);
|
||||||
createConvertedProfile();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|
@ -211,6 +210,8 @@ public class SimpleProfilePlugin implements PluginBase, ProfileInterface {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public ProfileStore getProfile() {
|
public ProfileStore getProfile() {
|
||||||
|
if (convertedProfile == null)
|
||||||
|
createConvertedProfile();
|
||||||
return convertedProfile;
|
return convertedProfile;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -149,12 +149,13 @@ public class BGSourceFragment extends SubscriberFragment {
|
||||||
builder.setMessage(MainApp.sResources.getString(R.string.removerecord) + "\n" + DateUtil.dateAndTimeString(bgReading.date) + "\n" + bgReading.valueToUnitsToString(profile.getUnits()));
|
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() {
|
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
final String _id = bgReading._id;
|
/* final String _id = bgReading._id;
|
||||||
if (NSUpload.isIdValid(_id)) {
|
if (NSUpload.isIdValid(_id)) {
|
||||||
NSUpload.removeFoodFromNS(_id);
|
NSUpload.removeFoodFromNS(_id);
|
||||||
} else {
|
} else {
|
||||||
UploadQueue.removeID("dbAdd", _id);
|
UploadQueue.removeID("dbAdd", _id);
|
||||||
}
|
}
|
||||||
|
*/
|
||||||
bgReading.isValid = false;
|
bgReading.isValid = false;
|
||||||
MainApp.getDbHelper().update(bgReading);
|
MainApp.getDbHelper().update(bgReading);
|
||||||
updateGUI();
|
updateGUI();
|
||||||
|
|
|
@ -807,5 +807,7 @@
|
||||||
<string name="closedmodeenabled">Closed mode enabled</string>
|
<string name="closedmodeenabled">Closed mode enabled</string>
|
||||||
<string name="maxiobset">Maximal IOB set properly</string>
|
<string name="maxiobset">Maximal IOB set properly</string>
|
||||||
<string name="hasbgdata">BG available from selected source</string>
|
<string name="hasbgdata">BG available from selected source</string>
|
||||||
|
<string name="basalprofilenotaligned">Basal values not aligned to hours</string>
|
||||||
|
<string name="zerovalueinprofile">Zero value in profile</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue