Merge branch 'dev' into dev
This commit is contained in:
commit
8a2846c516
13 changed files with 61 additions and 38 deletions
|
@ -219,7 +219,7 @@ public class DanaRFragment extends Fragment implements FragmentBase {
|
|||
Long agoMsec = new Date().getTime() - pump.lastBolusTime.getTime();
|
||||
double agoHours = agoMsec / 60d / 60d / 1000d;
|
||||
if (agoHours < 6) // max 6h back
|
||||
lastBolusView.setText(DateUtil.timeString(pump.lastBolusTime) + " (" + DecimalFormatter.to1Decimal(agoHours) + " " + getString(R.string.hoursago) + ") " + DecimalFormatter.to2Decimal(getPlugin().getDanaRPump().lastBolusAmount) + " U");
|
||||
lastBolusView.setText(DateUtil.timeString(pump.lastBolusTime) + " (" + DecimalFormatter.to1Decimal(agoHours) + " " + MainApp.sResources.getString(R.string.hoursago) + ") " + DecimalFormatter.to2Decimal(getPlugin().getDanaRPump().lastBolusAmount) + " U");
|
||||
else lastBolusView.setText("");
|
||||
}
|
||||
|
||||
|
@ -242,7 +242,7 @@ public class DanaRFragment extends Fragment implements FragmentBase {
|
|||
SetWarnColor.setColorInverse(batteryView, pump.batteryRemaining, 51d, 26d);
|
||||
iobView.setText(pump.iob + " U");
|
||||
if (pump.isNewPump) {
|
||||
firmwareView.setText(String.format(getString(R.string.danar_model), pump.model, pump.protocol, pump.productCode));
|
||||
firmwareView.setText(String.format(MainApp.sResources.getString(R.string.danar_model), pump.model, pump.protocol, pump.productCode));
|
||||
} else {
|
||||
firmwareView.setText("OLD");
|
||||
}
|
||||
|
|
|
@ -258,6 +258,8 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
if (!isInitialized())
|
||||
return true; // TODO: not sure what's better. so far TRUE to prevent too many SMS
|
||||
DanaRPump pump = getDanaRPump();
|
||||
if (pump.pumpProfiles == null)
|
||||
return true; // TODO: not sure what's better. so far TRUE to prevent too many SMS
|
||||
int basalValues = pump.basal48Enable ? 48 : 24;
|
||||
int basalIncrement = pump.basal48Enable ? 30 * 60 : 60 * 60;
|
||||
for (int h = 0; h < basalValues; h++) {
|
||||
|
@ -290,17 +292,19 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
|
||||
@Override
|
||||
public double getTempBasalAbsoluteRate() {
|
||||
if (isRealTempBasalInProgress()) {
|
||||
if (getRealTempBasal().isAbsolute) {
|
||||
return getRealTempBasal().absolute;
|
||||
TempBasal tb = getRealTempBasal();
|
||||
if (tb != null) {
|
||||
if (tb.isAbsolute) {
|
||||
return tb.absolute;
|
||||
} else {
|
||||
Double baseRate = getBaseBasalRate();
|
||||
Double tempRate = baseRate * (getRealTempBasal().percent / 100d);
|
||||
Double tempRate = baseRate * (tb.percent / 100d);
|
||||
return tempRate;
|
||||
}
|
||||
}
|
||||
if (isExtendedBoluslInProgress() && useExtendedBoluses) {
|
||||
return getBaseBasalRate() + getExtendedBolus().absolute;
|
||||
TempBasal eb = getExtendedBolus();
|
||||
if (eb != null && useExtendedBoluses) {
|
||||
return getBaseBasalRate() + eb.absolute;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -707,11 +711,12 @@ public class DanaRPlugin implements PluginBase, PumpInterface, ConstraintsInterf
|
|||
extended.put("PumpIOB", getDanaRPump().iob);
|
||||
extended.put("LastBolus", getDanaRPump().lastBolusTime.toLocaleString());
|
||||
extended.put("LastBolusAmount", getDanaRPump().lastBolusAmount);
|
||||
if (isTempBasalInProgress()) {
|
||||
TempBasal tb = getTempBasal();
|
||||
if (tb != null) {
|
||||
extended.put("TempBasalAbsoluteRate", getTempBasalAbsoluteRate());
|
||||
extended.put("TempBasalStart", getTempBasal().timeStart.toLocaleString());
|
||||
extended.put("TempBasalRemaining", getTempBasal().getPlannedRemainingMinutes());
|
||||
extended.put("IsExtended", getTempBasal().isExtended);
|
||||
extended.put("TempBasalStart", tb.timeStart.toLocaleString());
|
||||
extended.put("TempBasalRemaining", tb.getPlannedRemainingMinutes());
|
||||
extended.put("IsExtended", tb.isExtended);
|
||||
}
|
||||
extended.put("BaseBasalRate", getBaseBasalRate());
|
||||
try {
|
||||
|
|
|
@ -56,6 +56,7 @@ import info.nightscout.androidaps.plugins.DanaR.comm.RecordTypes;
|
|||
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRConnectionStatus;
|
||||
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRSyncStatus;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.SafeParse;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
public class DanaRStatsActivity extends Activity {
|
||||
|
@ -366,7 +367,7 @@ public class DanaRStatsActivity extends Activity {
|
|||
return;
|
||||
}
|
||||
else {
|
||||
magicNumber = Double.parseDouble(TBB);
|
||||
magicNumber = SafeParse.stringToDouble(TBB);
|
||||
}
|
||||
|
||||
magicNumber *=2;
|
||||
|
|
|
@ -240,7 +240,7 @@ public class DanaRKoreanFragment extends Fragment implements FragmentBase {
|
|||
SetWarnColor.setColorInverse(batteryView, pump.batteryRemaining, 51d, 26d);
|
||||
iobView.setText(pump.iob + " U");
|
||||
if (pump.isNewPump) {
|
||||
firmwareView.setText(String.format(getString(R.string.danar_model), pump.model, pump.protocol, pump.productCode));
|
||||
firmwareView.setText(String.format(MainApp.sResources.getString(R.string.danar_model), pump.model, pump.protocol, pump.productCode));
|
||||
} else {
|
||||
firmwareView.setText("OLD");
|
||||
}
|
||||
|
|
|
@ -258,6 +258,8 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
|
|||
if (!isInitialized())
|
||||
return true; // TODO: not sure what's better. so far TRUE to prevent too many SMS
|
||||
DanaRKoreanPump pump = getDanaRPump();
|
||||
if (pump.pumpProfiles == null)
|
||||
return true; // TODO: not sure what's better. so far TRUE to prevent too many SMS
|
||||
int basalValues = pump.basal48Enable ? 48 : 24;
|
||||
int basalIncrement = pump.basal48Enable ? 30 * 60 : 60 * 60;
|
||||
for (int h = 0; h < basalValues; h++) {
|
||||
|
@ -290,17 +292,19 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
|
|||
|
||||
@Override
|
||||
public double getTempBasalAbsoluteRate() {
|
||||
if (isRealTempBasalInProgress()) {
|
||||
if (getRealTempBasal().isAbsolute) {
|
||||
return getRealTempBasal().absolute;
|
||||
TempBasal tb = getRealTempBasal();
|
||||
if (tb != null) {
|
||||
if (tb.isAbsolute) {
|
||||
return tb.absolute;
|
||||
} else {
|
||||
Double baseRate = getBaseBasalRate();
|
||||
Double tempRate = baseRate * (getRealTempBasal().percent / 100d);
|
||||
Double tempRate = baseRate * (tb.percent / 100d);
|
||||
return tempRate;
|
||||
}
|
||||
}
|
||||
if (isExtendedBoluslInProgress() && useExtendedBoluses) {
|
||||
return getBaseBasalRate() + getExtendedBolus().absolute;
|
||||
TempBasal eb = getExtendedBolus();
|
||||
if (eb != null && useExtendedBoluses) {
|
||||
return getBaseBasalRate() + eb.absolute;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
@ -707,11 +711,12 @@ public class DanaRKoreanPlugin implements PluginBase, PumpInterface, Constraints
|
|||
extended.put("PumpIOB", getDanaRPump().iob);
|
||||
// extended.put("LastBolus", getDanaRPump().lastBolusTime.toLocaleString());
|
||||
// extended.put("LastBolusAmount", getDanaRPump().lastBolusAmount);
|
||||
if (isTempBasalInProgress()) {
|
||||
TempBasal tb = getTempBasal();
|
||||
if (tb != null) {
|
||||
extended.put("TempBasalAbsoluteRate", getTempBasalAbsoluteRate());
|
||||
extended.put("TempBasalStart", getTempBasal().timeStart.toLocaleString());
|
||||
extended.put("TempBasalRemaining", getTempBasal().getPlannedRemainingMinutes());
|
||||
extended.put("IsExtended", getTempBasal().isExtended);
|
||||
extended.put("TempBasalStart", tb.timeStart.toLocaleString());
|
||||
extended.put("TempBasalRemaining", tb.getPlannedRemainingMinutes());
|
||||
extended.put("IsExtended", tb.isExtended);
|
||||
}
|
||||
extended.put("BaseBasalRate", getBaseBasalRate());
|
||||
try {
|
||||
|
|
|
@ -56,6 +56,7 @@ import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRConnectionStatu
|
|||
import info.nightscout.androidaps.plugins.DanaR.events.EventDanaRSyncStatus;
|
||||
import info.nightscout.androidaps.plugins.DanaRKorean.Services.ExecutionService;
|
||||
import info.nightscout.utils.DecimalFormatter;
|
||||
import info.nightscout.utils.SafeParse;
|
||||
import info.nightscout.utils.ToastUtils;
|
||||
|
||||
public class DanaRStatsActivity extends Activity {
|
||||
|
@ -366,7 +367,7 @@ public class DanaRStatsActivity extends Activity {
|
|||
return;
|
||||
}
|
||||
else {
|
||||
magicNumber = Double.parseDouble(TBB);
|
||||
magicNumber = SafeParse.stringToDouble(TBB);
|
||||
}
|
||||
|
||||
magicNumber *=2;
|
||||
|
|
|
@ -124,7 +124,7 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
|
|||
@Override
|
||||
public void run() {
|
||||
if (c.sStatus == c.CONNECTING) {
|
||||
statusView.setText(String.format(getString(R.string.danar_history_connectingfor), c.sSecondsElapsed));
|
||||
statusView.setText(String.format(MainApp.sResources.getString(R.string.danar_history_connectingfor), c.sSecondsElapsed));
|
||||
} else if (c.sStatus == c.CONNECTED) {
|
||||
statusView.setText(MainApp.sResources.getString(R.string.connected));
|
||||
} else {
|
||||
|
|
|
@ -21,6 +21,7 @@ public class Notification {
|
|||
public static final int FAILED_UDPATE_PROFILE = 6;
|
||||
public static final int BASAL_VALUE_BELOW_MINIMUM = 7;
|
||||
public static final int OLD_NSCLIENT = 8;
|
||||
public static final int INVALID_PHONE_NUMBER = 9;
|
||||
|
||||
public int id;
|
||||
public Date date;
|
||||
|
|
|
@ -237,7 +237,7 @@ public class OverviewFragment extends Fragment {
|
|||
acceptTempButton.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View view) {
|
||||
MainApp.getConfigBuilder().getActiveLoop().invoke("Accept temp button", false);
|
||||
ConfigBuilderPlugin.getActiveLoop().invoke("Accept temp button", false);
|
||||
final LoopPlugin.LastRun finalLastRun = LoopPlugin.lastRun;
|
||||
if (finalLastRun != null && finalLastRun.lastAPSRun != null && finalLastRun.constraintsProcessed.changeRequested) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
|
@ -564,7 +564,7 @@ public class OverviewFragment extends Fragment {
|
|||
showAcceptButton = showAcceptButton && (finalLastRun.lastOpenModeAccept == null || finalLastRun.lastOpenModeAccept.getTime() < finalLastRun.lastAPSRun.getTime()); // never accepted or before last result
|
||||
showAcceptButton = showAcceptButton && finalLastRun.constraintsProcessed.changeRequested; // change is requested
|
||||
|
||||
if (showAcceptButton && pump.isInitialized()) {
|
||||
if (showAcceptButton && pump.isInitialized() && ConfigBuilderPlugin.getActiveLoop() != null) {
|
||||
acceptTempLayout.setVisibility(View.VISIBLE);
|
||||
acceptTempButton.setText(getContext().getString(R.string.setbasalquestion) + "\n" + finalLastRun.constraintsProcessed);
|
||||
} else {
|
||||
|
|
|
@ -31,6 +31,8 @@ import info.nightscout.androidaps.plugins.DanaR.DanaRPlugin;
|
|||
import info.nightscout.androidaps.plugins.DanaRKorean.DanaRKoreanPlugin;
|
||||
import info.nightscout.androidaps.plugins.Loop.LoopPlugin;
|
||||
import info.nightscout.androidaps.data.IobTotal;
|
||||
import info.nightscout.androidaps.plugins.Overview.Notification;
|
||||
import info.nightscout.androidaps.plugins.Overview.events.EventNewNotification;
|
||||
import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventNewSMS;
|
||||
import info.nightscout.androidaps.plugins.SmsCommunicator.events.EventSmsCommunicatorUpdateGui;
|
||||
import info.nightscout.client.data.NSProfile;
|
||||
|
@ -446,8 +448,13 @@ public class SmsCommunicatorPlugin implements PluginBase {
|
|||
SmsManager smsManager = SmsManager.getDefault();
|
||||
sms.text = stripAccents(sms.text);
|
||||
if (sms.text.length() > 140) sms.text = sms.text.substring(0, 139);
|
||||
try {
|
||||
smsManager.sendTextMessage(sms.phoneNumber, null, sms.text, null, null);
|
||||
messages.add(sms);
|
||||
} catch (IllegalArgumentException e) {
|
||||
Notification notification = new Notification(Notification.INVALID_PHONE_NUMBER, MainApp.sResources.getString(R.string.smscommunicator_invalidphonennumber), Notification.NORMAL);
|
||||
MainApp.bus().post(new EventNewNotification(notification));
|
||||
}
|
||||
}
|
||||
|
||||
private String generatePasscode() {
|
||||
|
|
|
@ -113,7 +113,6 @@ public class PersistentNotificationPlugin implements PluginBase{
|
|||
|
||||
if(profile != null && lastBG != null) {
|
||||
line1 = lastBG.valueToUnitsToString(profile.getUnits());
|
||||
}
|
||||
if (glucoseStatus != null) {
|
||||
line1 += " Δ" + deltastring(glucoseStatus.delta, glucoseStatus.delta * Constants.MGDL_TO_MMOLL, profile.getUnits())
|
||||
+ " avgΔ" + deltastring(glucoseStatus.avgdelta, glucoseStatus.avgdelta * Constants.MGDL_TO_MMOLL, profile.getUnits());
|
||||
|
@ -122,6 +121,7 @@ public class PersistentNotificationPlugin implements PluginBase{
|
|||
ctx.getString(R.string.old_data) +
|
||||
" ";
|
||||
}
|
||||
}
|
||||
|
||||
PumpInterface pump = MainApp.getConfigBuilder();
|
||||
|
||||
|
|
|
@ -439,4 +439,6 @@
|
|||
<string name="profile">Profil</string>
|
||||
<string name="short_tabtitles">Krátké názvy modulů</string>
|
||||
<string name="virtualpump_firmware_label">Firmware:</string>
|
||||
<string name="smscommunicator_invalidphonennumber">Špatné telefonní číslo</string>
|
||||
<string name="tempbasaldeliveryerror">Chyba nastavování dočasného bazálu</string>
|
||||
</resources>
|
||||
|
|
|
@ -475,4 +475,5 @@
|
|||
<string name="error_only_numeric_digits_range_allowed">Only numeric digits within the range %1$s - %2$s are allowed.</string>
|
||||
<string name="error_field_must_not_be_empty">The field must not be empty</string>
|
||||
<string name="error_phone_not_valid">Phone number not valid</string>
|
||||
<string name="smscommunicator_invalidphonennumber">Invalid SMS phone number</string>
|
||||
</resources>
|
||||
|
|
Loading…
Reference in a new issue