Merge branch 'mainline' into 'develop'

update develop from changes introduced to stable / mainline

See merge request !15
This commit is contained in:
Savek-CC 2017-08-06 22:37:39 +00:00
commit e01c8740c2
57 changed files with 830 additions and 528 deletions

View file

@ -44,7 +44,7 @@ android {
minSdkVersion 21
targetSdkVersion 23
versionCode 1500
version "1.5e"
version "1.5f"
buildConfigField "String", "VERSION", '"' + version + '"'
buildConfigField "String", "BUILDVERSION", generateGitBuild()
}

View file

@ -56,16 +56,6 @@
android:enabled="true"
android:exported="true">
<intent-filter>
<!-- Receiver from NSClient -->
<action android:name="info.nightscout.client.NEW_SGV" />
<action android:name="info.nightscout.client.NEW_TREATMENT" />
<action android:name="info.nightscout.client.CHANGED_TREATMENT" />
<action android:name="info.nightscout.client.REMOVED_TREATMENT" />
<action android:name="info.nightscout.client.NEW_PROFILE" />
<action android:name="info.nightscout.client.NEW_STATUS" />
<action android:name="info.nightscout.client.NEW_MBG" />
<action android:name="info.nightscout.client.NEW_DEVICESTATUS" />
<action android:name="info.nightscout.client.NEW_CAL" />
<!-- Receive new SMS messages -->
<action android:name="android.provider.Telephony.SMS_RECEIVED" />
<!-- Receiver from xDrip -->
@ -76,20 +66,6 @@
<action android:name="it.ct.glicemia.ACTION_GLUCOSE_MEASURED" />
</intent-filter>
</receiver>
<receiver
android:name=".receivers.NSAlarmReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<!-- Receiver from NSClient -->
<action android:name="info.nightscout.client.ANNOUNCEMENT" />
<action android:name="info.nightscout.client.ALARM" />
<action android:name="info.nightscout.client.URGENT_ALARM" />
<action android:name="info.nightscout.client.CLEAR_ALARM" />
</intent-filter>
</receiver>
<!-- Receiver keepalive, scheduled every 30 min -->
<receiver android:name=".receivers.KeepAliveReceiver" />
@ -120,14 +96,6 @@
<action android:name="info.nightscout.client.DBACCESS" />
</intent-filter>
</receiver>
<receiver
android:name=".plugins.NSClientInternal.receivers.AckAlarmReceiver"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="info.nightscout.client.ACK_ALARM" />
</intent-filter>
</receiver>
<!-- Service processing incomming data -->
<service

View file

@ -6,9 +6,22 @@ import org.monkey.d.ruffy.ruffy.driver.IRTHandler;
interface IRuffyService {
void setHandler(IRTHandler handler);
void addHandler(IRTHandler handler);
void removeHandler(IRTHandler handler);
/** Connect to the pump
*
* @return 0 if successful, -1 otherwise
*/
int doRTConnect();
/** Disconnect from the pump */
void doRTDisconnect();
/*What's the meaning of 'changed'?
* changed means if a button state has been changed, like btton pressed is a change and button release another*/
void rtSendKey(byte keyCode, boolean changed);
void resetPairing();
boolean isConnected();
boolean isBoundToPump();
}

View file

@ -48,16 +48,36 @@ public class RuffyScripter {
private volatile boolean connected = false;
private volatile long lastDisconnected = 0;
private boolean started = false;
public RuffyScripter(final IRuffyService ruffyService) {
this.ruffyService = ruffyService;
}
public void start() {
try {
ruffyService.setHandler(mHandler);
ruffyService.addHandler(mHandler);
idleDisconnectMonitorThread.start();
started = true;
} catch (RemoteException e) {
throw new RuntimeException(e);
}
}
public void stop() {
if (started) {
try {
ruffyService.removeHandler(mHandler);
} catch (RemoteException e) {
log.warn("Removing IRTHandler from Ruffy service failed, ignoring", e);
}
}
}
public boolean isRunning() {
return started;
}
private Thread idleDisconnectMonitorThread = new Thread(new Runnable() {
@Override
public void run() {

View file

@ -2,8 +2,10 @@ package info.nightscout.androidaps;
import android.app.Application;
import android.content.Intent;
import android.content.IntentFilter;
import android.content.res.Resources;
import android.support.annotation.Nullable;
import android.support.v4.content.LocalBroadcastManager;
import com.crashlytics.android.Crashlytics;
import com.crashlytics.android.answers.Answers;
@ -17,6 +19,7 @@ import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import info.nightscout.androidaps.Services.Intents;
import info.nightscout.androidaps.db.DatabaseHelper;
import info.nightscout.androidaps.interfaces.InsulinInterface;
import info.nightscout.androidaps.interfaces.PluginBase;
@ -32,6 +35,7 @@ import info.nightscout.androidaps.plugins.InsulinFastactingProlonged.InsulinFast
import info.nightscout.androidaps.plugins.IobCobCalculator.IobCobCalculatorPlugin;
import info.nightscout.androidaps.plugins.Loop.LoopFragment;
import info.nightscout.androidaps.plugins.NSClientInternal.NSClientInternalFragment;
import info.nightscout.androidaps.plugins.NSClientInternal.receivers.AckAlarmReceiver;
import info.nightscout.androidaps.plugins.OpenAPSAMA.OpenAPSAMAFragment;
import info.nightscout.androidaps.plugins.OpenAPSMA.OpenAPSMAFragment;
import info.nightscout.androidaps.plugins.Overview.OverviewFragment;
@ -60,7 +64,9 @@ import info.nightscout.androidaps.plugins.SourceXdrip.SourceXdripPlugin;
import info.nightscout.androidaps.plugins.Treatments.TreatmentsFragment;
import info.nightscout.androidaps.plugins.Wear.WearFragment;
import info.nightscout.androidaps.plugins.XDripStatusline.StatuslinePlugin;
import info.nightscout.androidaps.receivers.DataReceiver;
import info.nightscout.androidaps.receivers.KeepAliveReceiver;
import info.nightscout.androidaps.receivers.NSAlarmReceiver;
import info.nightscout.utils.NSUpload;
import io.fabric.sdk.android.Fabric;
@ -78,6 +84,11 @@ public class MainApp extends Application {
private static ArrayList<PluginBase> pluginsList = null;
private static DataReceiver dataReceiver = new DataReceiver();
private static NSAlarmReceiver alarmReciever = new NSAlarmReceiver();
private static AckAlarmReceiver ackAlarmReciever = new AckAlarmReceiver();
private LocalBroadcastManager lbm;
@Override
public void onCreate() {
super.onCreate();
@ -93,6 +104,8 @@ public class MainApp extends Application {
sInstance = this;
sResources = getResources();
registerLocalBroadcastReceiver();
if (pluginsList == null) {
pluginsList = new ArrayList<>();
// Register all tabs in app here
@ -157,6 +170,29 @@ public class MainApp extends Application {
}
});
t.start();
}
private void registerLocalBroadcastReceiver() {
lbm = LocalBroadcastManager.getInstance(this);
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_TREATMENT));
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_CHANGED_TREATMENT));
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_REMOVED_TREATMENT));
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_SGV));
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_PROFILE));
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_STATUS));
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_MBG));
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_DEVICESTATUS));
lbm.registerReceiver(dataReceiver, new IntentFilter(Intents.ACTION_NEW_CAL));
//register alarms
lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_ALARM));
lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_ANNOUNCEMENT));
lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_CLEAR_ALARM));
lbm.registerReceiver(alarmReciever, new IntentFilter(Intents.ACTION_URGENT_ALARM));
//register ack alarm
lbm.registerReceiver(ackAlarmReciever, new IntentFilter(Intents.ACTION_ACK_ALARM));
}
private void startKeepAliveService() {

View file

@ -506,7 +506,7 @@ public class DataService extends IntentService {
MainApp.getDbHelper().createCareportalEventFromJsonIfNotExists(trJson);
}
if (trJson.getString("eventType").equals(CareportalEvent.ANNOUNCEMENT)) {
if (trJson.has("eventType") && trJson.getString("eventType").equals(CareportalEvent.ANNOUNCEMENT)) {
long date = trJson.getLong("mills");
long now = System.currentTimeMillis();
if (date > now - 15 * 60 * 1000L && trJson.has("notes")) {

View file

@ -296,17 +296,17 @@ public class TemporaryBasal implements Interval {
Profile profile = MainApp.getConfigBuilder().getProfile();
Double currentBasalRate = profile.getBasal();
double rate = (currentBasalRate == null)?0d:(currentBasalRate+netExtendedRate);
return DecimalFormatter.to2Decimal(rate) + "U/h ("+DecimalFormatter.to2Decimal(netExtendedRate)+"E) @" +
return getCalcuatedPercentageIfNeeded() + DecimalFormatter.to2Decimal(rate) + "U/h ("+DecimalFormatter.to2Decimal(netExtendedRate)+"E) @" +
DateUtil.timeString(date) +
" " + getRealDuration() + "/" + durationInMinutes + "min";
" " + getRealDuration() + "/" + durationInMinutes + "'";
} else if (isAbsolute) {
return DecimalFormatter.to2Decimal(absoluteRate) + "U/h @" +
DateUtil.timeString(date) +
" " + getRealDuration() + "/" + durationInMinutes + "min";
" " + getRealDuration() + "/" + durationInMinutes + "'";
} else { // percent
return percentRate + "% @" +
DateUtil.timeString(date) +
" " + getRealDuration() + "/" + durationInMinutes + "min";
" " + getRealDuration() + "/" + durationInMinutes + "'";
}
}
@ -337,6 +337,31 @@ public class TemporaryBasal implements Interval {
}
}
private String getCalcuatedPercentageIfNeeded(){
if (isAbsolute || isFakeExtended) {
double rate = 0d;
if (isFakeExtended) {
Profile profile = MainApp.getConfigBuilder().getProfile();
Double currentBasalRate = profile.getBasal();
rate = (currentBasalRate == null)?0d:(currentBasalRate+netExtendedRate);
} else if (isAbsolute){
rate = absoluteRate;
}
if(SP.getBoolean(R.string.key_danar_visualizeextendedaspercentage, false) && SP.getBoolean(R.string.key_danar_useextended, false)){
Profile profile = MainApp.getConfigBuilder().getProfile();
if(profile != null) {
double basal = profile.getBasal();
if(basal != 0){
return Math.round(rate*100d/basal) + "% ";
}
}
}
}
return "";
}
public String toStringVeryShort() {
if (isAbsolute || isFakeExtended) {

View file

@ -34,7 +34,9 @@ public interface PumpInterface {
PumpEnactResult setTempBasalAbsolute(Double absoluteRate, Integer durationInMinutes);
PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes);
PumpEnactResult setExtendedBolus(Double insulin, Integer durationInMinutes);
PumpEnactResult cancelTempBasal();
//some pumps might set a very short temp close to 100% as canecelling a temp can be noisy
//when the cancel request is requested by the user, the pump should always do a real cancel
PumpEnactResult cancelTempBasal(boolean userRequested);
PumpEnactResult cancelExtendedBolus();
// Status to be passed to NS

View file

@ -20,6 +20,7 @@ import info.nightscout.androidaps.Config;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.db.ExtendedBolus;
import info.nightscout.androidaps.db.TemporaryBasal;
import info.nightscout.androidaps.events.EventExtendedBolusChange;
import info.nightscout.androidaps.events.EventInitializationChanged;
import info.nightscout.androidaps.events.EventRefreshOverview;
@ -49,6 +50,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
Button extendedBolus;
Button extendedBolusCancel;
Button tempBasal;
Button tempBasalCancel;
Button fill;
private static Handler sHandler;
@ -74,6 +76,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
extendedBolus = (Button) view.findViewById(R.id.actions_extendedbolus);
extendedBolusCancel = (Button) view.findViewById(R.id.actions_extendedbolus_cancel);
tempBasal = (Button) view.findViewById(R.id.actions_settempbasal);
tempBasalCancel = (Button) view.findViewById(R.id.actions_canceltempbasal);
fill = (Button) view.findViewById(R.id.actions_fill);
profileSwitch.setOnClickListener(this);
@ -81,6 +84,7 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
extendedBolus.setOnClickListener(this);
extendedBolusCancel.setOnClickListener(this);
tempBasal.setOnClickListener(this);
tempBasalCancel.setOnClickListener(this);
fill.setOnClickListener(this);
updateGUI();
@ -114,33 +118,59 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
if (MainApp.getConfigBuilder().getActiveProfileInterface().getProfile() == null)
if (MainApp.getConfigBuilder().getActiveProfileInterface().getProfile() == null) {
tempTarget.setVisibility(View.GONE);
profileSwitch.setVisibility(View.GONE);
extendedBolus.setVisibility(View.GONE);
extendedBolusCancel.setVisibility(View.GONE);
tempBasal.setVisibility(View.GONE);
tempBasalCancel.setVisibility(View.GONE);
fill.setVisibility(View.GONE);
return;
}
boolean allowProfileSwitch = MainApp.getConfigBuilder().getActiveProfileInterface().getProfile().getProfileList().size() > 1;
if (!MainApp.getConfigBuilder().getPumpDescription().isSetBasalProfileCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !allowProfileSwitch)
profileSwitch.setVisibility(View.GONE);
else
profileSwitch.setVisibility(View.VISIBLE);
if (!MainApp.getConfigBuilder().getPumpDescription().isExtendedBolusCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() || MainApp.getConfigBuilder().isFakingTempsByExtendedBoluses())
if (!MainApp.getConfigBuilder().getPumpDescription().isExtendedBolusCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || MainApp.getConfigBuilder().isFakingTempsByExtendedBoluses()) {
extendedBolus.setVisibility(View.GONE);
else {
extendedBolus.setVisibility(View.VISIBLE);
}
if (!MainApp.getConfigBuilder().getPumpDescription().isExtendedBolusCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() || MainApp.getConfigBuilder().isFakingTempsByExtendedBoluses())
extendedBolusCancel.setVisibility(View.GONE);
else {
extendedBolusCancel.setVisibility(View.VISIBLE);
ExtendedBolus running = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
extendedBolusCancel.setText(MainApp.instance().getString(R.string.cancel) + " " + running.toString());
} else {
if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress()) {
extendedBolus.setVisibility(View.GONE);
extendedBolusCancel.setVisibility(View.VISIBLE);
ExtendedBolus running = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());
extendedBolusCancel.setText(MainApp.instance().getString(R.string.cancel) + " " + running.toString());
} else {
extendedBolus.setVisibility(View.VISIBLE);
extendedBolusCancel.setVisibility(View.GONE);
}
}
if (!MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended() || MainApp.getConfigBuilder().isTempBasalInProgress())
if (!MainApp.getConfigBuilder().getPumpDescription().isTempBasalCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended()) {
tempBasal.setVisibility(View.GONE);
else
tempBasal.setVisibility(View.VISIBLE);
tempBasalCancel.setVisibility(View.GONE);
} else {
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
tempBasal.setVisibility(View.GONE);
tempBasalCancel.setVisibility(View.VISIBLE);
final TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis());
tempBasalCancel.setText(MainApp.instance().getString(R.string.cancel) + "\n" + activeTemp.toStringShort());
} else {
tempBasal.setVisibility(View.VISIBLE);
tempBasalCancel.setVisibility(View.GONE);
}
}
if (!MainApp.getConfigBuilder().getPumpDescription().isRefillingCapable || !MainApp.getConfigBuilder().isInitialized() || MainApp.getConfigBuilder().isSuspended())
fill.setVisibility(View.GONE);
else
fill.setVisibility(View.VISIBLE);
if (!Config.APS)
tempTarget.setVisibility(View.GONE);
else
@ -184,6 +214,17 @@ public class ActionsFragment extends SubscriberFragment implements View.OnClickL
});
}
break;
case R.id.actions_canceltempbasal:
if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress()) {
sHandler.post(new Runnable() {
@Override
public void run() {
pump.cancelTempBasal(true);
Answers.getInstance().logCustom(new CustomEvent("CancelTemp"));
}
});
}
break;
case R.id.actions_settempbasal:
NewTempBasalDialog newTempDialog = new NewTempBasalDialog();
newTempDialog.show(manager, "NewTempDialog");

