remove direct access to sResources 6
This commit is contained in:
parent
0e4e36f2b1
commit
545d1d1586
|
@ -53,7 +53,7 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
|
||||||
@Override
|
@Override
|
||||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||||
Bundle savedInstanceState) {
|
Bundle savedInstanceState) {
|
||||||
getDialog().setTitle(String.format(MainApp.sResources.getString(R.string.overview_bolusprogress_goingtodeliver), amount));
|
getDialog().setTitle(String.format(MainApp.gs(R.string.overview_bolusprogress_goingtodeliver), amount));
|
||||||
View view = inflater.inflate(R.layout.overview_bolusprogress_dialog, container, false);
|
View view = inflater.inflate(R.layout.overview_bolusprogress_dialog, container, false);
|
||||||
stopButton = (Button) view.findViewById(R.id.overview_bolusprogress_stop);
|
stopButton = (Button) view.findViewById(R.id.overview_bolusprogress_stop);
|
||||||
statusView = (TextView) view.findViewById(R.id.overview_bolusprogress_status);
|
statusView = (TextView) view.findViewById(R.id.overview_bolusprogress_status);
|
||||||
|
@ -61,7 +61,7 @@ public class BolusProgressDialog extends DialogFragment implements View.OnClickL
|
||||||
progressBar = (ProgressBar) view.findViewById(R.id.overview_bolusprogress_progressbar);
|
progressBar = (ProgressBar) view.findViewById(R.id.overview_bolusprogress_progressbar);
|
||||||
stopButton.setOnClickListener(this);
|
stopButton.setOnClickListener(this);
|
||||||
progressBar.setMax(100);
|
progressBar.setMax(100);
|
||||||
statusView.setText(MainApp.sResources.getString(R.string.waitingforpump));
|
statusView.setText(MainApp.gs(R.string.waitingforpump));
|
||||||
setCancelable(false);
|
setCancelable(false);
|
||||||
stopPressed = false;
|
stopPressed = false;
|
||||||
return view;
|
return view;
|
||||||
|
|
|
@ -149,13 +149,13 @@ public class EditQuickWizardDialog extends DialogFragment implements View.OnClic
|
||||||
|
|
||||||
int getSelection(Spinner spinner) {
|
int getSelection(Spinner spinner) {
|
||||||
String value = spinner.getSelectedItem().toString();
|
String value = spinner.getSelectedItem().toString();
|
||||||
if (value.equals(MainApp.sResources.getString(R.string.yes)))
|
if (value.equals(MainApp.gs(R.string.yes)))
|
||||||
return QuickWizardEntry.YES;
|
return QuickWizardEntry.YES;
|
||||||
if (value.equals(MainApp.sResources.getString(R.string.no)))
|
if (value.equals(MainApp.gs(R.string.no)))
|
||||||
return QuickWizardEntry.NO;
|
return QuickWizardEntry.NO;
|
||||||
if (value.equals(MainApp.sResources.getString(R.string.positiveonly)))
|
if (value.equals(MainApp.gs(R.string.positiveonly)))
|
||||||
return QuickWizardEntry.POSITIVE_ONLY;
|
return QuickWizardEntry.POSITIVE_ONLY;
|
||||||
if (value.equals(MainApp.sResources.getString(R.string.negativeonly)))
|
if (value.equals(MainApp.gs(R.string.negativeonly)))
|
||||||
return QuickWizardEntry.NEGATIVE_ONLY;
|
return QuickWizardEntry.NEGATIVE_ONLY;
|
||||||
return QuickWizardEntry.NO;
|
return QuickWizardEntry.NO;
|
||||||
}
|
}
|
||||||
|
@ -164,19 +164,19 @@ public class EditQuickWizardDialog extends DialogFragment implements View.OnClic
|
||||||
String selection;
|
String selection;
|
||||||
switch (value) {
|
switch (value) {
|
||||||
case QuickWizardEntry.YES:
|
case QuickWizardEntry.YES:
|
||||||
selection = MainApp.sResources.getString(R.string.yes);
|
selection = MainApp.gs(R.string.yes);
|
||||||
break;
|
break;
|
||||||
case QuickWizardEntry.NO:
|
case QuickWizardEntry.NO:
|
||||||
selection = MainApp.sResources.getString(R.string.no);
|
selection = MainApp.gs(R.string.no);
|
||||||
break;
|
break;
|
||||||
case QuickWizardEntry.POSITIVE_ONLY:
|
case QuickWizardEntry.POSITIVE_ONLY:
|
||||||
selection = MainApp.sResources.getString(R.string.positiveonly);
|
selection = MainApp.gs(R.string.positiveonly);
|
||||||
break;
|
break;
|
||||||
case QuickWizardEntry.NEGATIVE_ONLY:
|
case QuickWizardEntry.NEGATIVE_ONLY:
|
||||||
selection = MainApp.sResources.getString(R.string.negativeonly);
|
selection = MainApp.gs(R.string.negativeonly);
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
selection = MainApp.sResources.getString(R.string.no);
|
selection = MainApp.gs(R.string.no);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -94,7 +94,7 @@ public class NotificationRecyclerViewAdapter extends RecyclerView.Adapter<Notifi
|
||||||
}
|
}
|
||||||
// Adding current time to snooze if we got staleData
|
// Adding current time to snooze if we got staleData
|
||||||
log.debug("Notification text is: " + notification.text);
|
log.debug("Notification text is: " + notification.text);
|
||||||
if (notification.text.equals(MainApp.sResources.getString(R.string.nsalarm_staledata))) {
|
if (notification.text.equals(MainApp.gs(R.string.nsalarm_staledata))) {
|
||||||
NotificationStore nstore = OverviewPlugin.getPlugin().notificationStore;
|
NotificationStore nstore = OverviewPlugin.getPlugin().notificationStore;
|
||||||
long msToSnooze = SP.getInt("nsalarm_staledatavalue", 15) * 60 * 1000L;
|
long msToSnooze = SP.getInt("nsalarm_staledatavalue", 15) * 60 * 1000L;
|
||||||
log.debug("snooze nsalarm_staledatavalue in minutes is " + SP.getInt("nsalarm_staledatavalue", 15) + "\n in ms is: " + msToSnooze + " currentTimeMillis is: " + System.currentTimeMillis());
|
log.debug("snooze nsalarm_staledatavalue in minutes is " + SP.getInt("nsalarm_staledatavalue", 15) + "\n in ms is: " + msToSnooze + " currentTimeMillis is: " + System.currentTimeMillis());
|
||||||
|
|
|
@ -57,7 +57,7 @@ public class LocalProfileFragment extends SubscriberFragment {
|
||||||
Runnable save = () -> {
|
Runnable save = () -> {
|
||||||
doEdit();
|
doEdit();
|
||||||
if (basalView != null) {
|
if (basalView != null) {
|
||||||
basalView.updateLabel(MainApp.sResources.getString(R.string.nsprofileview_basal_label) + ": " + getSumLabel());
|
basalView.updateLabel(MainApp.gs(R.string.nsprofileview_basal_label) + ": " + getSumLabel());
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
@ -91,10 +91,10 @@ public class LocalProfileFragment extends SubscriberFragment {
|
||||||
diaView.setParams(LocalProfilePlugin.getPlugin().dia, 2d, 48d, 0.1d, new DecimalFormat("0.0"), false, textWatch);
|
diaView.setParams(LocalProfilePlugin.getPlugin().dia, 2d, 48d, 0.1d, new DecimalFormat("0.0"), false, textWatch);
|
||||||
mgdlView = (RadioButton) layout.findViewById(R.id.localprofile_mgdl);
|
mgdlView = (RadioButton) layout.findViewById(R.id.localprofile_mgdl);
|
||||||
mmolView = (RadioButton) layout.findViewById(R.id.localprofile_mmol);
|
mmolView = (RadioButton) layout.findViewById(R.id.localprofile_mmol);
|
||||||
icView = new TimeListEdit(getContext(), layout, R.id.localprofile_ic, MainApp.sResources.getString(R.string.nsprofileview_ic_label) + ":", LocalProfilePlugin.getPlugin().ic, null, 0.5, 50d, 0.1d, new DecimalFormat("0.0"), save);
|
icView = new TimeListEdit(getContext(), layout, R.id.localprofile_ic, MainApp.gs(R.string.nsprofileview_ic_label) + ":", LocalProfilePlugin.getPlugin().ic, null, 0.5, 50d, 0.1d, new DecimalFormat("0.0"), save);
|
||||||
isfView = new TimeListEdit(getContext(), layout, R.id.localprofile_isf, MainApp.sResources.getString(R.string.nsprofileview_isf_label) + ":", LocalProfilePlugin.getPlugin().isf, null, 0.5, 500d, 0.1d, new DecimalFormat("0.0"), save);
|
isfView = new TimeListEdit(getContext(), layout, R.id.localprofile_isf, MainApp.gs(R.string.nsprofileview_isf_label) + ":", LocalProfilePlugin.getPlugin().isf, null, 0.5, 500d, 0.1d, new DecimalFormat("0.0"), save);
|
||||||
basalView = new TimeListEdit(getContext(), layout, R.id.localprofile_basal, MainApp.sResources.getString(R.string.nsprofileview_basal_label) + ": " + getSumLabel(), LocalProfilePlugin.getPlugin().basal, null, pumpDescription.basalMinimumRate, 10, 0.01d, new DecimalFormat("0.00"), save);
|
basalView = new TimeListEdit(getContext(), layout, R.id.localprofile_basal, MainApp.gs(R.string.nsprofileview_basal_label) + ": " + getSumLabel(), LocalProfilePlugin.getPlugin().basal, null, pumpDescription.basalMinimumRate, 10, 0.01d, new DecimalFormat("0.00"), save);
|
||||||
targetView = new TimeListEdit(getContext(), layout, R.id.localprofile_target, MainApp.sResources.getString(R.string.nsprofileview_target_label) + ":", LocalProfilePlugin.getPlugin().targetLow, LocalProfilePlugin.getPlugin().targetHigh, 3d, 200, 0.1d, new DecimalFormat("0.0"), save);
|
targetView = new TimeListEdit(getContext(), layout, R.id.localprofile_target, MainApp.gs(R.string.nsprofileview_target_label) + ":", LocalProfilePlugin.getPlugin().targetLow, LocalProfilePlugin.getPlugin().targetHigh, 3d, 200, 0.1d, new DecimalFormat("0.0"), save);
|
||||||
profileswitchButton = (Button) layout.findViewById(R.id.localprofile_profileswitch);
|
profileswitchButton = (Button) layout.findViewById(R.id.localprofile_profileswitch);
|
||||||
resetButton = (Button) layout.findViewById(R.id.localprofile_reset);
|
resetButton = (Button) layout.findViewById(R.id.localprofile_reset);
|
||||||
saveButton = (Button) layout.findViewById(R.id.localprofile_save);
|
saveButton = (Button) layout.findViewById(R.id.localprofile_save);
|
||||||
|
@ -144,10 +144,10 @@ public class LocalProfileFragment extends SubscriberFragment {
|
||||||
mgdlView.setChecked(LocalProfilePlugin.getPlugin().mgdl);
|
mgdlView.setChecked(LocalProfilePlugin.getPlugin().mgdl);
|
||||||
mmolView.setChecked(LocalProfilePlugin.getPlugin().mmol);
|
mmolView.setChecked(LocalProfilePlugin.getPlugin().mmol);
|
||||||
diaView.setParams(LocalProfilePlugin.getPlugin().dia, 2d, 48d, 0.1d, new DecimalFormat("0.0"), false, textWatch);
|
diaView.setParams(LocalProfilePlugin.getPlugin().dia, 2d, 48d, 0.1d, new DecimalFormat("0.0"), false, textWatch);
|
||||||
icView = new TimeListEdit(getContext(), layout, R.id.localprofile_ic, MainApp.sResources.getString(R.string.nsprofileview_ic_label) + ":", LocalProfilePlugin.getPlugin().ic, null, 0.5, 50d, 0.1d, new DecimalFormat("0.0"), save);
|
icView = new TimeListEdit(getContext(), layout, R.id.localprofile_ic, MainApp.gs(R.string.nsprofileview_ic_label) + ":", LocalProfilePlugin.getPlugin().ic, null, 0.5, 50d, 0.1d, new DecimalFormat("0.0"), save);
|
||||||
isfView = new TimeListEdit(getContext(), layout, R.id.localprofile_isf, MainApp.sResources.getString(R.string.nsprofileview_isf_label) + ":", LocalProfilePlugin.getPlugin().isf, null, 0.5, 500d, 0.1d, new DecimalFormat("0.0"), save);
|
isfView = new TimeListEdit(getContext(), layout, R.id.localprofile_isf, MainApp.gs(R.string.nsprofileview_isf_label) + ":", LocalProfilePlugin.getPlugin().isf, null, 0.5, 500d, 0.1d, new DecimalFormat("0.0"), save);
|
||||||
basalView = new TimeListEdit(getContext(), layout, R.id.localprofile_basal, MainApp.sResources.getString(R.string.nsprofileview_basal_label) + ": " + getSumLabel(), LocalProfilePlugin.getPlugin().basal, null, pumpDescription.basalMinimumRate, 10, 0.01d, new DecimalFormat("0.00"), save);
|
basalView = new TimeListEdit(getContext(), layout, R.id.localprofile_basal, MainApp.gs(R.string.nsprofileview_basal_label) + ": " + getSumLabel(), LocalProfilePlugin.getPlugin().basal, null, pumpDescription.basalMinimumRate, 10, 0.01d, new DecimalFormat("0.00"), save);
|
||||||
targetView = new TimeListEdit(getContext(), layout, R.id.localprofile_target, MainApp.sResources.getString(R.string.nsprofileview_target_label) + ":", LocalProfilePlugin.getPlugin().targetLow, LocalProfilePlugin.getPlugin().targetHigh, 3d, 200, 0.1d, new DecimalFormat("0.0"), save);
|
targetView = new TimeListEdit(getContext(), layout, R.id.localprofile_target, MainApp.gs(R.string.nsprofileview_target_label) + ":", LocalProfilePlugin.getPlugin().targetLow, LocalProfilePlugin.getPlugin().targetHigh, 3d, 200, 0.1d, new DecimalFormat("0.0"), save);
|
||||||
updateGUI();
|
updateGUI();
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
|
@ -27,7 +27,7 @@ public class MsgInitConnStatusTime extends MessageBase {
|
||||||
@Override
|
@Override
|
||||||
public void handleMessage(byte[] bytes) {
|
public void handleMessage(byte[] bytes) {
|
||||||
if (bytes.length - 10 > 7) {
|
if (bytes.length - 10 > 7) {
|
||||||
Notification notification = new Notification(Notification.WRONG_DRIVER, MainApp.sResources.getString(R.string.pumpdrivercorrected), Notification.NORMAL);
|
Notification notification = new Notification(Notification.WRONG_DRIVER, MainApp.gs(R.string.pumpdrivercorrected), Notification.NORMAL);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
MainApp.getSpecificPlugin(DanaRPlugin.class).disconnect("Wrong Model");
|
MainApp.getSpecificPlugin(DanaRPlugin.class).disconnect("Wrong Model");
|
||||||
log.debug("Wrong model selected. Switching to Korean DanaR");
|
log.debug("Wrong model selected. Switching to Korean DanaR");
|
||||||
|
|
|
@ -33,12 +33,12 @@ public class MsgSetBasalProfile extends MessageBase {
|
||||||
if (result != 1) {
|
if (result != 1) {
|
||||||
failed = true;
|
failed = true;
|
||||||
log.debug("Set basal profile result: " + result + " FAILED!!!");
|
log.debug("Set basal profile result: " + result + " FAILED!!!");
|
||||||
Notification reportFail = new Notification(Notification.PROFILE_SET_FAILED, MainApp.sResources.getString(R.string.profile_set_failed), Notification.URGENT);
|
Notification reportFail = new Notification(Notification.PROFILE_SET_FAILED, MainApp.gs(R.string.profile_set_failed), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(reportFail));
|
MainApp.bus().post(new EventNewNotification(reportFail));
|
||||||
} else {
|
} else {
|
||||||
if (Config.logDanaMessageDetail)
|
if (Config.logDanaMessageDetail)
|
||||||
log.debug("Set basal profile result: " + result);
|
log.debug("Set basal profile result: " + result);
|
||||||
Notification reportOK = new Notification(Notification.PROFILE_SET_OK, MainApp.sResources.getString(R.string.profile_set_ok), Notification.INFO, 60);
|
Notification reportOK = new Notification(Notification.PROFILE_SET_OK, MainApp.gs(R.string.profile_set_ok), Notification.INFO, 60);
|
||||||
MainApp.bus().post(new EventNewNotification(reportOK));
|
MainApp.bus().post(new EventNewNotification(reportOK));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,12 +32,12 @@ public class MsgSetSingleBasalProfile extends MessageBase {
|
||||||
if (result != 1) {
|
if (result != 1) {
|
||||||
failed = true;
|
failed = true;
|
||||||
log.debug("Set basal profile result: " + result + " FAILED!!!");
|
log.debug("Set basal profile result: " + result + " FAILED!!!");
|
||||||
Notification reportFail = new Notification(Notification.PROFILE_SET_FAILED, MainApp.sResources.getString(R.string.profile_set_failed), Notification.URGENT);
|
Notification reportFail = new Notification(Notification.PROFILE_SET_FAILED, MainApp.gs(R.string.profile_set_failed), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(reportFail));
|
MainApp.bus().post(new EventNewNotification(reportFail));
|
||||||
} else {
|
} else {
|
||||||
if (Config.logDanaMessageDetail)
|
if (Config.logDanaMessageDetail)
|
||||||
log.debug("Set basal profile result: " + result);
|
log.debug("Set basal profile result: " + result);
|
||||||
Notification reportOK = new Notification(Notification.PROFILE_SET_OK, MainApp.sResources.getString(R.string.profile_set_ok), Notification.INFO, 60);
|
Notification reportOK = new Notification(Notification.PROFILE_SET_OK, MainApp.gs(R.string.profile_set_ok), Notification.INFO, 60);
|
||||||
MainApp.bus().post(new EventNewNotification(reportOK));
|
MainApp.bus().post(new EventNewNotification(reportOK));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -48,14 +48,14 @@ public class MsgSettingMeal extends MessageBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pump.basalStep != 0.01d) {
|
if (pump.basalStep != 0.01d) {
|
||||||
Notification notification = new Notification(Notification.WRONGBASALSTEP, MainApp.sResources.getString(R.string.danar_setbasalstep001), Notification.URGENT);
|
Notification notification = new Notification(Notification.WRONGBASALSTEP, MainApp.gs(R.string.danar_setbasalstep001), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.WRONGBASALSTEP));
|
MainApp.bus().post(new EventDismissNotification(Notification.WRONGBASALSTEP));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pump.isConfigUD) {
|
if (pump.isConfigUD) {
|
||||||
Notification notification = new Notification(Notification.UD_MODE_ENABLED, MainApp.sResources.getString(R.string.danar_switchtouhmode), Notification.URGENT);
|
Notification notification = new Notification(Notification.UD_MODE_ENABLED, MainApp.gs(R.string.danar_switchtouhmode), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.UD_MODE_ENABLED));
|
MainApp.bus().post(new EventDismissNotification(Notification.UD_MODE_ENABLED));
|
||||||
|
|
|
@ -134,7 +134,7 @@ public abstract class AbstractDanaRExecutionService extends Service {
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void getBTSocketForSelectedPump() {
|
protected void getBTSocketForSelectedPump() {
|
||||||
mDevName = SP.getString(MainApp.sResources.getString(R.string.key_danar_bt_name), "");
|
mDevName = SP.getString(MainApp.gs(R.string.key_danar_bt_name), "");
|
||||||
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
BluetoothAdapter bluetoothAdapter = BluetoothAdapter.getDefaultAdapter();
|
||||||
|
|
||||||
if (bluetoothAdapter != null) {
|
if (bluetoothAdapter != null) {
|
||||||
|
@ -152,10 +152,10 @@ public abstract class AbstractDanaRExecutionService extends Service {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.nobtadapter));
|
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.nobtadapter));
|
||||||
}
|
}
|
||||||
if (mBTDevice == null) {
|
if (mBTDevice == null) {
|
||||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.devicenotfound));
|
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.devicenotfound));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -97,7 +97,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
|
||||||
|
|
||||||
public void connect() {
|
public void connect() {
|
||||||
if (mDanaRPump.password != -1 && mDanaRPump.password != SP.getInt(R.string.key_danar_password, -1)) {
|
if (mDanaRPump.password != -1 && mDanaRPump.password != SP.getInt(R.string.key_danar_password, -1)) {
|
||||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.wrongpumppassword), R.raw.error);
|
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.wrongpumppassword), R.raw.error);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,7 +138,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
|
||||||
|
|
||||||
public void getPumpStatus() {
|
public void getPumpStatus() {
|
||||||
try {
|
try {
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingpumpstatus)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpstatus)));
|
||||||
MsgStatus statusMsg = new MsgStatus();
|
MsgStatus statusMsg = new MsgStatus();
|
||||||
MsgStatusBasic statusBasicMsg = new MsgStatusBasic();
|
MsgStatusBasic statusBasicMsg = new MsgStatusBasic();
|
||||||
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal();
|
MsgStatusTempBasal tempStatusMsg = new MsgStatusTempBasal();
|
||||||
|
@ -154,15 +154,15 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
|
||||||
|
|
||||||
mSerialIOThread.sendMessage(statusMsg);
|
mSerialIOThread.sendMessage(statusMsg);
|
||||||
mSerialIOThread.sendMessage(statusBasicMsg);
|
mSerialIOThread.sendMessage(statusBasicMsg);
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingtempbasalstatus)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingtempbasalstatus)));
|
||||||
mSerialIOThread.sendMessage(tempStatusMsg);
|
mSerialIOThread.sendMessage(tempStatusMsg);
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingextendedbolusstatus)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingextendedbolusstatus)));
|
||||||
mSerialIOThread.sendMessage(exStatusMsg);
|
mSerialIOThread.sendMessage(exStatusMsg);
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingbolusstatus)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingbolusstatus)));
|
||||||
|
|
||||||
long now = System.currentTimeMillis();
|
long now = System.currentTimeMillis();
|
||||||
if (mDanaRPump.lastSettingsRead + 60 * 60 * 1000L < now || !MainApp.getSpecificPlugin(DanaRPlugin.class).isInitialized()) {
|
if (mDanaRPump.lastSettingsRead + 60 * 60 * 1000L < now || !MainApp.getSpecificPlugin(DanaRPlugin.class).isInitialized()) {
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingpumpsettings)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
||||||
mSerialIOThread.sendMessage(new MsgSettingShippingInfo());
|
mSerialIOThread.sendMessage(new MsgSettingShippingInfo());
|
||||||
mSerialIOThread.sendMessage(new MsgSettingActiveProfile());
|
mSerialIOThread.sendMessage(new MsgSettingActiveProfile());
|
||||||
mSerialIOThread.sendMessage(new MsgSettingMeal());
|
mSerialIOThread.sendMessage(new MsgSettingMeal());
|
||||||
|
@ -173,7 +173,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
|
||||||
mSerialIOThread.sendMessage(new MsgSettingActiveProfile());
|
mSerialIOThread.sendMessage(new MsgSettingActiveProfile());
|
||||||
mSerialIOThread.sendMessage(new MsgSettingProfileRatios());
|
mSerialIOThread.sendMessage(new MsgSettingProfileRatios());
|
||||||
mSerialIOThread.sendMessage(new MsgSettingProfileRatiosAll());
|
mSerialIOThread.sendMessage(new MsgSettingProfileRatiosAll());
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingpumptime)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumptime)));
|
||||||
mSerialIOThread.sendMessage(new MsgSettingPumpTime());
|
mSerialIOThread.sendMessage(new MsgSettingPumpTime());
|
||||||
long timeDiff = (mDanaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L;
|
long timeDiff = (mDanaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L;
|
||||||
log.debug("Pump time difference: " + timeDiff + " seconds");
|
log.debug("Pump time difference: " + timeDiff + " seconds");
|
||||||
|
@ -192,9 +192,9 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
|
||||||
NSUpload.uploadDeviceStatus();
|
NSUpload.uploadDeviceStatus();
|
||||||
if (mDanaRPump.dailyTotalUnits > mDanaRPump.maxDailyTotalUnits * Constants.dailyLimitWarning) {
|
if (mDanaRPump.dailyTotalUnits > mDanaRPump.maxDailyTotalUnits * Constants.dailyLimitWarning) {
|
||||||
log.debug("Approaching daily limit: " + mDanaRPump.dailyTotalUnits + "/" + mDanaRPump.maxDailyTotalUnits);
|
log.debug("Approaching daily limit: " + mDanaRPump.dailyTotalUnits + "/" + mDanaRPump.maxDailyTotalUnits);
|
||||||
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.sResources.getString(R.string.approachingdailylimit), Notification.URGENT);
|
Notification reportFail = new Notification(Notification.APPROACHING_DAILY_LIMIT, MainApp.gs(R.string.approachingdailylimit), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(reportFail));
|
MainApp.bus().post(new EventNewNotification(reportFail));
|
||||||
NSUpload.uploadError(MainApp.sResources.getString(R.string.approachingdailylimit) + ": " + mDanaRPump.dailyTotalUnits + "/" + mDanaRPump.maxDailyTotalUnits + "U");
|
NSUpload.uploadError(MainApp.gs(R.string.approachingdailylimit) + ": " + mDanaRPump.dailyTotalUnits + "/" + mDanaRPump.maxDailyTotalUnits + "U");
|
||||||
}
|
}
|
||||||
} catch (Exception e) {
|
} catch (Exception e) {
|
||||||
log.error("Unhandled exception", e);
|
log.error("Unhandled exception", e);
|
||||||
|
@ -204,11 +204,11 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
|
||||||
public boolean tempBasal(int percent, int durationInHours) {
|
public boolean tempBasal(int percent, int durationInHours) {
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
if (mDanaRPump.isTempBasalInProgress) {
|
if (mDanaRPump.isTempBasalInProgress) {
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.stoppingtempbasal)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.stoppingtempbasal)));
|
||||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStop());
|
mSerialIOThread.sendMessage(new MsgSetTempBasalStop());
|
||||||
SystemClock.sleep(500);
|
SystemClock.sleep(500);
|
||||||
}
|
}
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.settingtempbasal)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.settingtempbasal)));
|
||||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStart(percent, durationInHours));
|
mSerialIOThread.sendMessage(new MsgSetTempBasalStart(percent, durationInHours));
|
||||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTING));
|
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTING));
|
||||||
|
@ -217,7 +217,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
|
||||||
|
|
||||||
public boolean tempBasalStop() {
|
public boolean tempBasalStop() {
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.stoppingtempbasal)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.stoppingtempbasal)));
|
||||||
mSerialIOThread.sendMessage(new MsgSetTempBasalStop());
|
mSerialIOThread.sendMessage(new MsgSetTempBasalStop());
|
||||||
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
mSerialIOThread.sendMessage(new MsgStatusTempBasal());
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTING));
|
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTING));
|
||||||
|
@ -226,7 +226,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
|
||||||
|
|
||||||
public boolean extendedBolus(double insulin, int durationInHalfHours) {
|
public boolean extendedBolus(double insulin, int durationInHalfHours) {
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.settingextendedbolus)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.settingextendedbolus)));
|
||||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStart(insulin, (byte) (durationInHalfHours & 0xFF)));
|
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStart(insulin, (byte) (durationInHalfHours & 0xFF)));
|
||||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
|
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTING));
|
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTING));
|
||||||
|
@ -235,7 +235,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
|
||||||
|
|
||||||
public boolean extendedBolusStop() {
|
public boolean extendedBolusStop() {
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.stoppingextendedbolus)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.stoppingextendedbolus)));
|
||||||
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStop());
|
mSerialIOThread.sendMessage(new MsgSetExtendedBolusStop());
|
||||||
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
|
mSerialIOThread.sendMessage(new MsgStatusBolusExtended());
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTING));
|
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTING));
|
||||||
|
@ -310,7 +310,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
|
||||||
|
|
||||||
while (System.currentTimeMillis() < expectedEnd) {
|
while (System.currentTimeMillis() < expectedEnd) {
|
||||||
long waitTime = expectedEnd - System.currentTimeMillis();
|
long waitTime = expectedEnd - System.currentTimeMillis();
|
||||||
bolusingEvent.status = String.format(MainApp.sResources.getString(R.string.waitingforestimatedbolusend), waitTime / 1000);
|
bolusingEvent.status = String.format(MainApp.gs(R.string.waitingforestimatedbolusend), waitTime / 1000);
|
||||||
MainApp.bus().post(bolusingEvent);
|
MainApp.bus().post(bolusingEvent);
|
||||||
SystemClock.sleep(1000);
|
SystemClock.sleep(1000);
|
||||||
}
|
}
|
||||||
|
@ -363,7 +363,7 @@ public class DanaRExecutionService extends AbstractDanaRExecutionService{
|
||||||
|
|
||||||
public boolean updateBasalsInPump(final Profile profile) {
|
public boolean updateBasalsInPump(final Profile profile) {
|
||||||
if (!isConnected()) return false;
|
if (!isConnected()) return false;
|
||||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.updatingbasalrates)));
|
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.updatingbasalrates)));
|
||||||
double[] basal = DanaRPump.buildDanaRProfileRecord(profile);
|
double[] basal = DanaRPump.buildDanaRProfileRecord(profile);
|
||||||
MsgSetBasalProfile msgSet = new MsgSetBasalProfile((byte) 0, basal);
|
MsgSetBasalProfile msgSet = new MsgSetBasalProfile((byte) 0, basal);
|
||||||
mSerialIOThread.sendMessage(msgSet);
|
mSerialIOThread.sendMessage(msgSet);
|
||||||
|
|
|
@ -39,7 +39,7 @@ public class MsgInitConnStatusBasic_k extends MessageBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pump.isEasyModeEnabled) {
|
if (pump.isEasyModeEnabled) {
|
||||||
Notification notification = new Notification(Notification.EASYMODE_ENABLED, MainApp.sResources.getString(R.string.danar_disableeasymode), Notification.URGENT);
|
Notification notification = new Notification(Notification.EASYMODE_ENABLED, MainApp.gs(R.string.danar_disableeasymode), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.EASYMODE_ENABLED));
|
MainApp.bus().post(new EventDismissNotification(Notification.EASYMODE_ENABLED));
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class MsgInitConnStatusBolus_k extends MessageBase {
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!pump.isExtendedBolusEnabled) {
|
if (!pump.isExtendedBolusEnabled) {
|
||||||
Notification notification = new Notification(Notification.EXTENDED_BOLUS_DISABLED, MainApp.sResources.getString(R.string.danar_enableextendedbolus), Notification.URGENT);
|
Notification notification = new Notification(Notification.EXTENDED_BOLUS_DISABLED, MainApp.gs(R.string.danar_enableextendedbolus), Notification.URGENT);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
} else {
|
} else {
|
||||||
MainApp.bus().post(new EventDismissNotification(Notification.EXTENDED_BOLUS_DISABLED));
|
MainApp.bus().post(new EventDismissNotification(Notification.EXTENDED_BOLUS_DISABLED));
|
||||||
|
|
|
@ -29,7 +29,7 @@ public class MsgInitConnStatusTime_k extends MessageBase {
|
||||||
public void handleMessage(byte[] bytes) {
|
public void handleMessage(byte[] bytes) {
|
||||||
|
|
||||||
if (bytes.length - 10 < 10) {
|
if (bytes.length - 10 < 10) {
|
||||||
Notification notification = new Notification(Notification.WRONG_DRIVER, MainApp.sResources.getString(R.string.pumpdrivercorrected), Notification.NORMAL);
|
Notification notification = new Notification(Notification.WRONG_DRIVER, MainApp.gs(R.string.pumpdrivercorrected), Notification.NORMAL);
|
||||||
MainApp.bus().post(new EventNewNotification(notification));
|
MainApp.bus().post(new EventNewNotification(notification));
|
||||||
DanaRKoreanPlugin.getPlugin().disconnect("Wrong Model");
|
DanaRKoreanPlugin.getPlugin().disconnect("Wrong Model");
|
||||||
log.debug("Wrong model selected. Switching to export DanaR");
|
log.debug("Wrong model selected. Switching to export DanaR");
|
||||||
|
|
Loading…
Reference in a new issue