mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2026-07-31 07:44:24 +02:00
Zepp OS: Enable workout detection sensitivity for Helio Strap
- Add supportsWorkoutActivityTypesConfiguration() to enable workout settings for devices without display - Add supportsWorkoutDetectionCategories() to control visibility of workout categories - Update ZeppOsSettingsCustomizer to hide workout categories preference for devices that don't support it - Enable workout detection sensitivity configuration for Amazfit Helio Strap - Workout categories selector is hidden for Helio Strap, only alert and sensitivity settings are shown This allows the Helio Strap to configure automatic workout detection sensitivity despite having no display.
This commit is contained in:
+18
-8
@@ -466,16 +466,18 @@ public abstract class ZeppOsCoordinator extends HuamiCoordinator {
|
||||
//
|
||||
// Workout
|
||||
//
|
||||
if (hasDisplay()) {
|
||||
if (hasDisplay() || supportsWorkoutActivityTypesConfiguration()) {
|
||||
final List<Integer> workout = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.WORKOUT);
|
||||
if (hasGps(device)) {
|
||||
workout.add(R.xml.devicesettings_gps_agps);
|
||||
} else {
|
||||
// If the device has GPS, it doesn't report workout start/end to the phone
|
||||
workout.add(R.xml.devicesettings_workout_start_on_phone);
|
||||
workout.add(R.xml.devicesettings_workout_send_gps_to_band);
|
||||
if (hasDisplay()) {
|
||||
if (hasGps(device)) {
|
||||
workout.add(R.xml.devicesettings_gps_agps);
|
||||
} else {
|
||||
// If the device has GPS, it doesn't report workout start/end to the phone
|
||||
workout.add(R.xml.devicesettings_workout_start_on_phone);
|
||||
workout.add(R.xml.devicesettings_workout_send_gps_to_band);
|
||||
}
|
||||
workout.add(R.xml.devicesettings_workout_keep_screen_on);
|
||||
}
|
||||
workout.add(R.xml.devicesettings_workout_keep_screen_on);
|
||||
workout.add(R.xml.devicesettings_workout_detection);
|
||||
}
|
||||
|
||||
@@ -649,6 +651,14 @@ public abstract class ZeppOsCoordinator extends HuamiCoordinator {
|
||||
return false;
|
||||
}
|
||||
|
||||
public boolean supportsWorkoutActivityTypesConfiguration() {
|
||||
return hasDisplay();
|
||||
}
|
||||
|
||||
public boolean supportsWorkoutDetectionCategories() {
|
||||
return hasDisplay();
|
||||
}
|
||||
|
||||
public boolean supportsFtpServer(final GBDevice device) {
|
||||
return false;
|
||||
}
|
||||
|
||||
+11
@@ -54,9 +54,11 @@ import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
||||
|
||||
public class ZeppOsSettingsCustomizer extends HuamiSettingsCustomizer {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(ZeppOsSettingsCustomizer.class);
|
||||
private final GBDevice device;
|
||||
|
||||
public ZeppOsSettingsCustomizer(final GBDevice device, final List<HuamiVibrationPatternNotificationType> vibrationPatternNotificationTypes) {
|
||||
super(device, vibrationPatternNotificationTypes);
|
||||
this.device = device;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -202,6 +204,15 @@ public class ZeppOsSettingsCustomizer extends HuamiSettingsCustomizer {
|
||||
);
|
||||
}
|
||||
|
||||
// Hide workout detection categories for devices without display (e.g., Helio Strap)
|
||||
final ZeppOsCoordinator coordinator = (ZeppOsCoordinator) device.getDeviceCoordinator();
|
||||
if (!coordinator.supportsWorkoutDetectionCategories()) {
|
||||
final Preference workoutCategoriesPref = handler.findPreference("workout_detection_categories");
|
||||
if (workoutCategoriesPref != null) {
|
||||
workoutCategoriesPref.setVisible(false);
|
||||
}
|
||||
}
|
||||
|
||||
// Hides the headers if none of the preferences under them are available
|
||||
hidePrefIfNoneVisible(handler, DeviceSettingsPreferenceConst.PREF_HEADER_APPS, Arrays.asList(
|
||||
LoyaltyCardsSettingsConst.PREF_KEY_LOYALTY_CARDS
|
||||
|
||||
+10
@@ -52,6 +52,16 @@ public class AmazfitHelioStrapCoordinator extends ZeppOsCoordinator {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsWorkoutActivityTypesConfiguration() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean supportsWorkoutDetectionCategories() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public DeviceKind getDeviceKind(@NonNull GBDevice device) {
|
||||
return DeviceKind.FITNESS_BAND;
|
||||
|
||||
Reference in New Issue
Block a user