show if pump is suspended

This commit is contained in:
Milos Kozak 2017-03-24 12:05:12 +01:00
parent 32fda0f0df
commit a4f302ee4a
10 changed files with 56 additions and 5 deletions

View file

@ -106,6 +106,18 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
pumpDescription.basalMinimumRate = 0.04d;
pumpDescription.isRefillingCapable = true;
Thread t = new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
}
refreshDataFromPump("Initialization");
}
});
t.start();
}
ServiceConnection mConnection = new ServiceConnection() {

View file

@ -108,6 +108,18 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
pumpDescription.basalMinimumRate = 0.1d;
pumpDescription.isRefillingCapable = true;
Thread t = new Thread(new Runnable() {
@Override
public void run() {
try {
Thread.sleep(5000);
} catch (InterruptedException e) {
}
refreshDataFromPump("Initialization");
}
});
t.start();
}
ServiceConnection mConnection = new ServiceConnection() {

View file

@ -133,12 +133,24 @@ public class LoopPlugin implements PluginBase {
log.debug("invoke");
ConstraintsInterface constraintsInterface = MainApp.getConfigBuilder();
if (!constraintsInterface.isLoopEnabled()) {
log.debug(MainApp.sResources.getString(R.string.loopdisabled));
MainApp.bus().post(new EventLoopSetLastRunGui(MainApp.sResources.getString(R.string.loopdisabled)));
return;
}
if (!constraintsInterface.isLoopEnabled()) {
log.debug(MainApp.sResources.getString(R.string.loopdisabled));
MainApp.bus().post(new EventLoopSetLastRunGui(MainApp.sResources.getString(R.string.loopdisabled)));
return;
}
final ConfigBuilderPlugin configBuilder = MainApp.getConfigBuilder();
APSResult result = null;
if (!configBuilder.isSuspended()) {
log.debug(MainApp.sResources.getString(R.string.pumpsuspended));
MainApp.bus().post(new EventLoopSetLastRunGui(MainApp.sResources.getString(R.string.pumpsuspended)));
return;
}
if (configBuilder == null || !isEnabled(PluginBase.LOOP))
return;

View file

@ -546,6 +546,8 @@ public class OverviewFragment extends Fragment {
loopStatusLayout.setVisibility(View.VISIBLE);
}
PumpInterface pump = MainApp.getConfigBuilder();
// Skip if not initialized yet
if (bgGraph == null)
return;
@ -560,7 +562,11 @@ public class OverviewFragment extends Fragment {
apsModeView.setBackgroundResource(R.drawable.loopmodeborder);
apsModeView.setTextColor(Color.BLACK);
final LoopPlugin activeloop = MainApp.getConfigBuilder().getActiveLoop();
if (activeloop != null && activeloop.isEnabled(activeloop.getType())) {
if (pump.isSuspended()) {
apsModeView.setBackgroundResource(R.drawable.loopmodesuspendedborder);
apsModeView.setText(MainApp.sResources.getString(R.string.pumpsuspended));
apsModeView.setTextColor(Color.WHITE);
} else if (activeloop != null && activeloop.isEnabled(activeloop.getType())) {
if (MainApp.getConfigBuilder().isClosedModeEnabled()) {
apsModeView.setText(MainApp.sResources.getString(R.string.closedloop));
} else {
@ -627,8 +633,6 @@ public class OverviewFragment extends Fragment {
}
// **** Temp button ****
PumpInterface pump = MainApp.getConfigBuilder();
boolean showAcceptButton = !MainApp.getConfigBuilder().isClosedModeEnabled(); // Open mode needed
showAcceptButton = showAcceptButton && finalLastRun != null && finalLastRun.lastAPSRun != null; // aps result must exist
showAcceptButton = showAcceptButton && (finalLastRun.lastOpenModeAccept == null || finalLastRun.lastOpenModeAccept.getTime() < finalLastRun.lastAPSRun.getTime()); // never accepted or before last result

View file

@ -1,5 +1,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="@color/colorCancelTempButton" />
<solid android:color="@color/loopenabled" />
<stroke android:width="1dip" android:color="@android:color/white"/>
<corners
android:radius="2dp" >

View file

@ -1,5 +1,5 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="@color/colorSetExtendedButton" />
<solid android:color="@color/loopdisabled" />
<stroke android:width="1dip" android:color="@android:color/white"/>
<corners
android:radius="2dp" >

View file

@ -0,0 +1,7 @@
<shape xmlns:android="http://schemas.android.com/apk/res/android" android:shape="rectangle" >
<solid android:color="@color/looppumpsuspended" />
<stroke android:width="1dip" android:color="@android:color/white"/>
<corners
android:radius="2dp" >
</corners>
</shape>

View file

@ -27,6 +27,10 @@
<color name="colorPumpLabel">#779ECB</color>
<color name="cardItemLabel">#FF478EFF</color>
<color name="loopenabled">#47c8ff</color>
<color name="loopdisabled">#FFDD7792</color>
<color name="looppumpsuspended">#ff0400</color>
<color name="notificationUrgent">#ff0400</color>
<color name="notificationNormal">#ff5e55</color>
<color name="notificationLow">#ff827c</color>