show running temp target on overview
This commit is contained in:
parent
61b1ee781f
commit
eaa16402a7
3 changed files with 47 additions and 5 deletions
|
@ -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
|
||||
|
|
7
app/src/main/res/drawable-mdpi-v11/temptargetborder.xml
Normal file
7
app/src/main/res/drawable-mdpi-v11/temptargetborder.xml
Normal file
|
@ -0,0 +1,7 @@
|
|||
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
|
||||
<solid android:color="@color/colorWizardButton" />
|
||||
<stroke android:width="1dip" android:color="@android:color/white"/>
|
||||
<corners
|
||||
android:radius="2dp" >
|
||||
</corners>
|
||||
</shape>
|
|
@ -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" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_activeprofile"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@drawable/pillborder"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:text="Profile"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/colorProfileSwitchButton" />
|
||||
android:textColor="@color/colorProfileSwitchButton"
|
||||
android:layout_weight="0.5" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/overview_temptarget"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@drawable/temptargetborder"
|
||||
android:gravity="center_vertical|center_horizontal"
|
||||
android:text="TempTarget"
|
||||
android:paddingLeft="10dp"
|
||||
android:paddingRight="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:textColor="@color/mdtp_white"
|
||||
android:layout_weight="0.2" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
|
|
Loading…
Reference in a new issue