insulincurves - freepeak
This commit is contained in:
parent
63d46aed56
commit
085caddeee
6 changed files with 158 additions and 0 deletions
|
@ -32,6 +32,7 @@ import info.nightscout.androidaps.plugins.ConstraintsObjectives.ObjectivesFragme
|
||||||
import info.nightscout.androidaps.plugins.ConstraintsSafety.SafetyPlugin;
|
import info.nightscout.androidaps.plugins.ConstraintsSafety.SafetyPlugin;
|
||||||
import info.nightscout.androidaps.plugins.InsulinFastacting.InsulinFastactingFragment;
|
import info.nightscout.androidaps.plugins.InsulinFastacting.InsulinFastactingFragment;
|
||||||
import info.nightscout.androidaps.plugins.InsulinFastactingProlonged.InsulinFastactingProlongedFragment;
|
import info.nightscout.androidaps.plugins.InsulinFastactingProlonged.InsulinFastactingProlongedFragment;
|
||||||
|
import info.nightscout.androidaps.plugins.InsulinOrefCurves.InsulinOrefFreePeakFragment;
|
||||||
import info.nightscout.androidaps.plugins.InsulinOrefCurves.InsulinOrefRapidActingFragment;
|
import info.nightscout.androidaps.plugins.InsulinOrefCurves.InsulinOrefRapidActingFragment;
|
||||||
import info.nightscout.androidaps.plugins.InsulinOrefCurves.InsulinOrefUltraRapidActingFragment;
|
import info.nightscout.androidaps.plugins.InsulinOrefCurves.InsulinOrefUltraRapidActingFragment;
|
||||||
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
|
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
|
||||||
|
@ -117,6 +118,7 @@ public class MainApp extends Application {
|
||||||
pluginsList.add(InsulinFastactingProlongedFragment.getPlugin());
|
pluginsList.add(InsulinFastactingProlongedFragment.getPlugin());
|
||||||
pluginsList.add(InsulinOrefRapidActingFragment.getPlugin());
|
pluginsList.add(InsulinOrefRapidActingFragment.getPlugin());
|
||||||
pluginsList.add(InsulinOrefUltraRapidActingFragment.getPlugin());
|
pluginsList.add(InsulinOrefUltraRapidActingFragment.getPlugin());
|
||||||
|
pluginsList.add(InsulinOrefFreePeakFragment.getPlugin());
|
||||||
pluginsList.add(SensitivityOref0Plugin.getPlugin());
|
pluginsList.add(SensitivityOref0Plugin.getPlugin());
|
||||||
pluginsList.add(SensitivityAAPSPlugin.getPlugin());
|
pluginsList.add(SensitivityAAPSPlugin.getPlugin());
|
||||||
pluginsList.add(SensitivityWeightedAveragePlugin.getPlugin());
|
pluginsList.add(SensitivityWeightedAveragePlugin.getPlugin());
|
||||||
|
|
|
@ -14,6 +14,7 @@ import android.preference.PreferenceManager;
|
||||||
import info.nightscout.androidaps.events.EventPreferenceChange;
|
import info.nightscout.androidaps.events.EventPreferenceChange;
|
||||||
import info.nightscout.androidaps.events.EventRefreshGui;
|
import info.nightscout.androidaps.events.EventRefreshGui;
|
||||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||||
|
import info.nightscout.androidaps.plugins.InsulinOrefCurves.InsulinOrefFreePeakPlugin;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.BluetoothDevicePreference;
|
import info.nightscout.androidaps.plugins.PumpDanaR.BluetoothDevicePreference;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
|
import info.nightscout.androidaps.plugins.PumpDanaR.DanaRPlugin;
|
||||||
import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;
|
import info.nightscout.androidaps.plugins.PumpDanaRKorean.DanaRKoreanPlugin;
|
||||||
|
@ -139,6 +140,11 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
||||||
if (virtualPumpPlugin != null && virtualPumpPlugin.isEnabled(PluginBase.PUMP)) {
|
if (virtualPumpPlugin != null && virtualPumpPlugin.isEnabled(PluginBase.PUMP)) {
|
||||||
addPreferencesFromResource(R.xml.pref_virtualpump);
|
addPreferencesFromResource(R.xml.pref_virtualpump);
|
||||||
}
|
}
|
||||||
|
InsulinOrefFreePeakPlugin insulinOrefFreePeakPlugin = (InsulinOrefFreePeakPlugin) MainApp.getSpecificPlugin(InsulinOrefFreePeakPlugin.class);
|
||||||
|
if(insulinOrefFreePeakPlugin.isEnabled(PluginBase.INSULIN)){
|
||||||
|
addPreferencesFromResource(R.xml.pref_insulinoreffreepeak);
|
||||||
|
}
|
||||||
|
|
||||||
NSClientInternalPlugin nsClientInternalPlugin = (NSClientInternalPlugin) MainApp.getSpecificPlugin(NSClientInternalPlugin.class);
|
NSClientInternalPlugin nsClientInternalPlugin = (NSClientInternalPlugin) MainApp.getSpecificPlugin(NSClientInternalPlugin.class);
|
||||||
if (nsClientInternalPlugin != null && nsClientInternalPlugin.isEnabled(PluginBase.GENERAL)) {
|
if (nsClientInternalPlugin != null && nsClientInternalPlugin.isEnabled(PluginBase.GENERAL)) {
|
||||||
addPreferencesFromResource(R.xml.pref_nsclientinternal);
|
addPreferencesFromResource(R.xml.pref_nsclientinternal);
|
||||||
|
|
|
@ -0,0 +1,58 @@
|
||||||
|
package info.nightscout.androidaps.plugins.InsulinOrefCurves;
|
||||||
|
|
||||||
|
import android.os.Bundle;
|
||||||
|
import android.support.v4.app.Fragment;
|
||||||
|
import android.view.LayoutInflater;
|
||||||
|
import android.view.View;
|
||||||
|
import android.view.ViewGroup;
|
||||||
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.MainApp;
|
||||||
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.androidaps.plugins.InsulinFastacting.ActivityGraph;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by adrian on 14/08/17.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class InsulinOrefFreePeakFragment extends Fragment {
|
||||||
|
|
||||||
|
static InsulinOrefFreePeakPlugin insulinPlugin = new InsulinOrefFreePeakPlugin();
|
||||||
|
|
||||||
|
static public InsulinOrefFreePeakPlugin getPlugin() {
|
||||||
|
return insulinPlugin;
|
||||||
|
}
|
||||||
|
|
||||||
|
TextView insulinName;
|
||||||
|
TextView insulinComment;
|
||||||
|
TextView insulinDia;
|
||||||
|
ActivityGraph insulinGraph;
|
||||||
|
|
||||||
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
|
Bundle savedInstanceState) {
|
||||||
|
View view = inflater.inflate(R.layout.insulin_fragment, container, false);
|
||||||
|
|
||||||
|
insulinName = (TextView) view.findViewById(R.id.insulin_name);
|
||||||
|
insulinComment = (TextView) view.findViewById(R.id.insulin_comment);
|
||||||
|
insulinDia = (TextView) view.findViewById(R.id.insulin_dia);
|
||||||
|
insulinGraph = (ActivityGraph) view.findViewById(R.id.insuling_graph);
|
||||||
|
|
||||||
|
updateGUI();
|
||||||
|
|
||||||
|
return view;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void onResume() {
|
||||||
|
super.onResume();
|
||||||
|
updateGUI();
|
||||||
|
}
|
||||||
|
|
||||||
|
private void updateGUI() {
|
||||||
|
insulinName.setText(insulinPlugin.getFriendlyName());
|
||||||
|
insulinComment.setText(insulinPlugin.getComment());
|
||||||
|
insulinDia.setText(MainApp.sResources.getText(R.string.dia) + " " + new Double(insulinPlugin.getDia()).toString() + "h");
|
||||||
|
insulinGraph.show(insulinPlugin);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -0,0 +1,66 @@
|
||||||
|
package info.nightscout.androidaps.plugins.InsulinOrefCurves;
|
||||||
|
|
||||||
|
import info.nightscout.androidaps.R;
|
||||||
|
import info.nightscout.utils.SP;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by adrian on 14/08/17.
|
||||||
|
*/
|
||||||
|
|
||||||
|
public class InsulinOrefFreePeakPlugin extends InsulinOrefBasePlugin {
|
||||||
|
|
||||||
|
private static boolean fragmentEnabled = false;
|
||||||
|
private static boolean fragmentVisible = false;
|
||||||
|
|
||||||
|
public static final int DEFAULT_PEAK = 75;
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public int getId() {
|
||||||
|
return OREF_FREE_PEAK;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getName() {
|
||||||
|
return "Free-Peak Oref";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFragmentClass() {
|
||||||
|
return InsulinOrefFreePeakFragment.class.getName();
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String getFriendlyName() {
|
||||||
|
return "Free-Peak Oref";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public String commentStandardText() {
|
||||||
|
return "Fiasp";
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isEnabled(int type) {
|
||||||
|
return type == INSULIN && fragmentEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean isVisibleInTabs(int type) {
|
||||||
|
return type == INSULIN && fragmentVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
|
||||||
|
if (type == INSULIN) this.fragmentEnabled = fragmentEnabled;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public void setFragmentVisible(int type, boolean fragmentVisible) {
|
||||||
|
if (type == INSULIN) this.fragmentVisible = fragmentVisible;
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
int getPeak() {
|
||||||
|
return SP.getInt(R.string.key_insulin_oref_peak, DEFAULT_PEAK);
|
||||||
|
}
|
||||||
|
}
|
|
@ -689,5 +689,10 @@
|
||||||
<string name="careportal_pump_label">PUMP</string>
|
<string name="careportal_pump_label">PUMP</string>
|
||||||
<string name="overview_newtempbasal_basalabsolute">Basal value [U/h]</string>
|
<string name="overview_newtempbasal_basalabsolute">Basal value [U/h]</string>
|
||||||
<string name="careportal_newnstreatment_duration_min_label">Duration [min]</string>
|
<string name="careportal_newnstreatment_duration_min_label">Duration [min]</string>
|
||||||
|
<string name="key_insulin_oref_peak" translatable="false">insulin_oref_peak</string>
|
||||||
|
<string name="insulin_oref_peak">IOB Curve Peak</string>
|
||||||
|
<string name="insulin_peak">Peak [min]</string>
|
||||||
|
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
|
||||||
|
|
21
app/src/main/res/xml/pref_insulinoreffreepeak.xml
Normal file
21
app/src/main/res/xml/pref_insulinoreffreepeak.xml
Normal file
|
@ -0,0 +1,21 @@
|
||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||||
|
xmlns:validate="http://schemas.android.com/apk/res-auto">
|
||||||
|
<PreferenceCategory
|
||||||
|
android:key="InsulinOrefFreePeak"
|
||||||
|
android:title="@string/insulin_oref_peak">
|
||||||
|
|
||||||
|
<com.andreabaccega.widget.ValidatingEditTextPreference
|
||||||
|
validate:testType="numericRange"
|
||||||
|
validate:minNumber="35"
|
||||||
|
validate:maxNumber="120"
|
||||||
|
android:digits="0123456789"
|
||||||
|
android:defaultValue="75"
|
||||||
|
android:selectAllOnFocus="true"
|
||||||
|
android:inputType="number"
|
||||||
|
android:maxLines="20"
|
||||||
|
android:title="@string/insulin_peak"
|
||||||
|
android:key="@string/key_insulin_oref_peak" />
|
||||||
|
</PreferenceCategory>
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
Loading…
Reference in a new issue