1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-26 10:35:50 +01:00

Garmin Fenix 8: Initial support

This commit is contained in:
José Rebelo 2024-10-10 20:47:35 +01:00
parent f9150f4c2c
commit 400d2aeaba
5 changed files with 56 additions and 9 deletions

View File

@ -22,12 +22,9 @@ import android.content.Context;
import android.content.Intent; import android.content.Intent;
import android.content.IntentFilter; import android.content.IntentFilter;
import android.os.Bundle; import android.os.Bundle;
import android.text.Editable;
import android.text.InputFilter; import android.text.InputFilter;
import android.text.InputType; import android.text.InputType;
import android.text.TextWatcher;
import android.widget.ArrayAdapter; import android.widget.ArrayAdapter;
import android.widget.EditText;
import android.widget.Toast; import android.widget.Toast;
import androidx.annotation.DrawableRes; import androidx.annotation.DrawableRes;
@ -411,6 +408,7 @@ public class GarminRealtimeSettingsFragment extends AbstractPreferenceFragment {
case 2: // garmin pay case 2: // garmin pay
case 7: // text responses case 7: // text responses
case 8: // music providers case 8: // music providers
case 17: // Solar Intensity
case 29: // Set Up ECG App case 29: // Set Up ECG App
case 30: // ECG case 30: // ECG
pref = new Preference(activity); 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 // 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--) { for (int i = prefScreen.getPreferenceCount() - 1; i >= 0; i--) {
final Preference lastVisiblePreference = prefScreen.getPreference(i); final Preference pref = prefScreen.getPreference(i);
if (lastVisiblePreference.isVisible() && !(lastVisiblePreference instanceof PreferenceCategory)) { if (pref instanceof PreferenceCategory) {
break; lastSeenCategory = (PreferenceCategory) pref;
if (!previousWasVisible) {
lastSeenCategory.setVisible(false);
} }
if (lastVisiblePreference instanceof PreferenceCategory) {
lastVisiblePreference.setVisible(false); previousWasVisible = false;
} else {
previousWasVisible |= pref.isVisible();
} }
} }
if (!previousWasVisible && lastSeenCategory != null) {
lastSeenCategory.setVisible(false);
}
} }
@DrawableRes @DrawableRes
@ -793,7 +802,12 @@ public class GarminRealtimeSettingsFragment extends AbstractPreferenceFragment {
case 11: // Connectivity case 11: // Connectivity
return R.drawable.ic_bluetooth_searching; return R.drawable.ic_bluetooth_searching;
case 13: // Audio Prompts case 13: // Audio Prompts
case 60: // Sound & Vibe
return R.drawable.ic_volume_up; 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 case 14: // User Profile
return R.drawable.ic_person; return R.drawable.ic_person;
case 15: // Safety & Tracking case 15: // Safety & Tracking

View File

@ -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;
}
}

View File

@ -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.GarminFenix6SapphireCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.fenix.GarminFenix7ProCoordinator; 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.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.GarminForerunner165Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.forerunner.GarminForerunner245Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.forerunner.GarminForerunner245Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.forerunner.GarminForerunner245MusicCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.garmin.watches.forerunner.GarminForerunner245MusicCoordinator;
@ -411,6 +412,7 @@ public enum DeviceType {
GARMIN_FENIX_6_SAPPHIRE(GarminFenix6SapphireCoordinator.class), GARMIN_FENIX_6_SAPPHIRE(GarminFenix6SapphireCoordinator.class),
GARMIN_FENIX_7S(GarminFenix7SCoordinator.class), GARMIN_FENIX_7S(GarminFenix7SCoordinator.class),
GARMIN_FENIX_7_PRO(GarminFenix7ProCoordinator.class), GARMIN_FENIX_7_PRO(GarminFenix7ProCoordinator.class),
GARMIN_FENIX_8(GarminFenix8Coordinator.class),
GARMIN_FORERUNNER_165(GarminForerunner165Coordinator.class), GARMIN_FORERUNNER_165(GarminForerunner165Coordinator.class),
GARMIN_FORERUNNER_245(GarminForerunner245Coordinator.class), GARMIN_FORERUNNER_245(GarminForerunner245Coordinator.class),
GARMIN_FORERUNNER_245_MUSIC(GarminForerunner245MusicCoordinator.class), GARMIN_FORERUNNER_245_MUSIC(GarminForerunner245MusicCoordinator.class),

View File

@ -0,0 +1,12 @@
<vector xmlns:android="http://schemas.android.com/apk/res/android"
android:width="24dp"
android:height="24dp"
android:tint="#7E7E7E"
android:viewportWidth="24"
android:viewportHeight="24">
<path
android:fillColor="@android:color/white"
android:pathData="M5,15L3,15v4c0,1.1 0.9,2 2,2h4v-2L5,19v-4zM5,5h4L9,3L5,3c-1.1,0 -2,0.9 -2,2v4h2L5,5zM19,3h-4v2h4v4h2L21,5c0,-1.1 -0.9,-2 -2,-2zM19,19h-4v2h4c1.1,0 2,-0.9 2,-2v-4h-2v4zM12,9c-1.66,0 -3,1.34 -3,3s1.34,3 3,3 3,-1.34 3,-3 -1.34,-3 -3,-3z" />
</vector>

View File

@ -1733,6 +1733,7 @@
<string name="devicetype_garmin_fenix_6_sapphire">Garmin Fenix 6 Sapphire</string> <string name="devicetype_garmin_fenix_6_sapphire">Garmin Fenix 6 Sapphire</string>
<string name="devicetype_garmin_fenix_7s">Garmin Fenix 7S</string> <string name="devicetype_garmin_fenix_7s">Garmin Fenix 7S</string>
<string name="devicetype_garmin_fenix_7_pro">Garmin Fenix 7 Pro</string> <string name="devicetype_garmin_fenix_7_pro">Garmin Fenix 7 Pro</string>
<string name="devicetype_garmin_fenix_8">Garmin Fenix 8</string>
<string name="devicetype_garmin_instinct">Garmin Instinct</string> <string name="devicetype_garmin_instinct">Garmin Instinct</string>
<string name="devicetype_garmin_instinct_solar">Garmin Instinct Solar</string> <string name="devicetype_garmin_instinct_solar">Garmin Instinct Solar</string>
<string name="devicetype_garmin_instinct_2s">Garmin Instinct 2S</string> <string name="devicetype_garmin_instinct_2s">Garmin Instinct 2S</string>