diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/garmin/GarminRealtimeSettingsFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/garmin/GarminRealtimeSettingsFragment.java index a487b88ee..bd98d6e2b 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/garmin/GarminRealtimeSettingsFragment.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/garmin/GarminRealtimeSettingsFragment.java @@ -22,12 +22,9 @@ import android.content.Context; import android.content.Intent; import android.content.IntentFilter; import android.os.Bundle; -import android.text.Editable; import android.text.InputFilter; import android.text.InputType; -import android.text.TextWatcher; import android.widget.ArrayAdapter; -import android.widget.EditText; import android.widget.Toast; import androidx.annotation.DrawableRes; @@ -411,6 +408,7 @@ public class GarminRealtimeSettingsFragment extends AbstractPreferenceFragment { case 2: // garmin pay case 7: // text responses case 8: // music providers + case 17: // Solar Intensity case 29: // Set Up ECG App case 30: // ECG pref = new Preference(activity); @@ -748,15 +746,26 @@ public class GarminRealtimeSettingsFragment extends AbstractPreferenceFragment { } // If no preferences after the last visible preference category are visible, hide it + boolean previousWasVisible = false; + PreferenceCategory lastSeenCategory = null; for (int i = prefScreen.getPreferenceCount() - 1; i >= 0; i--) { - final Preference lastVisiblePreference = prefScreen.getPreference(i); - if (lastVisiblePreference.isVisible() && !(lastVisiblePreference instanceof PreferenceCategory)) { - break; - } - if (lastVisiblePreference instanceof PreferenceCategory) { - lastVisiblePreference.setVisible(false); + final Preference pref = prefScreen.getPreference(i); + if (pref instanceof PreferenceCategory) { + lastSeenCategory = (PreferenceCategory) pref; + + if (!previousWasVisible) { + lastSeenCategory.setVisible(false); + } + + previousWasVisible = false; + } else { + previousWasVisible |= pref.isVisible(); } } + + if (!previousWasVisible && lastSeenCategory != null) { + lastSeenCategory.setVisible(false); + } } @DrawableRes @@ -793,7 +802,12 @@ public class GarminRealtimeSettingsFragment extends AbstractPreferenceFragment { case 11: // Connectivity return R.drawable.ic_bluetooth_searching; case 13: // Audio Prompts + case 60: // Sound & Vibe return R.drawable.ic_volume_up; + case 61: // Display & Brightness + return R.drawable.ic_wb_sunny; + case 62: // Focus Modes + return R.drawable.ic_focus; case 14: // User Profile return R.drawable.ic_person; case 15: // Safety & Tracking diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/garmin/watches/fenix/GarminFenix8Coordinator.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/garmin/watches/fenix/GarminFenix8Coordinator.java new file mode 100644 index 000000000..f971ba589 --- /dev/null +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/garmin/watches/fenix/GarminFenix8Coordinator.java @@ -0,0 +1,18 @@ +package nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.fenix; + +import java.util.regex.Pattern; + +import nodomain.freeyourgadget.gadgetbridge.R; +import nodomain.freeyourgadget.gadgetbridge.devices.garmin.GarminCoordinator; + +public class GarminFenix8Coordinator extends GarminCoordinator { + @Override + protected Pattern getSupportedDeviceName() { + return Pattern.compile("^fenix 8( - [\\d+]+mm)?$"); + } + + @Override + public int getDeviceNameResource() { + return R.string.devicetype_garmin_fenix_8; + } +} diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java index 46ee41b6a..b6c037c9e 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/DeviceType.java @@ -63,6 +63,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.fenix.GarminF import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.fenix.GarminFenix6SapphireCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.fenix.GarminFenix7ProCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.fenix.GarminFenix7SCoordinator; +import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.fenix.GarminFenix8Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.forerunner.GarminForerunner165Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.forerunner.GarminForerunner245Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.forerunner.GarminForerunner245MusicCoordinator; @@ -411,6 +412,7 @@ public enum DeviceType { GARMIN_FENIX_6_SAPPHIRE(GarminFenix6SapphireCoordinator.class), GARMIN_FENIX_7S(GarminFenix7SCoordinator.class), GARMIN_FENIX_7_PRO(GarminFenix7ProCoordinator.class), + GARMIN_FENIX_8(GarminFenix8Coordinator.class), GARMIN_FORERUNNER_165(GarminForerunner165Coordinator.class), GARMIN_FORERUNNER_245(GarminForerunner245Coordinator.class), GARMIN_FORERUNNER_245_MUSIC(GarminForerunner245MusicCoordinator.class), diff --git a/app/src/main/res/drawable/ic_focus.xml b/app/src/main/res/drawable/ic_focus.xml new file mode 100644 index 000000000..02d10808a --- /dev/null +++ b/app/src/main/res/drawable/ic_focus.xml @@ -0,0 +1,12 @@ + + + + + diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index e4a673018..b40762441 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -1733,6 +1733,7 @@ Garmin Fenix 6 Sapphire Garmin Fenix 7S Garmin Fenix 7 Pro + Garmin Fenix 8 Garmin Instinct Garmin Instinct Solar Garmin Instinct 2S