temp target treatment dialog & sync fix

This commit is contained in:
Milos Kozak 2017-01-16 16:59:12 +01:00
parent 61a8cad4e8
commit 61b1ee781f
22 changed files with 234 additions and 39 deletions

View file

@ -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">

View file

@ -596,21 +596,27 @@ public class DataService extends IntentService {
public void handleAddChangeTempTargetRecord(JSONObject trJson) throws JSONException, SQLException {
if (trJson.has("eventType") && trJson.getString("eventType").equals("Temporary Target")) {
if (Config.logIncommingData)
log.debug("Processing TempTarget record: " + trJson.toString());
Dao<TempTarget, Long> daoTempTargets = MainApp.getDbHelper().getDaoTempTargets();
QueryBuilder<TempTarget, Long> queryBuilder = daoTempTargets.queryBuilder();
Where where = queryBuilder.where();
where.eq("_id", trJson.getString("_id")).or().eq("timeIndex", trJson.getLong("mills"));
PreparedQuery<TempTarget> preparedQuery = queryBuilder.prepare();
List<TempTarget> list = daoTempTargets.query(preparedQuery);
NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
if (profile == null) return; // no profile data, better ignore than do something wrong
String units = profile.getUnits();
if (list.size() == 0) {
// Record does not exists. add
TempTarget newRecord = new TempTarget();
newRecord.timeStart = new Date(trJson.getLong("mills"));
newRecord.duration = trJson.getInt("duration");
newRecord.low = trJson.getDouble("targetBottom");
newRecord.high = trJson.getDouble("targetTop");
newRecord.low = NSProfile.toMgdl(trJson.getDouble("targetBottom"), units);
newRecord.high = NSProfile.toMgdl(trJson.getDouble("targetTop"), units);
newRecord.reason = trJson.getString("reason");
newRecord._id = trJson.getString("_id");
newRecord.setTimeIndex(newRecord.getTimeIndex());
daoTempTargets.createIfNotExists(newRecord);
if (Config.logIncommingData)
log.debug("Adding TempTarget record to database: " + newRecord.log());
@ -621,9 +627,10 @@ public class DataService extends IntentService {
TempTarget record = list.get(0);
record.timeStart = new Date(trJson.getLong("mills"));
record.duration = trJson.getInt("duration");
record.low = trJson.getDouble("targetBottom");
record.high = trJson.getDouble("targetTop");
record.low = NSProfile.toMgdl(trJson.getDouble("targetBottom"), units);
record.high = NSProfile.toMgdl(trJson.getDouble("targetTop"), units);
record.reason = trJson.getString("reason");
record._id = trJson.getString("_id");
daoTempTargets.update(record);
MainApp.bus().post(new EventTempTargetRangeChange());
}

View file

@ -18,7 +18,7 @@ public class TempTarget {
private static Logger log = LoggerFactory.getLogger(TempTarget.class);
public long getTimeIndex() {
return timeStart.getTime();
return timeStart.getTime() - timeStart.getTime() % 1000;
}
public void setTimeIndex(long timeIndex) {

View file

@ -12,6 +12,7 @@ import android.widget.Button;
import com.squareup.otto.Subscribe;
import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.events.EventInitializationChanged;
@ -35,6 +36,7 @@ public class ActionsFragment extends Fragment implements FragmentBase, View.OnCl
}
Button profileSwitch;
Button tempTarget;
Button extendedBolus;
Button tempBasal;
Button fill;
@ -49,11 +51,13 @@ public class ActionsFragment extends Fragment implements FragmentBase, View.OnCl
View view = inflater.inflate(R.layout.actions_fragment, container, false);
profileSwitch = (Button) view.findViewById(R.id.actions_profileswitch);
tempTarget = (Button) view.findViewById(R.id.actions_temptarget);
extendedBolus = (Button) view.findViewById(R.id.actions_extendedbolus);
tempBasal = (Button) view.findViewById(R.id.actions_settempbasal);
fill = (Button) view.findViewById(R.id.actions_fill);
profileSwitch.setOnClickListener(this);
tempTarget.setOnClickListener(this);
extendedBolus.setOnClickListener(this);
tempBasal.setOnClickListener(this);
fill.setOnClickListener(this);
@ -106,6 +110,10 @@ public class ActionsFragment extends Fragment implements FragmentBase, View.OnCl
fill.setVisibility(View.GONE);
else
fill.setVisibility(View.VISIBLE);
if (!Config.APS)
tempTarget.setVisibility(View.GONE);
else
tempTarget.setVisibility(View.VISIBLE);
}
});
}
@ -117,11 +125,18 @@ public class ActionsFragment extends Fragment implements FragmentBase, View.OnCl
switch (view.getId()) {
case R.id.actions_profileswitch:
NewNSTreatmentDialog newDialog = new NewNSTreatmentDialog();
final OptionsToShow profileswitch = new OptionsToShow(R.id.careportal_profileswitch, R.string.careportal_profileswitch, true, false, false, false, false, false, false, true, false);
final OptionsToShow profileswitch = new OptionsToShow(R.id.careportal_profileswitch, R.string.careportal_profileswitch, true, false, false, false, false, false, false, true, false, false);
profileswitch.executeProfileSwitch = true;
newDialog.setOptions(profileswitch);
newDialog.show(manager, "NewNSTreatmentDialog");
break;
case R.id.actions_temptarget:
NewNSTreatmentDialog newTTDialog = new NewNSTreatmentDialog();
final OptionsToShow temptarget = new OptionsToShow(R.id.careportal_temptarget, R.string.careportal_temptarget, false, false, false, false, true, false, false, false, false, true);
temptarget.executeTempTarget = true;
newTTDialog.setOptions(temptarget);
newTTDialog.show(manager, "NewNSTreatmentDialog");
break;
case R.id.actions_extendedbolus:
NewExtendedBolusDialog newExtendedDialog = new NewExtendedBolusDialog();
newExtendedDialog.show(manager, "NewExtendedDialog");

View file

@ -25,25 +25,26 @@ public class CareportalFragment extends Fragment implements FragmentBase, View.O
return careportalPlugin;
}
// 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);
// bg,insulin,carbs,prebolus,duration,percent,absolute,profile,split,temptarget
final OptionsToShow bgcheck = new OptionsToShow(R.id.careportal_bgcheck, R.string.careportal_bgcheck, true, true, true, false, 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, false);
final OptionsToShow mealbolus = new OptionsToShow(R.id.careportal_mealbolus, R.string.careportal_mealbolus, true, true, true, true, false, 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, false);
final OptionsToShow carbcorrection = new OptionsToShow(R.id.careportal_carbscorrection, R.string.careportal_carbscorrection, true, false, true, false, 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, false);
final OptionsToShow announcement = new OptionsToShow(R.id.careportal_announcement, R.string.careportal_announcement, true, false, 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, false);
final OptionsToShow question = new OptionsToShow(R.id.careportal_question, R.string.careportal_question, true, false, 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, false);
final OptionsToShow sitechange = new OptionsToShow(R.id.careportal_pumpsitechange, R.string.careportal_pumpsitechange, true, true, false, 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, false);
final OptionsToShow sensorchange = new OptionsToShow(R.id.careportal_cgmsensorinsert, R.string.careportal_cgmsensorinsert, true, false, 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, false);
final OptionsToShow tempbasalstart = new OptionsToShow(R.id.careportal_tempbasalstart, R.string.careportal_tempbasalstart, true, false, false, false, true, true, true, false, false, false);
final OptionsToShow tempbasalend = new OptionsToShow(R.id.careportal_tempbasalend, R.string.careportal_tempbasalend, true, false, 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, false);
final OptionsToShow openapsoffline = new OptionsToShow(R.id.careportal_openapsoffline, R.string.careportal_openapsoffline, false, false, false, false, true, false, false, false, false, false);
final OptionsToShow temptarget = new OptionsToShow(R.id.careportal_temptarget, R.string.careportal_temptarget, false, false, false, false, true, false, false, false, false, true);
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
@ -68,6 +69,7 @@ public class CareportalFragment extends Fragment implements FragmentBase, View.O
view.findViewById(R.id.careportal_tempbasalend).setOnClickListener(this);
view.findViewById(R.id.careportal_tempbasalstart).setOnClickListener(this);
view.findViewById(R.id.careportal_openapsoffline).setOnClickListener(this);
view.findViewById(R.id.careportal_temptarget).setOnClickListener(this);
return view;
}
@ -130,6 +132,9 @@ public class CareportalFragment extends Fragment implements FragmentBase, View.O
case R.id.careportal_openapsoffline:
newDialog.setOptions(openapsoffline);
break;
case R.id.careportal_temptarget:
newDialog.setOptions(temptarget);
break;
default:
newDialog = null;
}

