Skip to content

Commit 0a649c2

Browse files
committed
2 parents 496451f + 54f51d7 commit 0a649c2

File tree

8 files changed

+54
-29
lines changed

8 files changed

+54
-29
lines changed

app/src/main/AndroidManifest.xml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@
368368
<activity
369369
android:name=".stats.StatsActivity"
370370
android:configChanges="orientation|screenSize"
371-
android:label="Statistics"
371+
android:label="@string/statistics"
372372
android:theme="@style/AppTheme" />
373373
<activity
374374
android:name=".SnoozeActivity"

app/src/main/java/com/eveningoutpost/dexdrip/AlertList.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -190,11 +190,11 @@ public void run() {
190190

191191
if (!isFinishing()) {
192192
new AlertDialog.Builder(AlertList.this)
193-
.setTitle("Warning !")
194-
.setMessage("No low alert is active. You won’t be notified of low glucose—please add or enable one.")
193+
.setTitle(getString(R.string.alert_warning))
194+
.setMessage(getString(R.string.no_active_low_alert_warning))
195195
.setCancelable(false)
196196
.setPositiveButton(
197-
"Ok",
197+
getString(R.string.ok),
198198
new DialogInterface.OnClickListener() {
199199
public void onClick(DialogInterface dialog, int id) {
200200
dialog.cancel();

app/src/main/java/com/eveningoutpost/dexdrip/EditAlertActivity.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -390,15 +390,15 @@ private boolean verifyThreshold(double threshold, boolean allDay, int startTime,
390390
List<AlertType> highAlerts = AlertType.getAll(true);
391391

392392
if(threshold < MIN_ALERT || threshold > MAX_ALERT) {
393-
Toast.makeText(getApplicationContext(), "Threshold must be between " +unitsConvert2Disp(doMgdl, MIN_ALERT) + " and " + unitsConvert2Disp(doMgdl, MAX_ALERT) + ".", Toast.LENGTH_LONG).show();
393+
Toast.makeText(getApplicationContext(), getString(R.string.threshold_has_to_be_between, unitsConvert2Disp(doMgdl, MIN_ALERT), unitsConvert2Disp(doMgdl, MAX_ALERT)),Toast.LENGTH_LONG).show();
394394
return false;
395395
}
396396
// We want to make sure that for each threashold there is only one alert. Otherwise, which file should we play.
397397
for (AlertType lowAlert : lowAlerts) {
398398
if(lowAlert.threshold == threshold && overlapping(lowAlert, allDay, startTime, endTime) && lowAlert.active) {
399399
if(uuid == null || ! uuid.equals(lowAlert.uuid)){ //new alert or not myself
400400
Toast.makeText(getApplicationContext(),
401-
"Each alert needs a unique threshold. Please choose a different one.",Toast.LENGTH_LONG).show();
401+
getString(R.string.alert_threshold_already_in_use),Toast.LENGTH_LONG).show();
402402
return false;
403403
}
404404
}
@@ -407,7 +407,7 @@ private boolean verifyThreshold(double threshold, boolean allDay, int startTime,
407407
if(highAlert.threshold == threshold && overlapping(highAlert, allDay, startTime, endTime) && highAlert.active) {
408408
if(uuid == null || ! uuid.equals(highAlert.uuid)){ //new alert or not myself
409409
Toast.makeText(getApplicationContext(),
410-
"Each alert needs a unique threshold. Please choose a different one.",Toast.LENGTH_LONG).show();
410+
getString(R.string.alert_threshold_already_in_use),Toast.LENGTH_LONG).show();
411411
return false;
412412
}
413413
}
@@ -418,7 +418,7 @@ private boolean verifyThreshold(double threshold, boolean allDay, int startTime,
418418
for (AlertType lowAlert : lowAlerts) {
419419
if(threshold < lowAlert.threshold && overlapping(lowAlert, allDay, startTime, endTime) && lowAlert.active) {
420420
Toast.makeText(getApplicationContext(),
421-
"High alerts must be set above all low alerts. Please adjust the threshold.",Toast.LENGTH_LONG).show();
421+
getString(R.string.high_alert_threshold_error),Toast.LENGTH_LONG).show();
422422
return false;
423423
}
424424
}
@@ -427,7 +427,7 @@ private boolean verifyThreshold(double threshold, boolean allDay, int startTime,
427427
for (AlertType highAlert : highAlerts) {
428428
if(threshold > highAlert.threshold && overlapping(highAlert, allDay, startTime, endTime) && highAlert.active) {
429429
Toast.makeText(getApplicationContext(),
430-
"Low alerts must be set below all high alerts. Please adjust the threshold.",Toast.LENGTH_LONG).show();
430+
getString(R.string.low_alert_threshold_error),Toast.LENGTH_LONG).show();
431431
return false;
432432
}
433433
}
@@ -513,10 +513,10 @@ public void onClick(View v) {
513513
int defaultSnooze = safeGetDefaultSnooze();
514514

515515
if(alertReraise < 1) {
516-
Toast.makeText(getApplicationContext(), "Reraise Value must be 1 minute or greater", Toast.LENGTH_LONG).show();
516+
Toast.makeText(getApplicationContext(), getString(R.string.alert_reraise_value_too_small), Toast.LENGTH_LONG).show();
517517
return;
518518
} else if (alertReraise >= defaultSnooze) {
519-
Toast.makeText(getApplicationContext(), "Reraise Value must be less than snooze length", Toast.LENGTH_LONG).show();
519+
Toast.makeText(getApplicationContext(), getString(R.string.alert_reraise_value_too_big), Toast.LENGTH_LONG).show();
520520
return;
521521
}
522522

@@ -536,7 +536,7 @@ public void onClick(View v) {
536536
allDay = true;
537537
}
538538
if (timeStart == timeEnd && (allDay==false)) {
539-
Toast.makeText(getApplicationContext(), "Alert start and end times cannot be equal.", Toast.LENGTH_LONG).show();
539+
Toast.makeText(getApplicationContext(), getString(R.string.start_and_end_time_same),Toast.LENGTH_LONG).show();
540540
return;
541541
}
542542
boolean disabled = checkboxDisabled.isChecked();
@@ -592,7 +592,7 @@ public void onClick(View v) {
592592
buttonalertMp3.setOnClickListener(new View.OnClickListener() {
593593
public void onClick(View v) {
594594
AlertDialog.Builder builder = new AlertDialog.Builder(mContext);
595-
builder.setTitle("What type of sound?")
595+
builder.setTitle(getString(R.string.what_type_of_alert))
596596
.setItems(R.array.alertType, new DialogInterface.OnClickListener() {
597597
public void onClick(DialogInterface dialog, int which) {
598598
if (which == 0) {
@@ -857,7 +857,7 @@ public void onClick(View v) {
857857
d.setContentView(R.layout.snooze_picker);
858858
Button b1 = (Button) d.findViewById(R.id.button1);
859859
Button b2 = (Button) d.findViewById(R.id.button2);
860-
b1.setText("pre-Snooze");
860+
b1.setText(getString(R.string.pre_snooze));
861861

862862
final NumberPicker snoozeValue = (NumberPicker) d.findViewById(R.id.numberPicker1);
863863

@@ -928,7 +928,7 @@ public void testAlert() {
928928
allDay = true;
929929
}
930930
if (timeStart == timeEnd && (!allDay)) {
931-
Toast.makeText(getApplicationContext(), "Alert start and end times cannot be equal.", Toast.LENGTH_LONG).show();
931+
Toast.makeText(getApplicationContext(), getString(R.string.start_and_end_time_same),Toast.LENGTH_LONG).show();
932932
return;
933933
}
934934
if(!verifyThreshold(threshold, allDay, timeStart, timeEnd)) {
@@ -942,11 +942,11 @@ public void testAlert() {
942942
int defaultSnooze = safeGetDefaultSnooze();
943943

944944
if (Pref.getBooleanDefaultFalse("start_snoozed")) {
945-
JoH.static_toast_long("Start Snoozed setting means alert would normally start silent");
945+
JoH.static_toast_long(getString(R.string.start_snoozed_enabled));
946946
} else if (Pref.getStringDefaultBlank("bg_alert_profile").equals("ascending") && Pref.getBoolean("delay_ascending_3min", true)) {
947-
JoH.static_toast_long("Ascending Volume Profile + delayed ascending means it will start silent");
947+
JoH.static_toast_long(getString(R.string.volume_profile_set_to_ascending_with_delay));
948948
} else if (Pref.getStringDefaultBlank("bg_alert_profile").equals("Silent")) {
949-
JoH.static_toast_long("Volume Profile is set to silent!");
949+
JoH.static_toast_long(getString(R.string.volume_profile_set_to_silent));
950950
}
951951

952952
AlertType.testAlert(alertText.getText().toString(), above, threshold, allDay, 1, mp3_file, timeStart, timeEnd, overrideSilentMode, forceSpeaker, defaultSnooze, vibrate, mContext);

app/src/main/java/com/eveningoutpost/dexdrip/models/Calibration.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,7 @@
4242

4343
import static com.eveningoutpost.dexdrip.models.BgReading.isDataSuitableForDoubleCalibration;
4444
import static com.eveningoutpost.dexdrip.calibrations.PluggableCalibration.newFingerStickData;
45+
import static com.eveningoutpost.dexdrip.utils.DexCollectionType.getBestCollectorHardwareName;
4546

4647

4748
class DexParameters extends SlopeParameters {
@@ -640,7 +641,8 @@ public static Calibration create(double bg, long timeoffset, Context context, bo
640641
} else {
641642
Log.d(TAG, "Follower mode or note so not processing calibration deeply");
642643
}
643-
} else {
644+
} else if (!getBestCollectorHardwareName().equals("G7")) {
645+
// Only if we are not using newer devices, which are limited to native behavior
644646
final String msg = "Sensor data fails sanity test - Cannot Calibrate! raw:" + bgReading.raw_data;
645647
UserError.Log.e(TAG, msg);
646648
JoH.static_toast_long(msg);

app/src/main/java/com/eveningoutpost/dexdrip/models/SensorSanity.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
package com.eveningoutpost.dexdrip.models;
22

3+
import static com.eveningoutpost.dexdrip.utils.DexCollectionType.getBestCollectorHardwareName;
4+
35
import com.eveningoutpost.dexdrip.Home;
46
import com.eveningoutpost.dexdrip.models.UserError.Log;
57
import com.eveningoutpost.dexdrip.utilitymodels.PersistentStore;
@@ -71,7 +73,7 @@ public static boolean isRawValueSane(double raw_value, DexCollectionType type, b
7173
else if (raw_value > DEXCOM_MAX_RAW) state = false;
7274
}
7375

74-
if (!state) {
76+
if (!state && !getBestCollectorHardwareName().equals("G7")) {
7577
if (JoH.ratelimit("sanity-failure", 20)) {
7678
final String msg = "Sensor Raw Data Sanity Failure: " + raw_value;
7779
UserError.Log.e(TAG, msg);

app/src/main/java/com/eveningoutpost/dexdrip/utils/Preferences.java

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1133,7 +1133,6 @@ public void onCreate(Bundle savedInstanceState) {
11331133
bindPreferenceSummaryToValue(findPreference("falling_bg_val"));
11341134
bindPreferenceSummaryToValue(findPreference("rising_bg_val"));
11351135
bindPreferenceSummaryToValue(findPreference("other_alerts_sound"));
1136-
bindPreferenceSummaryToValue(findPreference("bridge_battery_alert_level"));
11371136
bindPreferenceSummaryToUnitizedValueAndEnsureNumeric(findPreference("persistent_high_threshold"));
11381137
bindPreferenceSummaryToUnitizedValueAndEnsureNumeric(findPreference("forecast_low_threshold"));
11391138

app/src/main/res/values/arrays.xml

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,11 +166,11 @@
166166

167167
<!-- make sure to keep this values in sync with AlertPlayer.getAlertProfile -->
168168
<string-array name="BgAlertProfileEntries">
169-
<item>High</item>
170-
<item>Medium</item>
171-
<item>Ascending</item>
172-
<item>Vibrate only</item>
173-
<item>Silent</item>
169+
<item>@string/volume_profile_high</item>
170+
<item>@string/volume_profile_medium</item>
171+
<item>@string/volume_profile_ascending</item>
172+
<item>@string/volume_profile_vibrate_only</item>
173+
<item>@string/volume_profile_silent</item>
174174
</string-array>
175175

176176
<string-array name="BgAlertProfileValues">
@@ -194,9 +194,9 @@
194194
</string-array>
195195

196196
<string-array name="alertType">
197-
<item>System Sound/Alarm</item>
198-
<item>Custom Sound/Alarm</item>
199-
<item>Default xDrip sound</item>
197+
<item>@string/system_sound_alarm</item>
198+
<item>@string/custom_sound_alarm</item>
199+
<item>@string/default_xdrip_sound</item>
200200
</string-array>
201201

202202
<string-array name="reminderAlertType">

app/src/main/res/values/strings.xml

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1983,4 +1983,26 @@
19831983
<string name="last_90_days">Last 90 days</string>
19841984
<string name="scan_with_xdrip_settings_auto_configure"><![CDATA[Scan with\nxDrip Settings -> Auto Configure]]></string>
19851985
<string name="could_not_create_qr_code">Could not create QR code</string>
1986+
<string name="alert_warning">Warning !</string>
1987+
<string name="no_active_low_alert_warning">No low alert is active. You won\'t be notified of low glucose—please add or enable one.</string>
1988+
<string name="volume_profile_set_to_silent">Volume Profile is set to silent!</string>
1989+
<string name="volume_profile_set_to_ascending_with_delay">Ascending Volume Profile + delayed ascending means it will start silent</string>
1990+
<string name="start_snoozed_enabled">Start Snoozed setting means alert would normally start silent</string>
1991+
<string name="pre_snooze">pre-Snooze</string>
1992+
<string name="volume_profile_high">High</string>
1993+
<string name="volume_profile_medium">Medium</string>
1994+
<string name="volume_profile_ascending">Ascending</string>
1995+
<string name="volume_profile_vibrate_only">Vibrate only</string>
1996+
<string name="volume_profile_silent">Silent</string>
1997+
<string name="alert_threshold_already_in_use">Each alert needs a unique threshold. Please choose a different one.</string>
1998+
<string name="high_alert_threshold_error">High alerts must be set above all low alerts. Please adjust the threshold.</string>
1999+
<string name="low_alert_threshold_error">Low alerts must be set below all high alerts. Please adjust the threshold.</string>
2000+
<string name="threshold_has_to_be_between">Threshold must be between %1$s and %2$s.</string>
2001+
<string name="alert_reraise_value_too_small">Reraise Value must be 1 minute or greater</string>
2002+
<string name="alert_reraise_value_too_big">Reraise Value must be less than snooze length</string>
2003+
<string name="start_and_end_time_same">Alert start and end times cannot be equal.</string>
2004+
<string name="what_type_of_alert">What type of sound?</string>
2005+
<string name="system_sound_alarm">System Sound/Alarm</string>
2006+
<string name="custom_sound_alarm">Custom Sound/Alarm</string>
2007+
<string name="default_xdrip_sound">Default xDrip sound</string>
19862008
</resources>

0 commit comments

Comments
 (0)