View file

@ -27,6 +27,7 @@ import info.nightscout.androidaps.data.PumpEnactResult;
import info.nightscout.androidaps.interfaces.PumpDescription;
import info.nightscout.androidaps.interfaces.PumpInterface;
import info.nightscout.androidaps.data.Profile;
import info.nightscout.utils.NumberPicker;
import info.nightscout.utils.PlusMinusEditText;
import info.nightscout.utils.SafeParse;
@ -35,14 +36,14 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
RadioButton percentRadio;
RadioButton absoluteRadio;
RadioGroup basalTypeRadioGroup;
RelativeLayout typeSelectorLayout;
LinearLayout typeSelectorLayout;
LinearLayout percentLayout;
LinearLayout absoluteLayout;
PlusMinusEditText basalPercent;
PlusMinusEditText basalAbsolute;
PlusMinusEditText duration;
NumberPicker basalPercent;
NumberPicker basalAbsolute;
NumberPicker duration;
Handler mHandler;
public static HandlerThread mHandlerThread;
@ -65,22 +66,24 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
percentRadio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_percent_radio);
basalTypeRadioGroup = (RadioGroup) view.findViewById(R.id.overview_newtempbasal_radiogroup);
absoluteRadio = (RadioButton) view.findViewById(R.id.overview_newtempbasal_absolute_radio);
typeSelectorLayout = (RelativeLayout) view.findViewById(R.id.overview_newtempbasal_typeselector_layout);
typeSelectorLayout = (LinearLayout) view.findViewById(R.id.overview_newtempbasal_typeselector_layout);
PumpDescription pumpDescription = MainApp.getConfigBuilder().getPumpDescription();
basalPercent = new PlusMinusEditText(view, R.id.overview_newtempbasal_basalpercentinput, R.id.overview_newtempbasal_basalpercent_plus, R.id.overview_newtempbasal_basalpercent_minus,
100d, 0d, (double) pumpDescription.maxTempPercent, (double) pumpDescription.tempPercentStep, new DecimalFormat("0"), true);
basalPercent = (NumberPicker) view.findViewById(R.id.overview_newtempbasal_basalpercentinput);
double maxTempPercent = pumpDescription.maxTempPercent;
double tempPercentStep = pumpDescription.tempPercentStep;
basalPercent.setParams(100d, 0d, maxTempPercent, tempPercentStep, new DecimalFormat("0"), true);
Profile profile = MainApp.getConfigBuilder().getProfile();
Double currentBasal = profile.getBasal();
basalAbsolute = new PlusMinusEditText(view, R.id.overview_newtempbasal_basalabsoluteinput, R.id.overview_newtempbasal_basalabsolute_plus, R.id.overview_newtempbasal_basalabsolute_minus,
currentBasal, 0d, pumpDescription.maxTempAbsolute, pumpDescription.tempAbsoluteStep, new DecimalFormat("0.00"), true);
Double currentBasal = profile != null ? profile.getBasal() : 0d;
basalAbsolute = (NumberPicker) view.findViewById(R.id.overview_newtempbasal_basalabsoluteinput);
basalAbsolute.setParams(currentBasal, 0d, pumpDescription.maxTempAbsolute, pumpDescription.tempAbsoluteStep, new DecimalFormat("0.00"), true);
double tempDurationStep = MainApp.getConfigBuilder().getPumpDescription().tempDurationStep;
double tempMaxDuration = MainApp.getConfigBuilder().getPumpDescription().tempMaxDuration;
duration = new PlusMinusEditText(view, R.id.overview_newtempbasal_duration, R.id.overview_newtempbasal_duration_plus, R.id.overview_newtempbasal_duration_minus,
tempDurationStep, tempDurationStep, tempMaxDuration, tempDurationStep, new DecimalFormat("0"), false);
double tempDurationStep = pumpDescription.tempDurationStep;
double tempMaxDuration = pumpDescription.tempMaxDuration;
duration = (NumberPicker) view.findViewById(R.id.overview_newtempbasal_duration);
duration.setParams(tempDurationStep, tempDurationStep, tempMaxDuration, tempDurationStep, new DecimalFormat("0"), false);
if ((pumpDescription.tempBasalStyle & PumpDescription.PERCENT) == PumpDescription.PERCENT && (pumpDescription.tempBasalStyle & PumpDescription.ABSOLUTE) == PumpDescription.ABSOLUTE) {
// Both allowed
@ -107,13 +110,6 @@ public class NewTempBasalDialog extends DialogFragment implements View.OnClickLi
return view;
}
@Override
public void onResume() {
super.onResume();
if (getDialog() != null)
getDialog().getWindow().setLayout(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
}
@Override
public void onClick(View view) {
switch (view.getId()) {

View file

@ -509,8 +509,8 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
}
@Override
public PumpEnactResult cancelTempBasal() {
PumpEnactResult result = activePump.cancelTempBasal();
public PumpEnactResult cancelTempBasal(boolean userRequested) {
PumpEnactResult result = activePump.cancelTempBasal(userRequested);
if (Config.logCongigBuilderActions)
log.debug("cancelTempBasal success: " + result.success + " enacted: " + result.enacted);
return result;
@ -559,7 +559,7 @@ public class ConfigBuilderPlugin implements PluginBase, PumpInterface, Constrain
if (isTempBasalInProgress()) {
if (Config.logCongigBuilderActions)
log.debug("applyAPSRequest: cancelTempBasal()");
result = cancelTempBasal();
result = cancelTempBasal(false);
} else {
result = new PumpEnactResult();
result.absolute = request.rate;

View file

@ -159,7 +159,7 @@ public class NSClientInternalPlugin implements PluginBase {
MainApp.bus().post(new EventNSClientUpdateGUI());
}
void clearLog() {
synchronized void clearLog() {
handler.post(new Runnable() {
@Override
public void run() {
@ -169,7 +169,7 @@ public class NSClientInternalPlugin implements PluginBase {
});
}
private void addToLog(final EventNSClientNewLog ev) {
private synchronized void addToLog(final EventNSClientNewLog ev) {
handler.post(new Runnable() {
@Override
public void run() {
@ -183,7 +183,7 @@ public class NSClientInternalPlugin implements PluginBase {
});
}
static void updateLog() {
static synchronized void updateLog() {
try {
StringBuilder newTextLog = new StringBuilder();
List<EventNSClientNewLog> temporaryList = new ArrayList<>(listLog);

View file

@ -4,12 +4,15 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.Services.Intents;
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSAlarm;
import info.nightscout.utils.SP;
@ -22,7 +25,7 @@ public class BroadcastAckAlarm {
private static Logger log = LoggerFactory.getLogger(BroadcastAckAlarm.class);
public static void handleClearAlarm(NSAlarm originalAlarm, Context context, long silenceTimeInMsec) {
if(!SP.getBoolean("nsclient_localbroadcasts", true)) return;
Bundle bundle = new Bundle();
bundle.putInt("level", originalAlarm.getLevel());
bundle.putString("group", originalAlarm.getGroup());
@ -30,7 +33,18 @@ public class BroadcastAckAlarm {
Intent intent = new Intent(Intents.ACTION_ACK_ALARM);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
bundle = new Bundle();
bundle.putInt("level", originalAlarm.getLevel());
bundle.putString("group", originalAlarm.getGroup());
bundle.putLong("silenceTime", silenceTimeInMsec);
intent = new Intent(Intents.ACTION_ACK_ALARM);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
}
}
}

View file

@ -4,6 +4,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import org.json.JSONObject;
import org.slf4j.Logger;
@ -11,6 +12,8 @@ import org.slf4j.LoggerFactory;
import java.util.List;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.Services.Intents;
import info.nightscout.utils.SP;
@ -21,14 +24,20 @@ public class BroadcastAlarm {
private static Logger log = LoggerFactory.getLogger(BroadcastAlarm.class);
public static void handleAlarm(JSONObject alarm, Context context) {
if(!SP.getBoolean("nsclient_localbroadcasts", true)) return;
Bundle bundle = new Bundle();
bundle.putString("data", alarm.toString());
Intent intent = new Intent(Intents.ACTION_ALARM);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
bundle = new Bundle();
bundle.putString("data", alarm.toString());
intent = new Intent(Intents.ACTION_ALARM);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
}
}
}

View file

@ -4,6 +4,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import org.json.JSONArray;
import org.json.JSONObject;
@ -12,6 +13,8 @@ import org.slf4j.LoggerFactory;
import java.util.List;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.Services.Intents;
import info.nightscout.utils.SP;
@ -22,14 +25,20 @@ public class BroadcastAnnouncement {
private static Logger log = LoggerFactory.getLogger(BroadcastAnnouncement.class);
public static void handleAnnouncement(JSONObject announcement, Context context) {
if(!SP.getBoolean("nsclient_localbroadcasts", true)) return;
Bundle bundle = new Bundle();
bundle.putString("data", announcement.toString());
Intent intent = new Intent(Intents.ACTION_ANNOUNCEMENT);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
bundle = new Bundle();
bundle.putString("data", announcement.toString());
intent = new Intent(Intents.ACTION_ANNOUNCEMENT);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
}
}
}

View file

@ -4,6 +4,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import org.json.JSONArray;
import org.slf4j.Logger;
@ -11,6 +12,8 @@ import org.slf4j.LoggerFactory;
import java.util.List;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.Services.Intents;
import info.nightscout.utils.SP;
@ -22,14 +25,22 @@ public class BroadcastCals {
public static void handleNewCal(JSONArray cals, Context context, boolean isDelta) {
if(!SP.getBoolean("nsclient_localbroadcasts", true)) return;
Bundle bundle = new Bundle();
bundle.putString("cals", cals.toString());
bundle.putBoolean("delta", isDelta);
Intent intent = new Intent(Intents.ACTION_NEW_CAL);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
bundle = new Bundle();
bundle.putString("cals", cals.toString());
bundle.putBoolean("delta", isDelta);
intent = new Intent(Intents.ACTION_NEW_CAL);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
}
}
}

View file

@ -4,6 +4,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import org.json.JSONObject;
import org.slf4j.Logger;
@ -11,6 +12,8 @@ import org.slf4j.LoggerFactory;
import java.util.List;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.Services.Intents;
import info.nightscout.utils.SP;
@ -21,14 +24,20 @@ public class BroadcastClearAlarm {
private static Logger log = LoggerFactory.getLogger(BroadcastClearAlarm.class);
public static void handleClearAlarm(JSONObject clearalarm, Context context) {
if(!SP.getBoolean("nsclient_localbroadcasts", true)) return;
Bundle bundle = new Bundle();
bundle.putString("data", clearalarm.toString());
Intent intent = new Intent(Intents.ACTION_CLEAR_ALARM);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
bundle = new Bundle();
bundle.putString("data", clearalarm.toString());
intent = new Intent(Intents.ACTION_CLEAR_ALARM);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
}
}
}

View file

@ -4,6 +4,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import org.json.JSONArray;
import org.json.JSONObject;
@ -12,6 +13,8 @@ import org.slf4j.LoggerFactory;
import java.util.List;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.Services.Intents;
import info.nightscout.utils.SP;
@ -26,14 +29,20 @@ public class BroadcastDeviceStatus {
Intent intent = new Intent(Intents.ACTION_NEW_DEVICESTATUS);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
bundle = new Bundle();
bundle.putString("devicestatus", status.toString());
bundle.putBoolean("delta", isDelta);
intent = new Intent(Intents.ACTION_NEW_DEVICESTATUS);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
}
}
public static void handleNewDeviceStatus(JSONArray statuses, Context context, boolean isDelta) {
if(!SP.getBoolean("nsclient_localbroadcasts", true)) return;
List<JSONArray> splitted = BroadcastTreatment.splitArray(statuses);
for (JSONArray part: splitted) {
Bundle bundle = new Bundle();
@ -42,7 +51,20 @@ public class BroadcastDeviceStatus {
Intent intent = new Intent(Intents.ACTION_NEW_DEVICESTATUS);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
}
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
splitted = BroadcastTreatment.splitArray(statuses);
for (JSONArray part : splitted) {
Bundle bundle = new Bundle();
bundle.putString("devicestatuses", part.toString());
bundle.putBoolean("delta", isDelta);
Intent intent = new Intent(Intents.ACTION_NEW_DEVICESTATUS);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
}
}
}
}

View file

@ -4,6 +4,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import org.json.JSONArray;
import org.slf4j.Logger;
@ -11,6 +12,8 @@ import org.slf4j.LoggerFactory;
import java.util.List;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.Services.Intents;
import info.nightscout.utils.SP;
@ -22,14 +25,22 @@ public class BroadcastMbgs {
public static void handleNewMbg(JSONArray mbgs, Context context, boolean isDelta) {
if(!SP.getBoolean("nsclient_localbroadcasts", true)) return;
Bundle bundle = new Bundle();
bundle.putString("mbgs", mbgs.toString());
bundle.putBoolean("delta", isDelta);
Intent intent = new Intent(Intents.ACTION_NEW_MBG);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
bundle = new Bundle();
bundle.putString("mbgs", mbgs.toString());
bundle.putBoolean("delta", isDelta);
intent = new Intent(Intents.ACTION_NEW_MBG);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
}
}
}

View file

@ -4,12 +4,15 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.Services.Intents;
import info.nightscout.androidaps.data.ProfileStore;
import info.nightscout.utils.SP;
@ -23,15 +26,23 @@ public class BroadcastProfile {
public static void handleNewTreatment(ProfileStore profile, Context context, boolean isDelta) {
if(!SP.getBoolean("nsclient_localbroadcasts", true)) return;
Bundle bundle = new Bundle();
bundle.putString("profile", profile.getData().toString());
bundle.putBoolean("delta", isDelta);
Intent intent = new Intent(Intents.ACTION_NEW_PROFILE);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
bundle = new Bundle();
bundle.putString("profile", profile.getData().toString());
bundle.putBoolean("delta", isDelta);
intent = new Intent(Intents.ACTION_NEW_PROFILE);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
}
}
}

View file

@ -5,6 +5,7 @@ import android.content.Intent;
import android.os.Bundle;
import android.os.PowerManager;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.Services.Intents;
import info.nightscout.utils.SP;
@ -14,7 +15,7 @@ import info.nightscout.utils.SP;
public class BroadcastQueueStatus {
public static void handleNewStatus(int size, Context context) {
if(!SP.getBoolean("nsclient_localbroadcasts", true)) return;
if(!SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) return;
PowerManager powerManager = (PowerManager) context.getSystemService(Context.POWER_SERVICE);
PowerManager.WakeLock wakeLock = powerManager.newWakeLock(PowerManager.PARTIAL_WAKE_LOCK,

View file

@ -4,6 +4,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import org.json.JSONArray;
import org.json.JSONObject;
@ -12,6 +13,8 @@ import org.slf4j.LoggerFactory;
import java.util.List;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.Services.Intents;
import info.nightscout.utils.SP;
@ -23,15 +26,23 @@ public class BroadcastSgvs {
public static void handleNewSgv(JSONObject sgv, Context context, boolean isDelta) {
if(!SP.getBoolean("nsclient_localbroadcasts", true)) return;
Bundle bundle = new Bundle();
bundle.putString("sgv", sgv.toString());
bundle.putBoolean("delta", isDelta);
Intent intent = new Intent(Intents.ACTION_NEW_SGV);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
bundle = new Bundle();
bundle.putString("sgv", sgv.toString());
bundle.putBoolean("delta", isDelta);
intent = new Intent(Intents.ACTION_NEW_SGV);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
}
}
public static void handleNewSgv(JSONArray sgvs, Context context, boolean isDelta) {
@ -41,7 +52,17 @@ public class BroadcastSgvs {
Intent intent = new Intent(Intents.ACTION_NEW_SGV);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
bundle = new Bundle();
bundle.putString("sgvs", sgvs.toString());
bundle.putBoolean("delta", isDelta);
intent = new Intent(Intents.ACTION_NEW_SGV);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
}
}
}

View file

@ -5,6 +5,7 @@ import android.content.Intent;
import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -12,6 +13,7 @@ import org.slf4j.LoggerFactory;
import java.util.List;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.Services.Intents;
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSSettingsStatus;
import info.nightscout.androidaps.plugins.NSClientInternal.services.NSClientService;
@ -25,8 +27,6 @@ public class BroadcastStatus {
public static void handleNewStatus(NSSettingsStatus status, Context context, boolean isDelta) {
if(!SP.getBoolean("nsclient_localbroadcasts", true)) return;
Bundle bundle = new Bundle();
try {
bundle.putString("nsclientversionname", MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionName);
@ -41,6 +41,24 @@ public class BroadcastStatus {
Intent intent = new Intent(Intents.ACTION_NEW_STATUS);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
bundle = new Bundle();
try {
bundle.putString("nsclientversionname", MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionName);
bundle.putInt("nsclientversioncode", MainApp.instance().getPackageManager().getPackageInfo(MainApp.instance().getPackageName(), 0).versionCode);
} catch (PackageManager.NameNotFoundException e) {
e.printStackTrace();
}
bundle.putString("nightscoutversionname", NSClientService.nightscoutVersionName);
bundle.putInt("nightscoutversioncode", NSClientService.nightscoutVersionCode);
bundle.putString("status", status.getData().toString());
bundle.putBoolean("delta", isDelta);
intent = new Intent(Intents.ACTION_NEW_STATUS);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
}
}
}

View file

@ -5,6 +5,7 @@ import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.os.TransactionTooLargeException;
import android.support.v4.content.LocalBroadcastManager;
import org.json.JSONArray;
import org.json.JSONException;
@ -15,9 +16,12 @@ import org.slf4j.LoggerFactory;
import java.util.ArrayList;
import java.util.List;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.Services.Intents;
import info.nightscout.androidaps.plugins.NSClientInternal.data.NSTreatment;
import info.nightscout.utils.SP;
import info.nightscout.utils.ToastUtils;
/**
* Created by mike on 20.02.2016.
@ -27,21 +31,27 @@ public class BroadcastTreatment {
public static void handleNewTreatment(NSTreatment treatment, Context context, boolean isDelta) {
if(!SP.getBoolean("nsclient_localbroadcasts", true)) return;
Bundle bundle = new Bundle();
bundle.putString("treatment", treatment.getData().toString());
bundle.putBoolean("delta", isDelta);
Intent intent = new Intent(Intents.ACTION_NEW_TREATMENT);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
bundle = new Bundle();
bundle.putString("treatment", treatment.getData().toString());
bundle.putBoolean("delta", isDelta);
intent = new Intent(Intents.ACTION_NEW_TREATMENT);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
}
}
public static void handleNewTreatment(JSONArray treatments, Context context, boolean isDelta) {
if(!SP.getBoolean("nsclient_localbroadcasts", true)) return;
List<JSONArray> splitted = splitArray(treatments);
for (JSONArray part: splitted) {
Bundle bundle = new Bundle();
@ -50,42 +60,73 @@ public class BroadcastTreatment {
Intent intent = new Intent(Intents.ACTION_NEW_TREATMENT);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
}
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)){
splitted = splitArray(treatments);
for (JSONArray part: splitted) {
Bundle bundle = new Bundle();
bundle.putString("treatments", part.toString());
bundle.putBoolean("delta", isDelta);
Intent intent = new Intent(Intents.ACTION_NEW_TREATMENT);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
}
}
}
public void handleChangedTreatment(JSONObject treatment, Context context, boolean isDelta) {
if(!SP.getBoolean("nsclient_localbroadcasts", true)) return;
Bundle bundle = new Bundle();
bundle.putString("treatment", treatment.toString());
bundle.putBoolean("delta", isDelta);
Intent intent = new Intent(Intents.ACTION_CHANGED_TREATMENT);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
}
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
public static void handleChangedTreatment(JSONArray treatments, Context context, boolean isDelta) {
if(!SP.getBoolean("nsclient_localbroadcasts", true)) return;
List<JSONArray> splitted = splitArray(treatments);
for (JSONArray part: splitted) {
Bundle bundle = new Bundle();
bundle.putString("treatments", part.toString());
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
bundle = new Bundle();
bundle.putString("treatment", treatment.toString());
bundle.putBoolean("delta", isDelta);
Intent intent = new Intent(Intents.ACTION_CHANGED_TREATMENT);
intent = new Intent(Intents.ACTION_CHANGED_TREATMENT);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
}
}
public static void handleRemovedTreatment(JSONObject treatment, Context context, boolean isDelta) {
public static void handleChangedTreatment(JSONArray treatments, Context context, boolean isDelta) {
if(!SP.getBoolean("nsclient_localbroadcasts", true)) return;
List<JSONArray> splitted = splitArray(treatments);
for (JSONArray part : splitted) {
Bundle bundle = new Bundle();
bundle.putString("treatments", part.toString());
bundle.putBoolean("delta", isDelta);
Intent intent = new Intent(Intents.ACTION_CHANGED_TREATMENT);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
}
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
splitted = splitArray(treatments);
for (JSONArray part : splitted) {
Bundle bundle = new Bundle();
bundle.putString("treatments", part.toString());
bundle.putBoolean("delta", isDelta);
Intent intent = new Intent(Intents.ACTION_CHANGED_TREATMENT);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
}
}
}
public static void handleRemovedTreatment(JSONObject treatment, Context context, boolean isDelta) {
Bundle bundle = new Bundle();
bundle.putString("treatment", treatment.toString());
@ -93,20 +134,40 @@ public class BroadcastTreatment {
Intent intent = new Intent(Intents.ACTION_REMOVED_TREATMENT);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
bundle = new Bundle();
bundle.putString("treatment", treatment.toString());
bundle.putBoolean("delta", isDelta);
intent = new Intent(Intents.ACTION_REMOVED_TREATMENT);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
}
}
public static void handleRemovedTreatment(JSONArray treatments, Context context, boolean isDelta) {
if(!SP.getBoolean("nsclient_localbroadcasts", true)) return;
Bundle bundle = new Bundle();
bundle.putString("treatments", treatments.toString());
bundle.putBoolean("delta", isDelta);
Intent intent = new Intent(Intents.ACTION_REMOVED_TREATMENT);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
bundle = new Bundle();
bundle.putString("treatments", treatments.toString());
bundle.putBoolean("delta", isDelta);
intent = new Intent(Intents.ACTION_REMOVED_TREATMENT);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
}
}

View file

@ -4,6 +4,7 @@ import android.content.Context;
import android.content.Intent;
import android.content.pm.ResolveInfo;
import android.os.Bundle;
import android.support.v4.content.LocalBroadcastManager;
import org.json.JSONObject;
import org.slf4j.Logger;
@ -11,6 +12,8 @@ import org.slf4j.LoggerFactory;
import java.util.List;
import info.nightscout.androidaps.MainApp;
import info.nightscout.androidaps.R;
import info.nightscout.androidaps.Services.Intents;
import info.nightscout.utils.SP;
@ -21,14 +24,20 @@ public class BroadcastUrgentAlarm {
private static Logger log = LoggerFactory.getLogger(BroadcastUrgentAlarm.class);
public static void handleUrgentAlarm(JSONObject urgentalarm, Context context) {
if(!SP.getBoolean("nsclient_localbroadcasts", true)) return;
Bundle bundle = new Bundle();
bundle.putString("data", urgentalarm.toString());
Intent intent = new Intent(Intents.ACTION_URGENT_ALARM);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
LocalBroadcastManager.getInstance(MainApp.instance()).sendBroadcast(intent);
if(SP.getBoolean(R.string.key_nsclient_localbroadcasts, true)) {
bundle = new Bundle();
bundle.putString("data", urgentalarm.toString());
intent = new Intent(Intents.ACTION_URGENT_ALARM);
intent.putExtras(bundle);
intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
context.sendBroadcast(intent);
}
}
}

View file

@ -313,6 +313,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
activeloop.superBolusTo(System.currentTimeMillis() + 2 * 60L * 60 * 1000);
MainApp.bus().post(new EventRefreshOverview("WizardDialog"));
}
pump.cancelTempBasal(true);
result = pump.setTempBasalAbsolute(0d, 120);
if (!result.success) {
OKDialog.show(getActivity(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror), result.comment, null);

View file

@ -175,7 +175,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
LinearLayoutManager llm;
LinearLayout acceptTempLayout;
Button cancelTempButton;
Button treatmentButton;
Button wizardButton;
Button calibrationButton;
@ -269,9 +268,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
bgGraph = (GraphView) view.findViewById(R.id.overview_bggraph);
iobGraph = (GraphView) view.findViewById(R.id.overview_iobgraph);
cancelTempButton = (Button) view.findViewById(R.id.overview_canceltempbutton);
if (cancelTempButton != null)
cancelTempButton.setOnClickListener(this);
treatmentButton = (Button) view.findViewById(R.id.overview_treatmentbutton);
treatmentButton.setOnClickListener(this);
wizardButton = (Button) view.findViewById(R.id.overview_wizardbutton);
@ -415,7 +411,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal(true);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
}
@ -436,7 +432,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal(true);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
}
@ -450,7 +446,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal(true);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
}
@ -464,7 +460,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal(true);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
}
@ -478,7 +474,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal(true);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
}
@ -492,7 +488,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal(true);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
}
@ -506,6 +502,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
MainApp.getConfigBuilder().cancelTempBasal(true);
PumpEnactResult result = MainApp.getConfigBuilder().setTempBasalAbsolute(0d, 30);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
@ -520,6 +517,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
MainApp.getConfigBuilder().cancelTempBasal(true);
PumpEnactResult result = MainApp.getConfigBuilder().setTempBasalAbsolute(0d, 60);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
@ -534,6 +532,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
MainApp.getConfigBuilder().cancelTempBasal(true);
PumpEnactResult result = MainApp.getConfigBuilder().setTempBasalAbsolute(0d, 2 * 60);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
@ -548,6 +547,7 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
sHandler.post(new Runnable() {
@Override
public void run() {
MainApp.getConfigBuilder().cancelTempBasal(true);
PumpEnactResult result = MainApp.getConfigBuilder().setTempBasalAbsolute(0d, 3 * 60);
if (!result.success) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
@ -583,18 +583,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
NewTreatmentDialog treatmentDialogFragment = new NewTreatmentDialog();
treatmentDialogFragment.show(manager, "TreatmentDialog");
break;
case R.id.overview_canceltempbutton:
final PumpInterface pump = MainApp.getConfigBuilder();
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
sHandler.post(new Runnable() {
@Override
public void run() {
pump.cancelTempBasal();
Answers.getInstance().logCustom(new CustomEvent("CancelTemp"));
}
});
}
break;
case R.id.overview_pumpstatus:
if (MainApp.getConfigBuilder().isSuspended() || !MainApp.getConfigBuilder().isInitialized())
sHandler.post(new Runnable() {
@ -1016,15 +1004,6 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
}
final TemporaryBasal activeTemp = MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis());
if (cancelTempButton != null) {
if (activeTemp != null) {
cancelTempButton.setVisibility(View.VISIBLE);
cancelTempButton.setText(MainApp.instance().getString(R.string.cancel) + "\n" + activeTemp.toStringShort());
} else {
cancelTempButton.setVisibility(View.GONE);
}
}
String basalText = "";
if (shorttextmode) {
if (activeTemp != null) {
@ -1053,6 +1032,13 @@ public class OverviewFragment extends Fragment implements View.OnClickListener,
basalText += "(" + DecimalFormatter.to2Decimal(pump.getBaseBasalRate()) + "U/h)";
}
}
if (activeTemp != null) {
baseBasalView.setTextColor(MainApp.sResources.getColor(R.color.basal));
} else {
baseBasalView.setTextColor(Color.WHITE);
}
baseBasalView.setText(basalText);
final ExtendedBolus extendedBolus = MainApp.getConfigBuilder().getExtendedBolusFromHistory(System.currentTimeMillis());

View file

@ -18,7 +18,6 @@ import android.support.v4.app.NotificationCompat;
import com.squareup.otto.Subscribe;
import org.json.JSONException;
import org.json.JSONObject;
import org.monkey.d.ruffy.ruffy.driver.IRuffyService;
import org.slf4j.Logger;
@ -195,11 +194,14 @@ public class ComboPlugin implements PluginBase, PumpInterface {
@Override
public void onServiceConnected(ComponentName name, IBinder service) {
ruffyScripter = new RuffyScripter(IRuffyService.Stub.asInterface(service));
ruffyScripter.start();
log.debug("ruffy serivce connected");
}
@Override
public void onServiceDisconnected(ComponentName name) {
ruffyScripter.stop();
ruffyScripter = null;
log.debug("ruffy service disconnected");
}
};
@ -485,22 +487,27 @@ public class ComboPlugin implements PluginBase, PumpInterface {
@Override
public PumpEnactResult setTempBasalPercent(Integer percent, Integer durationInMinutes) {
log.debug("setTempBasalPercent called with " + percent + "% for " + durationInMinutes + "min");
if (percent % 10 != 0) {
int rounded = percent;
while (rounded % 10 != 0) rounded = rounded - 1;
log.debug("Rounded requested percentage from " + percent + " to " + rounded);
percent = rounded;
int adjustedPercent = percent;
if (adjustedPercent > pumpDescription.maxTempPercent) {
log.debug("Reducing requested TBR to the maximum support by the pump: " + percent + " -> " + pumpDescription.maxTempPercent);
adjustedPercent = pumpDescription.maxTempPercent;
}
percent = percent > pumpDescription.maxTempPercent ? pumpDescription.maxTempPercent : percent;
if (adjustedPercent % 10 != 0) {
Long rounded = Math.round(adjustedPercent / 10d) * 10;
log.debug("Rounded requested percentage:" + adjustedPercent + " -> " + rounded);
adjustedPercent = rounded.intValue();
}
CommandResult commandResult = runCommand(new SetTbrCommand(percent, durationInMinutes));
CommandResult commandResult = runCommand(new SetTbrCommand(adjustedPercent, durationInMinutes));
if (commandResult.enacted) {
TemporaryBasal tempStart = new TemporaryBasal(commandResult.completionTime);
// TODO commandResult.state.tbrRemainingDuration might already display 29 if 30 was set, since 29:59 is shown as 29 ...
// we should check this, but really ... something must be really screwed up if that number was anything different
tempStart.durationInMinutes = durationInMinutes;
tempStart.percentRate = percent;
tempStart.percentRate = adjustedPercent;
tempStart.isAbsolute = false;
tempStart.source = Source.USER;
ConfigBuilderPlugin treatmentsInterface = MainApp.getConfigBuilder();
@ -514,7 +521,7 @@ public class ComboPlugin implements PluginBase, PumpInterface {
pumpEnactResult.isPercent = true;
// Combo would have bailed if this wasn't set properly. Maybe we should
// have the command return this anyways ...
pumpEnactResult.percent = percent;
pumpEnactResult.percent = adjustedPercent;
pumpEnactResult.duration = durationInMinutes;
return pumpEnactResult;
}

View file

@ -566,7 +566,7 @@ public class DanaRPlugin implements PluginBase, PumpInterface, DanaRInterface, C
}
@Override
public PumpEnactResult cancelTempBasal() {
public PumpEnactResult cancelTempBasal(boolean userRequested) {
if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress())
return cancelRealTempBasal();
if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() && useExtendedBoluses) {

View file

@ -570,7 +570,7 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, DanaRInterf
}
@Override
public PumpEnactResult cancelTempBasal() {
public PumpEnactResult cancelTempBasal(boolean userRequested) {
if (MainApp.getConfigBuilder().isInHistoryRealTempBasalInProgress())
return cancelRealTempBasal();
if (MainApp.getConfigBuilder().isInHistoryExtendedBoluslInProgress() && useExtendedBoluses) {

View file

@ -340,7 +340,7 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
if (Config.logPumpActions)
log.debug("setTempBasalAbsolute: Stopping temp basal (doTempOff)");
return cancelTempBasal();
return cancelTempBasal(false);
}
result.success = true;
result.enacted = false;
@ -507,7 +507,7 @@ public class DanaRv2Plugin implements PluginBase, PumpInterface, DanaRInterface,
}
@Override
public PumpEnactResult cancelTempBasal() {
public PumpEnactResult cancelTempBasal(boolean userRequested) {
PumpEnactResult result = new PumpEnactResult();
if (pump.isTempBasalInProgress) {
sExecutionService.tempBasalStop();

View file

@ -196,7 +196,7 @@ public class MDIPlugin implements PluginBase, PumpInterface {
}
@Override
public PumpEnactResult cancelTempBasal() {
public PumpEnactResult cancelTempBasal(boolean userRequested) {
PumpEnactResult result = new PumpEnactResult();
result.success = false;
result.comment = MainApp.instance().getString(R.string.pumperror);

View file

@ -57,7 +57,6 @@ public class VirtualPumpFragment extends SubscriberFragment {
batteryView = (TextView) view.findViewById(R.id.virtualpump_battery);
reservoirView = (TextView) view.findViewById(R.id.virtualpump_reservoir);
updateGUI();
return view;
}
@ -73,8 +72,8 @@ public class VirtualPumpFragment extends SubscriberFragment {
activity.runOnUiThread(new Runnable() {
@Override
public void run() {
basaBasalRateView.setText(VirtualPumpPlugin.getInstance().getBaseBasalRate() + "U");
VirtualPumpPlugin virtualPump = VirtualPumpPlugin.getInstance();
basaBasalRateView.setText(virtualPump.getBaseBasalRate() + "U");
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
tempBasalView.setText(MainApp.getConfigBuilder().getTempBasalFromHistory(System.currentTimeMillis()).toStringFull());
} else {
@ -85,8 +84,8 @@ public class VirtualPumpFragment extends SubscriberFragment {
} else {
extendedBolusView.setText("");
}
batteryView.setText(VirtualPumpPlugin.getInstance().batteryPercent + "%");
reservoirView.setText(VirtualPumpPlugin.getInstance().reservoirInUnits + "U");
batteryView.setText(virtualPump.batteryPercent + "%");
reservoirView.setText(virtualPump.reservoirInUnits + "U");
}
});
}

View file

@ -204,7 +204,11 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
@Override
public double getBaseBasalRate() {
return MainApp.getConfigBuilder().getProfile().getBasal();
Profile profile = MainApp.getConfigBuilder().getProfile();
if (profile != null)
return profile.getBasal();
else
return 0d;
}
@Override
@ -282,7 +286,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
PumpEnactResult result = new PumpEnactResult();
if (MainApp.getConfigBuilder().isTempBasalInProgress()) {
result = cancelTempBasal();
result = cancelTempBasal(false);
if (!result.success)
return result;
}
@ -333,7 +337,7 @@ public class VirtualPumpPlugin implements PluginBase, PumpInterface {
}
@Override
public PumpEnactResult cancelTempBasal() {
public PumpEnactResult cancelTempBasal(boolean userRequested) {
TreatmentsInterface treatmentsInterface = MainApp.getConfigBuilder();
PumpEnactResult result = new PumpEnactResult();
result.success = true;

View file

@ -272,7 +272,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
LoopPlugin loopPlugin = (LoopPlugin) MainApp.getSpecificPlugin(LoopPlugin.class);
if (loopPlugin != null && loopPlugin.isEnabled(PluginBase.LOOP)) {
loopPlugin.setFragmentEnabled(PluginBase.LOOP, false);
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal(true);
MainApp.bus().post(new EventRefreshOverview("SMS_LOOP_STOP"));
reply = MainApp.sResources.getString(R.string.smscommunicator_loophasbeendisabled)+ " " +
MainApp.sResources.getString(result.success?R.string.smscommunicator_tempbasalcanceled:R.string.smscommunicator_tempbasalcancelfailed);
@ -506,7 +506,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
PumpInterface pumpInterface = MainApp.getConfigBuilder();
if (pumpInterface != null) {
danaRPlugin = (DanaRPlugin) MainApp.getSpecificPlugin(DanaRPlugin.class);
PumpEnactResult result = pumpInterface.cancelTempBasal();
PumpEnactResult result = pumpInterface.cancelTempBasal(true);
if (result.success) {
reply = MainApp.sResources.getString(R.string.smscommunicator_tempbasalcanceled);
if (danaRPlugin != null)
@ -535,7 +535,7 @@ public class SmsCommunicatorPlugin implements PluginBase {
suspendWaitingForConfirmation.processed = true;
final LoopPlugin activeloop = ConfigBuilderPlugin.getActiveLoop();
activeloop.suspendTo(System.currentTimeMillis() + suspendWaitingForConfirmation.duration * 60L * 1000);
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal();
PumpEnactResult result = MainApp.getConfigBuilder().cancelTempBasal(true);
NSUpload.uploadOpenAPSOffline(suspendWaitingForConfirmation.duration * 60);
MainApp.bus().post(new EventRefreshOverview("SMS_LOOP_SUSPENDED"));
reply = MainApp.sResources.getString(R.string.smscommunicator_loopsuspended) + " " +

View file

@ -189,6 +189,7 @@ public class ActionStringHandler {
boolean useBG = Boolean.parseBoolean(act[2]);
boolean useBolusIOB = Boolean.parseBoolean(act[3]);
boolean useBasalIOB = Boolean.parseBoolean(act[4]);
int percentage = Integer.parseInt(act[5]);
Profile profile = MainApp.getConfigBuilder().getProfile();
if (profile == null) {
@ -203,7 +204,7 @@ public class ActionStringHandler {
}
DecimalFormat format = new DecimalFormat("0.00");
BolusWizard bolusWizard = new BolusWizard();
bolusWizard.doCalc(profile, carbsAfterConstraints, 0d, useBG ? bgReading.valueToUnits(profile.getUnits()) : 0d, 0d, useBolusIOB, useBasalIOB, false, false);
bolusWizard.doCalc(profile, carbsAfterConstraints, 0d, useBG ? bgReading.valueToUnits(profile.getUnits()) : 0d, 0d, percentage, useBolusIOB, useBasalIOB, false, false);
Double insulinAfterConstraints = MainApp.getConfigBuilder().applyBolusConstraints(bolusWizard.calculatedTotalInsulin);
if (insulinAfterConstraints - bolusWizard.calculatedTotalInsulin != 0) {
@ -233,6 +234,9 @@ public class ActionStringHandler {
rMessage += "\nBolus IOB: " + format.format(bolusWizard.insulingFromBolusIOB) + "U";
if (useBasalIOB)
rMessage += "\nBasal IOB: " + format.format(bolusWizard.insulingFromBasalsIOB) + "U";
if(percentage != 100){
rMessage += "\nPercentage: " +format.format(bolusWizard.totalBeforePercentageAdjustment) + "U * " + percentage + "% -> ~" + format.format(bolusWizard.calculatedTotalInsulin) + "U";
}
lastBolusWizard = bolusWizard;

View file

@ -47,9 +47,14 @@ public class BolusWizard {
// Result
public Double calculatedTotalInsulin = 0d;
public Double totalBeforePercentageAdjustment = 0d;
public Double carbsEquivalent = 0d;
public Double doCalc(Profile specificProfile, Integer carbs, Double cob, Double bg, Double correction, Boolean includeBolusIOB, Boolean includeBasalIOB, Boolean superBolus, Boolean trend) {
return doCalc(specificProfile, carbs, cob, bg, correction, 100d, includeBolusIOB, includeBasalIOB, superBolus, trend);
}
public Double doCalc(Profile specificProfile, Integer carbs, Double cob, Double bg, Double correction, double percentageCorrection, Boolean includeBolusIOB, Boolean includeBasalIOB, Boolean superBolus, Boolean trend) {
this.specificProfile = specificProfile;
this.carbs = carbs;
this.bg = bg;
@ -103,7 +108,13 @@ public class BolusWizard {
}
// Total
calculatedTotalInsulin = insulinFromBG + insulinFromTrend + insulinFromCarbs + insulingFromBolusIOB + insulingFromBasalsIOB + insulinFromCorrection + insulinFromSuperBolus + insulinFromCOB;
calculatedTotalInsulin = totalBeforePercentageAdjustment = insulinFromBG + insulinFromTrend + insulinFromCarbs + insulingFromBolusIOB + insulingFromBasalsIOB + insulinFromCorrection + insulinFromSuperBolus + insulinFromCOB;
//percentage
if(totalBeforePercentageAdjustment > 0){
calculatedTotalInsulin = totalBeforePercentageAdjustment*percentageCorrection/100d;
}
if (calculatedTotalInsulin < 0) {
carbsEquivalent = -calculatedTotalInsulin * ic;

View file

@ -49,7 +49,6 @@ public class NSUpload {
data.put("pumpId", temporaryBasal.pumpId);
data.put("created_at", DateUtil.toISOString(temporaryBasal.date));
data.put("enteredBy", "openaps://" + MainApp.instance().getString(R.string.app_name));
data.put("notes", MainApp.sResources.getString(R.string.androidaps_tempbasalstartnote) + " " + temporaryBasal.absoluteRate + "u/h " + temporaryBasal.durationInMinutes + " min"); // ECOR
if (originalExtendedAmount != null)
data.put("originalExtendedAmount", originalExtendedAmount); // for back synchronization
Bundle bundle = new Bundle();
@ -88,7 +87,6 @@ public class NSUpload {
data.put("pumpId", temporaryBasal.pumpId);
data.put("created_at", DateUtil.toISOString(temporaryBasal.date));
data.put("enteredBy", "openaps://" + MainApp.instance().getString(R.string.app_name));
data.put("notes", MainApp.sResources.getString(R.string.androidaps_tempbasalstartnote) + " " + temporaryBasal.percentRate + "% " + temporaryBasal.durationInMinutes + " min"); // ECOR
Bundle bundle = new Bundle();
bundle.putString("action", "dbAdd");
bundle.putString("collection", "treatments");
@ -111,7 +109,6 @@ public class NSUpload {
data.put("eventType", CareportalEvent.TEMPBASAL);
data.put("created_at", DateUtil.toISOString(time));
data.put("enteredBy", "openaps://" + MainApp.instance().getString(R.string.app_name));
data.put("notes", MainApp.sResources.getString(R.string.androidaps_tempbasalendnote)); // ECOR
if (isFakedTempBasal)
data.put("isFakedTempBasal", isFakedTempBasal);
if (pumpId != 0)

View file

@ -52,6 +52,19 @@
android:drawableTop="@drawable/icon_actions_starttempbasal"
android:text="@string/overview_tempbasal_button" />
<Button
android:id="@+id/actions_canceltempbasal"
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:drawableTop="@drawable/icon_cancelbasal"
android:text="Cancel temp basal" />
<Button
android:id="@+id/actions_extendedbolus"
style="?android:attr/buttonStyle"

View file

@ -355,7 +355,8 @@
<com.jjoe64.graphview.GraphView
android:id="@+id/overview_iobgraph"
android:layout_width="wrap_content"
android:layout_height="100dp" />
android:layout_height="100dp"
android:visibility="gone" />
</LinearLayout>
@ -385,7 +386,8 @@
android:layout_marginTop="3dp"
android:layout_weight="0.5"
android:text="Accept new temp\n0.25U/h"
android:textColor="@color/colorAcceptTempButton" />
android:textColor="@color/colorAcceptTempButton"
android:visibility="gone" />
</LinearLayout>
<LinearLayout
@ -405,7 +407,8 @@
android:paddingRight="0dp"
android:text="@string/overview_bolus_label"
android:textColor="@color/colorTreatmentButton"
android:textSize="10sp" />
android:textSize="10sp"
android:visibility="gone" />
<Button
android:id="@+id/overview_wizardbutton"
@ -452,20 +455,6 @@
android:textSize="10sp"
android:visibility="gone" />
<Button
android:id="@+id/overview_canceltempbutton"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_cancelbasal"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="Cancel temp basal"
android:textColor="@color/colorCancelTempButton"
android:textSize="10sp"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>

View file

@ -756,20 +756,6 @@
android:textSize="10sp"
android:visibility="gone" />
<Button
android:id="@+id/overview_canceltempbutton"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_cancelbasal"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="Cancel temp basal"
android:textColor="@color/colorCancelTempButton"
android:textSize="10sp"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>

View file

@ -433,20 +433,6 @@
android:textSize="10sp"
android:visibility="gone" />
<Button
android:id="@+id/overview_canceltempbutton"
style="?android:attr/buttonStyle"
android:layout_width="0px"
android:layout_height="fill_parent"
android:layout_weight="0.5"
android:drawableTop="@drawable/icon_cancelbasal"
android:paddingLeft="0dp"
android:paddingRight="0dp"
android:text="Cancel temp basal"
android:textColor="@color/colorCancelTempButton"
android:textSize="10sp"
android:visibility="gone" />
</LinearLayout>
</LinearLayout>

View file

@ -12,266 +12,134 @@
android:layout_height="match_parent">
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:orientation="vertical"
android:padding="10dp">
<RelativeLayout
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:text="@string/virtualpump_tempbasal_label"
android:textAppearance="?android:attr/textAppearanceLarge" />
<LinearLayout
android:id="@+id/overview_newtempbasal_typeselector_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content">
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:id="@+id/textView2"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginTop="5dp"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="5dp"
android:layout_marginTop="15dp"
android:text="@string/overview_newtempbasal_basaltype_label"
android:textAlignment="center"
android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
<RadioGroup
android:id="@+id/overview_newtempbasal_radiogroup"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<RadioButton
android:id="@+id/overview_newtempbasal_percent_radio"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:checked="true"
android:text="@string/overview_newtempbasal_percent_label"
/>
android:text="@string/overview_newtempbasal_percent_label" />
<RadioButton
android:id="@+id/overview_newtempbasal_absolute_radio"
android:layout_width="200dp"
android:layout_height="wrap_content"
android:text="U/h" />
</RadioGroup>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_alignParentBottom="true"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="@color/listdelimiter" />
</LinearLayout>
</RelativeLayout>
<RelativeLayout
android:layout_width="match_parent"
<LinearLayout
android:id="@+id/overview_newtempbasal_percent_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginTop="5dp"
android:text="@string/overview_newtempbasal_basal_label"
android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
<LinearLayout
android:id="@+id/overview_newtempbasal_percent_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/overview_newtempbasal_basalpercent_minus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.5"
android:background="@drawable/circle"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_action_minus"
android:tint="#ffffff" />
<EditText
android:id="@+id/overview_newtempbasal_basalpercentinput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="0.5"
android:gravity="center_horizontal"
android:inputType="numberDecimal"
android:minWidth="100dp"
android:padding="10dp"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageView
android:id="@+id/overview_newtempbasal_basalpercent_plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.5"
android:background="@drawable/circle"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_action_add"
android:tint="#ffffff" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="left"
android:minWidth="40dp"
android:paddingLeft="5dp"
android:text="%"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<LinearLayout
android:id="@+id/overview_newtempbasal_absolute_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:orientation="horizontal">
<ImageView
android:id="@+id/overview_newtempbasal_basalabsolute_minus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.5"
android:background="@drawable/circle"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_action_minus"
android:tint="#ffffff" />
<EditText
android:id="@+id/overview_newtempbasal_basalabsoluteinput"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_weight="0.5"
android:gravity="center_horizontal"
android:inputType="numberDecimal"
android:minWidth="100dp"
android:padding="10dp"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge" />
<ImageView
android:id="@+id/overview_newtempbasal_basalabsolute_plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_weight="0.5"
android:background="@drawable/circle"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_action_add"
android:tint="#ffffff" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="left"
android:minWidth="40dp"
android:paddingLeft="5dp"
android:text="U/h"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
<View
android:layout_width="fill_parent"
android:layout_height="2dip"
android:layout_alignParentBottom="true"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="5dp"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_marginTop="5dp"
android:background="@color/listdelimiter" />
android:layout_marginTop="15dp"
android:text="@string/overview_newtempbasal_basalpercent"
android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
</RelativeLayout>
<info.nightscout.utils.NumberPicker
android:id="@+id/overview_newtempbasal_basalpercentinput"
android:layout_width="130dp"
android:layout_height="40dp"
android:layout_gravity="end"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp" />
</LinearLayout>
<LinearLayout
android:id="@+id/overview_newtempbasal_absolute_layout"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:orientation="vertical">
<RelativeLayout
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_alignParentStart="true"
android:layout_marginTop="5dp"
android:text="@string/careportal_newnstreatment_duration_label"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="5dp"
android:layout_marginTop="15dp"
android:text="@string/overview_newtempbasal_basalabsolute"
android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
<LinearLayout
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerHorizontal="true"
android:layout_marginTop="30dp"
android:orientation="horizontal">
<info.nightscout.utils.NumberPicker
android:id="@+id/overview_newtempbasal_basalabsoluteinput"
android:layout_width="130dp"
android:layout_height="40dp"
android:layout_gravity="end"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp" />
<ImageView
android:id="@+id/overview_newtempbasal_duration_minus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/circle"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_action_minus"
android:tint="#ffffff" />
</LinearLayout>
<EditText
android:id="@+id/overview_newtempbasal_duration"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:gravity="center_horizontal"
android:inputType="numberDecimal"
android:minWidth="100dp"
android:padding="10dp"
android:text=""
android:textAppearance="?android:attr/textAppearanceLarge" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_horizontal"
android:layout_marginBottom="5dp"
android:layout_marginTop="15dp"
android:text="@string/careportal_newnstreatment_duration_min_label"
android:textAppearance="@android:style/TextAppearance.Material.Small"
android:textStyle="bold" />
<ImageView
android:id="@+id/overview_newtempbasal_duration_plus"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:background="@drawable/circle"
android:backgroundTint="#ffffff"
android:src="@drawable/ic_action_add"
android:tint="#ffffff" />
<info.nightscout.utils.NumberPicker
android:id="@+id/overview_newtempbasal_duration"
android:layout_width="130dp"
android:layout_height="40dp"
android:layout_gravity="end"
android:layout_marginLeft="30dp"
android:layout_marginRight="30dp" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:gravity="left"
android:minWidth="40dp"
android:paddingLeft="5dp"
android:text="@string/careportal_newnstreatment_minutes"
android:textAppearance="?android:attr/textAppearanceSmall" />
</LinearLayout>
</RelativeLayout>
<include layout="@layout/mdtp_done_button" />
<include layout="@layout/mdtp_done_button" />
</LinearLayout>

View file

@ -3,7 +3,6 @@
<string name="treatmentssafety_title">Настройки на сигурността</string>
<string name="treatmentssafety_maxbolus_title">Максимален инсулин при болус [единици]</string>
<string name="treatmentssafety_maxcarbs_title">Максимални въглехидрати [гр]</string>
<string name="nav_preferences">Опции</string>
<string name="nav_refreshtreatments">Обнови леченията от NS</string>
<string name="nav_backup">Резервно копие</string>
@ -77,7 +76,6 @@
<string name="delta">Промяна</string>
<string name="sms_delta">Delta:</string>
<string name="avgdelta">Средна промяна</string>
<string name="configbuilder">Конфигурация</string>
<string name="objectives">Цели</string>
<string name="openapsma">OpenAPS MA</string>
@ -99,7 +97,6 @@
<string name="days">дни</string>
<string name="objectives_minimalduration">Минимална продължителност</string>
<string name="configbuilder_constraints">Ограничения</string>
<string name="loop">Цикъл</string>
<string name="configbuilder_loop">Цикъл</string>
<string name="loop_aps_label">APS</string>
@ -114,7 +111,7 @@
<string name="constraints_violation">Нарушено ограничение</string>
<string name="treatmentdeliveryerror">Грешка при подаване на болус</string>
<string name="tempbasaldeliveryerror">Грешка при подаване на временен базал</string>
<string name="overview_newtempbasal_basal_label">Стойност на базал</string>
<string name="overview_newtempbasal_basalpercent">Стойност на базал [%]</string>
<string name="overview_newtempbasal_percent_label">% (100% = текущ)</string>
<string name="setbasalquestion">Приложи нов временен базал:</string>
<string name="overview_bolus_label">Болус</string>
@ -139,7 +136,6 @@
<string name="disabledloop">изключен</string>
<string name="disableloop">Изключи</string>
<string name="enableloop">Включи</string>
<string name="openloop_newsuggestion">Има ново предложение</string>
<string name="unsupportedclientver">Несъвместима версия на NSClient</string>
<string name="unsupportednsversion">Несъвместима версия на Nightscout</string>
@ -171,7 +167,6 @@
<string name="careportal_tempbasalend">Край на временен базал</string>
<string name="careportal_carbscorrection">Корекция с въглехидрати</string>
<string name="careportal_openapsoffline">OpenAPS спрян</string>
<string name="careportal_newnstreatment_eventtype">Тип събитие</string>
<string name="careportal_newnstreatment_other">Друго</string>
<string name="careportal_newnstreatment_meter">Глюкомер</string>
@ -183,7 +178,6 @@
<string name="careportal_newnstreatment_duration_label">Продължителност</string>
<string name="careportal_newnstreatment_percent_label">Процент</string>
<string name="careportal_newnstreatment_absolute_label">Абсолютна</string>
<string name="careportal_newnstreatment_minutes">мин</string>
<string name="careportal_newnstreatment_notes_label">Бележки</string>
<string name="careportal_newnstreatment_eventtime_label">Време на събитие</string>
<string name="careportal_newnstreatment_profile_label">Профил</string>
@ -219,7 +213,6 @@
<string name="bg_lang">Bulgarian</string>
<string name="dismiss">Разбрах</string>
<string name="language">Език</string>
<string name="danarpump">DanaR</string>
<string name="connecting">Свързване</string>
<string name="connected">Свързана</string>
@ -268,7 +261,7 @@
<string name="careportal_temporarytargetcancel">Откажи временна цел</string>
<string name="danarprofile">DanaR профил</string>
<string name="danarprofile_dia">DIA (Време на действие на инсулина) ч.:</string>
<string name="danarprofile_dia_summary">Продължителност на действие на инсулина</string>
<string name="danarprofile_dia_summary">Време на действие на инсулина</string>
<string name="failedupdatebasalprofile">Неуспешно обноввяване на базалния профил</string>
<string name="danar_history">История</string>
<string name="danar_historyreload">Презареди</string>
@ -288,12 +281,12 @@
<string name="danar_history_basalhours">Базален по часове</string>
<string name="danar_history_bolus">Болуси</string>
<string name="danar_history_carbohydrates">Въглехидрати</string>
<string name="danar_history_dailyinsulin">Дневен инсулин</string>
<string name="danar_history_dailyinsulin">Инсулин за деня</string>
<string name="danar_history_errors">Грешки</string>
<string name="danar_history_glucose">КЗ</string>
<string name="danar_history_refill">Пълнене</string>
<string name="danar_history_syspend">Спиране</string>
<string name="danar_history_connectingfor" formatted="false">Опитва да се свърже през последните %d с</string>
<string name="danar_history_connectingfor" formatted="false">Свързване с помпата за %d сек.</string>
<string name="danar_password_title">Парола за помпата</string>
<string name="wrongpumppassword">Грешна парола за помпата!</string>
<string name="pumpbusy">Помпата е заета</string>
@ -336,7 +329,6 @@
<string name="smscommunicator_tempbasalcanceled">Temp basal canceled</string>
<string name="smscommunicator_tempbasalcancelfailed">Canceling temp basal failed</string>
<string name="smscommunicator_unknowncommand">Uknonwn command or wrong reply</string>
<string name="quickwizard">Бърз болус</string>
<string name="quickwizardsettings">Настройки за бърз болус</string>
<string name="overview_editquickwizard_buttontext">Текст на бутона:</string>
@ -348,7 +340,7 @@
<string name="mealbolus">Хранене</string>
<string name="correctionbous">Корекция</string>
<string name="ko_lang">Korean</string>
<string name="actions">Actions</string>
<string name="actions">Действия</string>
<string name="androidaps_start">Стартиран AndroidAPS</string>
<string name="ns_upload_only">NS upload only (изключва синхронизацията)</string>
<string name="ns_upload_only_summary">Само качване на данните в NS. Няма ефект върху данните за КЗ ако локален източник като xDrip е избран. Няма ефект върху профила освен ако не е избран NS-профил.</string>
@ -363,19 +355,17 @@
<string name="button3">Бутон 3</string>
<string name="percentagefactor_hint">% с който базовият профил ще бъде променен.</string>
<string name="timeshift_hint">Точен брой часове, с които ще бъде изместен профила!</string>
<string name="send_to_pump">Изпрати в помпата</string>
<string name="send_to_pump">ИЗПРАТИ КЪМ ПОМПАТА</string>
<string name="units">Единици:</string>
<string name="mgdl">мг/дл</string>
<string name="mmol">ммол/л</string>
<string name="dia">DIA(продължителност на действие на инсулина):</string>
<string name="dia">DIA(време на действие на инсулина):</string>
<string name="target_range">Целеви диапазон:</string>
<string name="edit_base_basal">Редактирай базални стойности</string>
<string name="edit_base_isf">Редактирай Инс. чувствителност</string>
<string name="edit_base_ic">Редактирай Инс./ВХ</string>
<string name="base_profile_label">Базов профил:</string>
<string name="circadian_percentage_profile">Процентен профил</string>
<string name="androidaps_tempbasalendnote">край на временен базал</string>
<string name="androidaps_tempbasalstartnote">Старт на временен базал</string>
<string name="prefs_range_title">Диапазон за визуализация</string>
<string name="prefs_range_summary">Стойност на линиите за ниска и висока КЗ (mmol/l) за телефона и часовника</string>
<string name="low_mark">Ниска КЗ под</string>
@ -489,7 +479,7 @@
<string name="stoppingtempbasal">Спира временен базал</string>
<string name="settingextendedbolus">Настойва удължен болус</string>
<string name="stoppingextendedbolus">Спира удължен болус</string>
<string name="updatingbasalrates">Обновява базалите</string>
<string name="updatingbasalrates">Обновява базални стойности</string>
<string name="disconnecting">Спира връзката</string>
<string name="executing">Изпълнява</string>
<string name="virtualpump_settings">Настойки Виртуална Помпа</string>
@ -511,13 +501,13 @@
<string name="nsclientinternal_secret_dialogmessage">Въведете NS API secret (мин 12 символа)</string>
<string name="nsclientinternal_devicename_title">Име на устройството</string>
<string name="nsclientinternal_devicename_dialogtitle">Въведете името на телефона</string>
<string name="nsclientinternal_devicename_dialogmessage">Ще се използва за полето enteredBy</string>
<string name="nsclientinternal_devicename_dialogmessage">Ще се използва за полето \"Въведено от\"</string>
<string name="deliver_now">Изпрати сега</string>
<string name="clear_queue">Изчисти опашка</string>
<string name="show_queue">Покажи опашка</string>
<string name="queue">Опашка:</string>
<string name="status">Статус:</string>
<string name="paused">пауза</string>
<string name="paused">Пауза</string>
<string name="patientage">Възраст на потребителя</string>
<string name="child">Дете</string>
<string name="teenage">Тийнейджър</string>
@ -604,8 +594,6 @@
<string name="nsalarm_urgent_staledatavalue_label">Много стари данни при повече от [мин]</string>
<string name="openapsama_autosens_period">Интервал за autosens [ч]</string>
<string name="openapsama_autosens_period_summary">Брой часове назад за определяне на чувствителността (приемът на въглехидрати е изключен)</string>
<string name="ratio_short">RAT</string>
<string name="key_do_not_track_profile_switch">do_not_track_profile_switch</string>
<string name="do_not_track_profile_switch">Игнорирай събитията от тип Смяна на профил</string>
<string name="do_not_track_profile_switch_summary">Всички смени на профила се игнорират и винаги се използва текущия профил</string>
<string name="pump">Помпа</string>
@ -614,8 +602,8 @@
<string name="uploader">Uploader</string>
<string name="configbuilder_sensitivity">Определяне на чувствителност</string>
<string name="sensitivity_shortname">ЧУВСТВ</string>
<string name="sensitivityoref0">Алгоритъм на Oref0</string>
<string name="sensitivityaaps">Алгоритъм на AAPS</string>
<string name="sensitivityoref0">чрез Oref0</string>
<string name="sensitivityaaps">чрез AAPS</string>
<string name="absorptionsettings_title">Настройки за абсорбция</string>
<string name="absorption_maxtime_title">Максимално време за усвояване на храненето [ч]</string>
<string name="absorption_maxtime_summary">Брой часове, за които се очаква храненето да бъде напълно усвоено в организма</string>
@ -631,11 +619,20 @@
<string name="lock_screen">Заключен екран</string>
<string name="lock_screen_short">Закл</string>
<string name="sensitivity_warning">Когато включите Autosense feature трябва да въвеждате ВСИЧКИ въглехидрати. В противен случай те ще се изчисляват грешно като повишена чувствителност!!</string>
<string name="sensitivityweightedaverage">Алгоритъм на Среднопретеглената стойност</string>
<string name="sensitivityweightedaverage">чрез Среднопретеглената стойност</string>
<string name="mdtp_ok">OK</string>
<string name="mdtp_cancel">Откажи</string>
<string name="cpp_sync_setting_missing">трябва да е активно за да изпратя стойностите към помпата!</string>
<string name="cpp_sync_setting_missing">трябва да е активно за да изпрати стойностите към помпата!</string>
<string name="cpp_notloadedplugins">Не всички профили са заредени!</string>
<string name="cpp_valuesnotstored">Стойностите не са запазени!</string>
<string name="clearlog">Изчисти лога</string>
<string name="nosuccess">неуспешно - моля проверете телефона</string>
<string name="notavailable">Недостъпно</string>
<string name="nowritepermission">NSClient няма права за запис. Грешна API secret?</string>
<string name="ns_localbroadcasts">Разреши предаване към други приложения (напр. xDrip)</string>
<string name="ns_localbroadcasts_title">Разреши локално предаване на данни</string>
<string name="objectives_0_gate">Потвърждаване, че КЗ е достъпна в Найтскаут и данните за помпата се качват там</string>
<string name="wear_detailedIOB_summary">Раздели IOB от болус и от базал на часовника</string>
<string name="wear_detailedIOB_title">Покажи подробен IOB</string>
<string name="app_name">AndroidAPS</string>
</resources>

View file

@ -26,7 +26,6 @@
<string name="careportal_newnstreatment_carbs_label">Sacharidy</string>
<string name="careportal_newnstreatment_carbtime_label">Čas jídla</string>
<string name="careportal_newnstreatment_duration_label">Trvání</string>
<string name="careportal_newnstreatment_minutes">min</string>
<string name="careportal_newnstreatment_enteredby_title">Zadal</string>
<string name="careportal_newnstreatment_eventtime_label">Čas</string>
<string name="careportal_newnstreatment_insulin_label">Inzulín</string>
@ -116,7 +115,7 @@
<string name="openloop_newsuggestion">Dostupné nové doporučení</string>
<string name="overview">Přehled</string>
<string name="overview_calculator_label">Kalkulačka</string>
<string name="overview_newtempbasal_basal_label">Hodnota bazálu</string>
<string name="overview_newtempbasal_basalpercent">Hodnota bazálu [%]</string>
<string name="overview_newtempbasal_percent_label">% (100% = současný)</string>
<string name="overview_bolus_label">Bolus</string>
<string name="profileviewer">NS profil</string>
@ -313,8 +312,6 @@
<string name="correctionbous">Korekce</string>
<string name="actions">Akce</string>
<string name="androidaps_start">AndroidAPS restartován</string>
<string name="androidaps_tempbasalendnote">Dočasný bazál konec</string>
<string name="androidaps_tempbasalstartnote">Dočasný bazál začátek</string>
<string name="alert_dialog_storage_permission_text">Prosím restartujte Váš telefon nebo restartujte AndroidAPS z nastavení systému jinak nebudou zaznamenány ladící informace (důležité pro sledování a kontrolu, zda algoritmus pracuje správně)</string>
<string name="base_profile_label">Bazální profil:</string>
<string name="batterydischarged">Baterie v pumpě vybitá</string>
@ -540,4 +537,91 @@
<string name="nav_about">O aplikaci</string>
<string name="smscommunicator_missingsmspermission">Chybějící povolení SMS</string>
<string name="it_lang">Italian</string>
<string name="absorption_maxtime_summary">Čas v hodinách, ve kterém předpokládáme, že všechny sacharidy budou strávené</string>
<string name="absorption_maxtime_title">Max. doba absorbce sacharidu [h]</string>
<string name="absorptionsettings_title">Nastavení absorbce sacharidů</string>
<string name="basalshortlabel">BAS</string>
<string name="bolus_step">Krok bolusu</string>
<string name="careportal_canulaage_label">Stáří kanyly</string>
<string name="careportal_canulaage_label_short">KAN</string>
<string name="careportal_carbsandbolus_label">SACHARIDY &amp; BOLUSY</string>
<string name="careportal_cgm_label">CGM &amp; OPENAPS</string>
<string name="careportal_insulinage_label">Stáří inzulínu</string>
<string name="careportal_insulinage_label_short">INZ</string>
<string name="careportal_newnstreatment_duration_min_label">Trvání [min]</string>
<string name="careportal_pbage_label">Stáří baterie v pumpě</string>
<string name="careportal_pbage_label_short">BAT</string>
<string name="careportal_pump_label">PUMPA</string>
<string name="careportal_pumpbatterychange">Výměna baterie pumpy</string>
<string name="careportal_sensorage_label">Stáří senzoru</string>
<string name="careportal_sensorage_label_short">SEN</string>
<string name="cob">COB</string>
<string name="configbuilder_sensitivity">Detekce citlivosti</string>
<string name="cpp_notloadedplugins">Všechny profily nenačteny</string>
<string name="cpp_sync_setting_missing">musí být aktivovaný, aby šly poslat hodnoty do pumpy!</string>
<string name="cpp_valuesnotstored">Hodnoty nejsou uloženy!</string>
<string name="danarv2pump">DanaRv2</string>
<string name="dev">ODCH</string>
<string name="device">Zařízení</string>
<string name="do_not_track_profile_switch">Ignorovat přepnutí profilu</string>
<string name="do_not_track_profile_switch_summary">Všechny záznamy přepnutí profilu jsou ignorovány a vždy je použit aktivní profil</string>
<string name="extendedbolus">ProdlouženýBolus</string>
<string name="hours">hodin</string>
<string name="icmissing">I:S chybí. Je použita výchozí hodnota.</string>
<string name="invalidprofile">Chybný profil !!!</string>
<string name="iob">IOB</string>
<string name="isfmissing">Senzitivita chybí. Je použita výchozí hodnota.</string>
<string name="lock_screen">Zámek obrazovky</string>
<string name="lock_screen_short">Zámek</string>
<string name="mdtp_cancel">Zrušit</string>
<string name="mdtp_ok">OK</string>
<string name="ns_alarmoptions">Nastavení alarmů</string>
<string name="ns_localbroadcasts">Povolit odesílání do ostatních aplikací (jako xDrip)</string>
<string name="ns_localbroadcasts_title">Povolení odesílaní</string>
<string name="ns_noupload">Zakazát nahrávání do NS</string>
<string name="ns_noupload_summary">Všechny data odeslaná do NS jsou zahozena. AAPS je připojen k NS, ale nedělá do něj žádné změny.</string>
<string name="nsalarm_high">Vysoká</string>
<string name="nsalarm_low">Nízká</string>
<string name="nsalarm_staledata">Zastaralá data</string>
<string name="nsalarm_staledatavalue_label">Mezní hodnota pro zastaralá data [min]</string>
<string name="nsalarm_summary">Právě nastaveno na %f</string>
<string name="nsalarm_urgent_staledatavalue_label">Urgetní mezní hodnota pro zastaralá data [min]</string>
<string name="nsalarm_urgenthigh">Urgentně vysoká</string>
<string name="nsalarm_urgentlow">Urgentně nízká</string>
<string name="nsalarm_urgentstaledata">Urgentně zastaralá data</string>
<string name="overview_extendedbolus_cancel_button">Zrušit prodloužený bolus</string>
<string name="overview_newtempbasal_basalabsolute">Hodnota bazálu [U/h]</string>
<string name="overview_newtempbasal_basaltype_label">Typ bazálu</string>
<string name="predictionshortlabel">PRE</string>
<string name="profileswitch">PřepnutíProfilu</string>
<string name="pump">Pumpa</string>
<string name="ratio_short">SEN</string>
<string name="xdripstatus">Statusový řádek xDripu (hodinky)</string>
<string name="xdripstatus_settings">Status z xDripu (hodinky)</string>
<string name="xdripstatus_shortname">xds</string>
<string name="virtualpump_extendedbolus_label_short">EXT</string>
<string name="targetmissing">Chybí cílový rozsah. Použity výchozí hodnoty.</string>
<string name="tempbasal">DočasnýBazál</string>
<string name="temptarget">DočasnýCíl</string>
<string name="wear_overviewnotifications">Oznámení na hodinkách</string>
<string name="wear_overviewnotifications_summary">Předávat oznámení jako zprávy do hodinek</string>
<string name="wear_showbgi_summary">Přidat BGI do stavové řádky</string>
<string name="wear_showbgi_title">Zobrazovat BGI</string>
<string name="sensitivity_shortname">SENS</string>
<string name="ru_lang">Ruština</string>
<string name="sensitivity_warning">Při zapnuté detektci sensitivity nezapomeňte vkládat všechny sacharidy. Jinak budou odchylky mylně vyhodnocovány jako změna sensitivity !!</string>
<string name="sensitivityaaps">Sensitivita AAPS</string>
<string name="sensitivityoref0">Sensotivita Oref0</string>
<string name="sensitivityweightedaverage">Sensitivita vážený průměr</string>
<string name="openaps">OpenAPS</string>
<string name="openaps_short">OAPS</string>
<string name="danar_bluetooth_status">Bluetooth status</string>
<string name="careportal_activity_label">AKTIVITA &amp; ZPĚTNÁ VAZBA</string>
<string name="basalmissing">Chybějící bazál v profilu. Použita výchozí hodnota</string>
<string name="basal_step">Krok bazálu</string>
<string name="basal_short">BAZ</string>
<string name="unsupportednsversion">Nepodporovaná verze Nightscoutu</string>
<string name="uploader">Uploader</string>
<string name="uploader_short">UPLD</string>
<string name="app_name">AndroidAPS</string>
</resources>

View file

@ -33,7 +33,6 @@
<string name="careportal_cgmsensorstart">CGM Sensor Start</string>
<string name="careportal_newnstreatment_absolute_label">Absolut</string>
<string name="careportal_newnstreatment_carbs_label">Kohlehydrate</string>
<string name="careportal_newnstreatment_minutes">min</string>
<string name="careportal_newnstreatment_insulin_label">Insulin</string>
<string name="careportal_newnstreatment_glucosetype">Glukose-Art</string>
<string name="careportal_newnstreatment_eventtype">Ereignis-Typ</string>
@ -90,7 +89,7 @@
<string name="treatments_iobactivitytotal_label_string">Aktives IOB total:</string>
<string name="treatments_iobtotal_label_string">IOB total:</string>
<string name="treatments_wizard_basaliob_label">Basal IOB</string>
<string name="treatments_wizard_unit_label">U</string>
<string name="treatments_wizard_unit_label">E</string>
<string name="up">Up</string>
<string name="virtualpump">Virtuelle Pumpe</string>
<string name="virtualpump_reservoir_label">Reservoir</string>
@ -119,7 +118,7 @@
<string name="danar_useextended_title">Benutze extended Bolus für hohe temps (\>200%)></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>
<string name="overview_newtempbasal_basalpercent">Basal Wert [%]</string>
<string name="overview_extendedbolus_button">Extended Bolus</string>
<string name="overview">Übersicht</string>
<string name="openloop_newsuggestion">Neue Empfehlung verfügbar</string>
@ -286,7 +285,6 @@
<string name="basal_rate">Basalrate:</string>
<string name="base_profile_label">Basisprofil:</string>
<string name="batterydischarged">Pumpenbatterie entladen</string>
<string name="androidaps_tempbasalendnote">Basal Temp Ende</string>
<string name="danar_historyreload">neu laden</string>
<string name="high_mark">Hoch Markierung</string>
<string name="low_mark">Niedrig Markierung</string>
@ -328,11 +326,10 @@
<string name="error_phone_not_valid">Telefonnummer ist nicht gültig.</string>
<string name="error_only_numeric_digits_range_allowed">Bitte verwenden Sie nur Ziffern von %1$s - %2$s</string>
<string name="waitingforpump">Warte auf Pumpe</string>
<string name="wear"></string>
<string name="wear">Wear</string>
<string name="alert_dialog_storage_permission_text">Bitte starte dein Telefon neu oder starte AndroidAPS in den System-Einstellungen neu. Anderenfalls hat AndroidAPS kein logging (wichtig zum Nachverfolgen und Verifizieren, dass der Algorithmus korrekt funktioniert)</string>
<string name="always_use_shortavg">Immer das kurze Durchschnitts-Delta statt dem einfachen Delta verwenden</string>
<string name="always_use_shortavg_summary">Sinnvoll, wenn die Daten von einer ungefilterten Quelle Signalrauschen haben.</string>
<string name="androidaps_tempbasalstartnote">Basal Temp Anfang</string>
<string name="approachingdailylimit">Tagesinsulin-Limit wird erreicht.</string>
<string name="basalshortlabel">BR</string>
<string name="calibrationsent">Kalibrierung an xDrip gesendet</string>
@ -357,4 +354,47 @@
<string name="wear_detailedIOB_summary">Trenne IOB in Bolus- und Basal-IOB auf dem Watchface</string>
<string name="wrongpassword">Falsches Passwort</string>
<string name="it_lang">Italian</string>
<string name="Glimp">Glimp</string>
<string name="MM640g">MM640g</string>
<string name="absorption_maxtime_summary">Zeit in Stunden in der zu erwarten ist, dass alle Kohlenhydrate resorbiert sein werden</string>
<string name="absorption_maxtime_title">Maximale Essens-Resorptionszeit [h]</string>
<string name="absorptionsettings_title">Resorptions-Einstellungen</string>
<string name="activity">Aktivität</string>
<string name="adult">Erwachsener</string>
<string name="advancedsettings_title">Erweiter</string>
<string name="app_name">AndroidAPS</string>
<string name="basal_short">BAS</string>
<string name="basal_step">Basal-Schritt</string>
<string name="basalmissing">Basal fehlt im Profil. Verwende Standardwert.</string>
<string name="basalvaluebelowminimum">Basalwert unter dem Minimum. Profil nicht gesetzt!</string>
<string name="batteryoptimalizationerror">Gerät untertützt anscheinend das deaktivieren der Akku-Leistungsoptimierung nicht.</string>
<string name="bolus_step">Bolus-Schritt</string>
<string name="bolusrequested">Werde %.2fE abgeben</string>
<string name="careportal_activity_label">AKTIVITÄT &amp; FEEDBACK</string>
<string name="careportal_canulaage_label">Katheter-Liegedauer</string>
<string name="careportal_canulaage_label_short">CAGE</string>
<string name="careportal_carbsandbolus_label">CARBS &amp; BOLUS</string>
<string name="careportal_cgm_label">CGM &amp; OPENAPS</string>
<string name="careportal_insulinage_label"></string>
<string name="careportal_newnstreatment_duration_min_label">Dauer [min]</string>
<string name="paused">pausiert</string>
<string name="patientage">Patientenalter</string>
<string name="patientage_summary">Bitte wähle das Pateintenalter um die Sicherheits-Limits festzulegen</string>
<string name="targetmissing">Ziel fehlt im Profil. Verwende Standardwert.h</string>
<string name="teenage">Teenager</string>
<string name="tempbasal">TempBasal</string>
<string name="tempbasaldeliveryerror">Tempbasal Abgabe-Fehler</string>
<string name="temptarget">TempZiel</string>
<string name="timeshift_hint">Zeit in Stunden um die das profil zylindrisch verschoben wird.</string>
<string name="treatments_wizard_bgtrend_label"></string>
<string name="treatments_wizard_cob_label">COB</string>
<string name="unsupportednsversion">Nicht-unterstütze Nightscout-Version</string>
<string name="uploader">Uploader</string>
<string name="uploader_short">UPLD</string>
<string name="virtualpump_extendedbolus_label_short">EXT</string>
<string name="virtualpump_firmware_label">Firmware</string>
<string name="virtualpump_settings">Virtuelle Pumpe Einstellungen</string>
<string name="virtualpump_uploadstatus_title">Status zu NS hochladen</string>
<string name="superbolus">Superbolus</string>
<string name="suspendloopfor10h"></string>
</resources>

View file

@ -19,4 +19,5 @@
<string name="circadian_percentage_profile_shortname">" "</string>
<string name="careportal_shortname">" "</string>
<string name="it_lang">Italian</string>
<string name="app_name">AndroidAPS</string>
</resources>

View file

@ -108,7 +108,7 @@
<string name="openapsma_disabled">Plugin está desactivado</string>
<string name="constraints_violation">Violación restricciones</string>
<string name="treatmentdeliveryerror">Error de administración del bolo</string>
<string name="overview_newtempbasal_basal_label">Valor basal</string>
<string name="overview_newtempbasal_basalpercent">Valor basal [%]</string>
<string name="overview_newtempbasal_percent_label">% (100% = actual)</string>
<string name="setbasalquestion">Aceptar nueva basal temporal:</string>
<string name="overview_bolus_label">Bolo</string>
@ -170,7 +170,6 @@
<string name="careportal_newnstreatment_duration_label">Duración</string>
<string name="careportal_newnstreatment_percent_label">Dosis</string>
<string name="careportal_newnstreatment_absolute_label">Absoluto</string>
<string name="careportal_newnstreatment_minutes"> min</string>
<string name="careportal_newnstreatment_notes_label">Notas</string>
<string name="careportal_newnstreatment_eventtime_label">Fecha Hora</string>
<string name="careportal_newnstreatment_profile_label">Perfil</string>
@ -332,8 +331,6 @@
<string name="smscommunicator_unknowncommand">Comando desconocido o respuesta incorrecta</string>
<string name="fillwarning">¡Por favor asegurar que la cantidad coincide con la especificación del set de infusión!</string>
<string formatted="false" name="smscommunicator_basalreplywithcode">Para iniciar basal %.2fU/h responder con código %s</string>
<string name="androidaps_tempbasalstartnote">Inicio Basal Temporal</string>
<string name="androidaps_tempbasalendnote">Fin Basal Temporal</string>
<string name="actions_shortname">" "</string>
<string name="wear_shortname">" "</string>
<string name="virtualpump_shortname">" "</string>
@ -398,4 +395,5 @@
<string name="error_phone_not_valid">Número de teléfono inválido</string>
<string name="waitingforpump">Esperando bomba</string>
<string name="it_lang">Italian</string>
<string name="app_name">AndroidAPS</string>
</resources>

View file

@ -47,7 +47,6 @@
<string name="careportal_newnstreatment_glucosetype">Tipo di glucosio</string>
<string name="careportal_newnstreatment_insulin_label">Insulina</string>
<string name="careportal_newnstreatment_meter">Glucometro</string>
<string name="careportal_newnstreatment_minutes">Minimo</string>
<string name="careportal_newnstreatment_notes_label">Note</string>
<string name="careportal_newnstreatment_other">Altro</string>
<string name="careportal_newnstreatment_percent_label">Percentuale</string>
@ -310,7 +309,7 @@
<string name="overview_editquickwizard_valid">Valido:</string>
<string name="overview_editquickwizardlistactivity_add">Aggiungere</string>
<string name="overview_extendedbolus_button">Bolo Esteso</string>
<string name="overview_newtempbasal_basal_label">Valore Basale</string>
<string name="overview_newtempbasal_basalpercent">Valore Basale [%]</string>
<string name="overview_quickwizard_item_edit_button">Uscire</string>
<string name="overview_quickwizard_item_remove_button">Eliminare</string>
<string name="overview_shortname">HOME</string>
@ -497,5 +496,6 @@
<string name="profileviewer">Profilo NS</string>
<string name="profile_set_ok">Profilo Basale aggiornato nel Micro</string>
<string name="profile_set_failed">Impostazione Profilo Basale fallito</string>
<string name="app_name">AndroidAPS</string>
</resources>

View file

@ -108,7 +108,7 @@
<string name="constraints_violation">제한 위반</string>
<string name="treatmentdeliveryerror">식사주입 전송 에러</string>
<string name="tempbasaldeliveryerror">Tempbasal delivery error</string>
<string name="overview_newtempbasal_basal_label">기초주입 값</string>
<string name="overview_newtempbasal_basalpercent">기초주입 값 [%]</string>
<string name="overview_newtempbasal_percent_label">% (100% = 현재)</string>
<string name="setbasalquestion">새 임시기초주입 적용:</string>
<string name="overview_bolus_label">식사주입</string>
@ -171,7 +171,6 @@
<string name="careportal_newnstreatment_duration_label">Duration</string>
<string name="careportal_newnstreatment_percent_label">Percent</string>
<string name="careportal_newnstreatment_absolute_label">Absolute</string>
<string name="careportal_newnstreatment_minutes">min</string>
<string name="careportal_newnstreatment_notes_label">Notes</string>
<string name="careportal_newnstreatment_eventtime_label">Event time</string>
<string name="careportal_newnstreatment_profile_label">Profile</string>
@ -358,8 +357,6 @@
<string name="edit_base_ic">Edit Base-IC:</string>
<string name="base_profile_label">Base Profile:</string>
<string name="circadian_percentage_profile">CircadianPercentageProfile</string>
<string name="androidaps_tempbasalendnote">Basal Temp End</string>
<string name="androidaps_tempbasalstartnote">Basal Temp Start</string>
<string name="prefs_range_title">차트 표시 범위</string>
<string name="prefs_range_summary">Overview/스마트워치 차트 표시용 고/저혈당 선</string>
<string name="low_mark">저혈당 선</string>
@ -515,4 +512,5 @@
<string name="adult">성인</string>
<string name="patientage_summary">안전제한을 설정하기 위해 당뇨인의 나이를 선택하세요</string>
<string name="it_lang">Italian</string>
<string name="app_name">AndroidAPS</string>
</resources>

View file

@ -12,8 +12,6 @@
<string name="always_use_shortavg">всегда используйте укороченное среднее приращение вместо простого</string>
<string name="androidaps_start">AndroidAPS запущен</string>
<string name="always_use_shortavg_summary">полезно когда данные из нефильтруемых источников вроде Xdrip зашумляются</string>
<string name="androidaps_tempbasalendnote">конец действия временного базала</string>
<string name="androidaps_tempbasalstartnote">начало действия временного базала</string>
<string name="approachingdailylimit">приближается суточный лимит инсулина</string>
<string name="apsmode_title">режим APS</string>
<string name="array_of_elements" formatted="false">массив %d элементов. актуальная величина:</string>
@ -62,7 +60,6 @@
<string name="careportal_newnstreatment_glucosetype">тип глюкозы</string>
<string name="careportal_newnstreatment_insulin_label">инсулин</string>
<string name="careportal_newnstreatment_meter">глюкометр</string>
<string name="careportal_newnstreatment_minutes">минут</string>
<string name="careportal_newnstreatment_notes_label">заметки</string>
<string name="careportal_newnstreatment_other">другое</string>
<string name="careportal_newnstreatment_percent_label">процент</string>
@ -389,7 +386,7 @@
<string name="overview_editquickwizard_valid">использовать до:</string>
<string name="overview_editquickwizardlistactivity_add">добавить</string>
<string name="overview_extendedbolus_button">расширенный болюс</string>
<string name="overview_newtempbasal_basal_label">величина базала</string>
<string name="overview_newtempbasal_basalpercent">величина базала</string>
<string name="overview_newtempbasal_percent_label">% (100% = current)</string>
<string name="overview_quickwizard_item_edit_button">редактировать</string>
<string name="overview_quickwizard_item_remove_button">удалить</string>
@ -430,7 +427,6 @@
<string name="restart">перезапуск</string>
<string name="restartingapp">выход из приложения для применения настроек</string>
<string name="resume">возобновить</string>
<string name="ro_lang">русский</string>
<string name="safety">безопасность</string>
<string name="save">сохранить</string>
<string name="send">ОТПРАВИТЬ</string>
@ -570,4 +566,5 @@
<string name="xdripstatus_settings">"состояние xdrip (часы) "</string>
<string name="xdripstatus_shortname">xds</string>
<string name="youareonallowedlimit">разрешенный предел достигнут</string>
<string name="app_name">AndroidAPS</string>
</resources>

View file

@ -44,5 +44,4 @@
<item>@string/key_adult</item>
</string-array>
<string name="ro_lang">Russian</string>
</resources>

View file

@ -114,7 +114,7 @@
<string name="constraints_violation">Constraints violation</string>
<string name="treatmentdeliveryerror">Bolus delivery error</string>
<string name="tempbasaldeliveryerror">Tempbasal delivery error</string>
<string name="overview_newtempbasal_basal_label">Basal value</string>
<string name="overview_newtempbasal_basalpercent">Basal value [%]</string>
<string name="overview_newtempbasal_percent_label">% (100% = current)</string>
<string name="setbasalquestion">Accept new temp basal:</string>
<string name="overview_bolus_label">Bolus</string>
@ -183,7 +183,6 @@
<string name="careportal_newnstreatment_duration_label">Duration</string>
<string name="careportal_newnstreatment_percent_label">Percent</string>
<string name="careportal_newnstreatment_absolute_label">Absolute</string>
<string name="careportal_newnstreatment_minutes">min</string>
<string name="careportal_newnstreatment_notes_label">Notes</string>
<string name="careportal_newnstreatment_eventtime_label">Event time</string>
<string name="careportal_newnstreatment_profile_label">Profile</string>
@ -375,8 +374,6 @@
<string name="edit_base_ic">Edit Base-IC:</string>
<string name="base_profile_label">Base Profile:</string>
<string name="circadian_percentage_profile">CircadianPercentageProfile</string>
<string name="androidaps_tempbasalendnote">Basal Temp End</string>
<string name="androidaps_tempbasalstartnote">Basal Temp Start</string>
<string name="prefs_range_title">Range for Visualization</string>
<string name="prefs_range_summary">High and low mark for the charts in Overview and Smartwatch</string>
<string name="low_mark">LOW mark</string>
@ -649,8 +646,9 @@
<string name="openapsama_autosens_period">Interval for autosens [h]</string>
<string name="openapsama_autosens_period_summary">Amount of hours in the past for sensitivity detection (carbs absorption time is excluded)</string>
<string name="key_openapsama_autosens_period" translatable="false">openapsama_autosens_period</string>
<string name="ratio_short">RAT</string>
<string name="key_do_not_track_profile_switch">do_not_track_profile_switch</string>
<string name="key_nsclient_localbroadcasts" translatable="false">nsclient_localbroadcasts</string>
<string name="ratio_short">SEN</string>
<string name="key_do_not_track_profile_switch" translatable="false">do_not_track_profile_switch</string>
<string name="do_not_track_profile_switch">Ignore profile switch events</string>
<string name="do_not_track_profile_switch_summary">All profile switch events are ignored and active profile is always used</string>
<string name="pump">Pump</string>
@ -689,11 +687,13 @@
<string name="combopump">Accu-Chek Combo</string>
<string name="combopump_settings">Accu-Chek Combo settings</string>
<string name="combopump_shortname">COMBO</string>
<string name="ns_localbroadcasts">Enable loacal broadcasts to other apps (like xDrip).</string>
<string name="ns_localbroadcasts">Enable broadcasts to other apps (like xDrip).</string>
<string name="ns_localbroadcasts_title">Enable local Broadcasts.</string>
<string name="careportal_activity_label">ACTIVITY &amp; FEEDBACK</string>
<string name="careportal_carbsandbolus_label">CARBS &amp; BOLUS</string>
<string name="careportal_cgm_label">CGM &amp; OPENAPS</string>
<string name="careportal_pump_label">PUMP</string>
<string name="overview_newtempbasal_basalabsolute">Basal value [U/h]</string>
<string name="careportal_newnstreatment_duration_min_label">Duration [min]</string>
</resources>

View file

@ -2,8 +2,10 @@ package info.nightscout.androidaps.interaction.actions;
import android.app.Activity;
import android.content.SharedPreferences;
import android.content.res.Resources;
import android.os.Bundle;
import android.preference.PreferenceManager;
import android.support.wearable.view.DotsPageIndicator;
import android.support.wearable.view.GridPagerAdapter;
import android.support.wearable.view.GridViewPager;
@ -28,10 +30,13 @@ import info.nightscout.androidaps.interaction.utils.SafeParse;
public class WizardActivity extends ViewSelectorActivity {
PlusMinusEditText editCarbs;
PlusMinusEditText editPercentage;
boolean useBG;
boolean includeBolusIOB;
boolean includeBasalIOB;
boolean hasPercentage;
@Override
protected void onCreate(Bundle savedInstanceState) {
@ -43,6 +48,8 @@ public class WizardActivity extends ViewSelectorActivity {
pager.setAdapter(new MyGridViewPagerAdapter());
DotsPageIndicator dotsPageIndicator = (DotsPageIndicator) findViewById(R.id.page_indicator);
dotsPageIndicator.setPager(pager);
SharedPreferences sp = PreferenceManager.getDefaultSharedPreferences(this);
hasPercentage = sp.getBoolean("wizardpercentage", false);
}
@ -56,7 +63,7 @@ public class WizardActivity extends ViewSelectorActivity {
private class MyGridViewPagerAdapter extends GridPagerAdapter {
@Override
public int getColumnCount(int arg0) {
return 5;
return hasPercentage?6:5;
}
@Override
@ -151,6 +158,17 @@ public class WizardActivity extends ViewSelectorActivity {
});
container.addView(view);
return view;
} else if(col == 4 && hasPercentage){
final View view = getInflatedPlusMinusView(container);
if (editPercentage == null) {
editPercentage = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, 100d, 50d, 150d, 1d, new DecimalFormat("0"), false);
} else {
double def = SafeParse.stringToDouble(editPercentage.editText.getText().toString());
editPercentage = new PlusMinusEditText(view, R.id.amountfield, R.id.plusbutton, R.id.minusbutton, def, 50d, 150d, 1d, new DecimalFormat("0"), false);
}
setLabelToPlusMinusView(view, "percentage");
container.addView(view);
return view;
} else {
final View view = LayoutInflater.from(getApplicationContext()).inflate(R.layout.action_send_item, container, false);
@ -162,10 +180,15 @@ public class WizardActivity extends ViewSelectorActivity {
//check if it can happen that the fagment is never created that hold data?
// (you have to swipe past them anyways - but still)
int percentage = 100;
if (editPercentage != null) percentage = SafeParse.stringToInt(editPercentage.editText.getText().toString());
String actionstring = "wizard " + SafeParse.stringToInt(editCarbs.editText.getText().toString())
+ " " + useBG
+ " " + includeBolusIOB
+ " " + includeBasalIOB;
+ " " + includeBasalIOB
+ " " + percentage;
ListenerService.initiateAction(WizardActivity.this, actionstring);
finish();
}

View file

@ -142,4 +142,11 @@
android:title="Single Target"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
<CheckBoxPreference
android:defaultValue="false"
android:key="wizardpercentage"
android:summary="Percentage correction."
android:title="Wizard Percentage"
app:wear_iconOff="@drawable/settings_off"
app:wear_iconOn="@drawable/settings_on"/>
</PreferenceScreen>