View file

@ -24,6 +24,7 @@ import android.widget.RadioButton;
import android.widget.Spinner;
import android.widget.TextView;
import com.j256.ormlite.dao.Dao;
import com.wdullaer.materialdatetimepicker.date.DatePickerDialog;
import com.wdullaer.materialdatetimepicker.time.RadialPickerLayout;
import com.wdullaer.materialdatetimepicker.time.TimePickerDialog;
@ -33,6 +34,7 @@ import org.json.JSONObject;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.sql.SQLException;
import java.text.DecimalFormat;
import java.util.ArrayList;
import java.util.Calendar;
@ -42,10 +44,13 @@ import java.util.Date;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.events.EventNewBasalProfile;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.plugins.Careportal.OptionsToShow;
import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.TempTargetRange.events.EventTempTargetRangeChange;
import info.nightscout.client.data.NSProfile;
import info.nightscout.utils.DateUtil;
import info.nightscout.utils.PlusMinusEditText;
@ -73,6 +78,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
LinearLayout layoutAbsolute;
LinearLayout layoutCarbTime;
LinearLayout layoutProfile;
LinearLayout layoutTempTarget;
Button dateButton;
Button timeButton;
Button okButton;
@ -91,6 +97,9 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
EditText carbTimeEdit;
EditText splitEdit;
Spinner profileSpinner;
EditText low;
EditText high;
Spinner reasonSpinner;
PlusMinusEditText editBg;
PlusMinusEditText editCarbs;
@ -142,6 +151,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
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);
layoutTempTarget = (LinearLayout) view.findViewById(R.id.careportal_newnstreatment_temptarget_layout);
bgUnitsView = (TextView) view.findViewById(R.id.careportal_newnstreatment_bgunits);
meterRadioButton = (RadioButton) view.findViewById(R.id.careportal_newnstreatment_meter);
@ -193,6 +203,10 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
notesEdit = (EditText) view.findViewById(R.id.careportal_newnstreatment_notes);
splitEdit = (EditText) view.findViewById(R.id.careportal_newnstreatment_splitinput);
reasonSpinner = (Spinner) view.findViewById(R.id.careportal_newnstreatment_temptarget_reason);
low = (EditText) view.findViewById(R.id.careportal_temptarget_low);
high = (EditText) view.findViewById(R.id.careportal_temptarget_high);
eventTime = new Date();
dateButton = (Button) view.findViewById(R.id.careportal_newnstreatment_eventdate);
timeButton = (Button) view.findViewById(R.id.careportal_newnstreatment_eventtime);
@ -204,7 +218,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
okButton = (Button) view.findViewById(R.id.careportal_newnstreatment_ok);
okButton.setOnClickListener(this);
// BG
// profile
profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
ArrayList<CharSequence> profileList;
units = Constants.MGDL;
@ -227,6 +241,17 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
}
}
// temp target
ArrayList<CharSequence> reasonList = new ArrayList<CharSequence>();
reasonList.add(MainApp.sResources.getString(R.string.eatingsoon));
reasonList.add(MainApp.sResources.getString(R.string.activity));
reasonList.add(MainApp.sResources.getString(R.string.manual));
ArrayAdapter<CharSequence> adapterReason = new ArrayAdapter<CharSequence>(getContext(),
android.R.layout.simple_spinner_item, reasonList);
adapter.setDropDownViewResource(android.R.layout.simple_spinner_dropdown_item);
reasonSpinner.setAdapter(adapterReason);
// bg
bgUnitsView.setText(units);
// Set BG if not old
@ -271,6 +296,7 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
showOrHide(layoutAbsolute, options.absolute);
showOrHide(layoutCarbTime, options.prebolus);
showOrHide(layoutProfile, options.profile);
showOrHide(layoutTempTarget, options.tempTarget);
return view;
}
@ -403,6 +429,9 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
case R.id.careportal_openapsoffline:
data.put("eventType", "OpenAPS Offline");
break;
case R.id.careportal_temptarget:
data.put("eventType", "Temporary Target");
break;
}
if (SafeParse.stringToDouble(bgInputEdit.getText().toString()) != 0d) {
data.put("glucose", SafeParse.stringToDouble(bgInputEdit.getText().toString()));
@ -426,6 +455,12 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
data.put("preBolus", SafeParse.stringToDouble(carbTimeEdit.getText().toString()));
if (!notesEdit.getText().toString().equals(""))
data.put("notes", notesEdit.getText().toString());
if (!reasonSpinner.getSelectedItem().toString().equals(""))
data.put("reason", reasonSpinner.getSelectedItem().toString());
if (SafeParse.stringToDouble(low.getText().toString()) != 0d)
data.put("targetBottom", SafeParse.stringToDouble(low.getText().toString()));
if (SafeParse.stringToDouble(high.getText().toString()) != 0d)
data.put("targetTop", SafeParse.stringToDouble(high.getText().toString()));
data.put("units", units);
if (!enteredBy.equals("")) data.put("enteredBy", enteredBy);
if (options.eventType == R.id.careportal_combobolus) {
@ -509,6 +544,14 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
ret += data.get("profile");
ret += "\n";
}
if (data.has("targetBottom") && data.has("targetTop")) {
ret += getString(R.string.target_range);
ret += " ";
ret += data.get("targetBottom");
ret += " - ";
ret += data.get("targetTop");
ret += "\n";
}
if (data.has("created_at")) {
ret += getString(R.string.careportal_newnstreatment_eventtime_label);
ret += ": ";
@ -563,6 +606,35 @@ public class NewNSTreatmentDialog extends DialogFragment implements View.OnClick
} else {
ConfigBuilderPlugin.uploadCareportalEntryToNS(data);
}
if (options.executeTempTarget) {
if (data.has("targetBottom") && data.has("targetTop")) {
sHandler.post(new Runnable() {
@Override
public void run() {
try {
TempTarget tempTarget = new TempTarget();
tempTarget.timeStart = eventTime;
tempTarget.duration = data.getInt("duration");
tempTarget.reason = data.getString("reason");
tempTarget.low = NSProfile.toMgdl(data.getDouble("targetBottom"), MainApp.getConfigBuilder().getActiveProfile().getProfile().getUnits());
tempTarget.high = NSProfile.toMgdl(data.getDouble("targetTop"), MainApp.getConfigBuilder().getActiveProfile().getProfile().getUnits());
tempTarget.setTimeIndex(tempTarget.getTimeIndex());
Dao<TempTarget, Long> dao = MainApp.getDbHelper().getDaoTempTargets();
log.debug("Creating new TempTarget db record: " + tempTarget.log());
dao.createIfNotExists(tempTarget);
MainApp.bus().post(new EventTempTargetRangeChange());
ConfigBuilderPlugin.uploadCareportalEntryToNS(data);
} catch (JSONException e) {
e.printStackTrace();
} catch (SQLException e) {
e.printStackTrace();
}
}
});
}
} else {
ConfigBuilderPlugin.uploadCareportalEntryToNS(data);
}
}
});
builder.setNegativeButton(getContext().getString(R.string.cancel), null);

