Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
jamorham committed May 12, 2024
2 parents 72149f6 + e713834 commit db904ab
Show file tree
Hide file tree
Showing 7 changed files with 51 additions and 34 deletions.
26 changes: 14 additions & 12 deletions app/src/main/java/com/eveningoutpost/dexdrip/EditAlertActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@
import com.eveningoutpost.dexdrip.models.AlertType;
import com.eveningoutpost.dexdrip.models.JoH;
import com.eveningoutpost.dexdrip.models.UserError.Log;
import com.eveningoutpost.dexdrip.ui.dialog.GenericConfirmDialog;
import com.eveningoutpost.dexdrip.utilitymodels.AlertPlayer;
import com.eveningoutpost.dexdrip.utilitymodels.BgGraphBuilder;
import com.eveningoutpost.dexdrip.utilitymodels.Constants;
Expand Down Expand Up @@ -565,19 +566,20 @@ public void onClick(View v) {

buttonRemove.setOnClickListener(new View.OnClickListener() {
public void onClick(View v) {


if (uuid == null) {
Log.wtf(TAG, "Error remove pressed, while we were adding an alert");
} else {
AlertType.remove_alert(uuid);
startWatchUpdaterService(mContext, WatchUpdaterService.ACTION_SYNC_ALERTTYPE, TAG);
}
Intent returnIntent = new Intent();
setResult(RESULT_OK,returnIntent);
finish();
GenericConfirmDialog.show(EditAlertActivity.this, gs(R.string.are_you_sure), gs(R.string.you_cannot_undo_delete_alert),
() -> { // This, which deletes the alert, will only be executed after confirmation
if (uuid == null) {
Log.wtf(TAG, "Error remove pressed, while we were adding an alert");
} else {
AlertType.remove_alert(uuid);
startWatchUpdaterService(mContext, WatchUpdaterService.ACTION_SYNC_ALERTTYPE, TAG);
}
Intent returnIntent = new Intent();
setResult(RESULT_OK, returnIntent);
finish();
}
);
}

});

buttonTest.setOnClickListener(new View.OnClickListener() {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -365,7 +365,7 @@ private static void handleAuthenticationThrowable(final Throwable throwable, fin
// parent.reset_bond(true);
// parent.unBond(); // WARN
} else {
UserError.Log.e(TAG, "authentication notification throwable: (" + parent.getState() + ") " + throwable + " " + JoH.dateTimeText(tsl()));
UserError.Log.d(TAG, "authentication notification throwable: (" + parent.getState() + ") " + throwable + " " + JoH.dateTimeText(tsl()));
parent.incrementErrors();
if (throwable instanceof BleCannotSetCharacteristicNotificationException
|| throwable instanceof BleGattCharacteristicException) {
Expand Down Expand Up @@ -419,7 +419,7 @@ private static void authenticationProcessor(final Ob1G5CollectionService parent,
if (throwable instanceof OperationSuccess) {
UserError.Log.d(TAG, "Stopping auth challenge listener due to success");
} else {
UserError.Log.e(TAG, "Could not read reply to auth challenge: " + throwable);
UserError.Log.d(TAG, "Could not read reply to auth challenge: " + throwable);
parent.incrementErrors();
speakSlowly = true;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public class BroadcastGlucose {
private static final String TAG = "BroadcastGlucose";
private static long lastTimestamp = 0;
private static long dexStartedAt = 0;
private static boolean connectedToG7 = false;
private static boolean connectedToG6 = false;
private static boolean usingG6OrG7 = false;

public static void sendLocalBroadcast(final BgReading bgReading) {
if (SendXdripBroadcast.enabled()) {
Expand Down Expand Up @@ -152,14 +155,23 @@ public static void sendLocalBroadcast(final BgReading bgReading) {
}

bundle.putInt(Intents.EXTRA_SENSOR_BATTERY, BridgeBattery.getBestBridgeBattery());
if (getBestCollectorHardwareName().equals("G7")) {// If we are using G7 or One+
if (FirmwareCapability.isDeviceG7(getTransmitterID())) { // Only if there is connectivity
if (getBestCollectorHardwareName().equals("G7") || getBestCollectorHardwareName().equals("Native G6")) { // If we are using G7 or One+, or G6 in native mode
usingG6OrG7 = true;
}
if (getBestCollectorHardwareName().equals("G7") && FirmwareCapability.isDeviceG7(getTransmitterID())) { // If we are using G7 or One+ and there is connectivity
connectedToG7 = true;
}
if (getBestCollectorHardwareName().equals("G6 Native") && FirmwareCapability.isTransmitterG6(getTransmitterID())) { // If we are using a G6 in native mode and there is connectivity
connectedToG6 = true;
}
if (usingG6OrG7) { // If we are using G7 or G6 in native mode
if (connectedToG6 || connectedToG7) { // Only if there is connectivity
dexStartedAt = DexSessionKeeper.getStart(); // Session start time reported by the Dexcom transmitter
if (dexStartedAt > 0) { // Only if dexStartedAt is valid
bundle.putLong(Intents.EXTRA_SENSOR_STARTED_AT, dexStartedAt);
}
}
} else { // If we are not using G7 or One+
} else { // If we are not using G7, One+ or G6 in native mode
bundle.putLong(Intents.EXTRA_SENSOR_STARTED_AT, sensor.started_at);
}
bundle.putLong(Intents.EXTRA_TIMESTAMP, bgReading.timestamp);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,18 +44,16 @@ public void onReceive(Context context, Intent intent) {
final int state = intent.getIntExtra(BluetoothHeadset.EXTRA_STATE, -1);
final int previousState = intent.getIntExtra(BluetoothHeadset.EXTRA_PREVIOUS_STATE, -1);
final String deviceInfo = device.getName() + "\n" + device.getAddress() + " " + (device.getBluetoothClass() != null ? device.getBluetoothClass() : "<unknown class>");
//UserError.Log.uel(TAG, "Bluetooth audio connection state change: " + state + " was " + previousState + " " + device.getAddress() + " " + device.getName());
// UserError.Log.uel(TAG, "Bluetooth audio connection state change: from " + previousState + " to " + state + " " + device.getAddress() + " " + device.getName());
if (state == BluetoothProfile.STATE_CONNECTED && previousState != BluetoothProfile.STATE_CONNECTED) {
PersistentStore.setString(PREF_LAST_CONNECTED_MAC, device.getAddress());
PersistentStore.setString(PREF_LAST_CONNECTED_NAME, device.getName());
UserError.Log.uel(TAG, "Bluetooth Audio connected: " + deviceInfo);
processDevice(device.getAddress(), true);

} else if (state == BluetoothProfile.STATE_DISCONNECTED && previousState == BluetoothProfile.STATE_CONNECTED) {
} else if (state == BluetoothProfile.STATE_DISCONNECTED && previousState != BluetoothProfile.STATE_DISCONNECTED) {
UserError.Log.uel(TAG, "Bluetooth Audio disconnected: " + deviceInfo);
processDevice(device.getAddress(), false);
}

} else {
UserError.Log.d(TAG, "Device was null in intent!");
}
Expand Down
4 changes: 3 additions & 1 deletion app/src/main/res/values/strings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1773,8 +1773,9 @@
<string name="special_pairing_workaround">Special Pairing Workaround</string>
<string name="save_power">Save Power</string>
<string name="reduce_battery_and_network_overhead">Reduce battery and network overhead by using batch processing and excluding unnecessary data</string>
<string name="simplify_graphs_by_smoothing_out_irregularities">Simplify graphs by smoothing out irregularities</string>
<string name="simplify_graphs_by_smoothing_out_irregularities">Simplify graphs by smoothing out irregularities in the previous readings. The current reading, alerts and broadcast value are not affected by this setting. </string>
<string name="graph_smoothing">Graph Smoothing</string>
<string name="enable_graph_smoothing">Enable</string>
<string name="last_reading">Last Reading</string>
<string name="select_file_for_alert">Select File for Alert</string>
<string name="cannot_choose_file_without_permission">Cannot choose file without storage permission</string>
Expand Down Expand Up @@ -1828,6 +1829,7 @@
<string name="cloud_backup">Cloud Backup</string>
<string name="select_automatic_or_select_alternate">Select Automatic for xDrip to manage files in Google Drive or select an alternate specific file to use if you need to restore from elsewhere.</string>
<string name="restoring_backup_will_erase_warning">Restoring a backup will erase your current settings and data with that from the backup.\n\nAre you absolutely sure you wish to do this?</string>
<string name="you_cannot_undo_delete_alert">You will not be able to undo this!\n\nAre you sure you want to delete this alert?</string>
<string name="this_backup_looks_like_came_from_different_format_string">This backup looks like it came from a different device:\n%s\nAre you sure you wish to restore from this backup?</string>
<string name="megabyte_format_string">%.1f MB</string>
<string name="manual_selection_google_drive_file_warning">You have selected a file from Google Drive, but this is not automatically managed by xDrip so it can only be used for manual backups and restoring.\n\nNo automatic backing up will occur with this file.\n\nContinue?</string>
Expand Down
5 changes: 0 additions & 5 deletions app/src/main/res/xml/pref_advanced_settings.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1513,11 +1513,6 @@
android:key="predictive_bg"
android:summary="@string/predictive_readings_old"
android:title="@string/display_predictive_values" />
<CheckBoxPreference
android:defaultValue="false"
android:key="show-unsmoothed-values-as-plugin"
android:summary="@string/show_unsmoothed_summary"
android:title="@string/show_unsmoothed" />
<CheckBoxPreference
android:defaultValue="true"
android:dependency="engineering_mode"
Expand Down
22 changes: 15 additions & 7 deletions app/src/main/res/xml/xdrip_plus_prefs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -352,13 +352,21 @@
android:summary="@string/summary_xdrip_plus_graph_display_settings"
android:title="@string/title_xdrip_plus_graph_display_settings">

<SwitchPreference
android:defaultValue="false"
android:key="graph_smoothing"
android:summary="@string/simplify_graphs_by_smoothing_out_irregularities"
android:switchTextOff="@string/short_off_text_for_switches"
android:switchTextOn="@string/short_on_text_for_switches"
android:title="@string/graph_smoothing" />
<PreferenceScreen
android:key="graph_smoothing_screen"
android:title="@string/graph_smoothing">
<CheckBoxPreference
android:defaultValue="false"
android:key="graph_smoothing"
android:summary="@string/simplify_graphs_by_smoothing_out_irregularities"
android:title="@string/enable_graph_smoothing" />
<CheckBoxPreference
android:defaultValue="false"
android:dependency="graph_smoothing"
android:key="show-unsmoothed-values-as-plugin"
android:summary="@string/show_unsmoothed_summary"
android:title="@string/show_unsmoothed" />
</PreferenceScreen>

<CheckBoxPreference
android:defaultValue="false"
Expand Down

0 comments on commit db904ab

Please sign in to comment.