remove direct access to sResources 4
This commit is contained in:
parent
2af62d8e4e
commit
3979913a6d
14 changed files with 69 additions and 69 deletions
|
@ -46,13 +46,13 @@ public class EventPumpStatusChanged extends Event {
|
|||
|
||||
public String textStatus() {
|
||||
if (sStatus == CONNECTING)
|
||||
return String.format(MainApp.sResources.getString(R.string.danar_history_connectingfor), sSecondsElapsed);
|
||||
return String.format(MainApp.gs(R.string.danar_history_connectingfor), sSecondsElapsed);
|
||||
else if (sStatus == CONNECTED)
|
||||
return MainApp.sResources.getString(R.string.connected);
|
||||
return MainApp.gs(R.string.connected);
|
||||
else if (sStatus == PERFORMING)
|
||||
return sPerfomingAction;
|
||||
else if (sStatus == DISCONNECTING)
|
||||
return MainApp.sResources.getString(R.string.disconnecting);
|
||||
return MainApp.gs(R.string.disconnecting);
|
||||
else if (sStatus == DISCONNECTED)
|
||||
return "";
|
||||
return "";
|
||||
|
|
|
@ -54,7 +54,7 @@ public class FoodFragment extends SubscriberFragment {
|
|||
ArrayList<CharSequence> categories;
|
||||
ArrayList<CharSequence> subcategories;
|
||||
|
||||
final String EMPTY = MainApp.sResources.getString(R.string.none);
|
||||
final String EMPTY = MainApp.gs(R.string.none);
|
||||
|
||||
@Override
|
||||
public View onCreateView(LayoutInflater inflater, ViewGroup container,
|
||||
|
@ -158,7 +158,7 @@ public class FoodFragment extends SubscriberFragment {
|
|||
|
||||
// make it unique
|
||||
categories = new ArrayList<>(catSet);
|
||||
categories.add(0, MainApp.sResources.getString(R.string.none));
|
||||
categories.add(0, MainApp.gs(R.string.none));
|
||||
|
||||
ArrayAdapter<CharSequence> adapterCategories = new ArrayAdapter<>(getContext(),
|
||||
R.layout.spinner_centered, categories);
|
||||
|
@ -180,7 +180,7 @@ public class FoodFragment extends SubscriberFragment {
|
|||
|
||||
// make it unique
|
||||
subcategories = new ArrayList<>(subCatSet);
|
||||
subcategories.add(0, MainApp.sResources.getString(R.string.none));
|
||||
subcategories.add(0, MainApp.gs(R.string.none));
|
||||
|
||||
ArrayAdapter<CharSequence> adapterSubcategories = new ArrayAdapter<>(getContext(),
|
||||
R.layout.spinner_centered, subcategories);
|
||||
|
@ -242,14 +242,14 @@ public class FoodFragment extends SubscriberFragment {
|
|||
holder.ns.setVisibility(food._id != null ? View.VISIBLE : View.GONE);
|
||||
holder.name.setText(food.name);
|
||||
holder.portion.setText(food.portion + food.units);
|
||||
holder.carbs.setText(food.carbs + MainApp.sResources.getString(R.string.shortgramm));
|
||||
holder.fat.setText(MainApp.sResources.getString(R.string.shortfat) + ": " + food.fat + MainApp.sResources.getString(R.string.shortgramm));
|
||||
holder.carbs.setText(food.carbs + MainApp.gs(R.string.shortgramm));
|
||||
holder.fat.setText(MainApp.gs(R.string.shortfat) + ": " + food.fat + MainApp.gs(R.string.shortgramm));
|
||||
if (food.fat == 0)
|
||||
holder.fat.setVisibility(View.INVISIBLE);
|
||||
holder.protein.setText(MainApp.sResources.getString(R.string.shortprotein) + ": " + food.protein + MainApp.sResources.getString(R.string.shortgramm));
|
||||
holder.protein.setText(MainApp.gs(R.string.shortprotein) + ": " + food.protein + MainApp.gs(R.string.shortgramm));
|
||||
if (food.protein == 0)
|
||||
holder.protein.setVisibility(View.INVISIBLE);
|
||||
holder.energy.setText(MainApp.sResources.getString(R.string.shortenergy) + ": " + food.energy + MainApp.sResources.getString(R.string.shortkilojoul));
|
||||
holder.energy.setText(MainApp.gs(R.string.shortenergy) + ": " + food.energy + MainApp.gs(R.string.shortkilojoul));
|
||||
if (food.energy == 0)
|
||||
holder.energy.setVisibility(View.INVISIBLE);
|
||||
holder.remove.setTag(food);
|
||||
|
@ -291,9 +291,9 @@ public class FoodFragment extends SubscriberFragment {
|
|||
|
||||
case R.id.food_remove:
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(getContext());
|
||||
builder.setTitle(MainApp.sResources.getString(R.string.confirmation));
|
||||
builder.setMessage(MainApp.sResources.getString(R.string.removerecord) + "\n" + food.name);
|
||||
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
builder.setTitle(MainApp.gs(R.string.confirmation));
|
||||
builder.setMessage(MainApp.gs(R.string.removerecord) + "\n" + food.name);
|
||||
builder.setPositiveButton(MainApp.gs(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
final String _id = food._id;
|
||||
if (_id != null && !_id.equals("")) {
|
||||
|
@ -302,7 +302,7 @@ public class FoodFragment extends SubscriberFragment {
|
|||
MainApp.getSpecificPlugin(FoodPlugin.class).getService().delete(food);
|
||||
}
|
||||
});
|
||||
builder.setNegativeButton(MainApp.sResources.getString(R.string.cancel), null);
|
||||
builder.setNegativeButton(MainApp.gs(R.string.cancel), null);
|
||||
builder.show();
|
||||
break;
|
||||
|
||||
|
|
|
@ -165,7 +165,7 @@ public class NSClientFragment extends SubscriberFragment implements View.OnClick
|
|||
logScrollview.fullScroll(ScrollView.FOCUS_DOWN);
|
||||
}
|
||||
urlTextView.setText(NSClientPlugin.getPlugin().url());
|
||||
Spanned queuetext = Html.fromHtml(MainApp.sResources.getString(R.string.queue) + " <b>" + UploadQueue.size() + "</b>");
|
||||
Spanned queuetext = Html.fromHtml(MainApp.gs(R.string.queue) + " <b>" + UploadQueue.size() + "</b>");
|
||||
queueTextView.setText(queuetext);
|
||||
statusTextView.setText(NSClientPlugin.getPlugin().status);
|
||||
}
|
||||
|
|
|
@ -287,7 +287,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
|
||||
@Override
|
||||
public void onNothingSelected(AdapterView<?> parent) {
|
||||
ToastUtils.showToastInUiThread(context, MainApp.sResources.getString(R.string.noprofileselected));
|
||||
ToastUtils.showToastInUiThread(context, MainApp.gs(R.string.noprofileselected));
|
||||
okButton.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
|
@ -317,9 +317,9 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
|
||||
if (insulinAfterConstraints - calculatedTotalInsulin != 0 || !carbsAfterConstraints.equals(calculatedCarbs)) {
|
||||
AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(MainApp.sResources.getString(R.string.treatmentdeliveryerror));
|
||||
builder.setTitle(MainApp.gs(R.string.treatmentdeliveryerror));
|
||||
builder.setMessage(getString(R.string.constraints_violation) + "\n" + getString(R.string.changeyourinput));
|
||||
builder.setPositiveButton(MainApp.sResources.getString(R.string.ok), null);
|
||||
builder.setPositiveButton(MainApp.gs(R.string.ok), null);
|
||||
builder.show();
|
||||
return;
|
||||
}
|
||||
|
@ -332,7 +332,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
final String finalNotes = notesEdit.getText().toString();
|
||||
|
||||
final AlertDialog.Builder builder = new AlertDialog.Builder(context);
|
||||
builder.setTitle(MainApp.sResources.getString(R.string.confirmation));
|
||||
builder.setTitle(MainApp.gs(R.string.confirmation));
|
||||
builder.setMessage(Html.fromHtml(confirmMessage));
|
||||
builder.setPositiveButton(getString(R.string.ok), new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int id) {
|
||||
|
@ -356,7 +356,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class);
|
||||
i.putExtra("soundid", R.raw.boluserror);
|
||||
i.putExtra("status", result.comment);
|
||||
i.putExtra("title", MainApp.sResources.getString(R.string.tempbasaldeliveryerror));
|
||||
i.putExtra("title", MainApp.gs(R.string.tempbasaldeliveryerror));
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
MainApp.instance().startActivity(i);
|
||||
}
|
||||
|
@ -382,7 +382,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
Intent i = new Intent(MainApp.instance(), ErrorHelperActivity.class);
|
||||
i.putExtra("soundid", R.raw.boluserror);
|
||||
i.putExtra("status", result.comment);
|
||||
i.putExtra("title", MainApp.sResources.getString(R.string.treatmentdeliveryerror));
|
||||
i.putExtra("title", MainApp.gs(R.string.treatmentdeliveryerror));
|
||||
i.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
MainApp.instance().startActivity(i);
|
||||
}
|
||||
|
@ -412,14 +412,14 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
ProfileStore profileStore = MainApp.getConfigBuilder().getActiveProfileInterface().getProfile();
|
||||
|
||||
if (profile == null) {
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.noprofile));
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.noprofile));
|
||||
dismiss();
|
||||
return;
|
||||
}
|
||||
|
||||
ArrayList<CharSequence> profileList;
|
||||
profileList = profileStore.getProfileList();
|
||||
profileList.add(0, MainApp.sResources.getString(R.string.active));
|
||||
profileList.add(0, MainApp.gs(R.string.active));
|
||||
ArrayAdapter<CharSequence> adapter = new ArrayAdapter<>(getContext(),
|
||||
R.layout.spinner_centered, profileList);
|
||||
|
||||
|
@ -458,7 +458,7 @@ public class WizardDialog extends DialogFragment implements OnClickListener, Com
|
|||
return; // not initialized yet
|
||||
String selectedAlternativeProfile = profileSpinner.getSelectedItem().toString();
|
||||
Profile specificProfile;
|
||||
if (selectedAlternativeProfile.equals(MainApp.sResources.getString(R.string.active)))
|
||||
if (selectedAlternativeProfile.equals(MainApp.gs(R.string.active)))
|
||||
specificProfile = MainApp.getConfigBuilder().getProfile();
|
||||
else
|
||||
specificProfile = profileStore.getSpecificProfile(selectedAlternativeProfile);
|
||||
|
|
|
@ -43,7 +43,7 @@ public class DanaRS_Packet_General_Get_Pump_Check extends DanaRS_Packet {
|
|||
}
|
||||
|
||||
if (pump.productCode < 2) {
|
||||
MainApp.bus().post(new EventNewNotification(new Notification(Notification.UNSUPPORTED_FIRMWARE, MainApp.sResources.getString(R.string.unsupportedfirmware), Notification.URGENT)));
|
||||
MainApp.bus().post(new EventNewNotification(new Notification(Notification.UNSUPPORTED_FIRMWARE, MainApp.gs(R.string.unsupportedfirmware), Notification.URGENT)));
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -39,7 +39,7 @@ public class DanaRS_Packet_Notify_Delivery_Rate_Display extends DanaRS_Packet {
|
|||
lastReceive = System.currentTimeMillis();
|
||||
t.insulin = deliveredInsulin;
|
||||
EventOverviewBolusProgress bolusingEvent = EventOverviewBolusProgress.getInstance();
|
||||
bolusingEvent.status = String.format(MainApp.sResources.getString(R.string.bolusdelivering), deliveredInsulin);
|
||||
bolusingEvent.status = String.format(MainApp.gs(R.string.bolusdelivering), deliveredInsulin);
|
||||
bolusingEvent.t = t;
|
||||
bolusingEvent.percent = Math.min((int) (deliveredInsulin / amount * 100), 100);
|
||||
MainApp.bus().post(bolusingEvent);
|
||||
|
|
|
@ -433,7 +433,7 @@ public class BLEComm {
|
|||
if (inputBuffer.length == 4 && inputBuffer[2] == 'O' && inputBuffer[3] == 'K') {
|
||||
log.debug("<<<<< " + "ENCRYPTION__PUMP_CHECK (OK)" + " " + DanaRS_Packet.toHexString(inputBuffer));
|
||||
// Grab pairing key from preferences if exists
|
||||
String pairingKey = SP.getString(MainApp.sResources.getString(R.string.key_danars_pairingkey) + DanaRSPlugin.mDeviceName, null);
|
||||
String pairingKey = SP.getString(MainApp.gs(R.string.key_danars_pairingkey) + DanaRSPlugin.mDeviceName, null);
|
||||
log.debug("Using stored pairing key: " + pairingKey);
|
||||
if (pairingKey != null) {
|
||||
byte[] encodedPairingKey = DanaRS_Packet.hexToBytes(pairingKey);
|
||||
|
@ -448,11 +448,11 @@ public class BLEComm {
|
|||
} else if (inputBuffer.length == 6 && inputBuffer[2] == 'B' && inputBuffer[3] == 'U' && inputBuffer[4] == 'S' && inputBuffer[5] == 'Y') {
|
||||
log.debug("<<<<< " + "ENCRYPTION__PUMP_CHECK (BUSY)" + " " + DanaRS_Packet.toHexString(inputBuffer));
|
||||
mSendQueue.clear();
|
||||
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTED, MainApp.sResources.getString(R.string.pumpbusy)));
|
||||
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTED, MainApp.gs(R.string.pumpbusy)));
|
||||
} else {
|
||||
log.debug("<<<<< " + "ENCRYPTION__PUMP_CHECK (ERROR)" + " " + DanaRS_Packet.toHexString(inputBuffer));
|
||||
mSendQueue.clear();
|
||||
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTED, MainApp.sResources.getString(R.string.connectionerror)));
|
||||
MainApp.bus().post(new EventPumpStatusChanged(EventPumpStatusChanged.DISCONNECTED, MainApp.gs(R.string.connectionerror)));
|
||||
}
|
||||
break;
|
||||
// 2nd packet, pairing key
|
||||
|
@ -480,7 +480,7 @@ public class BLEComm {
|
|||
SendTimeInfo();
|
||||
byte[] pairingKey = {inputBuffer[2], inputBuffer[3]};
|
||||
// store pairing key to preferences
|
||||
SP.putString(MainApp.sResources.getString(R.string.key_danars_pairingkey) + DanaRSPlugin.mDeviceName, DanaRS_Packet.bytesToHex(pairingKey));
|
||||
SP.putString(MainApp.gs(R.string.key_danars_pairingkey) + DanaRSPlugin.mDeviceName, DanaRS_Packet.bytesToHex(pairingKey));
|
||||
log.debug("Got pairing key: " + DanaRS_Packet.bytesToHex(pairingKey));
|
||||
break;
|
||||
// time and user password information. last packet in handshake
|
||||
|
|
|
@ -123,19 +123,19 @@ public class DanaRSService extends Service {
|
|||
|
||||
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)));
|
||||
|
||||
bleComm.sendMessage(new DanaRS_Packet_General_Initial_Screen_Information());
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingextendedbolusstatus)));
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingextendedbolusstatus)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Extended_Bolus_State());
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingbolusstatus)));
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingbolusstatus)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Step_Bolus_Information()); // last bolus, bolusStep, maxBolus
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingtempbasalstatus)));
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingtempbasalstatus)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State());
|
||||
|
||||
long now = System.currentTimeMillis();
|
||||
if (danaRPump.lastSettingsRead + 60 * 60 * 1000L < now || !MainApp.getSpecificPlugin(DanaRSPlugin.class).isInitialized()) {
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingpumpsettings)));
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumpsettings)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_General_Get_Shipping_Information()); // serial no
|
||||
bleComm.sendMessage(new DanaRS_Packet_General_Get_Pump_Check()); // firmware
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Profile_Number());
|
||||
|
@ -143,7 +143,7 @@ public class DanaRSService extends Service {
|
|||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Basal_Rate()); // basal profile, basalStep, maxBasal
|
||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Calculation_Information()); // target
|
||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_CIR_CF_Array());
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingpumptime)));
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingpumptime)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Option_Get_Pump_Time());
|
||||
long timeDiff = (danaRPump.pumpTime.getTime() - System.currentTimeMillis()) / 1000L;
|
||||
log.debug("Pump time difference: " + timeDiff + " seconds");
|
||||
|
@ -165,9 +165,9 @@ public class DanaRSService extends Service {
|
|||
NSUpload.uploadDeviceStatus();
|
||||
if (danaRPump.dailyTotalUnits > danaRPump.maxDailyTotalUnits * Constants.dailyLimitWarning) {
|
||||
log.debug("Approaching daily limit: " + danaRPump.dailyTotalUnits + "/" + danaRPump.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) + ": " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits + "U");
|
||||
NSUpload.uploadError(MainApp.gs(R.string.approachingdailylimit) + ": " + danaRPump.dailyTotalUnits + "/" + danaRPump.maxDailyTotalUnits + "U");
|
||||
}
|
||||
} catch (Exception e) {
|
||||
log.error("Unhandled exception", e);
|
||||
|
@ -202,7 +202,7 @@ public class DanaRSService extends Service {
|
|||
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)));
|
||||
bolusingTreatment = t;
|
||||
final int preferencesSpeed = SP.getInt(R.string.key_danars_bolusspeed, 0);
|
||||
DanaRS_Packet_Bolus_Set_Step_Bolus_Start start = new DanaRS_Packet_Bolus_Set_Step_Bolus_Start(insulin, preferencesSpeed);
|
||||
|
@ -258,7 +258,7 @@ public class DanaRSService extends Service {
|
|||
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);
|
||||
}
|
||||
|
@ -267,10 +267,10 @@ public class DanaRSService extends Service {
|
|||
@Override
|
||||
public void run() {
|
||||
// reread bolus status
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.gettingbolusstatus)));
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.gettingbolusstatus)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Step_Bolus_Information()); // last bolus
|
||||
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;
|
||||
|
@ -295,11 +295,11 @@ public class DanaRSService extends Service {
|
|||
public boolean tempBasal(Integer percent, int durationInHours) {
|
||||
if (!isConnected()) return false;
|
||||
if (danaRPump.isTempBasalInProgress) {
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.stoppingtempbasal)));
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.stoppingtempbasal)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal());
|
||||
SystemClock.sleep(500);
|
||||
}
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.settingtempbasal)));
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.settingtempbasal)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Set_Temporary_Basal(percent, durationInHours));
|
||||
SystemClock.sleep(200);
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State());
|
||||
|
@ -310,11 +310,11 @@ public class DanaRSService extends Service {
|
|||
|
||||
public boolean highTempBasal(Integer percent) {
|
||||
if (danaRPump.isTempBasalInProgress) {
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.stoppingtempbasal)));
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.stoppingtempbasal)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal());
|
||||
SystemClock.sleep(500);
|
||||
}
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.sResources.getString(R.string.settingtempbasal)));
|
||||
MainApp.bus().post(new EventPumpStatusChanged(MainApp.gs(R.string.settingtempbasal)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_APS_Basal_Set_Temporary_Basal(percent));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State());
|
||||
loadEvents();
|
||||
|
@ -343,7 +343,7 @@ public class DanaRSService extends Service {
|
|||
|
||||
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)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Set_Cancel_Temporary_Basal());
|
||||
bleComm.sendMessage(new DanaRS_Packet_Basal_Get_Temporary_Basal_State());
|
||||
loadEvents();
|
||||
|
@ -353,7 +353,7 @@ public class DanaRSService extends Service {
|
|||
|
||||
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)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Set_Extended_Bolus(insulin, durationInHalfHours));
|
||||
SystemClock.sleep(200);
|
||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Extended_Bolus_State());
|
||||
|
@ -364,7 +364,7 @@ public class DanaRSService extends Service {
|
|||
|
||||
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)));
|
||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Set_Extended_Bolus_Cancel());
|
||||
bleComm.sendMessage(new DanaRS_Packet_Bolus_Get_Extended_Bolus_State());
|
||||
loadEvents();
|
||||
|
@ -374,7 +374,7 @@ public class DanaRSService extends Service {
|
|||
|
||||
public boolean updateBasalsInPump(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);
|
||||
DanaRS_Packet_Basal_Set_Profile_Basal_Rate msgSet = new DanaRS_Packet_Basal_Set_Profile_Basal_Rate(0, basal);
|
||||
bleComm.sendMessage(msgSet);
|
||||
|
|
|
@ -81,7 +81,7 @@ public class CommandQueue {
|
|||
private QueueThread thread = null;
|
||||
|
||||
private PumpEnactResult executingNowError() {
|
||||
return new PumpEnactResult().success(false).enacted(false).comment(MainApp.sResources.getString(R.string.executingrightnow));
|
||||
return new PumpEnactResult().success(false).enacted(false).comment(MainApp.gs(R.string.executingrightnow));
|
||||
}
|
||||
|
||||
public boolean isRunning(Command.CommandType type) {
|
||||
|
@ -314,10 +314,10 @@ public class CommandQueue {
|
|||
}
|
||||
|
||||
if (!MainApp.isEngineeringModeOrRelease()) {
|
||||
Notification notification = new Notification(Notification.NOT_ENG_MODE_OR_RELEASE, MainApp.sResources.getString(R.string.not_eng_mode_or_release), Notification.URGENT);
|
||||
Notification notification = new Notification(Notification.NOT_ENG_MODE_OR_RELEASE, MainApp.gs(R.string.not_eng_mode_or_release), Notification.URGENT);
|
||||
MainApp.bus().post(new EventNewNotification(notification));
|
||||
if (callback != null)
|
||||
callback.result(new PumpEnactResult().success(false).comment(MainApp.sResources.getString(R.string.not_eng_mode_or_release))).run();
|
||||
callback.result(new PumpEnactResult().success(false).comment(MainApp.gs(R.string.not_eng_mode_or_release))).run();
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -327,10 +327,10 @@ public class CommandQueue {
|
|||
|
||||
for (Profile.BasalValue basalValue : basalValues) {
|
||||
if (basalValue.value < pump.getPumpDescription().basalMinimumRate) {
|
||||
Notification notification = new Notification(Notification.BASAL_VALUE_BELOW_MINIMUM, MainApp.sResources.getString(R.string.basalvaluebelowminimum), Notification.URGENT);
|
||||
Notification notification = new Notification(Notification.BASAL_VALUE_BELOW_MINIMUM, MainApp.gs(R.string.basalvaluebelowminimum), Notification.URGENT);
|
||||
MainApp.bus().post(new EventNewNotification(notification));
|
||||
if (callback != null)
|
||||
callback.result(new PumpEnactResult().success(false).comment(MainApp.sResources.getString(R.string.basalvaluebelowminimum))).run();
|
||||
callback.result(new PumpEnactResult().success(false).comment(MainApp.gs(R.string.basalvaluebelowminimum))).run();
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -33,7 +33,7 @@ import info.nightscout.androidaps.events.EventAppExit;
|
|||
public class ImportExportPrefs {
|
||||
private static Logger log = LoggerFactory.getLogger(ImportExportPrefs.class);
|
||||
static File path = new File(Environment.getExternalStorageDirectory().toString());
|
||||
static final File file = new File(path, MainApp.sResources.getString(R.string.app_name) + "Preferences");
|
||||
static final File file = new File(path, MainApp.gs(R.string.app_name) + "Preferences");
|
||||
|
||||
private static final int REQUEST_EXTERNAL_STORAGE = 1;
|
||||
private static String[] PERMISSIONS_STORAGE = {
|
||||
|
@ -59,7 +59,7 @@ public class ImportExportPrefs {
|
|||
public static void exportSharedPreferences(final Activity c) {
|
||||
|
||||
new AlertDialog.Builder(c)
|
||||
.setMessage(MainApp.sResources.getString(R.string.export_to) + " " + file + " ?")
|
||||
.setMessage(MainApp.gs(R.string.export_to) + " " + file + " ?")
|
||||
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
|
@ -73,9 +73,9 @@ public class ImportExportPrefs {
|
|||
}
|
||||
pw.close();
|
||||
fw.close();
|
||||
ToastUtils.showToastInUiThread(c, MainApp.sResources.getString(R.string.exported));
|
||||
ToastUtils.showToastInUiThread(c, MainApp.gs(R.string.exported));
|
||||
} catch (FileNotFoundException e) {
|
||||
ToastUtils.showToastInUiThread(c, MainApp.sResources.getString(R.string.filenotfound) + " " + file);
|
||||
ToastUtils.showToastInUiThread(c, MainApp.gs(R.string.filenotfound) + " " + file);
|
||||
log.error("Unhandled exception", e);
|
||||
} catch (IOException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
|
@ -88,7 +88,7 @@ public class ImportExportPrefs {
|
|||
|
||||
public static void importSharedPreferences(final Activity c) {
|
||||
new AlertDialog.Builder(c)
|
||||
.setMessage(MainApp.sResources.getString(R.string.import_from) + " " + file + " ?")
|
||||
.setMessage(MainApp.gs(R.string.import_from) + " " + file + " ?")
|
||||
.setPositiveButton(android.R.string.yes, new DialogInterface.OnClickListener() {
|
||||
public void onClick(DialogInterface dialog, int which) {
|
||||
|
||||
|
@ -113,7 +113,7 @@ public class ImportExportPrefs {
|
|||
}
|
||||
reader.close();
|
||||
editor.commit();
|
||||
OKDialog.show(c, MainApp.sResources.getString(R.string.setting_imported), MainApp.sResources.getString(R.string.restartingapp), new Runnable() {
|
||||
OKDialog.show(c, MainApp.gs(R.string.setting_imported), MainApp.gs(R.string.restartingapp), new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
log.debug("Exiting");
|
||||
|
@ -126,7 +126,7 @@ public class ImportExportPrefs {
|
|||
}
|
||||
});
|
||||
} catch (FileNotFoundException e) {
|
||||
ToastUtils.showToastInUiThread(c, MainApp.sResources.getString(R.string.filenotfound) + " " + file);
|
||||
ToastUtils.showToastInUiThread(c, MainApp.gs(R.string.filenotfound) + " " + file);
|
||||
log.error("Unhandled exception", e);
|
||||
} catch (IOException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
|
|
|
@ -496,7 +496,7 @@ public class NSUpload {
|
|||
try {
|
||||
data.put("eventType", "Note");
|
||||
data.put("created_at", DateUtil.toISOString(new Date()));
|
||||
data.put("notes", MainApp.sResources.getString(R.string.androidaps_start)+" - "+ Build.MANUFACTURER + " "+ Build.MODEL);
|
||||
data.put("notes", MainApp.gs(R.string.androidaps_start)+" - "+ Build.MANUFACTURER + " "+ Build.MODEL);
|
||||
} catch (JSONException e) {
|
||||
log.error("Unhandled exception", e);
|
||||
}
|
||||
|
|
|
@ -199,7 +199,7 @@ public class NumberPicker extends LinearLayout implements View.OnKeyListener,
|
|||
value += step * multiplier;
|
||||
if (value > maxValue) {
|
||||
value = maxValue;
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.youareonallowedlimit));
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.youareonallowedlimit));
|
||||
stopUpdating();
|
||||
}
|
||||
updateEditText();
|
||||
|
@ -209,7 +209,7 @@ public class NumberPicker extends LinearLayout implements View.OnKeyListener,
|
|||
value -= step * multiplier;
|
||||
if (value < minValue) {
|
||||
value = minValue;
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.sResources.getString(R.string.youareonallowedlimit));
|
||||
ToastUtils.showToastInUiThread(MainApp.instance().getApplicationContext(), MainApp.gs(R.string.youareonallowedlimit));
|
||||
stopUpdating();
|
||||
}
|
||||
updateEditText();
|
||||
|
|
|
@ -25,7 +25,7 @@ public class OKDialog {
|
|||
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(activity, R.style.AppTheme));
|
||||
builder.setTitle(title);
|
||||
builder.setMessage(message);
|
||||
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 which) {
|
||||
dialog.dismiss();
|
||||
if (runnable != null) {
|
||||
|
@ -46,7 +46,7 @@ public class OKDialog {
|
|||
AlertDialog.Builder builder = new AlertDialog.Builder(new ContextThemeWrapper(activity, R.style.AppTheme));
|
||||
builder.setTitle(title);
|
||||
builder.setMessage(message);
|
||||
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 which) {
|
||||
dialog.dismiss();
|
||||
if (runnable != null) {
|
||||
|
|
|
@ -37,7 +37,7 @@ public class PasswordProtection {
|
|||
alertDialogBuilder.setView(promptsView);
|
||||
|
||||
final TextView label = (TextView) promptsView.findViewById(R.id.passwordprompt_text);
|
||||
label.setText(MainApp.sResources.getString(stringID));
|
||||
label.setText(MainApp.gs(stringID));
|
||||
final EditText userInput = (EditText) promptsView.findViewById(R.id.passwordprompt_pass);
|
||||
|
||||
// set dialog message
|
||||
|
@ -50,7 +50,7 @@ public class PasswordProtection {
|
|||
if (password.equals(enteredPassword)) {
|
||||
if (ok != null) ok.run();
|
||||
} else {
|
||||
ToastUtils.showToastInUiThread(context, MainApp.sResources.getString(R.string.wrongpassword));
|
||||
ToastUtils.showToastInUiThread(context, MainApp.gs(R.string.wrongpassword));
|
||||
if (fail != null) fail.run();
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue