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 353ad17b74..5872fde438 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
@@ -53,6 +53,7 @@ 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.TempTarget;
import info.nightscout.androidaps.db.Treatment;
import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.events.EventNewBG;
@@ -76,6 +77,8 @@ import info.nightscout.androidaps.plugins.Overview.graphExtensions.PointsWithLab
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.graphExtensions.TimeAsXAxisLabelFormatter;
+import info.nightscout.androidaps.plugins.TempBasals.TempBasalsPlugin;
+import info.nightscout.androidaps.plugins.TempTargetRange.TempTargetRangePlugin;
import info.nightscout.client.data.NSProfile;
import info.nightscout.utils.BolusWizard;
import info.nightscout.utils.DateUtil;
@@ -105,6 +108,7 @@ public class OverviewFragment extends Fragment {
TextView activeProfileView;
TextView iobView;
TextView apsModeView;
+ TextView tempTargetView;
GraphView bgGraph;
RecyclerView notificationsView;
@@ -152,6 +156,7 @@ public class OverviewFragment extends Fragment {
iobView = (TextView) view.findViewById(R.id.overview_iob);
apsModeView = (TextView) view.findViewById(R.id.overview_apsmode);
+ tempTargetView = (TextView) view.findViewById(R.id.overview_temptarget);
bgGraph = (GraphView) view.findViewById(R.id.overview_bggraph);
cancelTempButton = (Button) view.findViewById(R.id.overview_canceltemp);
treatmentButton = (Button) view.findViewById(R.id.overview_treatment);
@@ -441,7 +446,7 @@ public class OverviewFragment extends Fragment {
updateNotifications();
BgReading actualBG = MainApp.getDbHelper().actualBg();
BgReading lastBG = MainApp.getDbHelper().lastBg();
- if (MainApp.getConfigBuilder() == null || MainApp.getConfigBuilder().getActiveProfile() == null) // app not initialized yet
+ if (MainApp.getConfigBuilder() == null || MainApp.getConfigBuilder().getActiveProfile() == null || MainApp.getConfigBuilder().getActiveProfile().getProfile() == null) // app not initialized yet
return;
// Skip if not initialized yet
@@ -497,8 +502,20 @@ public class OverviewFragment extends Fragment {
apsModeView.setVisibility(View.GONE);
}
- // **** Temp button ****
+ // temp target
NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
+ TempTargetRangePlugin tempTargetRangePlugin = (TempTargetRangePlugin) MainApp.getSpecificPlugin(TempTargetRangePlugin.class);
+ if (tempTargetRangePlugin != null && tempTargetRangePlugin.isEnabled(PluginBase.GENERAL)) {
+ TempTarget tempTarget = tempTargetRangePlugin.getTempTargetInProgress(new Date().getTime());
+ if (tempTarget != null) {
+ tempTargetView.setVisibility(View.VISIBLE);
+ tempTargetView.setText(NSProfile.toUnitsString(tempTarget.low, NSProfile.fromMgdlToUnits(tempTarget.low, profile.getUnits()), profile.getUnits()) + " - " + NSProfile.toUnitsString(tempTarget.high, NSProfile.fromMgdlToUnits(tempTarget.high, profile.getUnits()), profile.getUnits()));
+ } else {
+ tempTargetView.setVisibility(View.GONE);
+ }
+ }
+
+ // **** Temp button ****
PumpInterface pump = MainApp.getConfigBuilder();
boolean showAcceptButton = !MainApp.getConfigBuilder().isClosedModeEnabled(); // Open mode needed
diff --git a/app/src/main/res/drawable-mdpi-v11/temptargetborder.xml b/app/src/main/res/drawable-mdpi-v11/temptargetborder.xml
new file mode 100644
index 0000000000..8dc85926e2
--- /dev/null
+++ b/app/src/main/res/drawable-mdpi-v11/temptargetborder.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/app/src/main/res/layout/overview_fragment.xml b/app/src/main/res/layout/overview_fragment.xml
index 12c183d9e8..6ba6316a63 100644
--- a/app/src/main/res/layout/overview_fragment.xml
+++ b/app/src/main/res/layout/overview_fragment.xml
@@ -36,20 +36,38 @@
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="Open Loop"
- android:textAppearance="?android:attr/textAppearanceSmall" />
+ android:textAppearance="?android:attr/textAppearanceSmall"
+ android:layout_weight="0.2" />
+ android:textColor="@color/colorProfileSwitchButton"
+ android:layout_weight="0.5" />
+
+