Merge pull request #127 from MilosKozak/temptarget

Temptarget
This commit is contained in:
Milos Kozak 2017-01-17 17:47:14 +01:00 committed by GitHub
commit 08c078466a
35 changed files with 1040 additions and 61 deletions

View file

@ -38,6 +38,7 @@ import info.nightscout.androidaps.plugins.SourceMM640g.SourceMM640gFragment;
import info.nightscout.androidaps.plugins.SourceNSClient.SourceNSClientFragment;
import info.nightscout.androidaps.plugins.SourceXdrip.SourceXdripFragment;
import info.nightscout.androidaps.plugins.TempBasals.TempBasalsFragment;
import info.nightscout.androidaps.plugins.TempTargetRange.TempTargetRangeFragment;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsFragment;
import info.nightscout.androidaps.plugins.VirtualPump.VirtualPumpFragment;
import info.nightscout.androidaps.plugins.Wear.WearFragment;
@ -87,6 +88,7 @@ public class MainApp extends Application {
pluginsList.add(SimpleProfileFragment.getPlugin());
pluginsList.add(LocalProfileFragment.getPlugin());
pluginsList.add(CircadianPercentageProfileFragment.getPlugin());
pluginsList.add(TempTargetRangeFragment.getPlugin());
pluginsList.add(TreatmentsFragment.getPlugin());
pluginsList.add(TempBasalsFragment.getPlugin());
pluginsList.add(SafetyFragment.getPlugin());

View file

@ -29,6 +29,7 @@ import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.db.DanaRHistoryRecord;
import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.db.Treatment;
import info.nightscout.androidaps.events.EventNewBG;
import info.nightscout.androidaps.events.EventNewBasalProfile;
@ -39,12 +40,16 @@ import info.nightscout.androidaps.plugins.ConfigBuilder.ConfigBuilderPlugin;
import info.nightscout.androidaps.plugins.DanaR.History.DanaRNSHistorySync;
import info.nightscout.androidaps.plugins.NSProfile.NSProfilePlugin;
import info.nightscout.androidaps.plugins.Objectives.ObjectivesPlugin;
import info.nightscout.androidaps.plugins.Overview.Notification;
import info.nightscout.androidaps.plugins.Overview.OverviewPlugin;
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.SmsCommunicator.SmsCommunicatorPlugin;
import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventNewSMS;
import info.nightscout.androidaps.plugins.SourceMM640g.SourceMM640gPlugin;
import info.nightscout.androidaps.plugins.SourceNSClient.SourceNSClientPlugin;
import info.nightscout.androidaps.plugins.SourceXdrip.SourceXdripPlugin;
import info.nightscout.androidaps.plugins.TempTargetRange.events.EventTempTargetRangeChange;
import info.nightscout.androidaps.receivers.DataReceiver;
import info.nightscout.client.data.NSProfile;
import info.nightscout.client.data.NSSgv;
@ -251,10 +256,15 @@ public class DataService extends IntentService {
ConfigBuilderPlugin.nsClientVersionCode = bundles.getInt("nsclientversioncode"); // for ver 1.17 contains 117
ConfigBuilderPlugin.nsClientVersionName = bundles.getString("nsclientversionname");
log.debug("Got versions: NSClient: " + ConfigBuilderPlugin.nsClientVersionName + " Nightscout: " + ConfigBuilderPlugin.nightscoutVersionName);
if (ConfigBuilderPlugin.nsClientVersionCode < 118)
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.unsupportedclientver));
if (ConfigBuilderPlugin.nsClientVersionCode < 121) {
Notification notification = new Notification(Notification.OLD_NSCLIENT, MainApp.sResources.getString(R.string.unsupportedclientver), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
} else {
MainApp.bus().post(new EventDismissNotification(Notification.OLD_NSCLIENT));
}
} else {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.unsupportedclientver));
Notification notification = new Notification(Notification.OLD_NSCLIENT, MainApp.sResources.getString(R.string.unsupportedclientver), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
}
if (bundles.containsKey("status")) {
try {
@ -379,6 +389,7 @@ public class DataService extends IntentService {
JSONObject trJson = new JSONObject(trstring);
String _id = trJson.getString("_id");
removeTreatmentFromDb(_id);
handleRemoveTempTargetRecord(trJson);
}
if (bundles.containsKey("treatments")) {
@ -388,6 +399,7 @@ public class DataService extends IntentService {
JSONObject trJson = jsonArray.getJSONObject(i);
String _id = trJson.getString("_id");
removeTreatmentFromDb(_id);
handleRemoveTempTargetRecord(trJson);
}
}
} catch (Exception e) {
@ -443,6 +455,7 @@ public class DataService extends IntentService {
private void handleAddedTreatment(String trstring) throws JSONException, SQLException {
JSONObject trJson = new JSONObject(trstring);
handleDanaRHistoryRecords(trJson); // update record _id in history
handleAddChangeTempTargetRecord(trJson);
if (!trJson.has("insulin") && !trJson.has("carbs")) {
if (Config.logIncommingData)
log.debug("ADD: Uninterested treatment: " + trstring);
@ -499,6 +512,7 @@ public class DataService extends IntentService {
private void handleChangedTreatment(String trstring) throws JSONException, SQLException {
JSONObject trJson = new JSONObject(trstring);
handleDanaRHistoryRecords(trJson); // update record _id in history
handleAddChangeTempTargetRecord(trJson);
if (!trJson.has("insulin") && !trJson.has("carbs")) {
if (Config.logIncommingData)
log.debug("CHANGE: Uninterested treatment: " + trstring);
@ -573,6 +587,86 @@ public class DataService extends IntentService {
}
}
/*
{
"_id": "58795998aa86647ba4d68ce7",
"enteredBy": "",
"eventType": "Temporary Target",
"reason": "Eating Soon",
"targetTop": 80,
"targetBottom": 80,
"duration": 120,
"created_at": "2017-01-13T22:50:00.782Z",
"carbs": null,
"insulin": null
}
*/
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 = 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());
MainApp.bus().post(new EventTempTargetRangeChange());
} else if (list.size() == 1) {
if (Config.logIncommingData)
log.debug("Updating TempTarget record in database: " + trJson.getString("_id"));
TempTarget record = list.get(0);
record.timeStart = new Date(trJson.getLong("mills"));
record.duration = trJson.getInt("duration");
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());
}
}
}
public void handleRemoveTempTargetRecord(JSONObject trJson) throws JSONException, SQLException {
if (trJson.has("_id")) {
Dao<TempTarget, Long> daoTempTargets = MainApp.getDbHelper().getDaoTempTargets();
QueryBuilder<TempTarget, Long> queryBuilder = daoTempTargets.queryBuilder();
Where where = queryBuilder.where();
where.eq("_id", trJson.getString("_id"));
PreparedQuery<TempTarget> preparedQuery = queryBuilder.prepare();
List<TempTarget> list = daoTempTargets.query(preparedQuery);
if (list.size() == 1) {
TempTarget record = list.get(0);
if (Config.logIncommingData)
log.debug("Removing TempTarget record from database: " + record.log());
daoTempTargets.delete(record);
MainApp.bus().post(new EventTempTargetRangeChange());
} else {
if (Config.logIncommingData)
log.debug("TempTarget not found database: " + trJson.toString());
}
}
}
@Nullable
public static Treatment findById(String _id) {
try {

View file

@ -37,6 +37,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
public static final String DATABASE_NAME = "AndroidAPSDb";
public static final String DATABASE_BGREADINGS = "BgReadings";
public static final String DATABASE_TEMPBASALS = "TempBasals";
public static final String DATABASE_TEMPTARGETS = "TempTargets";
public static final String DATABASE_TREATMENTS = "Treatments";
public static final String DATABASE_DANARHISTORY = "DanaRHistory";
@ -44,6 +45,7 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
public DatabaseHelper(Context context) {
super(context, DATABASE_NAME, null, DATABASE_VERSION);
onCreate(getWritableDatabase(), getConnectionSource());
}
@ -52,11 +54,12 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
try {
log.info("onCreate");
TableUtils.createTableIfNotExists(connectionSource, TempBasal.class);
TableUtils.createTableIfNotExists(connectionSource, TempTarget.class);
TableUtils.createTableIfNotExists(connectionSource, Treatment.class);
TableUtils.createTableIfNotExists(connectionSource, BgReading.class);
TableUtils.createTableIfNotExists(connectionSource, DanaRHistoryRecord.class);
} catch (SQLException e) {
log.error(DatabaseHelper.class.getName(), "Can't create database", e);
log.error("Can't create database", e);
throw new RuntimeException(e);
}
}
@ -66,12 +69,13 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
try {
log.info(DatabaseHelper.class.getName(), "onUpgrade");
TableUtils.dropTable(connectionSource, TempBasal.class, true);
TableUtils.dropTable(connectionSource, TempTarget.class, true);
TableUtils.dropTable(connectionSource, Treatment.class, true);
TableUtils.dropTable(connectionSource, BgReading.class, true);
TableUtils.dropTable(connectionSource, DanaRHistoryRecord.class, true);
onCreate(database, connectionSource);
} catch (SQLException e) {
log.error(DatabaseHelper.class.getName(), "Can't drop databases", e);
log.error("Can't drop databases", e);
throw new RuntimeException(e);
}
}
@ -87,35 +91,38 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
public void cleanUpDatabases() {
// TODO: call it somewhere
log.debug("Before BgReadings size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_BGREADINGS));
getWritableDatabase().delete("BgReadings", "timeIndex" + " < '" + (new Date().getTime() - Constants.hoursToKeepInDatabase * 60 * 60 * 1000L) + "'", null);
getWritableDatabase().delete(DATABASE_BGREADINGS, "timeIndex" + " < '" + (new Date().getTime() - Constants.hoursToKeepInDatabase * 60 * 60 * 1000L) + "'", null);
log.debug("After BgReadings size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_BGREADINGS));
log.debug("Before TempBasals size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_TEMPBASALS));
getWritableDatabase().delete("TempBasals", "timeIndex" + " < '" + (new Date().getTime() - Constants.hoursToKeepInDatabase * 60 * 60 * 1000L) + "'", null);
getWritableDatabase().delete(DATABASE_TEMPBASALS, "timeIndex" + " < '" + (new Date().getTime() - Constants.hoursToKeepInDatabase * 60 * 60 * 1000L) + "'", null);
log.debug("After TempBasals size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_TEMPBASALS));
log.debug("Before TempTargets size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_TEMPTARGETS));
getWritableDatabase().delete(DATABASE_TEMPTARGETS, "timeIndex" + " < '" + (new Date().getTime() - Constants.hoursToKeepInDatabase * 60 * 60 * 1000L) + "'", null);
log.debug("After TempTargets size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_TEMPTARGETS));
log.debug("Before Treatments size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_TREATMENTS));
getWritableDatabase().delete("Treatments", "timeIndex" + " < '" + (new Date().getTime() - Constants.hoursToKeepInDatabase * 60 * 60 * 1000L) + "'", null);
getWritableDatabase().delete(DATABASE_TREATMENTS, "timeIndex" + " < '" + (new Date().getTime() - Constants.hoursToKeepInDatabase * 60 * 60 * 1000L) + "'", null);
log.debug("After Treatments size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_TREATMENTS));
log.debug("Before History size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), "DanaRHistory"));
getWritableDatabase().delete("History", "recordDate" + " < '" + (new Date().getTime() - Constants.daysToKeepHistoryInDatabase * 24 * 60 * 60 * 1000L) + "'", null);
log.debug("After History size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), "DanaRHistory"));
log.debug("Before History size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_DANARHISTORY));
getWritableDatabase().delete(DATABASE_DANARHISTORY, "recordDate" + " < '" + (new Date().getTime() - Constants.daysToKeepHistoryInDatabase * 24 * 60 * 60 * 1000L) + "'", null);
log.debug("After History size: " + DatabaseUtils.queryNumEntries(getReadableDatabase(), DATABASE_DANARHISTORY));
}
public void resetDatabases() {
try {
TableUtils.dropTable(connectionSource, TempBasal.class, true);
TableUtils.dropTable(connectionSource, TempTarget.class, true);
TableUtils.dropTable(connectionSource, Treatment.class, true);
TableUtils.dropTable(connectionSource, BgReading.class, true);
TableUtils.dropTable(connectionSource, DanaRHistoryRecord.class, true);
TableUtils.createTableIfNotExists(connectionSource, TempBasal.class);
TableUtils.createTableIfNotExists(connectionSource, TempTarget.class);
TableUtils.createTableIfNotExists(connectionSource, Treatment.class);
TableUtils.createTableIfNotExists(connectionSource, BgReading.class);
TableUtils.createTableIfNotExists(connectionSource, DanaRHistoryRecord.class);
// MainApp.bus().post(new EventNewBG());
// MainApp.bus().post(new EventTreatmentChange());
// MainApp.bus().post(new EventTempBasalChange());
} catch (SQLException e) {
e.printStackTrace();
}
@ -123,7 +130,6 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
public void resetTreatments() {
try {
TableUtils.dropTable(connectionSource, Treatment.class, true);
TableUtils.createTableIfNotExists(connectionSource, Treatment.class);
} catch (SQLException e) {
@ -131,10 +137,23 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
}
}
public void resetTempTargets() {
try {
TableUtils.dropTable(connectionSource, TempTarget.class, true);
TableUtils.createTableIfNotExists(connectionSource, TempTarget.class);
} catch (SQLException e) {
e.printStackTrace();
}
}
public Dao<TempBasal, Long> getDaoTempBasals() throws SQLException {
return getDao(TempBasal.class);
}
public Dao<TempTarget, Long> getDaoTempTargets() throws SQLException {
return getDao(TempTarget.class);
}
public Dao<Treatment, Long> getDaoTreatments() throws SQLException {
return getDao(Treatment.class);
}
@ -206,6 +225,23 @@ public class DatabaseHelper extends OrmLiteSqliteOpenHelper {
return new ArrayList<BgReading>();
}
public List<TempTarget> getTemptargetsDataFromTime(long mills, boolean ascending) {
try {
Dao<TempTarget, Long> daoTempTargets = getDaoTempTargets();
List<TempTarget> tempTargets;
QueryBuilder<TempTarget, Long> queryBuilder = daoTempTargets.queryBuilder();
queryBuilder.orderBy("timeIndex", ascending);
Where where = queryBuilder.where();
where.ge("timeIndex", mills);
PreparedQuery<TempTarget> preparedQuery = queryBuilder.prepare();
tempTargets = daoTempTargets.query(preparedQuery);
return tempTargets;
} catch (SQLException e) {
e.printStackTrace();
}
return new ArrayList<TempTarget>();
}
/*
* Returns glucose_status for openAPS or null if no actual data available
*/

View file

@ -0,0 +1,78 @@
package info.nightscout.androidaps.db;
import com.j256.ormlite.field.DatabaseField;
import com.j256.ormlite.table.DatabaseTable;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Date;
import info.nightscout.androidaps.Constants;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.plugins.TempTargetRange.TempTargetRangePlugin;
import info.nightscout.utils.DecimalFormatter;
@DatabaseTable(tableName = DatabaseHelper.DATABASE_TEMPTARGETS)
public class TempTarget {
private static Logger log = LoggerFactory.getLogger(TempTarget.class);
public long getTimeIndex() {
return timeStart.getTime() - timeStart.getTime() % 1000;
}
public void setTimeIndex(long timeIndex) {
this.timeIndex = timeIndex;
}
@DatabaseField(id = true, useGetSet = true)
public long timeIndex;
@DatabaseField
public Date timeStart;
@DatabaseField
public double low; // in mgdl
@DatabaseField
public double high; // in mgdl
@DatabaseField
public String reason;
@DatabaseField
public int duration; // in minutes
@DatabaseField
public String _id; // NS _id
public Date getPlannedTimeEnd() {
return new Date(timeStart.getTime() + 60 * 1_000 * duration);
}
public String lowValueToUnitsToString(String units) {
if (units.equals(Constants.MGDL)) return DecimalFormatter.to0Decimal(low);
else return DecimalFormatter.to1Decimal(low * Constants.MGDL_TO_MMOLL);
}
public String highValueToUnitsToString(String units) {
if (units.equals(Constants.MGDL)) return DecimalFormatter.to0Decimal(high);
else return DecimalFormatter.to1Decimal(low * Constants.MGDL_TO_MMOLL);
}
public boolean isInProgress() {
return ((TempTargetRangePlugin) MainApp.getSpecificPlugin(TempTargetRangePlugin.class)).getTempTargetInProgress(new Date().getTime()) == this;
}
public String log() {
return "TempTarget{" +
"timeIndex=" + timeIndex +
", timeStart=" + timeStart +
", duration=" + duration +
", reason=" + reason +
", low=" + low +
", high=" + high +
'}';
}
}

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

@ -974,7 +974,25 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
DbLogger.dbAdd(intent, data.toString(), NewExtendedBolusDialog.class);
DbLogger.dbAdd(intent, data.toString(), ConfigBuilderPlugin.class);
} catch (Exception e) {
e.printStackTrace();
}
}
public static void removeCareportalEntryFromNS(String _id) {
try {
Context context = MainApp.instance().getApplicationContext();
Bundle bundle = new Bundle();
bundle.putString("action", "dbRemove");
bundle.putString("collection", "treatments");
bundle.putString("_id", _id);
Intent intent = new Intent(Intents.ACTION_DATABASE);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
DbLogger.dbRemove(intent, _id, ConfigBuilderPlugin.class);
} catch (Exception e) {
e.printStackTrace();
}

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

@ -20,6 +20,7 @@ import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.Services.Intents;
import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.interfaces.APSInterface;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.interfaces.PumpInterface;
@ -29,6 +30,7 @@ import info.nightscout.androidaps.plugins.Loop.APSResult;
import info.nightscout.androidaps.plugins.Loop.ScriptReader;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSMAUpdateGui;
import info.nightscout.androidaps.plugins.OpenAPSMA.events.EventOpenAPSMAUpdateResultGui;
import info.nightscout.androidaps.plugins.TempTargetRange.TempTargetRangePlugin;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsPlugin;
import info.nightscout.client.data.DbLogger;
import info.nightscout.client.data.NSProfile;
@ -183,6 +185,17 @@ public class OpenAPSMAPlugin implements PluginBase, APSInterface {
minBg = verifyHardLimits(minBg, "minBg", 72, 180);
maxBg = verifyHardLimits(maxBg, "maxBg", 100, 270);
targetBg = verifyHardLimits(targetBg, "targetBg", 80, 200);
TempTargetRangePlugin tempTargetRangePlugin = (TempTargetRangePlugin) MainApp.getSpecificPlugin(TempTargetRangePlugin.class);
if (tempTargetRangePlugin != null && tempTargetRangePlugin.isEnabled(PluginBase.GENERAL)) {
TempTarget tempTarget = tempTargetRangePlugin.getTempTargetInProgress(new Date().getTime());
if (tempTarget != null) {
minBg = verifyHardLimits(tempTarget.low, "minBg", 72, 180);
maxBg = verifyHardLimits(tempTarget.high, "maxBg", 72, 270);
targetBg = verifyHardLimits((tempTarget.low + tempTarget.high) / 2, "targetBg", 80, 200);
}
}
maxIob = verifyHardLimits(maxIob, "maxIob", 0, 7);
maxBasal = verifyHardLimits(maxBasal, "max_basal", 0.1, 10);

View file

@ -20,6 +20,7 @@ public class Notification {
public static final int PROFILE_NOT_SET_NOT_INITIALIZED = 5;
public static final int FAILED_UDPATE_PROFILE = 6;
public static final int BASAL_VALUE_BELOW_MINIMUM = 7;
public static final int OLD_NSCLIENT = 8;
public int id;
public Date date;

View file

@ -53,6 +53,7 @@ import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.db.BgReading;
import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.db.TempBasal;
import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.db.Treatment;
import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.events.EventNewBG;
@ -76,6 +77,8 @@ import info.nightscout.androidaps.plugins.Overview.graphExtensions.PointsWithLab
import info.nightscout.androidaps.plugins.Overview.events.EventDismissNotification;
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
import info.nightscout.androidaps.plugins.Overview.graphExtensions.TimeAsXAxisLabelFormatter;
import info.nightscout.androidaps.plugins.TempBasals.TempBasalsPlugin;
import info.nightscout.androidaps.plugins.TempTargetRange.TempTargetRangePlugin;
import info.nightscout.client.data.NSProfile;
import info.nightscout.utils.BolusWizard;
import info.nightscout.utils.DateUtil;
@ -105,6 +108,7 @@ public class OverviewFragment extends Fragment {
TextView activeProfileView;
TextView iobView;
TextView apsModeView;
TextView tempTargetView;
GraphView bgGraph;
RecyclerView notificationsView;
@ -152,6 +156,7 @@ public class OverviewFragment extends Fragment {
iobView = (TextView) view.findViewById(R.id.overview_iob);
apsModeView = (TextView) view.findViewById(R.id.overview_apsmode);
tempTargetView = (TextView) view.findViewById(R.id.overview_temptarget);
bgGraph = (GraphView) view.findViewById(R.id.overview_bggraph);
cancelTempButton = (Button) view.findViewById(R.id.overview_canceltemp);
treatmentButton = (Button) view.findViewById(R.id.overview_treatment);
@ -441,7 +446,7 @@ public class OverviewFragment extends Fragment {
updateNotifications();
BgReading actualBG = MainApp.getDbHelper().actualBg();
BgReading lastBG = MainApp.getDbHelper().lastBg();
if (MainApp.getConfigBuilder() == null || MainApp.getConfigBuilder().getActiveProfile() == null) // app not initialized yet
if (MainApp.getConfigBuilder() == null || MainApp.getConfigBuilder().getActiveProfile() == null || MainApp.getConfigBuilder().getActiveProfile().getProfile() == null) // app not initialized yet
return;
// Skip if not initialized yet
@ -497,8 +502,20 @@ public class OverviewFragment extends Fragment {
apsModeView.setVisibility(View.GONE);
}
// **** Temp button ****
// temp target
NSProfile profile = MainApp.getConfigBuilder().getActiveProfile().getProfile();
TempTargetRangePlugin tempTargetRangePlugin = (TempTargetRangePlugin) MainApp.getSpecificPlugin(TempTargetRangePlugin.class);
if (tempTargetRangePlugin != null && tempTargetRangePlugin.isEnabled(PluginBase.GENERAL)) {
TempTarget tempTarget = tempTargetRangePlugin.getTempTargetInProgress(new Date().getTime());
if (tempTarget != null) {
tempTargetView.setVisibility(View.VISIBLE);
tempTargetView.setText(NSProfile.toUnitsString(tempTarget.low, NSProfile.fromMgdlToUnits(tempTarget.low, profile.getUnits()), profile.getUnits()) + " - " + NSProfile.toUnitsString(tempTarget.high, NSProfile.fromMgdlToUnits(tempTarget.high, profile.getUnits()), profile.getUnits()));
} else {
tempTargetView.setVisibility(View.GONE);
}
}
// **** Temp button ****
PumpInterface pump = MainApp.getConfigBuilder();
boolean showAcceptButton = !MainApp.getConfigBuilder().isClosedModeEnabled(); // Open mode needed
@ -539,7 +556,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

@ -0,0 +1,234 @@
package info.nightscout.androidaps.plugins.TempTargetRange;
import android.app.Activity;
import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent;
import android.content.SharedPreferences;
import android.graphics.Paint;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.v4.app.Fragment;
import android.support.v7.app.AlertDialog;
import android.support.v7.widget.CardView;
import android.support.v7.widget.LinearLayoutManager;
import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.j256.ormlite.dao.Dao;
import com.squareup.otto.Subscribe;
import java.sql.SQLException;
import java.util.List;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.Services.Intents;
import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.interfaces.FragmentBase;
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.DecimalFormatter;
import info.nightscout.utils.ToastUtils;
/**
* Created by mike on 13/01/17.
*/
public class TempTargetRangeFragment extends Fragment implements View.OnClickListener, FragmentBase {
private static TempTargetRangePlugin tempTargetRangePlugin = new TempTargetRangePlugin();
public static TempTargetRangePlugin getPlugin() {
return tempTargetRangePlugin;
}
RecyclerView recyclerView;
LinearLayoutManager llm;
Button refreshFromNS;
Context context;
public class RecyclerViewAdapter extends RecyclerView.Adapter<RecyclerViewAdapter.TempTargetsViewHolder> {
List<TempTarget> tempTargetList;
RecyclerViewAdapter(List<TempTarget> TempTargetList) {
this.tempTargetList = TempTargetList;
}
@Override
public TempTargetsViewHolder onCreateViewHolder(ViewGroup viewGroup, int viewType) {
View v = LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.temptargetrange_item, viewGroup, false);
TempTargetsViewHolder TempTargetsViewHolder = new TempTargetsViewHolder(v);
return TempTargetsViewHolder;
}
@Override
public void onBindViewHolder(TempTargetsViewHolder holder, int position) {
NSProfile profile = ConfigBuilderPlugin.getActiveProfile().getProfile();
if (profile == null) return;
TempTarget tempTarget = tempTargetList.get(position);
holder.date.setText(DateUtil.dateAndTimeString(tempTarget.timeStart) + " - " + DateUtil.timeString(tempTargetList.get(position).getPlannedTimeEnd()));
holder.duration.setText(DecimalFormatter.to0Decimal(tempTarget.duration) + " min");
holder.low.setText(tempTarget.lowValueToUnitsToString(profile.getUnits()));
holder.high.setText(tempTarget.highValueToUnitsToString(profile.getUnits()));
holder.reason.setText(tempTarget.reason);
if (tempTarget.isInProgress())
holder.dateLinearLayout.setBackgroundColor(MainApp.instance().getResources().getColor(R.color.colorInProgress));
else
holder.dateLinearLayout.setBackgroundColor(MainApp.instance().getResources().getColor(R.color.cardColorBackground));
holder.remove.setTag(tempTarget);
}
@Override
public int getItemCount() {
return tempTargetList.size();
}
@Override
public void onAttachedToRecyclerView(RecyclerView recyclerView) {
super.onAttachedToRecyclerView(recyclerView);
}
public class TempTargetsViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
CardView cv;
TextView date;
TextView duration;
TextView low;
TextView high;
TextView reason;
TextView remove;
LinearLayout dateLinearLayout;
TempTargetsViewHolder(View itemView) {
super(itemView);
cv = (CardView) itemView.findViewById(R.id.temptargetrange_cardview);
date = (TextView) itemView.findViewById(R.id.temptargetrange_date);
duration = (TextView) itemView.findViewById(R.id.temptargetrange_duration);
low = (TextView) itemView.findViewById(R.id.temptargetrange_low);
high = (TextView) itemView.findViewById(R.id.temptargetrange_high);
reason = (TextView) itemView.findViewById(R.id.temptargetrange_reason);
remove = (TextView) itemView.findViewById(R.id.temptargetrange_remove);
remove.setOnClickListener(this);
remove.setPaintFlags(remove.getPaintFlags() | Paint.UNDERLINE_TEXT_FLAG);
dateLinearLayout = (LinearLayout) itemView.findViewById(R.id.temptargetrange_datelinearlayout);
}
@Override
public void onClick(View v) {
final TempTarget tempTarget = (TempTarget) v.getTag();
final Context finalContext = context;
switch (v.getId()) {
case R.id.temptargetrange_remove:
final String _id = tempTarget._id;
if (_id != null && !_id.equals("")) {
AlertDialog.Builder builder = new AlertDialog.Builder(context);
builder.setTitle(MainApp.sResources.getString(R.string.confirmation));
builder.setMessage(MainApp.sResources.getString(R.string.removerecord) + "\n" + _id);
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
MainApp.getConfigBuilder().removeCareportalEntryFromNS(_id);
try {
Dao<TempTarget, Long> daoTempTargets = MainApp.getDbHelper().getDaoTempTargets();
daoTempTargets.delete(tempTarget);
MainApp.bus().post(new EventTempTargetRangeChange());
} catch (SQLException e) {
e.printStackTrace();
}
}
});
builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null);
builder.show();
}
break;
}
}
}
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.temptargetrange_fragment, container, false);
recyclerView = (RecyclerView) view.findViewById(R.id.temptargetrange_recyclerview);
recyclerView.setHasFixedSize(true);
llm = new LinearLayoutManager(view.getContext());
recyclerView.setLayoutManager(llm);
RecyclerViewAdapter adapter = new RecyclerViewAdapter(tempTargetRangePlugin.getList());
recyclerView.setAdapter(adapter);
refreshFromNS = (Button) view.findViewById(R.id.temptargetrange_refreshfromnightscout);
refreshFromNS.setOnClickListener(this);
context = getContext();
updateGUI();
return view;
}
@Override
public void onClick(View view) {
switch (view.getId()) {
case R.id.temptargetrange_refreshfromnightscout:
SharedPreferences SP = PreferenceManager.getDefaultSharedPreferences(getContext());
boolean nsUploadOnly = SP.getBoolean("ns_upload_only", false);
if(nsUploadOnly){
ToastUtils.showToastInUiThread(getContext(),this.getContext().getString(R.string.ns_upload_only_enabled));
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(this.getContext());
builder.setTitle(this.getContext().getString(R.string.confirmation));
builder.setMessage(this.getContext().getString(R.string.refreshtemptargetsfromnightscout));
builder.setPositiveButton(this.getContext().getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
MainApp.getDbHelper().resetTempTargets();
tempTargetRangePlugin.initializeData();
updateGUI();
Intent restartNSClient = new Intent(Intents.ACTION_RESTART);
MainApp.instance().getApplicationContext().sendBroadcast(restartNSClient);
}
});
builder.setNegativeButton(this.getContext().getString(R.string.cancel), null);
builder.show();
}
break;
}
}
@Override
public void onPause() {
super.onPause();
MainApp.bus().unregister(this);
}
@Override
public void onResume() {
super.onResume();
MainApp.bus().register(this);
}
@Subscribe
public void onStatusEvent(final EventTempTargetRangeChange ev) {
updateGUI();
}
void updateGUI() {
Activity activity = getActivity();
if (activity != null)
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
recyclerView.swapAdapter(new RecyclerViewAdapter(tempTargetRangePlugin.getList()), false);
}
});
}
}

View file

@ -0,0 +1,100 @@
package info.nightscout.androidaps.plugins.TempTargetRange;
import android.support.annotation.Nullable;
import com.squareup.otto.Subscribe;
import java.util.Date;
import java.util.List;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.db.TempTarget;
import info.nightscout.androidaps.interfaces.PluginBase;
import info.nightscout.androidaps.plugins.TempTargetRange.events.EventTempTargetRangeChange;
/**
* Created by mike on 13/01/17.
*/
public class TempTargetRangePlugin implements PluginBase {
static boolean fragmentEnabled = true;
static boolean fragmentVisible = true;
private static List<TempTarget> tempTargets;
TempTargetRangePlugin() {
initializeData();
MainApp.bus().register(this);
}
@Override
public int getType() {
return PluginBase.GENERAL;
}
@Override
public String getFragmentClass() {
return TempTargetRangeFragment.class.getName();
}
@Override
public String getName() {
return MainApp.sResources.getString(R.string.temptargetrange);
}
@Override
public boolean isEnabled(int type) {
return type == GENERAL && fragmentEnabled;
}
@Override
public boolean isVisibleInTabs(int type) {
return type == GENERAL && fragmentVisible;
}
@Override
public boolean canBeHidden(int type) {
return true;
}
@Override
public void setFragmentEnabled(int type, boolean fragmentEnabled) {
if (type == GENERAL) {
this.fragmentEnabled = fragmentEnabled;
}
}
@Override
public void setFragmentVisible(int type, boolean fragmentVisible) {
if (type == GENERAL) this.fragmentVisible = fragmentVisible;
}
public static boolean isEnabled() {
return fragmentEnabled;
}
@Subscribe
public void onStatusEvent(final EventTempTargetRangeChange ev) {
initializeData();
}
public void initializeData() {
long fromMills = (long) (new Date().getTime() - 60 * 60 * 1000L * 24);
tempTargets = MainApp.getDbHelper().getTemptargetsDataFromTime(fromMills, false);
}
public List<TempTarget> getList() {
return tempTargets;
}
@Nullable
public TempTarget getTempTargetInProgress(long time) {
for (int i = tempTargets.size() - 1; i >= 0; i--) {
if (tempTargets.get(i).timeStart.getTime() > time) continue;
if (tempTargets.get(i).getPlannedTimeEnd().getTime() >= time) return tempTargets.get(i);
}
return null;
}
}

View file

@ -0,0 +1,8 @@
package info.nightscout.androidaps.plugins.TempTargetRange.events;
/**
* Created by mike on 13.01.2017.
*/
public class EventTempTargetRangeChange {
}

View file

@ -157,7 +157,7 @@ public class TreatmentsFragment extends Fragment implements View.OnClickListener
} else {
AlertDialog.Builder builder = new AlertDialog.Builder(this.getContext());
builder.setTitle(this.getContext().getString(R.string.confirmation));
builder.setMessage(this.getContext().getString(R.string.refreshfromnightscout));
builder.setMessage(this.getContext().getString(R.string.refreshtreatmentsfromnightscout));
builder.setPositiveButton(this.getContext().getString(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
MainApp.getDbHelper().resetTreatments();

View file

@ -26,4 +26,14 @@ public class DbLogger {
} else if (Config.logNSUpload)
log.debug("DBADD dbAdd " + q.size() + " receivers " + data);
}
public static void dbRemove(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.sResources.getString(R.string.nsclientnotinstalled));
log.error("DBREMOVE No receivers");
} else if (Config.logNSUpload)
log.debug("DBREMOVE dbRemove " + q.size() + " receivers " + data);
}
}

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

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

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

@ -36,20 +36,38 @@
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:text="Open Loop"
android:textAppearance="?android:attr/textAppearanceSmall" />
android:textAppearance="?android:attr/textAppearanceSmall"
android:layout_weight="0.2" />
<TextView
android:id="@+id/overview_activeprofile"
android:layout_width="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginRight="10dp"
android:background="@drawable/pillborder"
android:gravity="center_vertical|center_horizontal"
android:text="Profile"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/colorProfileSwitchButton" />
android:textColor="@color/colorProfileSwitchButton"
android:layout_weight="0.5" />
<TextView
android:id="@+id/overview_temptarget"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="right"
android:layout_marginRight="10dp"
android:background="@drawable/temptargetborder"
android:gravity="center_vertical|center_horizontal"
android:text="TempTarget"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:textAppearance="?android:attr/textAppearanceMedium"
android:textColor="@color/mdtp_white"
android:layout_weight="0.2" />
</LinearLayout>
<LinearLayout

View file

@ -0,0 +1,28 @@
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
tools:context="info.nightscout.androidaps.plugins.TempBasals.TempBasalsFragment">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="vertical">
<Button
android:id="@+id/temptargetrange_refreshfromnightscout"
style="?android:attr/buttonStyle"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/temptargetrange_refreshfromnightscout" />
<android.support.v7.widget.RecyclerView
android:id="@+id/temptargetrange_recyclerview"
android:layout_width="match_parent"
android:layout_height="match_parent">
</android.support.v7.widget.RecyclerView>
</LinearLayout>
</FrameLayout>

View file

@ -0,0 +1,123 @@
<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:card_view="http://schemas.android.com/apk/res-auto"
android:id="@+id/temptargetrange_cardview"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_gravity="center"
card_view:cardBackgroundColor="@color/cardColorBackground"
card_view:cardCornerRadius="6dp"
card_view:cardUseCompatPadding="true"
card_view:contentPadding="6dp">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="vertical">
<LinearLayout
android:id="@+id/temptargetrange_datelinearlayout"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:baselineAligned="true"
android:orientation="horizontal">
<com.joanzapata.iconify.widget.IconTextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="center_vertical|right"
android:paddingLeft="5dp"
android:paddingRight="5dp"
android:text="{fa-clock-o}"
android:textColor="@color/cardItemLabel" />
<TextView
android:id="@+id/temptargetrange_date"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="1.1.2000 18:00"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/cardItemLabel" />
<TextView
android:id="@+id/temptargetrange_low"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="80"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/cardItemLabel" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="-"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/cardItemLabel" />
<TextView
android:id="@+id/temptargetrange_high"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="5dp"
android:text="100"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/cardItemLabel" />
<TextView
android:id="@+id/temptargetrange_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingLeft="10dp"
android:text="30 min"
android:textAppearance="?android:attr/textAppearanceSmall"
android:textColor="@color/cardItemLabel" />
</LinearLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:orientation="horizontal">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="top"
android:paddingLeft="10dp"
android:text="@string/reason"
android:textAppearance="?android:attr/textAppearanceSmall" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:paddingRight="5dp"
android:text=":" />
<TextView
android:id="@+id/temptargetrange_reason"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:paddingRight="10dp"
android:text="Activity"
android:layout_weight="1"
android:textStyle="bold" />
<TextView
android:text="@string/overview_quickwizard_item_remove_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:id="@+id/temptargetrange_remove"
android:textAlignment="viewEnd"
android:textColor="@android:color/holo_orange_light" />
</LinearLayout>
</LinearLayout>
</android.support.v7.widget.CardView>

View file

@ -124,7 +124,7 @@
<string name="objectives_pumpstatusavailableinns">Статус на помпа в NS</string>
<string name="rate">Стойност</string>
<string name="reason">Основание</string>
<string name="refreshfromnightscout">Искате ли да обновите treatments от Nightscout</string>
<string name="refreshtreatmentsfromnightscout">Искате ли да обновите treatments от Nightscout</string>
<string name="safety">Безопасност</string>
<string name="setextendedbolusquestion">Задай нов удължен болусs:</string>
<string name="setbasalquestion">Приложи нов временен базал:</string>
@ -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

@ -124,7 +124,7 @@
<string name="objectives_pumpstatusavailableinns">Stav pumpy dostupný v NS</string>
<string name="rate">Hodnota</string>
<string name="reason">Zdůvodnění</string>
<string name="refreshfromnightscout">Opravdu aktualizovat ošetření z NS</string>
<string name="refreshtreatmentsfromnightscout">Opravdu aktualizovat ošetření z NS</string>
<string name="safety">Bezpečnost</string>
<string name="danar_useextended_title">Použít kombo bolusy pro >200%</string>
<string name="setextendedbolusquestion">Spustit nový kombo bolus:</string>
@ -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

@ -120,7 +120,7 @@
<string name="setextendedbolusquestion">Setze neuen extended Bolus:</string>
<string name="setbasalquestion">Akzeptiere neue temp Basalrate:</string>
<string name="danar_useextended_title">Benutze extended Bolus für hohe temps (\>200%)></string>
<string name="refreshfromnightscout">Möchtest du die Treatments von Nightscout abrufen</string>
<string name="refreshtreatmentsfromnightscout">Möchtest du die Treatments von Nightscout abrufen</string>
<string name="objectives_pumpstatusavailableinns">Pumpen Status verfügbar in NS</string>
<string name="overview_newtempbasal_percent_label">% (100% = current)</string>
<string name="overview_newtempbasal_basal_label">Basal Wert</string>
@ -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

@ -103,7 +103,7 @@
<string name="loop_constraintsprocessed_label">Tras procesar limitaciones</string>
<string name="loop_setbypump_label">Definido por la bomba</string>
<string name="openapsma_lastenact_label">Última aceptada</string>
<string name="refreshfromnightscout">¿Quieres actualizar tratamientos de Nightscout?</string>
<string name="refreshtreatmentsfromnightscout">¿Quieres actualizar tratamientos de Nightscout?</string>
<string name="ok">OK</string>
<string name="cancel">Cancelar</string>
<string name="noapsselected">NO APS Seleccionado</string>
@ -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

@ -104,7 +104,7 @@
<string name="loop_constraintsprocessed_label">After processed constraints</string>
<string name="loop_setbypump_label">Set by pump</string>
<string name="openapsma_lastenact_label">최근 주입</string>
<string name="refreshfromnightscout">나이트스카우트에서 Treatments를 새로고치시겠습니까</string>
<string name="refreshtreatmentsfromnightscout">나이트스카우트에서 Treatments를 새로고치시겠습니까</string>
<string name="ok">OK</string>
<string name="cancel">취소</string>
<string name="noapsselected">NO APS SELECTED OR PROVIDED RESULT</string>
@ -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

@ -107,7 +107,8 @@
<string name="loop_constraintsprocessed_label">After processed constraints</string>
<string name="loop_setbypump_label">Set by pump</string>
<string name="openapsma_lastenact_label">Last enacted</string>
<string name="refreshfromnightscout">Do you want to refresh treatments from Nightscout</string>
<string name="refreshtreatmentsfromnightscout">Do you want to refresh treatments from Nightscout</string>
<string name="refreshtemptargetsfromnightscout">Do you want to refresh temp targets from Nightscout</string>
<string name="ok">OK</string>
<string name="cancel">Cancel</string>
<string name="noapsselected">NO APS SELECTED OR PROVIDED RESULT</string>
@ -257,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>
@ -398,4 +399,10 @@
<string name="minago">%dmin ago</string>
<string name="sms_minago">%dmin ago</string>
<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>
<string name="removerecord">Remove record:</string>
</resources>