diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/EditAlertActivity.java b/app/src/main/java/com/eveningoutpost/dexdrip/EditAlertActivity.java index 2781bf027b..5551f78785 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/EditAlertActivity.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/EditAlertActivity.java @@ -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; @@ -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() { diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1G5StateMachine.java b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1G5StateMachine.java index 69240fde61..adb22b6a81 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1G5StateMachine.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1G5StateMachine.java @@ -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) { @@ -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; } diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java b/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java index 975eb64085..25d9542b57 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/utilitymodels/BroadcastGlucose.java @@ -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()) { @@ -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); diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/utils/HeadsetStateReceiver.java b/app/src/main/java/com/eveningoutpost/dexdrip/utils/HeadsetStateReceiver.java index 84eaa0eaca..d735138529 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/utils/HeadsetStateReceiver.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/utils/HeadsetStateReceiver.java @@ -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() : ""); - //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!"); } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 31ec97656c..1d28876c04 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1773,8 +1773,9 @@ Special Pairing Workaround Save Power Reduce battery and network overhead by using batch processing and excluding unnecessary data - 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. Graph Smoothing + Enable Last Reading Select File for Alert Cannot choose file without storage permission @@ -1828,6 +1829,7 @@ Cloud Backup 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. 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? + You will not be able to undo this!\n\nAre you sure you want to delete this alert? This backup looks like it came from a different device:\n%s\nAre you sure you wish to restore from this backup? %.1f MB 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? diff --git a/app/src/main/res/xml/pref_advanced_settings.xml b/app/src/main/res/xml/pref_advanced_settings.xml index b7ee5658eb..60563ab746 100644 --- a/app/src/main/res/xml/pref_advanced_settings.xml +++ b/app/src/main/res/xml/pref_advanced_settings.xml @@ -1513,11 +1513,6 @@ android:key="predictive_bg" android:summary="@string/predictive_readings_old" android:title="@string/display_predictive_values" /> - - + + + +