From 724a041341944d2ba7d53829c61d7ea7b816006e Mon Sep 17 00:00:00 2001 From: Milos Kozak Date: Wed, 4 Jan 2017 22:33:17 +0100 Subject: [PATCH] refactor classes --- .../androidaps/data/GlucoseStatus.java | 51 +++++++++++++++++++ .../{plugins/OpenAPSMA => data}/IobTotal.java | 2 +- .../androidaps/db/DatabaseHelper.java | 45 +--------------- .../nightscout/androidaps/db/TempBasal.java | 2 +- .../interfaces/TempBasalsInterface.java | 2 +- .../interfaces/TreatmentsInterface.java | 2 +- .../DetermineBasalAdapterAMAJS.java | 9 ++-- .../OpenAPSAMA/DetermineBasalResultAMA.java | 2 +- .../plugins/OpenAPSAMA/OpenAPSAMAPlugin.java | 6 +-- .../OpenAPSMA/DetermineBasalAdapterMAJS.java | 8 ++- .../OpenAPSMA/DetermineBasalResultMA.java | 1 + .../plugins/OpenAPSMA/OpenAPSMAPlugin.java | 5 +- .../Overview/Dialogs/WizardDialog.java | 2 +- .../plugins/Overview/OverviewFragment.java | 6 +-- .../SmsCommunicatorPlugin.java | 6 +-- .../TempBasals/TempBasalsFragment.java | 2 +- .../plugins/TempBasals/TempBasalsPlugin.java | 2 +- .../plugins/Treatments/TreatmentsPlugin.java | 2 +- .../wearintegration/WatchUpdaterService.java | 10 ++-- .../PersistentNotificationPlugin.java | 6 +-- .../info/nightscout/utils/BolusWizard.java | 2 +- 21 files changed, 89 insertions(+), 84 deletions(-) create mode 100644 app/src/main/java/info/nightscout/androidaps/data/GlucoseStatus.java rename app/src/main/java/info/nightscout/androidaps/{plugins/OpenAPSMA => data}/IobTotal.java (97%) diff --git a/app/src/main/java/info/nightscout/androidaps/data/GlucoseStatus.java b/app/src/main/java/info/nightscout/androidaps/data/GlucoseStatus.java new file mode 100644 index 0000000000..74bd0fa237 --- /dev/null +++ b/app/src/main/java/info/nightscout/androidaps/data/GlucoseStatus.java @@ -0,0 +1,51 @@ +package info.nightscout.androidaps.data; + +import android.text.Html; +import android.text.Spanned; + +import info.nightscout.androidaps.MainApp; +import info.nightscout.androidaps.R; +import info.nightscout.androidaps.db.DatabaseHelper; +import info.nightscout.utils.DecimalFormatter; +import info.nightscout.utils.Round; + +/** + * Created by mike on 04.01.2017. + */ + +public class GlucoseStatus { + public double glucose = 0d; + public double delta = 0d; + public double avgdelta = 0d; + public double short_avgdelta = 0d; // TODO: add calculation for AMA + public double long_avgdelta = 0d; // TODO: add calculation for AMA + + @Override + public String toString() { + return MainApp.sResources.getString(R.string.glucose) + " " + DecimalFormatter.to0Decimal(glucose) + " mg/dl\n" + + MainApp.sResources.getString(R.string.delta) + " " + DecimalFormatter.to0Decimal(delta) + " mg/dl\n" + + MainApp.sResources.getString(R.string.avgdelta) + " " + DecimalFormatter.to2Decimal(avgdelta) + " mg/dl"; + } + + public Spanned toSpanned() { + return Html.fromHtml("" + MainApp.sResources.getString(R.string.glucose) + ": " + DecimalFormatter.to0Decimal(glucose) + " mg/dl
" + + "" + MainApp.sResources.getString(R.string.delta) + ": " + DecimalFormatter.to0Decimal(delta) + " mg/dl
" + + "" + MainApp.sResources.getString(R.string.avgdelta) + ": " + DecimalFormatter.to2Decimal(avgdelta) + " mg/dl"); + } + + public GlucoseStatus() { + } + + public GlucoseStatus(Double glucose, Double delta, Double avgdelta) { + this.glucose = glucose; + this.delta = delta; + this.avgdelta = avgdelta; + } + + public GlucoseStatus round() { + this.glucose = Round.roundTo(this.glucose, 0.1); + this.delta = Round.roundTo(this.delta, 0.01); + this.avgdelta = Round.roundTo(this.avgdelta, 0.01); + return this; + } +} diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/IobTotal.java b/app/src/main/java/info/nightscout/androidaps/data/IobTotal.java similarity index 97% rename from app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/IobTotal.java rename to app/src/main/java/info/nightscout/androidaps/data/IobTotal.java index ecd4ca1e82..8a50abc061 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/IobTotal.java +++ b/app/src/main/java/info/nightscout/androidaps/data/IobTotal.java @@ -1,4 +1,4 @@ -package info.nightscout.androidaps.plugins.OpenAPSMA; +package info.nightscout.androidaps.data; import org.json.JSONException; import org.json.JSONObject; diff --git a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java index 28bd2faf89..2b70a41fdb 100644 --- a/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java +++ b/app/src/main/java/info/nightscout/androidaps/db/DatabaseHelper.java @@ -3,11 +3,7 @@ package info.nightscout.androidaps.db; import android.content.Context; import android.database.DatabaseUtils; import android.database.sqlite.SQLiteDatabase; -import android.os.Parcel; -import android.os.Parcelable; import android.support.annotation.Nullable; -import android.text.Html; -import android.text.Spanned; import com.j256.ormlite.android.apptools.OrmLiteSqliteOpenHelper; import com.j256.ormlite.dao.Dao; @@ -27,9 +23,7 @@ import java.util.List; import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainApp; -import info.nightscout.androidaps.R; -import info.nightscout.utils.DecimalFormatter; -import info.nightscout.utils.Round; +import info.nightscout.androidaps.data.GlucoseStatus; public class DatabaseHelper extends OrmLiteSqliteOpenHelper { private static Logger log = LoggerFactory.getLogger(DatabaseHelper.class); @@ -209,43 +203,6 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper { /* * Returns glucose_status for openAPS or null if no actual data available */ - public static class GlucoseStatus { - public double glucose = 0d; - public double delta = 0d; - public double avgdelta = 0d; - public double short_avgdelta = 0d; // TODO: add calculation for AMA - public double long_avgdelta = 0d; // TODO: add calculation for AMA - - @Override - public String toString() { - return MainApp.sResources.getString(R.string.glucose) + " " + DecimalFormatter.to0Decimal(glucose) + " mg/dl\n" + - MainApp.sResources.getString(R.string.delta) + " " + DecimalFormatter.to0Decimal(delta) + " mg/dl\n" + - MainApp.sResources.getString(R.string.avgdelta) + " " + DecimalFormatter.to2Decimal(avgdelta) + " mg/dl"; - } - - public Spanned toSpanned() { - return Html.fromHtml("" + MainApp.sResources.getString(R.string.glucose) + ": " + DecimalFormatter.to0Decimal(glucose) + " mg/dl
" + - "" + MainApp.sResources.getString(R.string.delta) + ": " + DecimalFormatter.to0Decimal(delta) + " mg/dl
" + - "" + MainApp.sResources.getString(R.string.avgdelta) + ": " + DecimalFormatter.to2Decimal(avgdelta) + " mg/dl"); - } - - public GlucoseStatus() { - } - - public GlucoseStatus(Double glucose, Double delta, Double avgdelta) { - this.glucose = glucose; - this.delta = delta; - this.avgdelta = avgdelta; - } - - public GlucoseStatus round() { - this.glucose = Round.roundTo(this.glucose, 0.1); - this.delta = Round.roundTo(this.delta, 0.01); - this.avgdelta = Round.roundTo(this.avgdelta, 0.01); - return this; - } - } - @Nullable public GlucoseStatus getGlucoseStatusData() { GlucoseStatus result = new GlucoseStatus(); diff --git a/app/src/main/java/info/nightscout/androidaps/db/TempBasal.java b/app/src/main/java/info/nightscout/androidaps/db/TempBasal.java index 835fec8a59..6e45ab257f 100644 --- a/app/src/main/java/info/nightscout/androidaps/db/TempBasal.java +++ b/app/src/main/java/info/nightscout/androidaps/db/TempBasal.java @@ -12,7 +12,7 @@ import java.util.Date; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.data.Iob; -import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal; +import info.nightscout.androidaps.data.IobTotal; import info.nightscout.client.data.NSProfile; import info.nightscout.utils.DecimalFormatter; diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/TempBasalsInterface.java b/app/src/main/java/info/nightscout/androidaps/interfaces/TempBasalsInterface.java index 0abb176734..314cbd8161 100644 --- a/app/src/main/java/info/nightscout/androidaps/interfaces/TempBasalsInterface.java +++ b/app/src/main/java/info/nightscout/androidaps/interfaces/TempBasalsInterface.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.interfaces; import java.util.Date; import info.nightscout.androidaps.db.TempBasal; -import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal; +import info.nightscout.androidaps.data.IobTotal; /** * Created by mike on 14.06.2016. diff --git a/app/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java b/app/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java index 0b008d1a4d..3eef0af344 100644 --- a/app/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java +++ b/app/src/main/java/info/nightscout/androidaps/interfaces/TreatmentsInterface.java @@ -3,7 +3,7 @@ package info.nightscout.androidaps.interfaces; import java.util.List; import info.nightscout.androidaps.db.Treatment; -import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal; +import info.nightscout.androidaps.data.IobTotal; import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; /** diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/DetermineBasalAdapterAMAJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/DetermineBasalAdapterAMAJS.java index 7e0d28d9e3..1f7d9e9254 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/DetermineBasalAdapterAMAJS.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/DetermineBasalAdapterAMAJS.java @@ -1,8 +1,5 @@ package info.nightscout.androidaps.plugins.OpenAPSAMA; -import android.os.Parcel; -import android.os.Parcelable; - import com.eclipsesource.v8.JavaVoidCallback; import com.eclipsesource.v8.V8; import com.eclipsesource.v8.V8Array; @@ -16,10 +13,10 @@ import org.slf4j.LoggerFactory; import java.io.IOException; import info.nightscout.androidaps.Config; +import info.nightscout.androidaps.data.GlucoseStatus; import info.nightscout.androidaps.interfaces.PumpInterface; -import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.plugins.Loop.ScriptReader; -import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal; +import info.nightscout.androidaps.data.IobTotal; import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; import info.nightscout.client.data.NSProfile; @@ -248,7 +245,7 @@ public class DetermineBasalAdapterAMAJS { double targetBg, PumpInterface pump, IobTotal iobData, - DatabaseHelper.GlucoseStatus glucoseStatus, + GlucoseStatus glucoseStatus, TreatmentsPlugin.MealData mealData, JSONObject autosensData) { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/DetermineBasalResultAMA.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/DetermineBasalResultAMA.java index 5accd36ff6..148e529921 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/DetermineBasalResultAMA.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/DetermineBasalResultAMA.java @@ -9,7 +9,7 @@ import org.json.JSONException; import org.json.JSONObject; import info.nightscout.androidaps.plugins.Loop.APSResult; -import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal; +import info.nightscout.androidaps.data.IobTotal; public class DetermineBasalResultAMA extends APSResult { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java index 06544b79ca..cc940c03b3 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSAMA/OpenAPSAMAPlugin.java @@ -14,7 +14,7 @@ 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.DatabaseHelper; +import info.nightscout.androidaps.data.GlucoseStatus; import info.nightscout.androidaps.interfaces.APSInterface; import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PumpInterface; @@ -22,7 +22,7 @@ import info.nightscout.androidaps.interfaces.TempBasalsInterface; import info.nightscout.androidaps.interfaces.TreatmentsInterface; import info.nightscout.androidaps.plugins.Loop.APSResult; import info.nightscout.androidaps.plugins.Loop.ScriptReader; -import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal; +import info.nightscout.androidaps.data.IobTotal; import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateGui; import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSUpdateResultGui; import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; @@ -107,7 +107,7 @@ public class OpenAPSAMAPlugin implements PluginBase, APSInterface { return; } - DatabaseHelper.GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData(); + GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData(); NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile(); PumpInterface pump = MainApp.getConfigBuilder(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/DetermineBasalAdapterMAJS.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/DetermineBasalAdapterMAJS.java index 2598111dd5..6512754b75 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/DetermineBasalAdapterMAJS.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/DetermineBasalAdapterMAJS.java @@ -1,8 +1,5 @@ package info.nightscout.androidaps.plugins.OpenAPSMA; -import android.os.Parcel; -import android.os.Parcelable; - import com.eclipsesource.v8.JavaVoidCallback; import com.eclipsesource.v8.V8; import com.eclipsesource.v8.V8Array; @@ -16,8 +13,9 @@ import org.slf4j.LoggerFactory; import java.io.IOException; import info.nightscout.androidaps.Config; +import info.nightscout.androidaps.data.GlucoseStatus; +import info.nightscout.androidaps.data.IobTotal; import info.nightscout.androidaps.interfaces.PumpInterface; -import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.plugins.Loop.ScriptReader; import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin; import info.nightscout.client.data.NSProfile; @@ -226,7 +224,7 @@ public class DetermineBasalAdapterMAJS { double targetBg, PumpInterface pump, IobTotal iobData, - DatabaseHelper.GlucoseStatus glucoseStatus, + GlucoseStatus glucoseStatus, TreatmentsPlugin.MealData mealData) { String units = profile.getUnits(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/DetermineBasalResultMA.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/DetermineBasalResultMA.java index 04756cb434..662cf82600 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/DetermineBasalResultMA.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/DetermineBasalResultMA.java @@ -8,6 +8,7 @@ import com.eclipsesource.v8.V8Object; import org.json.JSONException; import org.json.JSONObject; +import info.nightscout.androidaps.data.IobTotal; import info.nightscout.androidaps.plugins.Loop.APSResult; public class DetermineBasalResultMA extends APSResult { diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java index 359d752f02..74d72192b8 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/OpenAPSMA/OpenAPSMAPlugin.java @@ -14,7 +14,8 @@ 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.DatabaseHelper; +import info.nightscout.androidaps.data.GlucoseStatus; +import info.nightscout.androidaps.data.IobTotal; import info.nightscout.androidaps.interfaces.APSInterface; import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PumpInterface; @@ -106,7 +107,7 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface { return; } - DatabaseHelper.GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData(); + GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData(); NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile(); PumpInterface pump = MainApp.getConfigBuilder(); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java index d6f1e8c6bb..4d83f0a298 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/Dialogs/WizardDialog.java @@ -41,7 +41,7 @@ import info.nightscout.androidaps.db.BgReading; import info.nightscout.androidaps.interfaces.TempBasalsInterface; import info.nightscout.androidaps.interfaces.TreatmentsInterface; import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; -import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal; +import info.nightscout.androidaps.data.IobTotal; import info.nightscout.client.data.NSProfile; import info.nightscout.utils.BolusWizard; import info.nightscout.utils.DateUtil; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java index 5cfd090a0c..9be30a48e3 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Overview/OverviewFragment.java @@ -50,9 +50,9 @@ import info.nightscout.androidaps.Config; import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; +import info.nightscout.androidaps.data.GlucoseStatus; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.db.BgReading; -import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.db.TempBasal; import info.nightscout.androidaps.db.Treatment; import info.nightscout.androidaps.events.EventInitializationChanged; @@ -70,7 +70,7 @@ import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin; import info.nightscout.androidaps.plugins.Loop.LoopPlugin; import info.nightscout.androidaps.plugins.Loop.events.EventNewOpenLoopNotification; import info.nightscout.androidaps.plugins.Objectives.ObjectivesPlugin; -import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal; +import info.nightscout.androidaps.data.IobTotal; import info.nightscout.androidaps.plugins.Overview.Dialogs.NewTreatmentDialog; import info.nightscout.androidaps.plugins.Overview.Dialogs.WizardDialog; import info.nightscout.androidaps.plugins.Overview.GraphSeriesExtension.PointsWithLabelGraphSeries; @@ -578,7 +578,7 @@ public class OverviewFragment extends Fragment { if (lastBG != null && bgView != null) { bgView.setText(lastBG.valueToUnitsToString(profile.getUnits())); arrowView.setText(lastBG.directionToSymbol()); - DatabaseHelper.GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData(); + GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData(); if (glucoseStatus != null){ deltaView.setText("Δ " + NSProfile.toUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) + " " + units); avgdeltaView.setText("øΔ " + NSProfile.toUnitsString(glucoseStatus.avgdelta, glucoseStatus.avgdelta * Constants.MGDL_TO_MMOLL, units) + " " + units); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java index 4f65995948..db2b00c715 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/SmsCommunicator/SmsCommunicatorPlugin.java @@ -21,16 +21,16 @@ import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; import info.nightscout.androidaps.Services.Intents; +import info.nightscout.androidaps.data.GlucoseStatus; import info.nightscout.androidaps.data.PumpEnactResult; import info.nightscout.androidaps.db.BgReading; -import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PumpInterface; import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin; import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPlugin; import info.nightscout.androidaps.plugins.Loop.LoopPlugin; -import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal; +import info.nightscout.androidaps.data.IobTotal; import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventNewSMS; import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventSmsCommunicatorUpdateGui; import info.nightscout.client.data.NSProfile; @@ -213,7 +213,7 @@ public class SmsCommunicatorPlugin implements PluginBase { } else if (lastBG != null) { reply = MainApp.sResources.getString(R.string.sms_lastbg) + " " + lastBG.valueToUnitsToString(units) + " " + String.format(MainApp.sResources.getString(R.string.sms_minago), agoMin) + ", "; } - DatabaseHelper.GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData(); + GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData(); if (glucoseStatus != null) reply += MainApp.sResources.getString(R.string.sms_delta) + " " + NSProfile.toUnitsString(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, units) + " " + units + ", "; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/TempBasals/TempBasalsFragment.java b/app/src/main/java/info/nightscout/androidaps/plugins/TempBasals/TempBasalsFragment.java index f194c3a53a..143e91ea31 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/TempBasals/TempBasalsFragment.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/TempBasals/TempBasalsFragment.java @@ -26,7 +26,7 @@ import info.nightscout.androidaps.R; import info.nightscout.androidaps.db.TempBasal; import info.nightscout.androidaps.events.EventTempBasalChange; import info.nightscout.androidaps.interfaces.FragmentBase; -import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal; +import info.nightscout.androidaps.data.IobTotal; import info.nightscout.utils.DecimalFormatter; diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/TempBasals/TempBasalsPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/TempBasals/TempBasalsPlugin.java index 87a73cb1df..94f98a939a 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/TempBasals/TempBasalsPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/TempBasals/TempBasalsPlugin.java @@ -28,7 +28,7 @@ import info.nightscout.androidaps.events.EventPreferenceChange; import info.nightscout.androidaps.events.EventTempBasalChange; import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.TempBasalsInterface; -import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal; +import info.nightscout.androidaps.data.IobTotal; /** * Created by mike on 05.08.2016. diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java index 432c9339bc..d2dc676109 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Treatments/TreatmentsPlugin.java @@ -20,7 +20,7 @@ import info.nightscout.androidaps.db.Treatment; import info.nightscout.androidaps.events.EventTreatmentChange; import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.TreatmentsInterface; -import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal; +import info.nightscout.androidaps.data.IobTotal; import info.nightscout.client.data.NSProfile; /** diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java index fe6f4455c0..3fc841b27e 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/Wear/wearintegration/WatchUpdaterService.java @@ -25,11 +25,11 @@ import java.util.List; import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; +import info.nightscout.androidaps.data.GlucoseStatus; import info.nightscout.androidaps.db.BgReading; -import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.db.TempBasal; import info.nightscout.androidaps.interfaces.PumpInterface; -import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal; +import info.nightscout.androidaps.data.IobTotal; import info.nightscout.androidaps.plugins.Overview.OverviewPlugin; import info.nightscout.androidaps.plugins.Wear.WearPlugin; import info.nightscout.client.data.NSProfile; @@ -144,7 +144,7 @@ public class WatchUpdaterService extends WearableListenerService implements BgReading lastBG = MainApp.getDbHelper().lastBg(); if (lastBG != null) { - DatabaseHelper.GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData(); + GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData(); if(googleApiClient != null && !googleApiClient.isConnected() && !googleApiClient.isConnecting()) { googleApiConnect(); } if (wear_integration) { @@ -160,7 +160,7 @@ public class WatchUpdaterService extends WearableListenerService implements } } - private DataMap dataMapSingleBG(BgReading lastBG, DatabaseHelper.GlucoseStatus glucoseStatus) { + private DataMap dataMapSingleBG(BgReading lastBG, GlucoseStatus glucoseStatus) { NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile(); if(profile == null) return null; @@ -255,7 +255,7 @@ public class WatchUpdaterService extends WearableListenerService implements if (last_bg == null) return; List graph_bgs = MainApp.getDbHelper().getDataFromTime(startTime); - DatabaseHelper.GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData(); + GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData(); if (!graph_bgs.isEmpty()) { DataMap entries = dataMapSingleBG(last_bg, glucoseStatus); diff --git a/app/src/main/java/info/nightscout/androidaps/plugins/persistentnotification/PersistentNotificationPlugin.java b/app/src/main/java/info/nightscout/androidaps/plugins/persistentnotification/PersistentNotificationPlugin.java index 652e107d8c..0e3bf5f44c 100644 --- a/app/src/main/java/info/nightscout/androidaps/plugins/persistentnotification/PersistentNotificationPlugin.java +++ b/app/src/main/java/info/nightscout/androidaps/plugins/persistentnotification/PersistentNotificationPlugin.java @@ -15,8 +15,8 @@ import info.nightscout.androidaps.Constants; import info.nightscout.androidaps.MainActivity; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.R; +import info.nightscout.androidaps.data.GlucoseStatus; import info.nightscout.androidaps.db.BgReading; -import info.nightscout.androidaps.db.DatabaseHelper; import info.nightscout.androidaps.db.TempBasal; import info.nightscout.androidaps.events.EventInitializationChanged; import info.nightscout.androidaps.events.EventNewBG; @@ -27,7 +27,7 @@ import info.nightscout.androidaps.events.EventTempBasalChange; import info.nightscout.androidaps.events.EventTreatmentChange; import info.nightscout.androidaps.interfaces.PluginBase; import info.nightscout.androidaps.interfaces.PumpInterface; -import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal; +import info.nightscout.androidaps.data.IobTotal; import info.nightscout.client.data.NSProfile; import info.nightscout.utils.DecimalFormatter; @@ -102,7 +102,7 @@ public class PersistentNotificationPlugin implements PluginBase{ BgReading lastBG = MainApp.getDbHelper().lastBg(); - DatabaseHelper.GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData(); + GlucoseStatus glucoseStatus = MainApp.getDbHelper().getGlucoseStatusData(); if(profile != null && lastBG != null) { line1 = lastBG.valueToUnitsToString(profile.getUnits()); diff --git a/app/src/main/java/info/nightscout/utils/BolusWizard.java b/app/src/main/java/info/nightscout/utils/BolusWizard.java index fa7ddf745d..61ca2ab2cb 100644 --- a/app/src/main/java/info/nightscout/utils/BolusWizard.java +++ b/app/src/main/java/info/nightscout/utils/BolusWizard.java @@ -5,7 +5,7 @@ import org.json.JSONObject; import info.nightscout.androidaps.MainApp; import info.nightscout.androidaps.interfaces.TempBasalsInterface; import info.nightscout.androidaps.interfaces.TreatmentsInterface; -import info.nightscout.androidaps.plugins.OpenAPSMA.IobTotal; +import info.nightscout.androidaps.data.IobTotal; import info.nightscout.client.data.NSProfile; /**