From bedcb2eaa962ad1fc1ba7569c405aa3e04f2600b Mon Sep 17 00:00:00 2001 From: Navid <51497406+Navid200@users.noreply.github.com> Date: Sun, 10 Mar 2024 13:45:21 -0400 Subject: [PATCH] No battery options for G7 (#3295) * No battery options for G7 * Cleanup * Try exception added --------- Co-authored-by: Navid --- .../dexdrip/g5model/Ob1G5StateMachine.java | 1 + .../com/eveningoutpost/dexdrip/utils/Preferences.java | 11 +++++++++++ app/src/main/res/values/strings.xml | 2 +- 3 files changed, 13 insertions(+), 1 deletion(-) 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 9374069db..02dfb7bc9 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1G5StateMachine.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/g5model/Ob1G5StateMachine.java @@ -1124,6 +1124,7 @@ public static boolean shortTxId() { return getTransmitterID().length() < 6; } + private static Ob1Work enqueueCommand(BaseMessage tm, String msg) { if (tm != null) { final Ob1Work item = new Ob1Work(tm, msg); diff --git a/app/src/main/java/com/eveningoutpost/dexdrip/utils/Preferences.java b/app/src/main/java/com/eveningoutpost/dexdrip/utils/Preferences.java index 4faa7f646..8db254ccb 100644 --- a/app/src/main/java/com/eveningoutpost/dexdrip/utils/Preferences.java +++ b/app/src/main/java/com/eveningoutpost/dexdrip/utils/Preferences.java @@ -1,5 +1,6 @@ package com.eveningoutpost.dexdrip.utils; +import static com.eveningoutpost.dexdrip.utils.DexCollectionType.getBestCollectorHardwareName; import static com.eveningoutpost.dexdrip.xdrip.gs; import android.Manifest; @@ -1731,6 +1732,16 @@ public boolean onPreferenceChange(Preference preference, Object newValue) { } } + if (getBestCollectorHardwareName().equals("G7")) { // Remove battery options, from G5/G6/Dex1/G7 Debug Settings, if we are using G7 or One+ + try { + PreferenceScreen screen = (PreferenceScreen) findPreference("xdrip_plus_g5_extra_settings"); + Preference pref = getPreferenceManager().findPreference("dex_battery_category"); + screen.removePreference(pref); + } catch (Exception e) { + UserError.Log.wtf(TAG, "Failed to remove G7 battery options"); + } + } + //Remove CL prefs for NON CLFollower if (collectionType != DexCollectionType.CLFollow) { try { diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 407600f98..31ec97656 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1390,7 +1390,7 @@ OB1 collector can initiate bonding. Allow OB1 initiate bonding Old G5 Collector Settings - G5/G6/G7/1 battery options + G5/G6/Dex1 battery options Adjust battery warning level Plugins and Features Heart rate monitor