remove direct access to sResources 2

This commit is contained in:
AdrianLxM 2018-05-02 13:36:56 +02:00
parent 81ad2779bc
commit a8382daefd
9 changed files with 85 additions and 85 deletions

View file

@ -99,7 +99,7 @@ public class OpenAPSSMBFragment extends SubscriberFragment {
currentTempView.setText(JSONFormatter.format(determineBasalAdapterSMBJS.getCurrentTempParam()).toString().trim());
try {
JSONArray iobArray = new JSONArray(determineBasalAdapterSMBJS.getIobDataParam());
iobDataView.setText((String.format(MainApp.sResources.getString(R.string.array_of_elements), iobArray.length()) + "\n" + JSONFormatter.format(iobArray.getString(0))).trim());
iobDataView.setText((String.format(MainApp.gs(R.string.array_of_elements), iobArray.length()) + "\n" + JSONFormatter.format(iobArray.getString(0))).trim());
} catch (JSONException e) {
log.error("Unhandled exception", e);
iobDataView.setText("JSONException see log for details");

View file

@ -57,7 +57,7 @@ public class DanaRNSHistorySync {
if (record._id != null) continue;
//log.debug(record.bytes);
JSONObject nsrec = new JSONObject();
ev.message = MainApp.sResources.getString(R.string.uploading) + " " + processing + "/" + records + " "; // TODO: translations
ev.message = MainApp.gs(R.string.uploading) + " " + processing + "/" + records + " "; // TODO: translations
switch (record.recordCode) {
case RecordTypes.RECORD_TYPE_BOLUS:
if ((what & SYNC_BOLUS) == 0) break;
@ -68,10 +68,10 @@ public class DanaRNSHistorySync {
nsrec.put("eventType", "Meal Bolus");
nsrec.put("insulin", record.recordValue);
nsrec.put("created_at", DateUtil.toISOString(record.recordDate));
nsrec.put("enteredBy", "openaps://" + MainApp.sResources.getString(R.string.app_name));
nsrec.put("enteredBy", "openaps://" + MainApp.gs(R.string.app_name));
NSUpload.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += MainApp.sResources.getString(R.string.danar_sbolus);
ev.message += MainApp.gs(R.string.danar_sbolus);
break;
case "E":
if (record.recordDuration > 0) {
@ -86,10 +86,10 @@ public class DanaRNSHistorySync {
cal.setTimeInMillis(record.recordDate);
cal.add(Calendar.MINUTE, -1 * record.recordDuration);
nsrec.put("created_at", DateUtil.toISOString(cal.getTime()));
nsrec.put("enteredBy", "openaps://" + MainApp.sResources.getString(R.string.app_name));
nsrec.put("enteredBy", "openaps://" + MainApp.gs(R.string.app_name));
NSUpload.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += MainApp.sResources.getString(R.string.danar_ebolus);
ev.message += MainApp.gs(R.string.danar_ebolus);
} else {
log.debug("NOT Syncing extended bolus record " + record.recordValue + "U " + DateUtil.toISOString(record.recordDate) + " zero duration");
}
@ -102,10 +102,10 @@ public class DanaRNSHistorySync {
nsrec.put("splitNow", 100);
nsrec.put("splitExt", 0);
nsrec.put("created_at", DateUtil.toISOString(record.recordDate));
nsrec.put("enteredBy", "openaps://" + MainApp.sResources.getString(R.string.app_name));
nsrec.put("enteredBy", "openaps://" + MainApp.gs(R.string.app_name));
NSUpload.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += MainApp.sResources.getString(R.string.danar_dsbolus);
ev.message += MainApp.gs(R.string.danar_dsbolus);
break;
case "DE":
log.debug("Syncing dual(E) bolus record " + record.recordValue + "U " + DateUtil.toISOString(record.recordDate));
@ -118,10 +118,10 @@ public class DanaRNSHistorySync {
cal.setTimeInMillis(record.recordDate);
cal.add(Calendar.MINUTE, -1 * record.recordDuration);
nsrec.put("created_at", DateUtil.toISOString(cal.getTime()));
nsrec.put("enteredBy", "openaps://" + MainApp.sResources.getString(R.string.app_name));
nsrec.put("enteredBy", "openaps://" + MainApp.gs(R.string.app_name));
NSUpload.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += MainApp.sResources.getString(R.string.danar_debolus);
ev.message += MainApp.gs(R.string.danar_debolus);
break;
default:
log.debug("Unknown bolus record");
@ -135,10 +135,10 @@ public class DanaRNSHistorySync {
nsrec.put("eventType", "Note");
nsrec.put("notes", "Error");
nsrec.put("created_at", DateUtil.toISOString(record.recordDate));
nsrec.put("enteredBy", "openaps://" + MainApp.sResources.getString(R.string.app_name));
nsrec.put("enteredBy", "openaps://" + MainApp.gs(R.string.app_name));
NSUpload.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += MainApp.sResources.getString(R.string.danar_error);
ev.message += MainApp.gs(R.string.danar_error);
break;
case RecordTypes.RECORD_TYPE_REFILL:
if ((what & SYNC_REFILL) == 0) break;
@ -147,10 +147,10 @@ public class DanaRNSHistorySync {
nsrec.put("eventType", "Insulin Change");
nsrec.put("notes", "Refill " + record.recordValue + "U");
nsrec.put("created_at", DateUtil.toISOString(record.recordDate));
nsrec.put("enteredBy", "openaps://" + MainApp.sResources.getString(R.string.app_name));
nsrec.put("enteredBy", "openaps://" + MainApp.gs(R.string.app_name));
NSUpload.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += MainApp.sResources.getString(R.string.danar_refill);
ev.message += MainApp.gs(R.string.danar_refill);
break;
case RecordTypes.RECORD_TYPE_BASALHOUR:
if ((what & SYNC_BASALHOURS) == 0) break;
@ -160,10 +160,10 @@ public class DanaRNSHistorySync {
nsrec.put("absolute", record.recordValue);
nsrec.put("duration", 60);
nsrec.put("created_at", DateUtil.toISOString(record.recordDate));
nsrec.put("enteredBy", "openaps://" + MainApp.sResources.getString(R.string.app_name));
nsrec.put("enteredBy", "openaps://" + MainApp.gs(R.string.app_name));
NSUpload.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += MainApp.sResources.getString(R.string.danar_basalhour);
ev.message += MainApp.gs(R.string.danar_basalhour);
break;
case RecordTypes.RECORD_TYPE_TB:
//log.debug("Ignoring TB record " + record.bytes + " " + DateUtil.toISOString(record.recordDate));
@ -176,10 +176,10 @@ public class DanaRNSHistorySync {
nsrec.put("glucose", Profile.fromMgdlToUnits(record.recordValue, MainApp.getConfigBuilder().getProfileUnits()));
nsrec.put("glucoseType", "Finger");
nsrec.put("created_at", DateUtil.toISOString(record.recordDate));
nsrec.put("enteredBy", "openaps://" + MainApp.sResources.getString(R.string.app_name));
nsrec.put("enteredBy", "openaps://" + MainApp.gs(R.string.app_name));
NSUpload.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += MainApp.sResources.getString(R.string.danar_glucose);
ev.message += MainApp.gs(R.string.danar_glucose);
break;
case RecordTypes.RECORD_TYPE_CARBO:
if ((what & SYNC_CARBO) == 0) break;
@ -188,10 +188,10 @@ public class DanaRNSHistorySync {
nsrec.put("eventType", "Meal Bolus");
nsrec.put("carbs", record.recordValue);
nsrec.put("created_at", DateUtil.toISOString(record.recordDate));
nsrec.put("enteredBy", "openaps://" + MainApp.sResources.getString(R.string.app_name));
nsrec.put("enteredBy", "openaps://" + MainApp.gs(R.string.app_name));
NSUpload.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += MainApp.sResources.getString(R.string.danar_carbohydrate);
ev.message += MainApp.gs(R.string.danar_carbohydrate);
break;
case RecordTypes.RECORD_TYPE_ALARM:
if ((what & SYNC_ALARM) == 0) break;
@ -200,10 +200,10 @@ public class DanaRNSHistorySync {
nsrec.put("eventType", "Note");
nsrec.put("notes", "Alarm: " + record.recordAlarm);
nsrec.put("created_at", DateUtil.toISOString(record.recordDate));
nsrec.put("enteredBy", "openaps://" + MainApp.sResources.getString(R.string.app_name));
nsrec.put("enteredBy", "openaps://" + MainApp.gs(R.string.app_name));
NSUpload.uploadCareportalEntryToNS(nsrec);
uploaded++;
ev.message += MainApp.sResources.getString(R.string.danar_alarm);
ev.message += MainApp.gs(R.string.danar_alarm);
break;
case RecordTypes.RECORD_TYPE_SUSPEND: // TODO: this too
case RecordTypes.RECORD_TYPE_DAILY:
@ -216,7 +216,7 @@ public class DanaRNSHistorySync {
}
MainApp.bus().post(ev);
}
ev.message = String.format(MainApp.sResources.getString(R.string.danar_totaluploaded), uploaded);
ev.message = String.format(MainApp.gs(R.string.danar_totaluploaded), uploaded);
MainApp.bus().post(ev);
} catch (JSONException e) {

View file

@ -297,22 +297,22 @@ public class DanaRSPlugin extends PluginBase implements PumpInterface, DanaRInte
}
if (!isInitialized()) {
log.error("setNewBasalProfile not initialized");
Notification notification = new Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, MainApp.sResources.getString(R.string.pumpNotInitializedProfileNotSet), Notification.URGENT);
Notification notification = new Notification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED, MainApp.gs(R.string.pumpNotInitializedProfileNotSet), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
result.comment = MainApp.sResources.getString(R.string.pumpNotInitializedProfileNotSet);
result.comment = MainApp.gs(R.string.pumpNotInitializedProfileNotSet);
return result;
} else {
MainApp.bus().post(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
}
if (!danaRSService.updateBasalsInPump(profile)) {
Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, MainApp.sResources.getString(R.string.failedupdatebasalprofile), Notification.URGENT);
Notification notification = new Notification(Notification.FAILED_UDPATE_PROFILE, MainApp.gs(R.string.failedupdatebasalprofile), Notification.URGENT);
MainApp.bus().post(new EventNewNotification(notification));
result.comment = MainApp.sResources.getString(R.string.failedupdatebasalprofile);
result.comment = MainApp.gs(R.string.failedupdatebasalprofile);
return result;
} else {
MainApp.bus().post(new EventDismissNotification(Notification.PROFILE_NOT_SET_NOT_INITIALIZED));
MainApp.bus().post(new EventDismissNotification(Notification.FAILED_UDPATE_PROFILE));
Notification notification = new Notification(Notification.PROFILE_SET_OK, MainApp.sResources.getString(R.string.profile_set_ok), Notification.INFO, 60);
Notification notification = new Notification(Notification.PROFILE_SET_OK, MainApp.gs(R.string.profile_set_ok), Notification.INFO, 60);
MainApp.bus().post(new EventNewNotification(notification));
result.success = true;
result.enacted = true;

View file

@ -51,14 +51,14 @@ public class PairingProgressDialog extends DialogFragment implements View.OnClic
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
View view = inflater.inflate(R.layout.danars_pairingprogressdialog, container, false);
getDialog().setTitle(MainApp.sResources.getString(R.string.pairing));
getDialog().setTitle(MainApp.gs(R.string.pairing));
statusView = (TextView) view.findViewById(R.id.danars_paringprogress_status);
progressBar = (ProgressBar) view.findViewById(R.id.danars_paringprogress_progressbar);
button = (Button) view.findViewById(R.id.ok);
progressBar.setMax(100);
progressBar.setProgress(0);
statusView.setText(MainApp.sResources.getString(R.string.waitingforpairing));
statusView.setText(MainApp.gs(R.string.waitingforpairing));
button.setVisibility(View.GONE);
button.setOnClickListener(this);
setCancelable(false);

View file

@ -200,7 +200,7 @@ public class DanaRS_Packet_APS_History_Events extends DanaRS_Packet {
if (datetime.getTime() > lastEventTimeLoaded)
lastEventTimeLoaded = datetime.getTime();
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.processinghistory) + ": " + status));
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.processinghistory) + ": " + status));
}
@Override

View file

@ -47,10 +47,10 @@ public class DanaRS_Packet_Bolus_Set_Step_Bolus_Stop extends DanaRS_Packet {
stopped = true;
if (!forced) {
t.insulin = amount;
bolusingEvent.status = MainApp.sResources.getString(R.string.overview_bolusprogress_delivered);
bolusingEvent.status = MainApp.gs(R.string.overview_bolusprogress_delivered);
bolusingEvent.percent = 100;
} else {
bolusingEvent.status = MainApp.sResources.getString(R.string.overview_bolusprogress_stoped);
bolusingEvent.status = MainApp.gs(R.string.overview_bolusprogress_stoped);
}
MainApp.bus().post(bolusingEvent);
}

View file

@ -120,7 +120,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
public void connect() {
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;
}
@ -161,7 +161,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
public void getPumpStatus() {
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();
MsgStatusBasic statusBasicMsg = new MsgStatusBasic();
MsgStatusTempBasal_v2 tempStatusMsg = new MsgStatusTempBasal_v2();
@ -175,17 +175,17 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
}
}
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingbolusstatus)));
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingbolusstatus)));
mSerialIOThread.sendMessage(statusMsg);
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);
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingextendedbolusstatus)));
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingextendedbolusstatus)));
mSerialIOThread.sendMessage(exStatusMsg);
long now = System.currentTimeMillis();
if (mDanaRPump.lastSettingsRead + 60 * 60 * 1000L < now || !MainApp.getSpecificPlugin(DanaRv2Plugin.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 MsgSettingActiveProfile());
mSerialIOThread.sendMessage(new MsgSettingMeal());
@ -196,7 +196,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
mSerialIOThread.sendMessage(new MsgSettingActiveProfile());
mSerialIOThread.sendMessage(new MsgSettingProfileRatios());
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());
long timeDiff = (mDanaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L;
log.debug("Pump time difference: " + timeDiff + " seconds");
@ -218,9 +218,9 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
NSUpload.uploadDeviceStatus();
if (mDanaRPump.dailyTotalUnits > mDanaRPump.maxDailyTotalUnits * Constants.dailyLimitWarning) {
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));
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) {
log.error("Unhandled exception", e);
@ -231,11 +231,11 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
public boolean tempBasal(int percent, int durationInHours) {
if (!isConnected()) return false;
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());
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 MsgStatusTempBasal_v2());
loadEvents();
@ -246,11 +246,11 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
public boolean highTempBasal(int percent) {
if (!isConnected()) return false;
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());
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 MsgSetAPSTempBasalStart_v2(percent));
mSerialIOThread.sendMessage(new MsgStatusTempBasal_v2());
loadEvents();
@ -280,7 +280,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
public boolean tempBasalStop() {
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 MsgStatusTempBasal_v2());
loadEvents();
@ -290,7 +290,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
public boolean extendedBolus(double insulin, int durationInHalfHours) {
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 MsgStatusBolusExtended_v2());
loadEvents();
@ -300,7 +300,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
public boolean extendedBolusStop() {
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 MsgStatusBolusExtended_v2());
loadEvents();
@ -312,7 +312,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
if (!isConnected()) return false;
if (BolusProgressDialog.stopPressed) return false;
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.startingbolus)));
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.startingbolus)));
mBolusingTreatment = t;
final int preferencesSpeed = SP.getInt(R.string.key_danars_bolusspeed, 0);
MessageBase start;
@ -371,7 +371,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
long expectedEnd = bolusStart + bolusDurationInMSec + 2000;
while (System.currentTimeMillis() < expectedEnd) {
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);
SystemClock.sleep(1000);
}
@ -380,10 +380,10 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
@Override
public void run() {
// load last bolus status
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingbolusstatus)));
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingbolusstatus)));
mSerialIOThread.sendMessage(new MsgStatus());
bolusingEvent.percent = 100;
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.disconnecting)));
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.disconnecting)));
}
});
return !start.failed;
@ -442,7 +442,7 @@ public class DanaRv2ExecutionService extends AbstractDanaRExecutionService {
public boolean updateBasalsInPump(final Profile profile) {
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);
MsgSetBasalProfile msgSet = new MsgSetBasalProfile((byte) 0, basal);
mSerialIOThread.sendMessage(msgSet);

View file

@ -12,51 +12,51 @@ public class Translator {
switch (text) {
case "BG Check":
return MainApp.sResources.getString(R.string.careportal_bgcheck);
return MainApp.gs(R.string.careportal_bgcheck);
case "Snack Bolus":
return MainApp.sResources.getString(R.string.careportal_snackbolus);
return MainApp.gs(R.string.careportal_snackbolus);
case "Meal Bolus":
return MainApp.sResources.getString(R.string.careportal_mealbolus);
return MainApp.gs(R.string.careportal_mealbolus);
case "Correction Bolus":
return MainApp.sResources.getString(R.string.careportal_correctionbolus);
return MainApp.gs(R.string.careportal_correctionbolus);
case "Carb Correction":
return MainApp.sResources.getString(R.string.careportal_carbscorrection);
return MainApp.gs(R.string.careportal_carbscorrection);
case "Combo Bolus":
return MainApp.sResources.getString(R.string.careportal_combobolus);
return MainApp.gs(R.string.careportal_combobolus);
case "Announcement":
return MainApp.sResources.getString(R.string.careportal_announcement);
return MainApp.gs(R.string.careportal_announcement);
case "Note":
return MainApp.sResources.getString(R.string.careportal_note);
return MainApp.gs(R.string.careportal_note);
case "Question":
return MainApp.sResources.getString(R.string.careportal_question);
return MainApp.gs(R.string.careportal_question);
case "Exercise":
return MainApp.sResources.getString(R.string.careportal_exercise);
return MainApp.gs(R.string.careportal_exercise);
case "Site Change":
return MainApp.sResources.getString(R.string.careportal_pumpsitechange);
return MainApp.gs(R.string.careportal_pumpsitechange);
case "Sensor Start":
return MainApp.sResources.getString(R.string.careportal_cgmsensorstart);
return MainApp.gs(R.string.careportal_cgmsensorstart);
case "Sensor Change":
return MainApp.sResources.getString(R.string.careportal_cgmsensorinsert);
return MainApp.gs(R.string.careportal_cgmsensorinsert);
case "Insulin Change":
return MainApp.sResources.getString(R.string.careportal_insulincartridgechange);
return MainApp.gs(R.string.careportal_insulincartridgechange);
case "Temp Basal Start":
return MainApp.sResources.getString(R.string.careportal_tempbasalstart);
return MainApp.gs(R.string.careportal_tempbasalstart);
case "Temp Basal End":
return MainApp.sResources.getString(R.string.careportal_tempbasalend);
return MainApp.gs(R.string.careportal_tempbasalend);
case "Profile Switch":
return MainApp.sResources.getString(R.string.careportal_profileswitch);
return MainApp.gs(R.string.careportal_profileswitch);
case "Temporary Target":
return MainApp.sResources.getString(R.string.careportal_temporarytarget);
return MainApp.gs(R.string.careportal_temporarytarget);
case "Temporary Target Cancel":
return MainApp.sResources.getString(R.string.careportal_temporarytargetcancel);
return MainApp.gs(R.string.careportal_temporarytargetcancel);
case "OpenAPS Offline":
return MainApp.sResources.getString(R.string.careportal_openapsoffline);
return MainApp.gs(R.string.careportal_openapsoffline);
case "Finger":
return MainApp.sResources.getString(R.string.glucosetype_finger);
return MainApp.gs(R.string.glucosetype_finger);
case "Sensor":
return MainApp.sResources.getString(R.string.glucosetype_sensor);
return MainApp.gs(R.string.glucosetype_sensor);
case "Manual":
return MainApp.sResources.getString(R.string.manual);
return MainApp.gs(R.string.manual);
}
return text;
}

View file

@ -28,17 +28,17 @@ public class XdripCalibrations {
public static void confirmAndSendCalibration(final Double bg, Context parentContext) {
if (parentContext != null) {
String confirmMessage = String.format(MainApp.sResources.getString(R.string.send_calibration), bg);
String confirmMessage = String.format(MainApp.gs(R.string.send_calibration), bg);
AlertDialog.Builder builder = new AlertDialog.Builder(parentContext);
builder.setTitle(MainApp.sResources.getString(R.string.confirmation));
builder.setTitle(MainApp.gs(R.string.confirmation));
builder.setMessage(confirmMessage);
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), new DialogInterface.OnClickListener() {
builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() {
public void onClick(DialogInterface dialog, int id) {
sendIntent(bg);
}
});
builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null);
builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
builder.show();
}
}
@ -55,12 +55,12 @@ public class XdripCalibrations {
context.sendBroadcast(intent);
List<ResolveInfo> q = MainApp.instance().getApplicationContext().getPackageManager().queryBroadcastReceivers(intent, 0);
if (q.size() < 1) {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.xdripnotinstalled));
log.debug(MainApp.sResources.getString(R.string.xdripnotinstalled));
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.xdripnotinstalled));
log.debug(MainApp.gs(R.string.xdripnotinstalled));
return false;
} else {
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.calibrationsent));
log.debug(MainApp.sResources.getString(R.string.calibrationsent));
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.calibrationsent));
log.debug(MainApp.gs(R.string.calibrationsent));
return true;
}
}