add necessity of profile switch to objectives

This commit is contained in:
Milos Kozak 2018-03-31 22:30:42 +02:00
parent 34ec1225c6
commit e9c7bdc7f4
5 changed files with 14 additions and 9 deletions

View file

@ -26,6 +26,7 @@ import info.nightscout.androidaps.plugins.ConstraintsSafety.SafetyPlugin;
import info.nightscout.androidaps.plugins.Loop.LoopPlugin; import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientPlugin; import info.nightscout.androidaps.plugins.NSClientInternal.NSClientPlugin;
import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin; import info.nightscout.androidaps.plugins.PumpVirtual.VirtualPumpPlugin;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.SP; import info.nightscout.utils.SP;
/** /**
@ -129,7 +130,9 @@ public class ObjectivesPlugin extends PluginBase implements ConstraintsInterface
if (usedAPS != null && ((PluginBase) usedAPS).isEnabled(PluginType.APS)) if (usedAPS != null && ((PluginBase) usedAPS).isEnabled(PluginType.APS))
apsEnabled = true; apsEnabled = true;
return new RequirementResult(hasBGData && bgIsAvailableInNS && pumpStatusIsAvailableInNS && NSClientPlugin.getPlugin().hasWritePermission() && LoopPlugin.getPlugin().isEnabled(PluginType.LOOP) && apsEnabled && vpUploadNeeded, boolean profileSwitchExists = MainApp.getConfigBuilder().getProfileSwitchFromHistory(DateUtil.now()) != null;
return new RequirementResult(hasBGData && bgIsAvailableInNS && pumpStatusIsAvailableInNS && NSClientPlugin.getPlugin().hasWritePermission() && LoopPlugin.getPlugin().isEnabled(PluginType.LOOP) && apsEnabled && vpUploadNeeded && profileSwitchExists,
MainApp.gs(R.string.objectives_bgavailableinns) + ": " + yesOrNo(bgIsAvailableInNS) MainApp.gs(R.string.objectives_bgavailableinns) + ": " + yesOrNo(bgIsAvailableInNS)
+ "\n" + MainApp.gs(R.string.nsclienthaswritepermission) + ": " + yesOrNo(NSClientPlugin.getPlugin().hasWritePermission()) + "\n" + MainApp.gs(R.string.nsclienthaswritepermission) + ": " + yesOrNo(NSClientPlugin.getPlugin().hasWritePermission())
+ (isVirtualPump ? "\n" + MainApp.gs(R.string.virtualpump_uploadstatus_title) + ": " + yesOrNo(vpUploadEnabled) : "") + (isVirtualPump ? "\n" + MainApp.gs(R.string.virtualpump_uploadstatus_title) + ": " + yesOrNo(vpUploadEnabled) : "")
@ -137,6 +140,7 @@ public class ObjectivesPlugin extends PluginBase implements ConstraintsInterface
+ "\n" + MainApp.gs(R.string.hasbgdata) + ": " + yesOrNo(hasBGData) + "\n" + MainApp.gs(R.string.hasbgdata) + ": " + yesOrNo(hasBGData)
+ "\n" + MainApp.gs(R.string.loopenabled) + ": " + yesOrNo(LoopPlugin.getPlugin().isEnabled(PluginType.LOOP)) + "\n" + MainApp.gs(R.string.loopenabled) + ": " + yesOrNo(LoopPlugin.getPlugin().isEnabled(PluginType.LOOP))
+ "\n" + MainApp.gs(R.string.apsselected) + ": " + yesOrNo(apsEnabled) + "\n" + MainApp.gs(R.string.apsselected) + ": " + yesOrNo(apsEnabled)
+ "\n" + MainApp.gs(R.string.activate_profile) + ": " + yesOrNo(profileSwitchExists)
); );
case 1: case 1:
return new RequirementResult(manualEnacts >= manualEnactsNeeded, return new RequirementResult(manualEnacts >= manualEnactsNeeded,

View file

@ -10,11 +10,6 @@
android:layout_gravity="center_horizontal" android:layout_gravity="center_horizontal"
android:layout_marginBottom="5dp" /> android:layout_marginBottom="5dp" />
<include
layout="@layout/profileviewer_fragment"
android:layout_width="match_parent"
android:layout_height="wrap_content" />
<Button <Button
android:id="@+id/nsprofile_profileswitch" android:id="@+id/nsprofile_profileswitch"
style="?android:attr/buttonStyle" style="?android:attr/buttonStyle"
@ -24,4 +19,10 @@
android:text="@string/activate_profile" android:text="@string/activate_profile"
android:textColor="@color/colorProfileSwitchButton" /> android:textColor="@color/colorProfileSwitchButton" />
<include
layout="@layout/profileviewer_fragment"
android:layout_width="match_parent"
android:layout_height="match_parent" />
</LinearLayout> </LinearLayout>

View file

@ -570,7 +570,7 @@
<string name="unsupportednsversion">Nepodporovaná verze Nightscoutu</string> <string name="unsupportednsversion">Nepodporovaná verze Nightscoutu</string>
<string name="uploader">Uploader</string> <string name="uploader">Uploader</string>
<string name="uploader_short">UPLD</string> <string name="uploader_short">UPLD</string>
<string name="activate_profile">AKTIVOVAT PROFIL</string> <string name="activate_profile">Aktivovat profil</string>
<string name="danar_visualizeextendedaspercentage_title">Zobrazovat prodloužený bolus v %</string> <string name="danar_visualizeextendedaspercentage_title">Zobrazovat prodloužený bolus v %</string>
<string name="date">Datum</string> <string name="date">Datum</string>
<string name="dia_too_short" formatted="false">DIA %f je příliž krátké - použito %f !</string> <string name="dia_too_short" formatted="false">DIA %f je příliž krátké - použito %f !</string>

View file

@ -567,7 +567,7 @@
<string formatted="false" name="dia_too_short">DIA von %f ist zu kurz - AAPS nutzt stattdessen %f!</string> <string formatted="false" name="dia_too_short">DIA von %f ist zu kurz - AAPS nutzt stattdessen %f!</string>
<string name="danar_stats_warning_Message">Möglicherweise ungenau, wenn zum Befüllen ein Bolus verwendet wurde!</string> <string name="danar_stats_warning_Message">Möglicherweise ungenau, wenn zum Befüllen ein Bolus verwendet wurde!</string>
<string name="danar_stats_ratio">Verhältnis</string> <string name="danar_stats_ratio">Verhältnis</string>
<string name="activate_profile">AKTIVIERE PROFIL</string> <string name="activate_profile">Aktiviere profil</string>
<string name="activity_duration">Aktivitätsdauer</string> <string name="activity_duration">Aktivitätsdauer</string>
<string name="activity_target">Aktivitätsziel</string> <string name="activity_target">Aktivitätsziel</string>
<string name="bloodsugarmeasurementalert">BZ-Messung</string> <string name="bloodsugarmeasurementalert">BZ-Messung</string>

View file

@ -664,7 +664,7 @@
<string name="rapid_acting_oref">Rapid-Acting Oref</string> <string name="rapid_acting_oref">Rapid-Acting Oref</string>
<string name="ultrarapid_oref">Ultra-Rapid Oref</string> <string name="ultrarapid_oref">Ultra-Rapid Oref</string>
<string name="dia_too_short" formatted="false">DIA of %f too short - using %f instead!</string> <string name="dia_too_short" formatted="false">DIA of %f too short - using %f instead!</string>
<string name="activate_profile">ACTIVATE PROFILE</string> <string name="activate_profile">Activate profile</string>
<string name="date">Date</string> <string name="date">Date</string>
<string name="invalid">INVALID</string> <string name="invalid">INVALID</string>
<string name="waitingforpairing">Waiting for pairing on pump</string> <string name="waitingforpairing">Waiting for pairing on pump</string>