careportal
This commit is contained in:
parent
a9748cc721
commit
92f4c37fac
22 changed files with 1766 additions and 61 deletions
|
@ -3,5 +3,6 @@
|
|||
<option name="myName" value="Project Default" />
|
||||
<inspection_tool class="AndroidLintLabelFor" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintRtlHardcoded" enabled="false" level="WARNING" enabled_by_default="false" />
|
||||
<inspection_tool class="AndroidLintValidFragment" enabled="false" level="ERROR" enabled_by_default="false" />
|
||||
</profile>
|
||||
</component>
|
|
@ -37,7 +37,7 @@
|
|||
<ConfirmationsSetting value="0" id="Add" />
|
||||
<ConfirmationsSetting value="0" id="Remove" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_7" default="true" assert-keyword="true" jdk-15="true" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
<component name="ProjectType">
|
||||
|
|
|
@ -23,8 +23,8 @@ android {
|
|||
applicationId "info.nightscout.androidaps"
|
||||
minSdkVersion 21
|
||||
targetSdkVersion 23
|
||||
versionCode 1
|
||||
versionName "1.0"
|
||||
versionCode 1002
|
||||
versionName "1.0.02"
|
||||
}
|
||||
buildTypes {
|
||||
release {
|
||||
|
@ -37,10 +37,15 @@ android {
|
|||
dependencies {
|
||||
compile fileTree(dir: 'libs', include: ['*.jar'])
|
||||
testCompile 'junit:junit:4.12'
|
||||
compile('com.crashlytics.sdk.android:crashlytics:2.5.7@aar') {
|
||||
transitive = true;
|
||||
}
|
||||
compile 'com.android.support:appcompat-v7:23.4.0'
|
||||
compile 'com.android.support:support-v4:23.4.0'
|
||||
compile 'com.android.support:cardview-v7:23.4.0'
|
||||
compile 'com.android.support:recyclerview-v7:23.4.0'
|
||||
compile 'com.android.support:gridlayout-v7:23.4.0'
|
||||
compile 'com.wdullaer:materialdatetimepicker:2.3.0'
|
||||
compile 'com.squareup:otto:1.3.7'
|
||||
compile 'com.j256.ormlite:ormlite-core:4.46'
|
||||
compile 'com.j256.ormlite:ormlite-android:4.46'
|
||||
|
@ -48,7 +53,4 @@ dependencies {
|
|||
compile 'org.slf4j:slf4j-api:1.7.12'
|
||||
compile 'com.jjoe64:graphview:4.0.1'
|
||||
compile 'com.eclipsesource.j2v8:j2v8:3.1.6@aar'
|
||||
compile('com.crashlytics.sdk.android:crashlytics:2.5.7@aar') {
|
||||
transitive = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,6 +11,7 @@ public class Config {
|
|||
public static final boolean OPENAPSMAENABLED = APS && true;
|
||||
public static final boolean LOOPENABLED = APS && true;
|
||||
public static final boolean OBJECTIVESENABLED = APS && true;
|
||||
public static final boolean CAREPORTALENABLED = true;
|
||||
|
||||
public static final boolean detailedLog = true;
|
||||
public static final boolean logFunctionCalls = true;
|
||||
|
|
|
@ -20,6 +20,7 @@ import java.util.Iterator;
|
|||
|
||||
import info.nightscout.androidaps.events.EventRefreshGui;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
|
||||
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderFragment;
|
||||
import info.nightscout.androidaps.plugins.Loop.LoopFragment;
|
||||
import info.nightscout.androidaps.plugins.LowSuspend.LowSuspendFragment;
|
||||
|
@ -64,6 +65,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
// Register all tabs in app here
|
||||
pluginsList.add(OverviewFragment.newInstance());
|
||||
pluginsList.add(VirtualPumpFragment.newInstance());
|
||||
if (Config.CAREPORTALENABLED) pluginsList.add(CareportalFragment.newInstance());
|
||||
if (Config.LOOPENABLED) pluginsList.add(LoopFragment.newInstance());
|
||||
if (Config.LOWSUSPEDENABLED) pluginsList.add(LowSuspendFragment.newInstance());
|
||||
if (Config.OPENAPSMAENABLED) pluginsList.add(OpenAPSMAFragment.newInstance());
|
||||
|
@ -72,7 +74,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
pluginsList.add(TreatmentsFragment.newInstance());
|
||||
pluginsList.add(TempBasalsFragment.newInstance());
|
||||
pluginsList.add(SafetyFragment.newInstance());
|
||||
if (Config.OPENAPSMAENABLED) pluginsList.add(ObjectivesFragment.newInstance());
|
||||
if (Config.OBJECTIVESENABLED) pluginsList.add(ObjectivesFragment.newInstance());
|
||||
pluginsList.add(SourceXdripFragment.newInstance());
|
||||
pluginsList.add(SourceNSClientFragment.newInstance());
|
||||
pluginsList.add(configBuilderFragment = ConfigBuilderFragment.newInstance());
|
||||
|
@ -164,11 +166,15 @@ public class MainActivity extends AppCompatActivity {
|
|||
public static ArrayList<PluginBase> getSpecificPluginsList(int type) {
|
||||
ArrayList<PluginBase> newList = new ArrayList<PluginBase>();
|
||||
|
||||
Iterator<PluginBase> it = pluginsList.iterator();
|
||||
while (it.hasNext()) {
|
||||
PluginBase p = it.next();
|
||||
if (p.getType() == type)
|
||||
newList.add(p);
|
||||
if (pluginsList != null) {
|
||||
Iterator<PluginBase> it = pluginsList.iterator();
|
||||
while (it.hasNext()) {
|
||||
PluginBase p = it.next();
|
||||
if (p.getType() == type)
|
||||
newList.add(p);
|
||||
}
|
||||
} else {
|
||||
log.error("pluginsList=null");
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
|
@ -176,11 +182,15 @@ public class MainActivity extends AppCompatActivity {
|
|||
public static ArrayList<PluginBase> getSpecificPluginsListByInterface(Class interfaceClass) {
|
||||
ArrayList<PluginBase> newList = new ArrayList<PluginBase>();
|
||||
|
||||
Iterator<PluginBase> it = pluginsList.iterator();
|
||||
while (it.hasNext()) {
|
||||
PluginBase p = it.next();
|
||||
if (p.getClass() != ConfigBuilderFragment.class && interfaceClass.isAssignableFrom(p.getClass()))
|
||||
newList.add(p);
|
||||
if (pluginsList != null) {
|
||||
Iterator<PluginBase> it = pluginsList.iterator();
|
||||
while (it.hasNext()) {
|
||||
PluginBase p = it.next();
|
||||
if (p.getClass() != ConfigBuilderFragment.class && interfaceClass.isAssignableFrom(p.getClass()))
|
||||
newList.add(p);
|
||||
}
|
||||
} else {
|
||||
log.error("pluginsList=null");
|
||||
}
|
||||
return newList;
|
||||
}
|
||||
|
@ -195,7 +205,7 @@ public class MainActivity extends AppCompatActivity {
|
|||
return p;
|
||||
}
|
||||
} else {
|
||||
log.debug("pluginsList=null");
|
||||
log.error("pluginsList=null");
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
|
|
@ -33,6 +33,8 @@ public class PreferencesActivity extends PreferenceActivity implements SharedPre
|
|||
addPreferencesFromResource(R.xml.pref_openapsma);
|
||||
if (Config.LOWSUSPEDENABLED)
|
||||
addPreferencesFromResource(R.xml.pref_lowsuspend);
|
||||
if (Config.CAREPORTALENABLED)
|
||||
addPreferencesFromResource(R.xml.pref_careportal);
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -49,7 +49,7 @@ import info.nightscout.utils.ToastUtils;
|
|||
public class DataService extends IntentService {
|
||||
private static Logger log = LoggerFactory.getLogger(DataService.class);
|
||||
|
||||
boolean xDripEnabled = true;
|
||||
boolean xDripEnabled = false;
|
||||
boolean nsClientEnabled = true;
|
||||
|
||||
public DataService() {
|
||||
|
@ -178,10 +178,10 @@ public class DataService extends IntentService {
|
|||
if (settings.has("thresholds")) {
|
||||
JSONObject thresholds = settings.getJSONObject("thresholds");
|
||||
OverviewFragment overviewFragment = (OverviewFragment) MainActivity.getSpecificPlugin(OverviewFragment.class);
|
||||
if (thresholds.has("bgTargetTop")) {
|
||||
if (overviewFragment != null && thresholds.has("bgTargetTop")) {
|
||||
overviewFragment.bgTargetHigh = thresholds.getDouble("bgTargetTop");
|
||||
}
|
||||
if (thresholds.has("bgTargetBottom")) {
|
||||
if (overviewFragment != null && thresholds.has("bgTargetBottom")) {
|
||||
overviewFragment.bgTargetLow = thresholds.getDouble("bgTargetBottom");
|
||||
}
|
||||
}
|
||||
|
|
|
@ -20,6 +20,7 @@ import info.nightscout.androidaps.Config;
|
|||
import info.nightscout.androidaps.data.Iob;
|
||||
import info.nightscout.androidaps.Services.Intents;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.client.data.DbLogger;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
|
||||
|
@ -117,11 +118,7 @@ public class Treatment {
|
|||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
context.sendBroadcast(intent);
|
||||
List<ResolveInfo> q = context.getPackageManager().queryBroadcastReceivers(intent, 0);
|
||||
if (q.size() < 1) {
|
||||
log.error("DBADD No receivers");
|
||||
} else if (Config.logNSUpload)
|
||||
log.debug("DBADD dbAdd " + q.size() + " receivers " + data.toString());
|
||||
DbLogger.dbAdd(intent, data.toString(), Treatment.class);
|
||||
}
|
||||
|
||||
public void updateToNSClient() {
|
||||
|
|
|
@ -0,0 +1,220 @@
|
|||
package info.nightscout.androidaps.plugins.Careportal;
|
||||
|
||||
|
||||
import android.os.Bundle;
|
||||
import android.support.v4.app.Fragment;
|
||||
import android.support.v4.app.FragmentManager;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.interfaces.PluginBase;
|
||||
import info.nightscout.androidaps.plugins.Careportal.Dialogs.NewNSTreatmentDialog;
|
||||
|
||||
public class CareportalFragment extends Fragment implements PluginBase, View.OnClickListener {
|
||||
|
||||
public class OptionsToShow {
|
||||
public int eventType;
|
||||
public int eventName;
|
||||
public boolean bg;
|
||||
public boolean insulin;
|
||||
public boolean carbs;
|
||||
public boolean prebolus;
|
||||
public boolean duration;
|
||||
public boolean percent;
|
||||
public boolean absolute;
|
||||
public boolean profile;
|
||||
public boolean split;
|
||||
|
||||
public OptionsToShow(int eventType,
|
||||
int eventName,
|
||||
boolean bg,
|
||||
boolean insulin,
|
||||
boolean carbs,
|
||||
boolean prebolus,
|
||||
boolean duration,
|
||||
boolean percent,
|
||||
boolean absolute,
|
||||
boolean profile,
|
||||
boolean split) {
|
||||
this.eventType = eventType;
|
||||
this.eventName = eventName;
|
||||
this.bg = bg;
|
||||
this.insulin = insulin;
|
||||
this.carbs = carbs;
|
||||
this.prebolus = prebolus;
|
||||
this.duration = duration;
|
||||
this.percent = percent;
|
||||
this.absolute = absolute;
|
||||
this.profile = profile;
|
||||
this.split = split;
|
||||
}
|
||||
}
|
||||
|
||||
// bg,insulin,carbs,prebolus,duration,percent,absolute,profile,split
|
||||
final OptionsToShow bgcheck = new OptionsToShow(R.id.careportal_bgcheck, R.string.careportal_bgcheck, true, true, true, false, false, false, false, false, false);
|
||||
final OptionsToShow snackbolus = new OptionsToShow(R.id.careportal_snackbolus, R.string.careportal_snackbolus, true, true, true, true, false, false, false, false, false);
|
||||
final OptionsToShow mealbolus = new OptionsToShow(R.id.careportal_mealbolus, R.string.careportal_mealbolus, true, true, true, true, false, false, false, false, false);
|
||||
final OptionsToShow correctionbolus = new OptionsToShow(R.id.careportal_correctionbolus, R.string.careportal_correctionbolus, true, true, true, true, false, false, false, false, false);
|
||||
final OptionsToShow carbcorrection = new OptionsToShow(R.id.careportal_carbscorrection, R.string.careportal_carbscorrection, true, false, true, false, false, false, false, false, false);
|
||||
final OptionsToShow combobolus = new OptionsToShow(R.id.careportal_combobolus, R.string.careportal_combobolus, true, true, true, true, true, false, false, false, true);
|
||||
final OptionsToShow announcement = new OptionsToShow(R.id.careportal_announcement, R.string.careportal_announcement, true, false, false, false, false, false, false, false, false);
|
||||
final OptionsToShow note = new OptionsToShow(R.id.careportal_note, R.string.careportal_note, true, false, false, false, true, false, false, false, false);
|
||||
final OptionsToShow question = new OptionsToShow(R.id.careportal_question, R.string.careportal_question, true, false, false, false, false, false, false, false, false);
|
||||
final OptionsToShow exercise = new OptionsToShow(R.id.careportal_exercise, R.string.careportal_exercise, false, false, false, false, true, false, false, false, false);
|
||||
final OptionsToShow sitechange = new OptionsToShow(R.id.careportal_pumpsitechange, R.string.careportal_pumpsitechange, true, true, false, false, false, false, false, false, false);
|
||||
final OptionsToShow sensorstart = new OptionsToShow(R.id.careportal_cgmsensorstart, R.string.careportal_cgmsensorstart, true, false, false, false, false, false, false, false, false);
|
||||
final OptionsToShow sensorchange = new OptionsToShow(R.id.careportal_cgmsensorinsert, R.string.careportal_cgmsensorinsert, true, false, false, false, false, false, false, false, false);
|
||||
final OptionsToShow insulinchange = new OptionsToShow(R.id.careportal_insulincartridgechange, R.string.careportal_insulincartridgechange, true, false, false, false, false, false, false, false, false);
|
||||
final OptionsToShow tempbasalstart = new OptionsToShow(R.id.careportal_tempbasalstart, R.string.careportal_tempbasalstart, true, false, false, false, true, true, true, false, false);
|
||||
final OptionsToShow tempbasalend = new OptionsToShow(R.id.careportal_tempbasalend, R.string.careportal_tempbasalend, true, false, false, false, false, false, false, false, false);
|
||||
final OptionsToShow profileswitch = new OptionsToShow(R.id.careportal_profileswitch, R.string.careportal_profileswitch, true, false, false, false, false, false, false, true, false);
|
||||
final OptionsToShow openapsoffline = new OptionsToShow(R.id.careportal_openapsoffline, R.string.careportal_openapsoffline, false, false, false, false, true, false, false, false, false);
|
||||
|
||||
boolean fragmentEnabled = true;
|
||||
boolean fragmentVisible = true;
|
||||
|
||||
public CareportalFragment() {
|
||||
// Required empty public constructor
|
||||
}
|
||||
|
||||
public static CareportalFragment newInstance() {
|
||||
CareportalFragment fragment = new CareportalFragment();
|
||||
return fragment;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate(Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return PluginBase.GENERAL;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getName() {
|
||||
return MainApp.resources.getString(R.string.careportal);
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isEnabled() {
|
||||
return fragmentEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisibleInTabs() {
|
||||
return fragmentVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean canBeHidden() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFragmentEnabled(boolean fragmentEnabled) {
|
||||
this.fragmentEnabled = fragmentEnabled;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setFragmentVisible(boolean fragmentVisible) {
|
||||
this.fragmentVisible = fragmentVisible;
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
View view = inflater.inflate(R.layout.careportal_fragment, container, false);
|
||||
|
||||
view.findViewById(R.id.careportal_bgcheck).setOnClickListener(this);
|
||||
view.findViewById(R.id.careportal_announcement).setOnClickListener(this);
|
||||
view.findViewById(R.id.careportal_cgmsensorinsert).setOnClickListener(this);
|
||||
view.findViewById(R.id.careportal_cgmsensorstart).setOnClickListener(this);
|
||||
view.findViewById(R.id.careportal_combobolus).setOnClickListener(this);
|
||||
view.findViewById(R.id.careportal_correctionbolus).setOnClickListener(this);
|
||||
view.findViewById(R.id.careportal_carbscorrection).setOnClickListener(this);
|
||||
view.findViewById(R.id.careportal_exercise).setOnClickListener(this);
|
||||
view.findViewById(R.id.careportal_insulincartridgechange).setOnClickListener(this);
|
||||
view.findViewById(R.id.careportal_mealbolus).setOnClickListener(this);
|
||||
view.findViewById(R.id.careportal_note).setOnClickListener(this);
|
||||
view.findViewById(R.id.careportal_profileswitch).setOnClickListener(this);
|
||||
view.findViewById(R.id.careportal_pumpsitechange).setOnClickListener(this);
|
||||
view.findViewById(R.id.careportal_question).setOnClickListener(this);
|
||||
view.findViewById(R.id.careportal_snackbolus).setOnClickListener(this);
|
||||
view.findViewById(R.id.careportal_tempbasalend).setOnClickListener(this);
|
||||
view.findViewById(R.id.careportal_tempbasalstart).setOnClickListener(this);
|
||||
view.findViewById(R.id.careportal_openapsoffline).setOnClickListener(this);
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
FragmentManager manager = getFragmentManager();
|
||||
NewNSTreatmentDialog newDialog = new NewNSTreatmentDialog();
|
||||
switch (view.getId()) {
|
||||
case R.id.careportal_bgcheck:
|
||||
newDialog.setOptions(bgcheck);
|
||||
break;
|
||||
case R.id.careportal_announcement:
|
||||
newDialog.setOptions(announcement);
|
||||
break;
|
||||
case R.id.careportal_cgmsensorinsert:
|
||||
newDialog.setOptions(sensorchange);
|
||||
break;
|
||||
case R.id.careportal_cgmsensorstart:
|
||||
newDialog.setOptions(sensorstart);
|
||||
break;
|
||||
case R.id.careportal_combobolus:
|
||||
newDialog.setOptions(combobolus);
|
||||
break;
|
||||
case R.id.careportal_correctionbolus:
|
||||
newDialog.setOptions(correctionbolus);
|
||||
break;
|
||||
case R.id.careportal_carbscorrection:
|
||||
newDialog.setOptions(carbcorrection);
|
||||
break;
|
||||
case R.id.careportal_exercise:
|
||||
newDialog.setOptions(exercise);
|
||||
break;
|
||||
case R.id.careportal_insulincartridgechange:
|
||||
newDialog.setOptions(insulinchange);
|
||||
break;
|
||||
case R.id.careportal_mealbolus:
|
||||
newDialog.setOptions(mealbolus);
|
||||
break;
|
||||
case R.id.careportal_note:
|
||||
newDialog.setOptions(note);
|
||||
break;
|
||||
case R.id.careportal_profileswitch:
|
||||
newDialog.setOptions(profileswitch);
|
||||
break;
|
||||
case R.id.careportal_pumpsitechange:
|
||||
newDialog.setOptions(sitechange);
|
||||
break;
|
||||
case R.id.careportal_question:
|
||||
newDialog.setOptions(question);
|
||||
break;
|
||||
case R.id.careportal_snackbolus:
|
||||
newDialog.setOptions(snackbolus);
|
||||
break;
|
||||
case R.id.careportal_tempbasalstart:
|
||||
newDialog.setOptions(tempbasalstart);
|
||||
break;
|
||||
case R.id.careportal_tempbasalend:
|
||||
newDialog.setOptions(tempbasalend);
|
||||
break;
|
||||
case R.id.careportal_openapsoffline:
|
||||
newDialog.setOptions(openapsoffline);
|
||||
break;
|
||||
default:
|
||||
newDialog = null;
|
||||
}
|
||||
if (newDialog != null)
|
||||
newDialog.show(manager, "NewNSTreatmentDialog");
|
||||
}
|
||||
|
||||
}
|
|
@ -0,0 +1,549 @@
|
|||
package info.nightscout.androidaps.plugins.Careportal.Dialogs;
|
||||
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.content.DialogInterface;
|
||||
import android.content.Intent;
|
||||
import android.content.SharedPreferences;
|
||||
import android.os.Bundle;
|
||||
import android.preference.PreferenceManager;
|
||||
import android.support.v4.app.DialogFragment;
|
||||
import android.support.v4.app.FragmentActivity;
|
||||
import android.support.v7.app.AlertDialog;
|
||||
import android.text.Editable;
|
||||
import android.text.TextWatcher;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ArrayAdapter;
|
||||
import android.widget.Button;
|
||||
import android.widget.EditText;
|
||||
import android.widget.LinearLayout;
|
||||
import android.widget.RadioButton;
|
||||
import android.widget.Spinner;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog;
|
||||
import com.wdullaer.materialdatetimepicker.time.RadialPickerLayout;
|
||||
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog;
|
||||
|
||||
import org.json.JSONException;
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.text.DateFormat;
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.androidaps.Services.Intents;
|
||||
import info.nightscout.androidaps.db.BgReading;
|
||||
import info.nightscout.androidaps.plugins.Careportal.CareportalFragment;
|
||||
import info.nightscout.androidaps.plugins.Overview.Dialogs.NewExtendedBolusDialog;
|
||||
import info.nightscout.client.data.DbLogger;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
import info.nightscout.utils.PlusMinusEditText;
|
||||
import info.nightscout.utils.SafeParse;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
public class NewNSTreatmentDialog extends DialogFragment implements View.OnClickListener, DatePickerDialog.OnDateSetListener, TimePickerDialog.OnTimeSetListener {
|
||||
private static Logger log = LoggerFactory.getLogger(NewNSTreatmentDialog.class);
|
||||
|
||||
private FragmentActivity context;
|
||||
|
||||
private CareportalFragment.OptionsToShow options;
|
||||
|
||||
NSProfile profile;
|
||||
String units;
|
||||
|
||||
LinearLayout layoutBg;
|
||||
LinearLayout layoutBgSource;
|
||||
LinearLayout layoutInsulin;
|
||||
LinearLayout layoutCarbs;
|
||||
LinearLayout layoutSplit;
|
||||
LinearLayout layoutDuration;
|
||||
LinearLayout layoutPercent;
|
||||
LinearLayout layoutAbsolute;
|
||||
LinearLayout layoutCarbTime;
|
||||
LinearLayout layoutProfile;
|
||||
Button dateButton;
|
||||
Button timeButton;
|
||||
Button okButton;
|
||||
|
||||
TextView bgUnitsView;
|
||||
RadioButton meterRadioButton;
|
||||
RadioButton sensorRadioButton;
|
||||
RadioButton otherRadioButton;
|
||||
EditText notesEdit;
|
||||
EditText bgInputEdit;
|
||||
EditText insulinEdit;
|
||||
EditText carbsEdit;
|
||||
EditText percentEdit;
|
||||
EditText absoluteEdit;
|
||||
EditText durationeEdit;
|
||||
EditText carbTimeEdit;
|
||||
EditText splitEdit;
|
||||
Spinner profileSpinner;
|
||||
|
||||
PlusMinusEditText editBg;
|
||||
PlusMinusEditText editCarbs;
|
||||
PlusMinusEditText editInsulin;
|
||||
PlusMinusEditText editSplit;
|
||||
PlusMinusEditText editDuration;
|
||||
PlusMinusEditText editPercent;
|
||||
PlusMinusEditText editAbsolute;
|
||||
PlusMinusEditText editCarbTime;
|
||||
|
||||
Date eventTime;
|
||||
|
||||
public void setOptions(CareportalFragment.OptionsToShow options) {
|
||||
this.options = options;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAttach(Activity activity) {
|
||||
context = (FragmentActivity) activity;
|
||||
super.onAttach(activity);
|
||||
}
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
Bundle savedInstanceState) {
|
||||
getDialog().setTitle(getString(options.eventName));
|
||||
View view = inflater.inflate(R.layout.careportal_newnstreatment_dialog, container, false);
|
||||
|
||||
layoutBg = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_bg_layout);
|
||||
layoutBgSource = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_bgsource_layout);
|
||||
layoutInsulin = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_insulin_layout);
|
||||
layoutCarbs = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_carbs_layout);
|
||||
layoutSplit = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_split_layout);
|
||||
layoutDuration = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_duration_layout);
|
||||
layoutPercent = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_percent_layout);
|
||||
layoutAbsolute = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_absolute_layout);
|
||||
layoutCarbTime = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_carbtime_layout);
|
||||
layoutProfile = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_profile_layout);
|
||||
|
||||
showOrHide(layoutBg, options.bg);
|
||||
showOrHide(layoutBgSource, options.bg);
|
||||
showOrHide(layoutInsulin, options.insulin);
|
||||
showOrHide(layoutCarbs, options.carbs);
|
||||
showOrHide(layoutSplit, options.split);
|
||||
showOrHide(layoutDuration, options.duration);
|
||||
showOrHide(layoutPercent, options.percent);
|
||||
showOrHide(layoutAbsolute, options.absolute);
|
||||
showOrHide(layoutCarbTime, options.prebolus);
|
||||
showOrHide(layoutProfile, options.profile);
|
||||
|
||||
bgUnitsView = (TextView) view.findViewById(R.id.careportal_newnstreatment_bgunits);
|
||||
meterRadioButton = (RadioButton) view.findViewById(R.id.careportal_newnstreatment_meter);
|
||||
sensorRadioButton = (RadioButton) view.findViewById(R.id.careportal_newnstreatment_sensor);
|
||||
otherRadioButton = (RadioButton) view.findViewById(R.id.careportal_newnstreatment_other);
|
||||
profileSpinner = (Spinner) view.findViewById(R.id.careportal_newnstreatment_profile);
|
||||
|
||||
bgInputEdit = (EditText) view.findViewById(R.id.careportal_newnstreatment_bginput);
|
||||
insulinEdit = (EditText) view.findViewById(R.id.careportal_newnstreatment_insulininput);
|
||||
carbsEdit = (EditText) view.findViewById(R.id.careportal_newnstreatment_carbsinput);
|
||||
percentEdit = (EditText) view.findViewById(R.id.careportal_newnstreatment_percentinput);
|
||||
percentEdit.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start,
|
||||
int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start,
|
||||
int before, int count) {
|
||||
layoutAbsolute.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
absoluteEdit = (EditText) view.findViewById(R.id.careportal_newnstreatment_absoluteinput);
|
||||
absoluteEdit.addTextChangedListener(new TextWatcher() {
|
||||
@Override
|
||||
public void afterTextChanged(Editable s) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTextChanged(CharSequence s, int start,
|
||||
int count, int after) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTextChanged(CharSequence s, int start,
|
||||
int before, int count) {
|
||||
layoutPercent.setVisibility(View.GONE);
|
||||
}
|
||||
});
|
||||
durationeEdit = (EditText) view.findViewById(R.id.careportal_newnstreatment_durationinput);
|
||||
carbTimeEdit = (EditText) view.findViewById(R.id.careportal_newnstreatment_carbtimeinput);
|
||||
notesEdit = (EditText) view.findViewById(R.id.careportal_newnstreatment_notes);
|
||||
splitEdit = (EditText) view.findViewById(R.id.careportal_newnstreatment_splitinput);
|
||||
|
||||
eventTime = new Date();
|
||||
dateButton = (Button) view.findViewById(R.id.careportal_newnstreatment_eventdate);
|
||||
timeButton = (Button) view.findViewById(R.id.careportal_newnstreatment_eventtime);
|
||||
DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
|
||||
DateFormat tf = DateFormat.getTimeInstance(DateFormat.SHORT);
|
||||
dateButton.setText(df.format(eventTime));
|
||||
timeButton.setText(tf.format(eventTime));
|
||||
dateButton.setOnClickListener(this);
|
||||
timeButton.setOnClickListener(this);
|
||||
|
||||
okButton = (Button) view.findViewById(R.id.careportal_newnstreatment_ok);
|
||||
okButton.setOnClickListener(this);
|
||||
|
||||
// BG
|
||||
profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
|
||||
ArrayList<CharSequence> profileList;
|
||||
units = Constants.MGDL;
|
||||
if (profile == null) {
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), context.getString(R.string.noprofile));
|
||||
profileList = new ArrayList<CharSequence>();
|
||||
} else {
|
||||
units = profile.getUnits();
|
||||
profileList = profile.getProfileList();
|
||||
}
|
||||
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<CharSequence>(getContext(),
|
||||
android.R.layout.simple_spinner_item, profileList);
|
||||
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
|
||||
profileSpinner.setAdapter(adapter);
|
||||
|
||||
bgUnitsView.setText(units);
|
||||
|
||||
// Set BG if not old
|
||||
BgReading lastBg = MainApp.getDbHelper().lastBg();
|
||||
Double lastBgValue = 0d;
|
||||
if (lastBg != null) {
|
||||
lastBgValue = lastBg.valueToUnits(units);
|
||||
sensorRadioButton.setChecked(true);
|
||||
} else {
|
||||
meterRadioButton.setChecked(true);
|
||||
}
|
||||
|
||||
if (units.equals(Constants.MMOL))
|
||||
editBg = new PlusMinusEditText(view, R.id.careportal_newnstreatment_bginput, R.id.careportal_newnstreatment_bg_plus, R.id.careportal_newnstreatment_bg_minus, lastBgValue, 0d, 40d, 0.1d, new DecimalFormat("0.0"), false);
|
||||
else
|
||||
editBg = new PlusMinusEditText(view, R.id.careportal_newnstreatment_bginput, R.id.careportal_newnstreatment_bg_plus, R.id.careportal_newnstreatment_bg_minus, lastBgValue, 0d, 500d, 1d, new DecimalFormat("0"), false);
|
||||
|
||||
Integer maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit);
|
||||
editCarbs = new PlusMinusEditText(view, R.id.careportal_newnstreatment_carbsinput, R.id.careportal_newnstreatment_carbs_plus, R.id.careportal_newnstreatment_carbs_minus, 0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false);
|
||||
|
||||
Double maxInsulin = MainApp.getConfigBuilder().applyBolusConstraints(Constants.bolusOnlyForCheckLimit);
|
||||
editInsulin = new PlusMinusEditText(view, R.id.careportal_newnstreatment_insulininput, R.id.careportal_newnstreatment_insulin_plus, R.id.careportal_newnstreatment_insulin_minus, 0d, 0d, maxInsulin, 0.05d, new DecimalFormat("0.00"), false);
|
||||
|
||||
editSplit = new PlusMinusEditText(view, R.id.careportal_newnstreatment_splitinput, R.id.careportal_newnstreatment_split_plus, R.id.careportal_newnstreatment_split_minus, 100d, 0d, 100d, 5d, new DecimalFormat("0"), true);
|
||||
editDuration = new PlusMinusEditText(view, R.id.careportal_newnstreatment_durationinput, R.id.careportal_newnstreatment_duration_plus, R.id.careportal_newnstreatment_duration_minus, 0d, 0d, 24 * 60d, 10d, new DecimalFormat("0"), false);
|
||||
|
||||
Integer maxPercent = MainApp.getConfigBuilder().applyBasalConstraints(Constants.basalPercentOnlyForCheckLimit);
|
||||
editPercent = new PlusMinusEditText(view, R.id.careportal_newnstreatment_percentinput, R.id.careportal_newnstreatment_percent_plus, R.id.careportal_newnstreatment_percent_minus, 0d, 0d, (double) maxPercent, 5d, new DecimalFormat("0"), true);
|
||||
|
||||
Double maxAbsolute = MainApp.getConfigBuilder().applyBasalConstraints(Constants.basalAbsoluteOnlyForCheckLimit);
|
||||
editAbsolute = new PlusMinusEditText(view, R.id.careportal_newnstreatment_absoluteinput, R.id.careportal_newnstreatment_absolute_plus, R.id.careportal_newnstreatment_absolute_minus, 0d, 0d, maxAbsolute, 0.05d, new DecimalFormat("0.00"), true);
|
||||
|
||||
editCarbTime = new PlusMinusEditText(view, R.id.careportal_newnstreatment_carbtimeinput, R.id.careportal_newnstreatment_carbtime_plus, R.id.careportal_newnstreatment_carbtime_minus, 0d, -60d, 60d, 5d, new DecimalFormat("0"), false);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
Calendar calendar = Calendar.getInstance();
|
||||
calendar.setTime(eventTime);
|
||||
switch (view.getId()) {
|
||||
case R.id.careportal_newnstreatment_eventdate:
|
||||
DatePickerDialog dpd = DatePickerDialog.newInstance(
|
||||
this,
|
||||
calendar.get(Calendar.YEAR),
|
||||
calendar.get(Calendar.MONTH),
|
||||
calendar.get(Calendar.DAY_OF_MONTH)
|
||||
);
|
||||
dpd.setThemeDark(true);
|
||||
dpd.dismissOnPause(true);
|
||||
dpd.show(context.getFragmentManager(), "Datepickerdialog");
|
||||
break;
|
||||
case R.id.careportal_newnstreatment_eventtime:
|
||||
android.text.format.DateFormat df = new android.text.format.DateFormat();
|
||||
TimePickerDialog tpd = TimePickerDialog.newInstance(
|
||||
this,
|
||||
calendar.get(Calendar.HOUR_OF_DAY),
|
||||
calendar.get(Calendar.MINUTE),
|
||||
df.is24HourFormat(context)
|
||||
);
|
||||
tpd.setThemeDark(true);
|
||||
tpd.dismissOnPause(true);
|
||||
tpd.show(context.getFragmentManager(), "Timepickerdialog");
|
||||
break;
|
||||
case R.id.careportal_newnstreatment_ok:
|
||||
createNSTreatment();
|
||||
dismiss();
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
private void showOrHide(LinearLayout layout, boolean visible) {
|
||||
if (visible) layout.setVisibility(View.VISIBLE);
|
||||
else layout.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDateSet(DatePickerDialog view, int year, int monthOfYear, int dayOfMonth) {
|
||||
eventTime.setYear(year);
|
||||
eventTime.setMonth(monthOfYear);
|
||||
eventTime.setDate(dayOfMonth);
|
||||
DateFormat df = DateFormat.getDateInstance(DateFormat.SHORT);
|
||||
dateButton.setText(df.format(eventTime));
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTimeSet(RadialPickerLayout view, int hourOfDay, int minute, int second) {
|
||||
eventTime.setHours(hourOfDay);
|
||||
eventTime.setMinutes(minute);
|
||||
eventTime.setSeconds(second);
|
||||
DateFormat tf = DateFormat.getTimeInstance(DateFormat.SHORT);
|
||||
timeButton.setText(tf.format(eventTime));
|
||||
}
|
||||
|
||||
|
||||
JSONObject gatherData() {
|
||||
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(MainApp.instance().getApplicationContext());
|
||||
String enteredBy = SP.getString("careportal_enteredby", "");
|
||||
JSONObject data = new JSONObject();
|
||||
try {
|
||||
data.put("created_at", DateUtil.toISOString(eventTime));
|
||||
switch (options.eventType) {
|
||||
case R.id.careportal_bgcheck:
|
||||
data.put("eventType", "BG Check");
|
||||
break;
|
||||
case R.id.careportal_announcement:
|
||||
data.put("eventType", "Announcement");
|
||||
break;
|
||||
case R.id.careportal_cgmsensorinsert:
|
||||
data.put("eventType", "Sensor Change");
|
||||
break;
|
||||
case R.id.careportal_cgmsensorstart:
|
||||
data.put("eventType", "Sensor Start");
|
||||
break;
|
||||
case R.id.careportal_combobolus:
|
||||
data.put("splitNow", SafeParse.stringToDouble(splitEdit.getText().toString()));
|
||||
data.put("splitExt", 100 - SafeParse.stringToDouble(splitEdit.getText().toString()));
|
||||
data.put("eventType", "Combo Bolus");
|
||||
break;
|
||||
case R.id.careportal_correctionbolus:
|
||||
data.put("eventType", "Correction Bolus");
|
||||
break;
|
||||
case R.id.careportal_carbscorrection:
|
||||
data.put("eventType", "Carb Correction");
|
||||
break;
|
||||
case R.id.careportal_exercise:
|
||||
data.put("eventType", "Exercise");
|
||||
break;
|
||||
case R.id.careportal_insulincartridgechange:
|
||||
data.put("eventType", "Insulin Change");
|
||||
break;
|
||||
case R.id.careportal_mealbolus:
|
||||
data.put("eventType", "Meal Bolus");
|
||||
break;
|
||||
case R.id.careportal_note:
|
||||
data.put("eventType", "Note");
|
||||
break;
|
||||
case R.id.careportal_profileswitch:
|
||||
data.put("eventType", "Profile Switch");
|
||||
break;
|
||||
case R.id.careportal_pumpsitechange:
|
||||
data.put("eventType", "Site Change");
|
||||
break;
|
||||
case R.id.careportal_question:
|
||||
data.put("eventType", "Question");
|
||||
break;
|
||||
case R.id.careportal_snackbolus:
|
||||
data.put("eventType", "Snack Bolus");
|
||||
break;
|
||||
case R.id.careportal_tempbasalstart:
|
||||
data.put("eventType", "Temp Basal");
|
||||
break;
|
||||
case R.id.careportal_tempbasalend:
|
||||
data.put("eventType", "Temp Basal");
|
||||
break;
|
||||
case R.id.careportal_openapsoffline:
|
||||
data.put("eventType", "OpenAPS Offline");
|
||||
break;
|
||||
}
|
||||
if (SafeParse.stringToDouble(bgInputEdit.getText().toString()) != 0d) {
|
||||
data.put("glucose", SafeParse.stringToDouble(bgInputEdit.getText().toString()));
|
||||
if (meterRadioButton.isChecked()) data.put("glucoseType", "Finger");
|
||||
if (sensorRadioButton.isChecked()) data.put("glucoseType", "Sensor");
|
||||
if (otherRadioButton.isChecked()) data.put("glucoseType", "Manual");
|
||||
}
|
||||
if (SafeParse.stringToDouble(carbsEdit.getText().toString()) != 0d)
|
||||
data.put("carbs", SafeParse.stringToDouble(carbsEdit.getText().toString()));
|
||||
if (SafeParse.stringToDouble(insulinEdit.getText().toString()) != 0d)
|
||||
data.put("insulin", SafeParse.stringToDouble(insulinEdit.getText().toString()));
|
||||
if (SafeParse.stringToDouble(durationeEdit.getText().toString()) != 0d)
|
||||
data.put("duration", SafeParse.stringToDouble(durationeEdit.getText().toString()));
|
||||
if (layoutPercent.getVisibility() != View.GONE)
|
||||
data.put("percent", SafeParse.stringToDouble(percentEdit.getText().toString()));
|
||||
if (layoutAbsolute.getVisibility() != View.GONE)
|
||||
data.put("absolute", profileSpinner.getSelectedItem().toString());
|
||||
if (options.profile) data.put("profile", profileSpinner.getSelectedItem().toString());
|
||||
if (SafeParse.stringToDouble(carbTimeEdit.getText().toString()) != 0d)
|
||||
data.put("preBolus", SafeParse.stringToDouble(carbTimeEdit.getText().toString()));
|
||||
if (!notesEdit.getText().toString().equals(""))
|
||||
data.put("notes", notesEdit.getText().toString());
|
||||
data.put("units", units);
|
||||
if (!enteredBy.equals("")) data.put("enteredBy", enteredBy);
|
||||
if (options.eventType == R.id.careportal_combobolus) {
|
||||
Double enteredInsulin = SafeParse.stringToDouble(insulinEdit.getText().toString());
|
||||
data.put("enteredinsulin", enteredInsulin);
|
||||
data.put("insulin", enteredInsulin * SafeParse.stringToDouble(splitEdit.getText().toString()) / 100);
|
||||
data.put("relative", enteredInsulin * (100 - SafeParse.stringToDouble(splitEdit.getText().toString())) / 100 / SafeParse.stringToDouble(durationeEdit.getText().toString()) * 60);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
return data;
|
||||
}
|
||||
|
||||
String buildConfirmText(JSONObject data) {
|
||||
String ret = "";
|
||||
try {
|
||||
if (data.has("eventType")) {
|
||||
ret += getString(R.string.careportal_newnstreatment_eventtype);
|
||||
ret += ": ";
|
||||
ret += data.get("eventType"); // TODO: translate this too
|
||||
ret += "\n";
|
||||
}
|
||||
if (data.has("glucose")) {
|
||||
ret += getString(R.string.treatments_wizard_bg_label);
|
||||
ret += ": ";
|
||||
ret += data.get("glucose");
|
||||
ret += " " + units + "\n";
|
||||
}
|
||||
if (data.has("glucoseType")) {
|
||||
ret += getString(R.string.careportal_newnstreatment_glucosetype);
|
||||
ret += ": ";
|
||||
ret += data.get("glucoseType"); // TODO: translate this too
|
||||
ret += "\n";
|
||||
}
|
||||
if (data.has("carbs")) {
|
||||
ret += getString(R.string.careportal_newnstreatment_carbs_label);
|
||||
ret += ": ";
|
||||
ret += data.get("carbs");
|
||||
ret += " g\n";
|
||||
}
|
||||
if (data.has("insulin")) {
|
||||
ret += getString(R.string.careportal_newnstreatment_insulin_label);
|
||||
ret += ": ";
|
||||
ret += data.get("insulin");
|
||||
ret += " U\n";
|
||||
}
|
||||
if (data.has("duration")) {
|
||||
ret += getString(R.string.careportal_newnstreatment_duration_label);
|
||||
ret += ": ";
|
||||
ret += data.get("duration");
|
||||
ret += " min\n";
|
||||
}
|
||||
if (data.has("percent")) {
|
||||
ret += getString(R.string.careportal_newnstreatment_percent_label);
|
||||
ret += ": ";
|
||||
ret += data.get("percent");
|
||||
ret += " %\n";
|
||||
}
|
||||
if (data.has("absolute")) {
|
||||
ret += getString(R.string.careportal_newnstreatment_absolute_label);
|
||||
ret += ": ";
|
||||
ret += data.get("absolute");
|
||||
ret += " U/h\n";
|
||||
}
|
||||
if (data.has("preBolus")) {
|
||||
ret += getString(R.string.careportal_newnstreatment_carbtime_label);
|
||||
ret += ": ";
|
||||
ret += data.get("preBolus");
|
||||
ret += " min\n";
|
||||
}
|
||||
if (data.has("notes")) {
|
||||
ret += getString(R.string.careportal_newnstreatment_notes_label);
|
||||
ret += ": ";
|
||||
ret += data.get("notes");
|
||||
ret += "\n";
|
||||
}
|
||||
if (data.has("profile")) {
|
||||
ret += getString(R.string.careportal_newnstreatment_profile_label);
|
||||
ret += ": ";
|
||||
ret += data.get("profile");
|
||||
ret += "\n";
|
||||
}
|
||||
if (data.has("created_at")) {
|
||||
ret += getString(R.string.careportal_newnstreatment_eventtime_label);
|
||||
ret += ": ";
|
||||
ret += eventTime.toLocaleString();
|
||||
ret += "\n";
|
||||
}
|
||||
if (data.has("enteredBy")) {
|
||||
ret += getString(R.string.careportal_newnstreatment_enteredby_title);
|
||||
ret += ": ";
|
||||
ret += data.get("enteredBy");
|
||||
ret += "\n";
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
void createNSTreatment() {
|
||||
final JSONObject data = gatherData();
|
||||
String confirmText = buildConfirmText(data);
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
builder.setTitle(getContext().getString(R.string.dialog));
|
||||
builder.setMessage(confirmText);
|
||||
builder.setPositiveButton(getContext().getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
sendTreatmentToNS(data);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(getContext().getString(R.string.cancel), null);
|
||||
builder.show();
|
||||
}
|
||||
|
||||
static void sendTreatmentToNS(JSONObject data) {
|
||||
try {
|
||||
if (data.has("preBolus") && data.has("carbs")) {
|
||||
JSONObject prebolus = new JSONObject();
|
||||
prebolus.put("carbs", data.get("carbs"));
|
||||
data.remove("carbs");
|
||||
prebolus.put("eventType", data.get("eventType"));
|
||||
prebolus.put("enteredBy", data.get("enteredBy"));
|
||||
if (data.has("notes")) prebolus.put("notes", data.get("notes"));
|
||||
long mills = DateUtil.fromISODateString(data.getString("created_at")).getTime();
|
||||
Date preBolusDate = new Date(mills + data.getInt("preBolus") * 60000L);
|
||||
prebolus.put("created_at", DateUtil.toISOString(preBolusDate));
|
||||
sendTreatmentToNS(prebolus);
|
||||
}
|
||||
Context context = MainApp.instance().getApplicationContext();
|
||||
Bundle bundle = new Bundle();
|
||||
bundle.putString("action", "dbAdd");
|
||||
bundle.putString("collection", "treatments");
|
||||
bundle.putString("data", data.toString());
|
||||
Intent intent = new Intent(Intents.ACTION_DATABASE);
|
||||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
context.sendBroadcast(intent);
|
||||
DbLogger.dbAdd(intent, data.toString(), NewExtendedBolusDialog.class);
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
}
|
||||
}
|
|
@ -50,6 +50,7 @@ import info.nightscout.androidaps.plugins.Loop.APSResult;
|
|||
import info.nightscout.androidaps.plugins.Loop.DeviceStatus;
|
||||
import info.nightscout.androidaps.plugins.Loop.LoopFragment;
|
||||
import info.nightscout.androidaps.plugins.OpenAPSMA.DetermineBasalResult;
|
||||
import info.nightscout.client.data.DbLogger;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
import info.nightscout.utils.DateUtil;
|
||||
|
||||
|
@ -861,12 +862,7 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI
|
|||
Intent intent = new Intent(Intents.ACTION_DATABASE);
|
||||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
context.sendBroadcast(intent);
|
||||
List<ResolveInfo> q = context.getPackageManager().queryBroadcastReceivers(intent, 0);
|
||||
if (q.size() < 1) {
|
||||
log.error("DBADD No receivers");
|
||||
} else if (Config.logNSUpload)
|
||||
log.debug("DBADD dbAdd " + q.size() + " receivers " + data.toString());
|
||||
DbLogger.dbAdd(intent, data.toString(), ConfigBuilderFragment.class);
|
||||
} catch (JSONException e) {
|
||||
}
|
||||
}
|
||||
|
@ -888,11 +884,7 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI
|
|||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
context.sendBroadcast(intent);
|
||||
List<ResolveInfo> q = context.getPackageManager().queryBroadcastReceivers(intent, 0);
|
||||
if (q.size() < 1) {
|
||||
log.error("DBADD No receivers");
|
||||
} else if (Config.logNSUpload)
|
||||
log.debug("DBADD dbAdd " + q.size() + " receivers " + data.toString());
|
||||
DbLogger.dbAdd(intent, data.toString(), ConfigBuilderFragment.class);
|
||||
} catch (JSONException e) {
|
||||
}
|
||||
}
|
||||
|
@ -912,11 +904,7 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI
|
|||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
context.sendBroadcast(intent);
|
||||
List<ResolveInfo> q = context.getPackageManager().queryBroadcastReceivers(intent, 0);
|
||||
if (q.size() < 1) {
|
||||
log.error("DBADD No receivers");
|
||||
} else if (Config.logNSUpload)
|
||||
log.debug("DBADD dbAdd " + q.size() + " receivers " + data.toString());
|
||||
DbLogger.dbAdd(intent, data.toString(), ConfigBuilderFragment.class);
|
||||
} catch (JSONException e) {
|
||||
}
|
||||
}
|
||||
|
@ -941,11 +929,7 @@ public class ConfigBuilderFragment extends Fragment implements PluginBase, PumpI
|
|||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
context.sendBroadcast(intent);
|
||||
List<ResolveInfo> q = context.getPackageManager().queryBroadcastReceivers(intent, 0);
|
||||
if (q.size() < 1) {
|
||||
log.error("DBADD No receivers");
|
||||
} else if (Config.logNSUpload)
|
||||
log.debug("DBADD dbAdd " + q.size() + " receivers " + data.toString());
|
||||
DbLogger.dbAdd(intent, data.toString(), ConfigBuilderFragment.class);
|
||||
} catch (JSONException e) {
|
||||
}
|
||||
}
|
||||
|
|
|
@ -15,6 +15,7 @@ import java.util.List;
|
|||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.Services.Intents;
|
||||
import info.nightscout.client.data.DbLogger;
|
||||
|
||||
/*
|
||||
{
|
||||
|
@ -416,10 +417,6 @@ public class DeviceStatus {
|
|||
intent.putExtras(bundle);
|
||||
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
|
||||
context.sendBroadcast(intent);
|
||||
List<ResolveInfo> q = context.getPackageManager().queryBroadcastReceivers(intent, 0);
|
||||
if (q.size() < 1) {
|
||||
log.error("DBADD No receivers");
|
||||
} else if (Config.logNSUpload)
|
||||
log.debug("DBADD dbAdd " + q.size() + " receivers " + mongoRecord().toString());
|
||||
DbLogger.dbAdd(intent, mongoRecord().toString(), DeviceStatus.class);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -178,7 +178,7 @@ public class OpenAPSMAFragment extends Fragment implements View.OnClickListener,
|
|||
@Override
|
||||
public void onSaveInstanceState(Bundle outState) {
|
||||
super.onSaveInstanceState(outState);
|
||||
outState.putParcelable("lastrun", lastRun);
|
||||
//outState.putParcelable("lastrun", lastRun);
|
||||
}
|
||||
|
||||
private void registerBus() {
|
||||
|
|
|
@ -44,8 +44,8 @@ public class NewTreatmentDialog extends DialogFragment implements OnClickListene
|
|||
Integer maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit);
|
||||
Double maxInsulin = MainApp.getConfigBuilder().applyBolusConstraints(Constants.bolusOnlyForCheckLimit);
|
||||
|
||||
editCarbs = new PlusMinusEditText(view, R.id.treatments_newtreatment_carbsamount, R.id.treatments_newtreatment_carbsamount_plus, R.id.treatments_newtreatment_carbsamount_minus, 0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"));
|
||||
editInsulin = new PlusMinusEditText(view, R.id.treatments_newtreatment_insulinamount, R.id.treatments_newtreatment_insulinamount_plus, R.id.treatments_newtreatment_insulinamount_minus, 0d, 0d, maxInsulin, 0.05d, new DecimalFormat("0.00"));
|
||||
editCarbs = new PlusMinusEditText(view, R.id.treatments_newtreatment_carbsamount, R.id.treatments_newtreatment_carbsamount_plus, R.id.treatments_newtreatment_carbsamount_minus, 0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false);
|
||||
editInsulin = new PlusMinusEditText(view, R.id.treatments_newtreatment_insulinamount, R.id.treatments_newtreatment_insulinamount_plus, R.id.treatments_newtreatment_insulinamount_minus, 0d, 0d, maxInsulin, 0.05d, new DecimalFormat("0.00"), false);
|
||||
|
||||
return view;
|
||||
}
|
||||
|
|
|
@ -115,9 +115,9 @@ public class WizardDialog extends DialogFragment implements OnClickListener {
|
|||
Integer maxCarbs = MainApp.getConfigBuilder().applyCarbsConstraints(Constants.carbsOnlyForCheckLimit);
|
||||
Double maxCorrection = MainApp.getConfigBuilder().applyBolusConstraints(Constants.bolusOnlyForCheckLimit);
|
||||
|
||||
editBg = new PlusMinusEditText(view, R.id.treatments_wizard_bginput, R.id.treatments_wizard_bginput_plus, R.id.treatments_wizard_bginput_minus, 0d, 0d, 500d, 0.1d, new DecimalFormat("0.0"));
|
||||
editCarbs = new PlusMinusEditText(view, R.id.treatments_wizard_carbsinput, R.id.treatments_wizard_carbsinput_plus, R.id.treatments_wizard_carbsinput_minus, 0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"));
|
||||
editCorr = new PlusMinusEditText(view, R.id.treatments_wizard_correctioninput, R.id.treatments_wizard_correctioninput_plus, R.id.treatments_wizard_correctioninput_minus, 0d, 0d, maxCorrection, 0.05d, new DecimalFormat("0.00"));
|
||||
editBg = new PlusMinusEditText(view, R.id.treatments_wizard_bginput, R.id.treatments_wizard_bginput_plus, R.id.treatments_wizard_bginput_minus, 0d, 0d, 500d, 0.1d, new DecimalFormat("0.0"), false);
|
||||
editCarbs = new PlusMinusEditText(view, R.id.treatments_wizard_carbsinput, R.id.treatments_wizard_carbsinput_plus, R.id.treatments_wizard_carbsinput_minus, 0d, 0d, (double) maxCarbs, 1d, new DecimalFormat("0"), false);
|
||||
editCorr = new PlusMinusEditText(view, R.id.treatments_wizard_correctioninput, R.id.treatments_wizard_correctioninput_plus, R.id.treatments_wizard_correctioninput_minus, 0d, 0d, maxCorrection, 0.05d, new DecimalFormat("0.00"), false);
|
||||
initDialog();
|
||||
return view;
|
||||
}
|
||||
|
@ -179,7 +179,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener {
|
|||
NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
|
||||
|
||||
if (profile == null) {
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), "No profile loaded from NS yet");
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.resources.getString(R.string.noprofile));
|
||||
return;
|
||||
}
|
||||
|
||||
|
|
30
app/src/main/java/info/nightscout/client/data/DbLogger.java
Normal file
30
app/src/main/java/info/nightscout/client/data/DbLogger.java
Normal file
|
@ -0,0 +1,30 @@
|
|||
package info.nightscout.client.data;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ResolveInfo;
|
||||
|
||||
import org.json.JSONObject;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import info.nightscout.androidaps.Config;
|
||||
import info.nightscout.androidaps.MainApp;
|
||||
import info.nightscout.androidaps.R;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
/**
|
||||
* Created by mike on 02.07.2016.
|
||||
*/
|
||||
public class DbLogger {
|
||||
public static void dbAdd(Intent intent, String data, Class sender) {
|
||||
Logger log = LoggerFactory.getLogger(sender);
|
||||
List<ResolveInfo> q = MainApp.instance().getApplicationContext().getPackageManager().queryBroadcastReceivers(intent, 0);
|
||||
if (q.size() < 1) {
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(),MainApp.resources.getString(R.string.nsclientnotinstalled));
|
||||
log.error("DBADD No receivers");
|
||||
} else if (Config.logNSUpload)
|
||||
log.debug("DBADD dbAdd " + q.size() + " receivers " + data);
|
||||
}
|
||||
}
|
|
@ -5,8 +5,10 @@ import org.json.JSONException;
|
|||
import org.json.JSONObject;
|
||||
|
||||
import java.text.DecimalFormat;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.Iterator;
|
||||
import java.util.TimeZone;
|
||||
|
||||
import info.nightscout.androidaps.Constants;
|
||||
|
@ -38,6 +40,26 @@ public class NSProfile {
|
|||
return profile;
|
||||
}
|
||||
|
||||
public ArrayList<CharSequence> getProfileList() {
|
||||
ArrayList<CharSequence> ret = new ArrayList<CharSequence>();
|
||||
|
||||
JSONObject store;
|
||||
JSONObject profile = null;
|
||||
try {
|
||||
store = json.getJSONObject("store");
|
||||
Iterator<?> keys = store.keys();
|
||||
|
||||
while( keys.hasNext() ) {
|
||||
String profileName = (String) keys.next();
|
||||
ret.add(profileName);
|
||||
}
|
||||
} catch (JSONException e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
public String log() {
|
||||
String ret = "\n";
|
||||
for (Integer hour = 0; hour < 24; hour ++) {
|
||||
|
|
|
@ -34,6 +34,7 @@ public class PlusMinusEditText implements View.OnKeyListener,
|
|||
Double maxValue = 1d;
|
||||
Double step = 1d;
|
||||
NumberFormat formater;
|
||||
boolean allowZero = false;
|
||||
|
||||
private Handler mHandler;
|
||||
private ScheduledExecutorService mUpdater;
|
||||
|
@ -57,7 +58,7 @@ public class PlusMinusEditText implements View.OnKeyListener,
|
|||
private static final int MSG_INC = 0;
|
||||
private static final int MSG_DEC = 1;
|
||||
|
||||
public PlusMinusEditText(View view, int editTextID, int plusID, int minusID, Double initValue, Double minValue, Double maxValue, Double step, NumberFormat formater) {
|
||||
public PlusMinusEditText(View view, int editTextID, int plusID, int minusID, Double initValue, Double minValue, Double maxValue, Double step, NumberFormat formater, boolean allowZero) {
|
||||
editText = (TextView) view.findViewById(editTextID);
|
||||
minusImage = (ImageView) view.findViewById(minusID);
|
||||
plusImage = (ImageView) view.findViewById(plusID);
|
||||
|
@ -67,6 +68,7 @@ public class PlusMinusEditText implements View.OnKeyListener,
|
|||
this.maxValue = maxValue;
|
||||
this.step = step;
|
||||
this.formater = formater;
|
||||
this.allowZero = allowZero;
|
||||
|
||||
mHandler = new Handler() {
|
||||
@Override
|
||||
|
@ -89,6 +91,7 @@ public class PlusMinusEditText implements View.OnKeyListener,
|
|||
plusImage.setOnTouchListener(this);
|
||||
plusImage.setOnKeyListener(this);
|
||||
plusImage.setOnClickListener(this);
|
||||
updateEditText();
|
||||
}
|
||||
|
||||
public void setValue(Double value) {
|
||||
|
@ -117,7 +120,7 @@ public class PlusMinusEditText implements View.OnKeyListener,
|
|||
}
|
||||
|
||||
private void updateEditText() {
|
||||
if (value == 0d)
|
||||
if (value == 0d && !allowZero)
|
||||
editText.setText("");
|
||||
else
|
||||
editText.setText(formater.format(value));
|
||||
|
|
202
app/src/main/res/layout/careportal_fragment.xml
Normal file
202
app/src/main/res/layout/careportal_fragment.xml
Normal file
|
@ -0,0 +1,202 @@
|
|||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
tools:context="info.nightscout.androidaps.plugins.Careportal.CareportalFragment">
|
||||
|
||||
|
||||
<ScrollView
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<android.support.v7.widget.GridLayout
|
||||
android:layout_width="fill_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerHorizontal="true"
|
||||
android:padding="10dip"
|
||||
app:columnCount="3">
|
||||
|
||||
<Button
|
||||
android:id="@+id/careportal_bgcheck"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:text="@string/careportal_bgcheck"
|
||||
app:layout_column="0"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill"
|
||||
app:layout_row="0" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/careportal_exercise"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:text="@string/careportal_exercise"
|
||||
app:layout_column="1"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill"
|
||||
app:layout_row="0" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/careportal_note"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:text="@string/careportal_note"
|
||||
app:layout_column="2"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill"
|
||||
app:layout_row="0" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/careportal_snackbolus"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:text="@string/careportal_snackbolus"
|
||||
app:layout_column="0"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill"
|
||||
app:layout_row="1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/careportal_mealbolus"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:text="@string/careportal_mealbolus"
|
||||
app:layout_column="1"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill"
|
||||
app:layout_row="1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/careportal_correctionbolus"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:text="@string/careportal_correctionbolus"
|
||||
app:layout_column="2"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill"
|
||||
app:layout_row="1" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/careportal_carbscorrection"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:text="@string/careportal_carbscorrection"
|
||||
app:layout_column="0"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill"
|
||||
app:layout_row="2" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/careportal_combobolus"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:text="@string/careportal_combobolus"
|
||||
app:layout_column="1"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill"
|
||||
app:layout_row="2" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/careportal_tempbasalstart"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:text="@string/careportal_tempbasalstart"
|
||||
app:layout_column="2"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill"
|
||||
app:layout_row="2" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/careportal_tempbasalend"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:text="@string/careportal_tempbasalend"
|
||||
app:layout_column="0"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill"
|
||||
app:layout_row="3" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/careportal_announcement"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:text="@string/careportal_announcement"
|
||||
app:layout_column="1"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill"
|
||||
app:layout_row="3" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/careportal_question"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:text="@string/careportal_question"
|
||||
app:layout_column="2"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill"
|
||||
app:layout_row="3" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/careportal_pumpsitechange"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:text="@string/careportal_pumpsitechange"
|
||||
app:layout_column="0"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill"
|
||||
app:layout_row="4" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/careportal_cgmsensorinsert"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:text="@string/careportal_cgmsensorinsert"
|
||||
app:layout_column="1"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill"
|
||||
app:layout_row="4" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/careportal_cgmsensorstart"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:text="@string/careportal_cgmsensorstart"
|
||||
app:layout_column="2"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill"
|
||||
app:layout_row="4" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/careportal_insulincartridgechange"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:text="@string/careportal_insulincartridgechange"
|
||||
app:layout_column="0"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill"
|
||||
app:layout_row="5" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/careportal_profileswitch"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:text="@string/careportal_profileswitch"
|
||||
app:layout_column="1"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill"
|
||||
app:layout_row="5" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/careportal_openapsoffline"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="80dp"
|
||||
android:text="@string/careportal_openapsoffline"
|
||||
app:layout_column="2"
|
||||
app:layout_columnWeight="1"
|
||||
app:layout_gravity="fill"
|
||||
app:layout_row="5" />
|
||||
|
||||
</android.support.v7.widget.GridLayout>
|
||||
</ScrollView>
|
||||
</FrameLayout>
|
632
app/src/main/res/layout/careportal_newnstreatment_dialog.xml
Normal file
632
app/src/main/res/layout/careportal_newnstreatment_dialog.xml
Normal file
|
@ -0,0 +1,632 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:focusableInTouchMode="true"
|
||||
android:minWidth="300dp"
|
||||
android:orientation="vertical"
|
||||
android:padding="10dp">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/careportal_newnstreatment_bg_layout"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:width="100dp"
|
||||
android:padding="10dp"
|
||||
android:text="@string/treatments_wizard_bg_label"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/careportal_newnstreatment_bg_plus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="#ffffff"
|
||||
android:src="@drawable/ic_action_add"
|
||||
android:tint="#ffffff" />
|
||||
|
||||
<EditText
|
||||
android:id="@+id/careportal_newnstreatment_bginput"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:width="100dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:inputType="numberDecimal"
|
||||
android:padding="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/careportal_newnstreatment_bg_minus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="#ffffff"
|
||||
android:src="@drawable/ic_action_minus"
|
||||
android:tint="#ffffff" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/careportal_newnstreatment_bgunits"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="left"
|
||||
android:minWidth="40dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="mg/dl"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/careportal_newnstreatment_bgsource_layout"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_gravity="right">
|
||||
|
||||
<RadioGroup
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/careportal_newnstreatment_meter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:checked="true"
|
||||
android:text="@string/careportal_newnstreatment_meter" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/careportal_newnstreatment_sensor"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/careportal_newnstreatment_sensor" />
|
||||
|
||||
<RadioButton
|
||||
android:id="@+id/careportal_newnstreatment_other"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/careportal_newnstreatment_other" />
|
||||
</RadioGroup>
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/careportal_newnstreatment_carbs_layout"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:width="100dp"
|
||||
android:padding="10dp"
|
||||
android:text="@string/careportal_newnstreatment_carbs_label"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/careportal_newnstreatment_carbs_plus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="#ffffff"
|
||||
android:src="@drawable/ic_action_add"
|
||||
android:tint="#ffffff" />
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/careportal_newnstreatment_carbsinput"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:width="100dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:inputType="numberDecimal"
|
||||
android:padding="10dp"
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/careportal_newnstreatment_carbs_minus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="#ffffff"
|
||||
android:src="@drawable/ic_action_minus"
|
||||
android:tint="#ffffff" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="left"
|
||||
android:minWidth="40dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="g"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/careportal_newnstreatment_insulin_layout"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:width="100dp"
|
||||
android:padding="10dp"
|
||||
android:text="@string/careportal_newnstreatment_insulin_label"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/careportal_newnstreatment_insulin_plus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="#ffffff"
|
||||
android:src="@drawable/ic_action_add"
|
||||
android:tint="#ffffff" />
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/careportal_newnstreatment_insulininput"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:width="100dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:inputType="numberDecimal"
|
||||
android:padding="10dp"
|
||||
android:text=""
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/careportal_newnstreatment_insulin_minus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="#ffffff"
|
||||
android:src="@drawable/ic_action_minus"
|
||||
android:tint="#ffffff" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="left"
|
||||
android:minWidth="40dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="U"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/careportal_newnstreatment_split_layout"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:width="100dp"
|
||||
android:padding="10dp"
|
||||
android:text="@string/careportal_newnstreatment_split_label"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/careportal_newnstreatment_split_plus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="#ffffff"
|
||||
android:src="@drawable/ic_action_add"
|
||||
android:tint="#ffffff" />
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/careportal_newnstreatment_splitinput"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:width="100dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:inputType="numberDecimal"
|
||||
android:padding="10dp"
|
||||
android:text=""
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/careportal_newnstreatment_split_minus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="#ffffff"
|
||||
android:src="@drawable/ic_action_minus"
|
||||
android:tint="#ffffff" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="left"
|
||||
android:minWidth="40dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="%"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/careportal_newnstreatment_duration_layout"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:width="100dp"
|
||||
android:padding="10dp"
|
||||
android:text="@string/careportal_newnstreatment_duration_label"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/careportal_newnstreatment_duration_plus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="#ffffff"
|
||||
android:src="@drawable/ic_action_add"
|
||||
android:tint="#ffffff" />
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/careportal_newnstreatment_durationinput"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:width="100dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:inputType="numberDecimal"
|
||||
android:padding="10dp"
|
||||
android:text=""
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/careportal_newnstreatment_duration_minus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="#ffffff"
|
||||
android:src="@drawable/ic_action_minus"
|
||||
android:tint="#ffffff" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/careportal_newnstreatment_duration_min"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="left"
|
||||
android:minWidth="40dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="@string/careportal_newnstreatment_duration_min"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/careportal_newnstreatment_percent_layout"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:width="100dp"
|
||||
android:padding="10dp"
|
||||
android:text="@string/careportal_newnstreatment_percent_label"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/careportal_newnstreatment_percent_plus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="#ffffff"
|
||||
android:src="@drawable/ic_action_add"
|
||||
android:tint="#ffffff" />
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/careportal_newnstreatment_percentinput"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:width="100dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:inputType="numberDecimal"
|
||||
android:padding="10dp"
|
||||
android:text=""
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/careportal_newnstreatment_percent_minus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="#ffffff"
|
||||
android:src="@drawable/ic_action_minus"
|
||||
android:tint="#ffffff" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="left"
|
||||
android:minWidth="40dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="%"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/careportal_newnstreatment_absolute_layout"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:width="100dp"
|
||||
android:padding="10dp"
|
||||
android:text="@string/careportal_newnstreatment_absolute_label"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/careportal_newnstreatment_absolute_plus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="#ffffff"
|
||||
android:src="@drawable/ic_action_add"
|
||||
android:tint="#ffffff" />
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/careportal_newnstreatment_absoluteinput"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:width="100dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:inputType="numberDecimal"
|
||||
android:padding="10dp"
|
||||
android:text=""
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/careportal_newnstreatment_absolute_minus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="#ffffff"
|
||||
android:src="@drawable/ic_action_minus"
|
||||
android:tint="#ffffff" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="left"
|
||||
android:minWidth="40dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="U/h"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/careportal_newnstreatment_carbtime_layout"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:width="100dp"
|
||||
android:padding="10dp"
|
||||
android:text="@string/careportal_newnstreatment_carbtime_label"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/careportal_newnstreatment_carbtime_plus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="#ffffff"
|
||||
android:src="@drawable/ic_action_add"
|
||||
android:tint="#ffffff" />
|
||||
|
||||
|
||||
<EditText
|
||||
android:id="@+id/careportal_newnstreatment_carbtimeinput"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:width="100dp"
|
||||
android:gravity="center_horizontal"
|
||||
android:inputType="numberDecimal"
|
||||
android:padding="10dp"
|
||||
android:text=""
|
||||
android:textAppearance="?android:attr/textAppearanceLarge" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/careportal_newnstreatment_carbtime_minus"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/circle"
|
||||
android:backgroundTint="#ffffff"
|
||||
android:src="@drawable/ic_action_minus"
|
||||
android:tint="#ffffff" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:gravity="left"
|
||||
android:minWidth="40dp"
|
||||
android:paddingLeft="5dp"
|
||||
android:text="min"
|
||||
android:textAppearance="?android:attr/textAppearanceSmall" />
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/careportal_newnstreatment_profile_layout"
|
||||
android:visibility="gone"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:width="100dp"
|
||||
android:padding="10dp"
|
||||
android:text="@string/careportal_newnstreatment_profile_label"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<Spinner
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/careportal_newnstreatment_profile" />
|
||||
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/careportal_newnstreatment_notes_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:width="100dp"
|
||||
android:padding="10dp"
|
||||
android:text="@string/careportal_newnstreatment_notes_label"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium" />
|
||||
|
||||
<EditText
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:id="@+id/careportal_newnstreatment_notes"
|
||||
android:width="200dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/careportal_newnstreatment_eventtime_layout"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:width="100dp"
|
||||
android:padding="10dp"
|
||||
android:text="@string/careportal_newnstreatment_eventtime_label"
|
||||
android:textAppearance="?android:attr/textAppearanceMedium"
|
||||
android:layout_gravity="center_vertical" />
|
||||
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:id="@+id/careportal_newnstreatment_eventdate"
|
||||
android:width="150dp"
|
||||
android:layout_gravity="center_vertical" />
|
||||
<Button
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text=""
|
||||
android:id="@+id/careportal_newnstreatment_eventtime"
|
||||
android:width="50dp"
|
||||
android:layout_gravity="center_vertical" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right"
|
||||
android:layout_marginLeft="20dp"
|
||||
android:layout_marginRight="20dp"
|
||||
android:orientation="horizontal"
|
||||
android:padding="10dp">
|
||||
|
||||
<Button
|
||||
android:id="@+id/careportal_newnstreatment_ok"
|
||||
style="?android:attr/buttonStyle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_weight="1"
|
||||
android:padding="10dp"
|
||||
android:text="@string/ok"
|
||||
android:textAllCaps="false"
|
||||
android:textSize="20sp" />
|
||||
|
||||
</LinearLayout>
|
||||
|
||||
|
||||
</LinearLayout>
|
|
@ -95,6 +95,8 @@
|
|||
<string name="tempbasals">Temp Basals</string>
|
||||
<string name="treatments">Treatments</string>
|
||||
<string name="virtualpump">Virtual Pump</string>
|
||||
<string name="careportal">Careportal</string>
|
||||
|
||||
|
||||
<string name="configbuilder_pump">Pump</string>
|
||||
<string name="configbuilder_treatments">Treatments</string>
|
||||
|
@ -150,6 +152,7 @@
|
|||
<string name="openloop">Open Loop</string>
|
||||
<string name="openloop_newsuggestion">New suggestion available</string>
|
||||
<string name="unsupportedclientver">Unsupported version of NSClient</string>
|
||||
<string name="nsclientnotinstalled">NSClient not installed. Record lost!</string>
|
||||
<string name="bgavailableinns">BG available in NS</string>
|
||||
<string name="pumpstatusavailableinns">Pump status available in NS</string>
|
||||
<string name="manualenacts">Manual enacts</string>
|
||||
|
@ -159,5 +162,42 @@
|
|||
<string name="treatments_wizard_basaliob_label">Basal IOB</string>
|
||||
<string name="bolusconstraintapplied">Bolus constraint applied</string>
|
||||
<string name="carbsconstraintapplied">Carbs constraint applied</string>
|
||||
<string name="careportal_bgcheck">BG Check</string>
|
||||
<string name="careportal_announcement">Announcement</string>
|
||||
<string name="careportal_note">Note</string>
|
||||
<string name="careportal_question">Question</string>
|
||||
<string name="careportal_exercise">Exercise</string>
|
||||
<string name="careportal_pumpsitechange">Pump Site Change</string>
|
||||
<string name="careportal_cgmsensorinsert">CGM Sensor Insert</string>
|
||||
<string name="careportal_cgmsensorstart">CGM Sensor Start</string>
|
||||
<string name="careportal_insulincartridgechange">Insulin Cartridge Change</string>
|
||||
<string name="careportal_profileswitch">Profile Switch</string>
|
||||
<string name="careportal_snackbolus">Snack Bolus</string>
|
||||
<string name="careportal_mealbolus">Meal Bolus</string>
|
||||
<string name="careportal_correctionbolus">Correction Bolus</string>
|
||||
<string name="careportal_combobolus">Combo Bolus</string>
|
||||
<string name="careportal_tempbasalstart">Temp Basal Start</string>
|
||||
<string name="careportal_tempbasalend">Temp Basal End</string>
|
||||
<string name="careportal_carbscorrection">Carbs correction</string>
|
||||
<string name="careportal_openapsoffline">OpenAPS Offline</string>
|
||||
|
||||
<string name="careportal_newnstreatment_eventtype">Event type</string>
|
||||
<string name="careportal_newnstreatment_other">Other</string>
|
||||
<string name="careportal_newnstreatment_meter">Meter</string>
|
||||
<string name="careportal_newnstreatment_sensor">Sensor</string>
|
||||
<string name="careportal_newnstreatment_carbs_label">Carbs</string>
|
||||
<string name="careportal_newnstreatment_insulin_label">Insulin</string>
|
||||
<string name="careportal_newnstreatment_carbtime_label">Carb time</string>
|
||||
<string name="careportal_newnstreatment_split_label">Split</string>
|
||||
<string name="careportal_newnstreatment_duration_label">Duration</string>
|
||||
<string name="careportal_newnstreatment_percent_label">Percent</string>
|
||||
<string name="careportal_newnstreatment_absolute_label">Absolute</string>
|
||||
<string name="careportal_newnstreatment_duration_min">min</string>
|
||||
<string name="careportal_newnstreatment_notes_label">Notes</string>
|
||||
<string name="careportal_newnstreatment_eventtime_label">Event time</string>
|
||||
<string name="careportal_newnstreatment_profile_label">Profile</string>
|
||||
<string name="careportal_newnstreatment_enteredby_title">Entered By</string>
|
||||
<string name="careportal_newnstreatment_glucosetype">Glucose type</string>
|
||||
<string name="noprofile">No profile loaded from NS yet</string>
|
||||
|
||||
</resources>
|
||||
|
|
13
app/src/main/res/xml/pref_careportal.xml
Normal file
13
app/src/main/res/xml/pref_careportal.xml
Normal file
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceCategory
|
||||
android:key="careportal"
|
||||
android:title="@string/careportal">
|
||||
|
||||
<EditTextPreference
|
||||
android:title="@string/careportal_newnstreatment_enteredby_title"
|
||||
android:key="careportal_enteredby"
|
||||
android:inputType="text">
|
||||
</EditTextPreference>
|
||||
</PreferenceCategory>
|
||||
</PreferenceScreen>
|
Loading…
Reference in a new issue