View file

@ -16,9 +16,11 @@ public class OptionsToShow {
public boolean absolute;
public boolean profile;
public boolean split;
public boolean tempTarget;
// perform direct actions
public boolean executeProfileSwitch = false;
public boolean executeTempTarget = false;
public OptionsToShow(int eventType,
int eventName,
@ -30,7 +32,8 @@ public class OptionsToShow {
boolean percent,
boolean absolute,
boolean profile,
boolean split) {
boolean split,
boolean tempTarget) {
this.eventType = eventType;
this.eventName = eventName;
this.bg = bg;
@ -42,5 +45,6 @@ public class OptionsToShow {
this.absolute = absolute;
this.profile = profile;
this.split = split;
this.tempTarget = tempTarget;
}
}

View file

@ -133,7 +133,7 @@ public class CircadianPercentageProfileFragment extends Fragment implements Frag
@Override
public void onClick(View view) {
NewNSTreatmentDialog newDialog = new NewNSTreatmentDialog();
final OptionsToShow profileswitch = new OptionsToShow(R.id.careportal_profileswitch, R.string.careportal_profileswitch, true, false, false, false, false, false, false, true, false);
final OptionsToShow profileswitch = new OptionsToShow(R.id.careportal_profileswitch, R.string.careportal_profileswitch, true, false, false, false, false, false, false, true, false, false);
profileswitch.executeProfileSwitch = true;
newDialog.setOptions(profileswitch);
newDialog.show(getFragmentManager(), "NewNSTreatmentDialog");

View file

@ -106,7 +106,7 @@ public class LocalProfileFragment extends Fragment implements FragmentBase {
@Override
public void onClick(View view) {
NewNSTreatmentDialog newDialog = new NewNSTreatmentDialog();
final OptionsToShow profileswitch = new OptionsToShow(R.id.careportal_profileswitch, R.string.careportal_profileswitch, true, false, false, false, false, false, false, true, false);
final OptionsToShow profileswitch = new OptionsToShow(R.id.careportal_profileswitch, R.string.careportal_profileswitch, true, false, false, false, false, false, false, true, false, false);
profileswitch.executeProfileSwitch = true;
newDialog.setOptions(profileswitch);
newDialog.show(getFragmentManager(), "NewNSTreatmentDialog");

View file

@ -539,7 +539,7 @@ public class OverviewFragment extends Fragment {
public boolean onLongClick(View view) {
view.performHapticFeedback(HapticFeedbackConstants.LONG_PRESS);
NewNSTreatmentDialog newDialog = new NewNSTreatmentDialog();
final OptionsToShow profileswitch = new OptionsToShow(R.id.careportal_profileswitch, R.string.careportal_profileswitch, true, false, false, false, false, false, false, true, false);
final OptionsToShow profileswitch = new OptionsToShow(R.id.careportal_profileswitch, R.string.careportal_profileswitch, true, false, false, false, false, false, false, true, false, false);
profileswitch.executeProfileSwitch = true;
newDialog.setOptions(profileswitch);
newDialog.show(getFragmentManager(), "NewNSTreatmentDialog");

View file

@ -110,7 +110,7 @@ public class SimpleProfileFragment extends Fragment implements FragmentBase {
@Override
public void onClick(View view) {
NewNSTreatmentDialog newDialog = new NewNSTreatmentDialog();
final OptionsToShow profileswitch = new OptionsToShow(R.id.careportal_profileswitch, R.string.careportal_profileswitch, true, false, false, false, false, false, false, true, false);
final OptionsToShow profileswitch = new OptionsToShow(R.id.careportal_profileswitch, R.string.careportal_profileswitch, true, false, false, false, false, false, false, true, false, false);
profileswitch.executeProfileSwitch = true;
newDialog.setOptions(profileswitch);
newDialog.show(getFragmentManager(), "NewNSTreatmentDialog");

View file

@ -56,7 +56,7 @@ public class Translator {
case "Sensor":
return MainApp.sResources.getString(R.string.glucosetype_sensor);
case "Manual":
return MainApp.sResources.getString(R.string.glucosetype_manual);
return MainApp.sResources.getString(R.string.manual);
}
return text;
}

View file

@ -22,6 +22,19 @@
android:text="@string/careportal_profileswitch"
android:textColor="@color/colorProfileSwitchButton" />
<Button
android:id="@+id/actions_temptarget"
style="?android:attr/buttonStyle"
android:layout_width="fill_parent"
android:layout_height="wrap_content"
android:layout_marginBottom="3dp"
android:layout_marginLeft="10dp"
android:layout_marginRight="10dp"
android:layout_marginTop="3dp"
android:layout_weight="0.5"
android:text="@string/careportal_temptarget"
android:textColor="@color/colorTempTargetButton" />
<Button
android:id="@+id/actions_settempbasal"
style="?android:attr/buttonStyle"

View file

@ -197,6 +197,16 @@
app:layout_gravity="fill"
app:layout_row="5" />
<Button
android:id="@+id/careportal_temptarget"
android:layout_width="0dp"
android:layout_height="70dp"
android:text="@string/careportal_temptarget"
app:layout_column="0"
app:layout_columnWeight="1"
app:layout_gravity="fill"
app:layout_row="6" />
</android.support.v7.widget.GridLayout>
</ScrollView>
</FrameLayout>

View file

@ -560,6 +560,71 @@
</LinearLayout>
<LinearLayout
android:id="@+id/careportal_newnstreatment_temptarget_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="vertical"
android:visibility="visible">
<LinearLayout
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/reason"
android:textAppearance="?android:attr/textAppearanceMedium" />
<Spinner
android:id="@+id/careportal_newnstreatment_temptarget_reason"
android:layout_width="wrap_content"
android:layout_height="wrap_content" />
</LinearLayout>
<LinearLayout
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/target_range"
android:textAppearance="?android:attr/textAppearanceMedium" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:width="70dp"
android:ems="10"
android:id="@+id/careportal_temptarget_low" />
<EditText
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:inputType="numberDecimal"
android:width="70dp"
android:ems="10"
android:id="@+id/careportal_temptarget_high" />
</LinearLayout>
</LinearLayout>
<LinearLayout
android:id="@+id/careportal_newnstreatment_notes_layout"
android:layout_width="wrap_content"

View file

@ -225,7 +225,7 @@
<string name="reloadprofile">Обнови профила</string>
<string name="percent">Процент</string>
<string name="glucosetype_sensor">Сензор</string>
<string name="glucosetype_manual">Ръчно</string>
<string name="manual">Ръчно</string>
<string name="glucosetype_finger">Пръст</string>
<string name="danar_valuenotsetproperly">Неправилно зададени стойности</string>
<string name="danar_viewprofile">Виж профила</string>

View file

@ -237,7 +237,7 @@
<string name="careportal_temporarytarget">Dočasný cíl</string>
<string name="careportal_temporarytargetcancel">Dočasný cíl konec</string>
<string name="glucosetype_finger">Glukoměr</string>
<string name="glucosetype_manual">Jiný</string>
<string name="manual">Jiný</string>
<string name="glucosetype_sensor">Senzor</string>
<string name="danarprofile">DanaR profil</string>
<string name="danarprofile_car">Rychlost absorbce sacharidů</string>

View file

@ -222,7 +222,7 @@
<string name="danarprofile">DanaR Profil Einstellungen</string>
<string name="danarprofile_dia">DIA [h]</string>
<string name="danarprofile_car">Kohlehydrahte Absorptionsrate</string>
<string name="glucosetype_manual">Manuell</string>
<string name="manual">Manuell</string>
<string name="danar_dailyunits">Einheiten (Tag)</string>
<string name="danar_invalidinput">ungültige Eingabe</string>
<string name="danar_valuenotsetproperly">Wert nicht korrekt gesetzt</string>

View file

@ -245,7 +245,7 @@
<string name="smscommunicator_remotebolusnotallowed">Bolo remoto no permitido</string>
<string name="glucosetype_finger">Dedo</string>
<string name="glucosetype_sensor">Sensor</string>
<string name="glucosetype_manual">Manual</string>
<string name="manual">Manual</string>
<string name="careportal_temporarytarget">Objetivo temporal</string>
<string name="careportal_temporarytargetcancel">Cancelar Objetivo temporal</string>
<string name="danarprofile">Configuración perfil DanaR</string>

View file

@ -248,7 +248,7 @@
<string name="smscommunicator_remotebolusnotallowed">원격 식사주입 허용되지 않음</string>
<string name="glucosetype_finger">Finger</string>
<string name="glucosetype_sensor">Sensor</string>
<string name="glucosetype_manual">Manual</string>
<string name="manual">Manual</string>
<string name="careportal_temporarytarget">Temporary Target</string>
<string name="careportal_temporarytargetcancel">Temporary Target Cancel</string>
<string name="danarprofile">DanaR 프로파일 설정</string>

View file

@ -16,6 +16,7 @@
<color name="colorSetTempButton">#FF478EFF</color>
<color name="colorSetExtendedButton">#FFDD7792</color>
<color name="colorProfileSwitchButton">#ca77dd</color>
<color name="colorTempTargetButton">#d43429</color>
<color name="colorInProgress">#c45026</color>
<color name="colorAffectingIOB">#830400</color>

View file

@ -258,7 +258,7 @@
<string name="smscommunicator_remotebolusnotallowed">Remote bolus not allowed</string>
<string name="glucosetype_finger">Finger</string>
<string name="glucosetype_sensor">Sensor</string>
<string name="glucosetype_manual">Manual</string>
<string name="manual">Manual</string>
<string name="careportal_temporarytarget">Temporary Target</string>
<string name="careportal_temporarytargetcancel">Temporary Target Cancel</string>
<string name="danarprofile">DanaR profile settings</string>
@ -401,4 +401,7 @@
<string name="localprofile">Local Profile</string>
<string name="temptargetrange">Temp Target</string>
<string name="temptargetrange_refreshfromnightscout">Refresh temp targets from NS</string>
<string name="careportal_temptarget">Temporary Target</string>
<string name="eatingsoon">Eating Soon</string>
<string name="activity">Activity</string>
</resources>