1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-09 03:37:03 +01:00

Huami: Migrate all device settings to sub-screens

This commit is contained in:
José Rebelo 2024-08-27 22:48:00 +01:00
parent 63a6f07de0
commit 39707a52da
111 changed files with 1596 additions and 1262 deletions

View File

@ -126,6 +126,15 @@ public class DeviceSpecificSettings implements Parcelable {
return subScreens.get(key); return subScreens.get(key);
} }
public List<Integer> getAllNonRootScreens() {
final List<Integer> allScreens = new ArrayList<>();
for (final List<Integer> screens : subScreens.values()) {
allScreens.addAll(screens);
}
allScreens.removeAll(rootScreens);
return allScreens;
}
public List<Integer> getAllScreens() { public List<Integer> getAllScreens() {
final List<Integer> allScreens = new ArrayList<>(rootScreens); final List<Integer> allScreens = new ArrayList<>(rootScreens);
for (final List<Integer> screens : subScreens.values()) { for (final List<Integer> screens : subScreens.values()) {

View File

@ -37,6 +37,7 @@ public enum DeviceSpecificSettingsScreen {
WORKOUT("pref_screen_workout", R.xml.devicesettings_root_workout), WORKOUT("pref_screen_workout", R.xml.devicesettings_root_workout),
HEALTH("pref_screen_health", R.xml.devicesettings_root_health), HEALTH("pref_screen_health", R.xml.devicesettings_root_health),
TOUCH_OPTIONS("pref_screen_touch_options", R.xml.devicesettings_root_touch_options), TOUCH_OPTIONS("pref_screen_touch_options", R.xml.devicesettings_root_touch_options),
SOUND("pref_screen_sound", R.xml.devicesettings_root_touch_options),
; ;
private final String key; private final String key;

View File

@ -33,7 +33,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiFirmwareT
public abstract class HuamiFWHelper extends AbstractMiBandFWHelper { public abstract class HuamiFWHelper extends AbstractMiBandFWHelper {
protected AbstractHuamiFirmwareInfo firmwareInfo; protected AbstractHuamiFirmwareInfo firmwareInfo;
public HuamiFWHelper(Uri uri, Context context) throws IOException { public HuamiFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -22,37 +22,33 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitband5.AmazfitBand5Support; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitband5.AmazfitBand5Support;
public class AmazfitBand5Coordinator extends HuamiCoordinator { public class AmazfitBand5Coordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBand5Coordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile(HuamiConst.AMAZFIT_BAND5_NAME, Pattern.CASE_INSENSITIVE); return Pattern.compile(HuamiConst.AMAZFIT_BAND5_NAME, Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitBand5FWInstallHandler handler = new AmazfitBand5FWInstallHandler(uri, context); final AmazfitBand5FWInstallHandler handler = new AmazfitBand5FWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -87,38 +83,49 @@ public class AmazfitBand5Coordinator extends HuamiCoordinator {
} }
@Override @Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
return new int[]{ final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_amazfitband5,
R.xml.devicesettings_vibrationpatterns, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_wearlocation, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_heartrate_sleep_alert_activity_stress, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_goal_notification, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_custom_emoji_font, dateTime.add(R.xml.devicesettings_dateformat);
R.xml.devicesettings_timeformat, dateTime.add(R.xml.devicesettings_world_clocks);
R.xml.devicesettings_dateformat, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_world_clocks, display.add(R.xml.devicesettings_amazfitband5);
R.xml.devicesettings_nightmode, display.add(R.xml.devicesettings_nightmode);
R.xml.devicesettings_liftwrist_display_sensitivity, display.add(R.xml.devicesettings_liftwrist_display_sensitivity);
R.xml.devicesettings_inactivity_dnd, display.add(R.xml.devicesettings_swipeunlock);
R.xml.devicesettings_workout_start_on_phone, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_workout_send_gps_to_band, health.add(R.xml.devicesettings_heartrate_sleep_alert_activity_stress);
R.xml.devicesettings_swipeunlock, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_sync_calendar, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_reserve_reminders_calendar, final List<Integer> workout = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.WORKOUT);
R.xml.devicesettings_expose_hr_thirdparty, workout.add(R.xml.devicesettings_workout_start_on_phone);
R.xml.devicesettings_bt_connected_advertisement, workout.add(R.xml.devicesettings_workout_send_gps_to_band);
R.xml.devicesettings_device_actions, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_phone_silent_mode, notifications.add(R.xml.devicesettings_custom_emoji_font);
R.xml.devicesettings_high_mtu, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_transliteration final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
}; calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_high_mtu);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
} }
@Override @Override
public String[] getSupportedLanguageSettings(GBDevice device) { public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{ return new String[]{
"auto", "auto",
"ar_SA", "ar_SA",
@ -158,13 +165,11 @@ public class AmazfitBand5Coordinator extends HuamiCoordinator {
return BONDING_STYLE_REQUIRE_KEY; return BONDING_STYLE_REQUIRE_KEY;
} }
@Override @Override
public int getDeviceNameResource() { public int getDeviceNameResource() {
return R.string.devicetype_amazfit_band5; return R.string.devicetype_amazfit_band5;
} }
@Override @Override
public int getDefaultIconResource() { public int getDefaultIconResource() {
return R.drawable.ic_device_miband2; return R.drawable.ic_device_miband2;

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitband5.A
public class AmazfitBand5FWHelper extends HuamiFWHelper { public class AmazfitBand5FWHelper extends HuamiFWHelper {
public AmazfitBand5FWHelper(Uri uri, Context context) throws IOException { public AmazfitBand5FWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitBand5FWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitBand5FWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitBand5FWInstallHandler(Uri uri, Context context) { AmazfitBand5FWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitBand5FWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitBand5FWHelper(uri, context); return new AmazfitBand5FWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITBAND5; return device.getType() == DeviceType.AMAZFITBAND5;
} }
} }

View File

@ -22,36 +22,32 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipSupport;
public class AmazfitBipCoordinator extends HuamiCoordinator { public class AmazfitBipCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipCoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit Bip Watch", Pattern.CASE_INSENSITIVE); return Pattern.compile("Amazfit Bip Watch", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitBipFWInstallHandler handler = new AmazfitBipFWInstallHandler(uri, context); final AmazfitBipFWInstallHandler handler = new AmazfitBipFWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -66,26 +62,54 @@ public class AmazfitBipCoordinator extends HuamiCoordinator {
} }
@Override @Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
return new int[]{ final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_amazfitbip,
R.xml.devicesettings_timeformat, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_wearlocation, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_heartrate_sleep, generic.add(R.xml.devicesettings_buttonactions_with_longpress);
R.xml.devicesettings_goal_notification, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_custom_emoji_font, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_liftwrist_display, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_inactivity_dnd, display.add(R.xml.devicesettings_amazfitbip);
R.xml.devicesettings_disconnectnotification, display.add(R.xml.devicesettings_liftwrist_display);
R.xml.devicesettings_sync_calendar, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_reserve_reminders_calendar, health.add(R.xml.devicesettings_heartrate_sleep);
R.xml.devicesettings_bt_connected_advertisement, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_buttonactions_with_longpress, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_device_actions, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_phone_silent_mode, notifications.add(R.xml.devicesettings_custom_emoji_font);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_transliteration final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_disconnectnotification);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
}
@Override
public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{
"auto",
"zh_CN",
"zh_TW",
"en_US",
"es_ES",
"de_DE",
"it_IT",
"fr_FR",
"pt_BR",
"tr_TR",
"cs_CZ",
"ru_RU",
}; };
} }
@ -100,7 +124,6 @@ public class AmazfitBipCoordinator extends HuamiCoordinator {
return R.string.devicetype_amazfit_bip; return R.string.devicetype_amazfit_bip;
} }
@Override @Override
public int getDefaultIconResource() { public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip; return R.drawable.ic_device_amazfit_bip;

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.Ama
public class AmazfitBipFWHelper extends HuamiFWHelper { public class AmazfitBipFWHelper extends HuamiFWHelper {
public AmazfitBipFWHelper(Uri uri, Context context) throws IOException { public AmazfitBipFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitBipFWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitBipFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitBipFWInstallHandler(Uri uri, Context context) { AmazfitBipFWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitBipFWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitBipFWHelper(uri, context); return new AmazfitBipFWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITBIP; return device.getType() == DeviceType.AMAZFITBIP;
} }
} }

View File

@ -22,30 +22,26 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipLiteSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipLiteSupport;
public class AmazfitBipLiteCoordinator extends AmazfitBipCoordinator { public class AmazfitBipLiteCoordinator extends AmazfitBipCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipLiteCoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit Bip Lite", Pattern.CASE_INSENSITIVE); return Pattern.compile("Amazfit Bip Lite", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitBipLiteFWInstallHandler handler = new AmazfitBipLiteFWInstallHandler(uri, context); final AmazfitBipLiteFWInstallHandler handler = new AmazfitBipLiteFWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@ -55,27 +51,38 @@ public class AmazfitBipLiteCoordinator extends AmazfitBipCoordinator {
} }
@Override @Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
return new int[]{ final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_amazfitbip,
R.xml.devicesettings_vibrationpatterns, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_timeformat, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_wearlocation, generic.add(R.xml.devicesettings_buttonactions_with_longpress);
R.xml.devicesettings_heartrate_sleep, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_goal_notification, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_custom_emoji_font, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_liftwrist_display, display.add(R.xml.devicesettings_amazfitbip);
R.xml.devicesettings_inactivity_dnd, display.add(R.xml.devicesettings_liftwrist_display);
R.xml.devicesettings_disconnectnotification, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_sync_calendar, health.add(R.xml.devicesettings_heartrate_sleep);
R.xml.devicesettings_bt_connected_advertisement, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_buttonactions_with_longpress, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_device_actions, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_relax_firmware_checks, notifications.add(R.xml.devicesettings_custom_emoji_font);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_transliteration final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
}; calendar.add(R.xml.devicesettings_sync_calendar);
//calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_disconnectnotification);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_relax_firmware_checks);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
} }
@Override @Override

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.Ama
public class AmazfitBipLiteFWHelper extends HuamiFWHelper { public class AmazfitBipLiteFWHelper extends HuamiFWHelper {
public AmazfitBipLiteFWHelper(Uri uri, Context context) throws IOException { public AmazfitBipLiteFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitBipLiteFWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitBipLiteFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitBipLiteFWInstallHandler(Uri uri, Context context) { AmazfitBipLiteFWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitBipLiteFWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitBipLiteFWHelper(uri, context); return new AmazfitBipLiteFWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITBIP_LITE; return device.getType() == DeviceType.AMAZFITBIP_LITE;
} }
} }

View File

@ -21,9 +21,12 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -88,7 +91,7 @@ public class AmazfitBip3Coordinator extends HuamiCoordinator {
} }
@Override @Override
public boolean supportsSpo2(GBDevice device) { public boolean supportsSpo2(final GBDevice device) {
return true; return true;
} }
@ -97,32 +100,43 @@ public class AmazfitBip3Coordinator extends HuamiCoordinator {
return true; return true;
} }
public int[] getSupportedDeviceSpecificSettings(final GBDevice device) { @Override
return new int[]{ public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
R.xml.devicesettings_amazfitbip3pro, final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_heartrate_sleep_alert_activity_stress, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_goal_notification, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_timeformat, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_dateformat, dateTime.add(R.xml.devicesettings_dateformat);
R.xml.devicesettings_world_clocks, dateTime.add(R.xml.devicesettings_world_clocks);
R.xml.devicesettings_liftwrist_display_sensitivity, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_inactivity_dnd, display.add(R.xml.devicesettings_amazfitbip3pro);
R.xml.devicesettings_sync_calendar, display.add(R.xml.devicesettings_liftwrist_display_sensitivity);
R.xml.devicesettings_reserve_reminders_calendar, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_expose_hr_thirdparty, health.add(R.xml.devicesettings_heartrate_sleep_alert_activity_stress);
R.xml.devicesettings_bt_connected_advertisement, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_device_actions, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_high_mtu, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_transliteration final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
}; calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_high_mtu);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
} }
@Override @Override
public String[] getSupportedLanguageSettings(GBDevice device) { public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{ return new String[]{
"auto", "auto",
"cs_CZ", "cs_CZ",

View File

@ -21,12 +21,12 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -34,8 +34,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip3pro.AmazfitBip3ProSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip3pro.AmazfitBip3ProSupport;
public class AmazfitBip3ProCoordinator extends HuamiCoordinator { public class AmazfitBip3ProCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBip3ProCoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit Bip 3 Pro", Pattern.CASE_INSENSITIVE); return Pattern.compile("Amazfit Bip 3 Pro", Pattern.CASE_INSENSITIVE);
@ -93,7 +91,7 @@ public class AmazfitBip3ProCoordinator extends HuamiCoordinator {
} }
@Override @Override
public boolean supportsSpo2(GBDevice device) { public boolean supportsSpo2(final GBDevice device) {
return true; return true;
} }
@ -102,32 +100,43 @@ public class AmazfitBip3ProCoordinator extends HuamiCoordinator {
return true; return true;
} }
public int[] getSupportedDeviceSpecificSettings(final GBDevice device) { @Override
return new int[]{ public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
R.xml.devicesettings_amazfitbip3pro, final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_heartrate_sleep_alert_activity_stress, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_goal_notification, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_timeformat, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_dateformat, dateTime.add(R.xml.devicesettings_dateformat);
R.xml.devicesettings_world_clocks, dateTime.add(R.xml.devicesettings_world_clocks);
R.xml.devicesettings_liftwrist_display_sensitivity, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_inactivity_dnd, display.add(R.xml.devicesettings_amazfitbip3pro);
R.xml.devicesettings_sync_calendar, display.add(R.xml.devicesettings_liftwrist_display_sensitivity);
R.xml.devicesettings_reserve_reminders_calendar, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_expose_hr_thirdparty, health.add(R.xml.devicesettings_heartrate_sleep_alert_activity_stress);
R.xml.devicesettings_bt_connected_advertisement, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_device_actions, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_high_mtu, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_transliteration final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
}; calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_high_mtu);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
} }
@Override @Override
public String[] getSupportedLanguageSettings(GBDevice device) { public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{ return new String[]{
"auto", "auto",
"cs_CZ", "cs_CZ",
@ -159,13 +168,11 @@ public class AmazfitBip3ProCoordinator extends HuamiCoordinator {
return AmazfitBip3ProSupport.class; return AmazfitBip3ProSupport.class;
} }
@Override @Override
public int getDeviceNameResource() { public int getDeviceNameResource() {
return R.string.devicetype_amazfit_bip3_pro; return R.string.devicetype_amazfit_bip3_pro;
} }
@Override @Override
public int getDefaultIconResource() { public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip; return R.drawable.ic_device_amazfit_bip;

View File

@ -22,12 +22,12 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -35,21 +35,19 @@ import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbips.AmazfitBipSSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbips.AmazfitBipSSupport;
public class AmazfitBipSCoordinator extends HuamiCoordinator { public class AmazfitBipSCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipSCoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit Bip S", Pattern.CASE_INSENSITIVE); return Pattern.compile("Amazfit Bip S", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitBipSFWInstallHandler handler = new AmazfitBipSFWInstallHandler(uri, context); final AmazfitBipSFWInstallHandler handler = new AmazfitBipSFWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -79,27 +77,55 @@ public class AmazfitBipSCoordinator extends HuamiCoordinator {
} }
@Override @Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
return new int[]{ final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_amazfitbips,
R.xml.devicesettings_timeformat, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_world_clocks, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_wearlocation, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_heartrate_sleep, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_goal_notification, dateTime.add(R.xml.devicesettings_world_clocks);
R.xml.devicesettings_custom_emoji_font, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_liftwrist_display, display.add(R.xml.devicesettings_amazfitbips);
R.xml.devicesettings_inactivity_dnd, display.add(R.xml.devicesettings_liftwrist_display);
R.xml.devicesettings_sync_calendar, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_reserve_reminders_calendar, health.add(R.xml.devicesettings_heartrate_sleep);
R.xml.devicesettings_expose_hr_thirdparty, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_bt_connected_advertisement, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_high_mtu, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_device_actions, notifications.add(R.xml.devicesettings_custom_emoji_font);
R.xml.devicesettings_phone_silent_mode, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
R.xml.devicesettings_transliteration calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_high_mtu);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
}
@Override
public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{
"auto",
"zh_CN",
"zh_TW",
"en_US",
"es_ES",
"de_DE",
"it_IT",
"fr_FR",
"pt_BR",
"tr_TR",
"cs_CZ",
"ru_RU",
}; };
} }
@ -114,13 +140,11 @@ public class AmazfitBipSCoordinator extends HuamiCoordinator {
return BONDING_STYLE_REQUIRE_KEY; return BONDING_STYLE_REQUIRE_KEY;
} }
@Override @Override
public int getDeviceNameResource() { public int getDeviceNameResource() {
return R.string.devicetype_amazfit_bips; return R.string.devicetype_amazfit_bips;
} }
@Override @Override
public int getDefaultIconResource() { public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip; return R.drawable.ic_device_amazfit_bip;

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbips.Am
public class AmazfitBipSFWHelper extends HuamiFWHelper { public class AmazfitBipSFWHelper extends HuamiFWHelper {
public AmazfitBipSFWHelper(Uri uri, Context context) throws IOException { public AmazfitBipSFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitBipSFWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitBipSFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitBipSFWInstallHandler(Uri uri, Context context) { AmazfitBipSFWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitBipSFWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitBipSFWHelper(uri, context); return new AmazfitBipSFWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITBIPS; return device.getType() == DeviceType.AMAZFITBIPS;
} }
} }

View File

@ -21,29 +21,22 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbips.AmazfitBipSLiteSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbips.AmazfitBipSLiteSupport;
public class AmazfitBipSLiteCoordinator extends AmazfitBipSCoordinator { public class AmazfitBipSLiteCoordinator extends AmazfitBipSCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipSLiteCoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Bip S Lite", Pattern.CASE_INSENSITIVE); return Pattern.compile("Bip S Lite", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitBipSLiteFWInstallHandler handler = new AmazfitBipSLiteFWInstallHandler(uri, context); final AmazfitBipSLiteFWInstallHandler handler = new AmazfitBipSLiteFWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@ -52,17 +45,6 @@ public class AmazfitBipSLiteCoordinator extends AmazfitBipSCoordinator {
return R.string.devicetype_amazfit_bips_lite; return R.string.devicetype_amazfit_bips_lite;
} }
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
@NonNull @NonNull
@Override @Override
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbips.Am
public class AmazfitBipSLiteFWHelper extends HuamiFWHelper { public class AmazfitBipSLiteFWHelper extends HuamiFWHelper {
public AmazfitBipSLiteFWHelper(Uri uri, Context context) throws IOException { public AmazfitBipSLiteFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitBipSLiteFWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitBipSLiteFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitBipSLiteFWInstallHandler(Uri uri, Context context) { AmazfitBipSLiteFWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitBipSLiteFWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitBipSLiteFWHelper(uri, context); return new AmazfitBipSLiteFWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITBIPS_LITE; return device.getType() == DeviceType.AMAZFITBIPS_LITE;
} }
} }

View File

@ -22,36 +22,32 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbipu.AmazfitBipUSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbipu.AmazfitBipUSupport;
public class AmazfitBipUCoordinator extends HuamiCoordinator { public class AmazfitBipUCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipUCoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit Bip U", Pattern.CASE_INSENSITIVE); return Pattern.compile("Amazfit Bip U", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitBipUFWInstallHandler handler = new AmazfitBipUFWInstallHandler(uri, context); final AmazfitBipUFWInstallHandler handler = new AmazfitBipUFWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -97,36 +93,46 @@ public class AmazfitBipUCoordinator extends HuamiCoordinator {
} }
@Override @Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
return new int[]{ final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_amazfitbipu,
R.xml.devicesettings_vibrationpatterns, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
//R.xml.devicesettings_canned_dismisscall_16, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_timeformat, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_world_clocks, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_wearlocation, dateTime.add(R.xml.devicesettings_world_clocks);
R.xml.devicesettings_heartrate_sleep_alert_activity_stress, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_goal_notification, display.add(R.xml.devicesettings_amazfitbipu);
R.xml.devicesettings_custom_emoji_font, display.add(R.xml.devicesettings_liftwrist_display_sensitivity);
R.xml.devicesettings_liftwrist_display_sensitivity, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_inactivity_dnd, health.add(R.xml.devicesettings_heartrate_sleep_alert_activity_stress);
R.xml.devicesettings_workout_start_on_phone, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_workout_send_gps_to_band, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_sync_calendar, final List<Integer> workout = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.WORKOUT);
R.xml.devicesettings_reserve_reminders_calendar, workout.add(R.xml.devicesettings_workout_start_on_phone);
R.xml.devicesettings_expose_hr_thirdparty, workout.add(R.xml.devicesettings_workout_send_gps_to_band);
R.xml.devicesettings_bt_connected_advertisement, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_high_mtu, notifications.add(R.xml.devicesettings_custom_emoji_font);
R.xml.devicesettings_device_actions, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_phone_silent_mode, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
R.xml.devicesettings_transliteration calendar.add(R.xml.devicesettings_sync_calendar);
}; calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_high_mtu);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
} }
@Override @Override
public String[] getSupportedLanguageSettings(GBDevice device) { public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{ return new String[]{
"auto", "auto",
"cs_CZ", "cs_CZ",
@ -163,13 +169,11 @@ public class AmazfitBipUCoordinator extends HuamiCoordinator {
return BONDING_STYLE_REQUIRE_KEY; return BONDING_STYLE_REQUIRE_KEY;
} }
@Override @Override
public int getDeviceNameResource() { public int getDeviceNameResource() {
return R.string.devicetype_amazfit_bipu; return R.string.devicetype_amazfit_bipu;
} }
@Override @Override
public int getDefaultIconResource() { public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip; return R.drawable.ic_device_amazfit_bip;

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbipu.Am
public class AmazfitBipUFWHelper extends HuamiFWHelper { public class AmazfitBipUFWHelper extends HuamiFWHelper {
public AmazfitBipUFWHelper(Uri uri, Context context) throws IOException { public AmazfitBipUFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitBipUFWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitBipUFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitBipUFWInstallHandler(Uri uri, Context context) { AmazfitBipUFWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitBipUFWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitBipUFWHelper(uri, context); return new AmazfitBipUFWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITBIPU; return device.getType() == DeviceType.AMAZFITBIPU;
} }
} }

View File

@ -22,36 +22,32 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbipupro.AmazfitBipUProSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbipupro.AmazfitBipUProSupport;
public class AmazfitBipUProCoordinator extends HuamiCoordinator { public class AmazfitBipUProCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipUProCoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit Bip U Pro", Pattern.CASE_INSENSITIVE); return Pattern.compile("Amazfit Bip U Pro", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitBipUProFWInstallHandler handler = new AmazfitBipUProFWInstallHandler(uri, context); final AmazfitBipUProFWInstallHandler handler = new AmazfitBipUProFWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -91,33 +87,43 @@ public class AmazfitBipUProCoordinator extends HuamiCoordinator {
} }
@Override @Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
return new int[]{ final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_amazfitbipupro,
R.xml.devicesettings_vibrationpatterns, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_timeformat, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_world_clocks, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_wearlocation, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_heartrate_sleep_alert_activity_stress, dateTime.add(R.xml.devicesettings_world_clocks);
R.xml.devicesettings_goal_notification, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_custom_emoji_font, display.add(R.xml.devicesettings_amazfitbipupro);
R.xml.devicesettings_liftwrist_display_sensitivity, display.add(R.xml.devicesettings_liftwrist_display_sensitivity);
R.xml.devicesettings_inactivity_dnd, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_sync_calendar, health.add(R.xml.devicesettings_heartrate_sleep_alert_activity_stress);
R.xml.devicesettings_reserve_reminders_calendar, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_expose_hr_thirdparty, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_bt_connected_advertisement, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_high_mtu, notifications.add(R.xml.devicesettings_custom_emoji_font);
R.xml.devicesettings_device_actions, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_phone_silent_mode, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
R.xml.devicesettings_transliteration calendar.add(R.xml.devicesettings_sync_calendar);
}; calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_high_mtu);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
} }
@Override @Override
public String[] getSupportedLanguageSettings(GBDevice device) { public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{ return new String[]{
"auto", "auto",
"cs_CZ", "cs_CZ",
@ -154,13 +160,11 @@ public class AmazfitBipUProCoordinator extends HuamiCoordinator {
return BONDING_STYLE_REQUIRE_KEY; return BONDING_STYLE_REQUIRE_KEY;
} }
@Override @Override
public int getDeviceNameResource() { public int getDeviceNameResource() {
return R.string.devicetype_amazfit_bipupro; return R.string.devicetype_amazfit_bipupro;
} }
@Override @Override
public int getDefaultIconResource() { public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip; return R.drawable.ic_device_amazfit_bip;

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbipupro
public class AmazfitBipUProFWHelper extends HuamiFWHelper { public class AmazfitBipUProFWHelper extends HuamiFWHelper {
public AmazfitBipUProFWHelper(Uri uri, Context context) throws IOException { public AmazfitBipUProFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitBipUProFWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitBipUProFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitBipUProFWInstallHandler(Uri uri, Context context) { AmazfitBipUProFWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitBipUProFWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitBipUProFWHelper(uri, context); return new AmazfitBipUProFWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITBIPUPRO; return device.getType() == DeviceType.AMAZFITBIPUPRO;
} }
} }

View File

@ -25,9 +25,12 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -37,21 +40,19 @@ import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcor.AmazfitCorSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcor.AmazfitCorSupport;
public class AmazfitCorCoordinator extends HuamiCoordinator { public class AmazfitCorCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitCorCoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit Band|Amazfit Cor", Pattern.CASE_INSENSITIVE); return Pattern.compile("Amazfit Band|Amazfit Cor", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitCorFWInstallHandler handler = new AmazfitCorFWInstallHandler(uri, context); final AmazfitCorFWInstallHandler handler = new AmazfitCorFWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -71,29 +72,59 @@ public class AmazfitCorCoordinator extends HuamiCoordinator {
} }
@Override @Override
public boolean supportsUnicodeEmojis() { return true; } public boolean supportsUnicodeEmojis() {
return true;
}
@Override @Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
return new int[]{ final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_amazfitcor,
R.xml.devicesettings_vibrationpatterns, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_wearlocation, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_heartrate_sleep, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_goal_notification, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_timeformat, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_custom_emoji_font, display.add(R.xml.devicesettings_amazfitcor);
R.xml.devicesettings_liftwrist_display, display.add(R.xml.devicesettings_liftwrist_display);
R.xml.devicesettings_inactivity_dnd, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_disconnectnotification, health.add(R.xml.devicesettings_heartrate_sleep);
R.xml.devicesettings_sync_calendar, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_reserve_reminders_calendar, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_bt_connected_advertisement, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_device_actions, notifications.add(R.xml.devicesettings_custom_emoji_font);
R.xml.devicesettings_phone_silent_mode, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_transliteration final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_disconnectnotification);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
}
@Override
public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{
"auto",
"zh_CN",
"zh_TW",
"en_US",
"es_ES",
"de_DE",
"it_IT",
"fr_FR",
"pt_BR",
"tr_TR",
"cs_CZ",
"ru_RU",
}; };
} }

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcor.Ama
public class AmazfitCorFWHelper extends HuamiFWHelper { public class AmazfitCorFWHelper extends HuamiFWHelper {
public AmazfitCorFWHelper(Uri uri, Context context) throws IOException { public AmazfitCorFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitCorFWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitCorFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitCorFWInstallHandler(Uri uri, Context context) { AmazfitCorFWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitCorFWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitCorFWHelper(uri, context); return new AmazfitCorFWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITCOR; return device.getType() == DeviceType.AMAZFITCOR;
} }
} }

View File

@ -22,36 +22,32 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcor2.AmazfitCor2Support; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcor2.AmazfitCor2Support;
public class AmazfitCor2Coordinator extends HuamiCoordinator { public class AmazfitCor2Coordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitCor2Coordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit Band 2|Amazfit Cor 2", Pattern.CASE_INSENSITIVE); return Pattern.compile("Amazfit Band 2|Amazfit Cor 2", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitCor2FWInstallHandler handler = new AmazfitCor2FWInstallHandler(uri, context); final AmazfitCor2FWInstallHandler handler = new AmazfitCor2FWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -76,26 +72,54 @@ public class AmazfitCor2Coordinator extends HuamiCoordinator {
} }
@Override @Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
return new int[]{ final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_amazfitcor,
R.xml.devicesettings_vibrationpatterns, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_wearlocation, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_heartrate_sleep, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_goal_notification, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_timeformat, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_custom_emoji_font, display.add(R.xml.devicesettings_amazfitcor);
R.xml.devicesettings_liftwrist_display, display.add(R.xml.devicesettings_liftwrist_display);
R.xml.devicesettings_inactivity_dnd, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_disconnectnotification, health.add(R.xml.devicesettings_heartrate_sleep);
R.xml.devicesettings_sync_calendar, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_reserve_reminders_calendar, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_bt_connected_advertisement, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_device_actions, notifications.add(R.xml.devicesettings_custom_emoji_font);
R.xml.devicesettings_phone_silent_mode, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_transliteration final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_disconnectnotification);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
}
@Override
public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{
"auto",
"zh_CN",
"zh_TW",
"en_US",
"es_ES",
"de_DE",
"it_IT",
"fr_FR",
"pt_BR",
"tr_TR",
"cs_CZ",
"ru_RU",
}; };
} }
@ -110,7 +134,6 @@ public class AmazfitCor2Coordinator extends HuamiCoordinator {
return R.string.devicetype_amazfit_cor2; return R.string.devicetype_amazfit_cor2;
} }
@Override @Override
public int getDefaultIconResource() { public int getDefaultIconResource() {
return R.drawable.ic_device_default; return R.drawable.ic_device_default;

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcor2.Am
public class AmazfitCor2FWHelper extends HuamiFWHelper { public class AmazfitCor2FWHelper extends HuamiFWHelper {
public AmazfitCor2FWHelper(Uri uri, Context context) throws IOException { public AmazfitCor2FWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitCor2FWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitCor2FWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitCor2FWInstallHandler(Uri uri, Context context) { AmazfitCor2FWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitCor2FWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitCor2FWHelper(uri, context); return new AmazfitCor2FWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITCOR2; return device.getType() == DeviceType.AMAZFITCOR2;
} }
} }

View File

@ -22,30 +22,26 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr.AmazfitGTRSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr.AmazfitGTRSupport;
public class AmazfitGTRCoordinator extends HuamiCoordinator { public class AmazfitGTRCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTRCoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit GTR", Pattern.CASE_INSENSITIVE); return Pattern.compile("Amazfit GTR", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitGTRFWInstallHandler handler = new AmazfitGTRFWInstallHandler(uri, context); final AmazfitGTRFWInstallHandler handler = new AmazfitGTRFWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@ -55,7 +51,7 @@ public class AmazfitGTRCoordinator extends HuamiCoordinator {
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -73,28 +69,58 @@ public class AmazfitGTRCoordinator extends HuamiCoordinator {
public boolean supportsMusicInfo() { public boolean supportsMusicInfo() {
return true; return true;
} }
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{ @Override
R.xml.devicesettings_amazfitgtsgtr, public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
R.xml.devicesettings_vibrationpatterns, final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_goal_notification, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_timeformat, generic.add(R.xml.devicesettings_buttonactions_with_longpress);
R.xml.devicesettings_liftwrist_display, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_inactivity_dnd, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_disconnectnotification, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_sync_calendar, display.add(R.xml.devicesettings_amazfitgtsgtr);
R.xml.devicesettings_reserve_reminders_calendar, display.add(R.xml.devicesettings_liftwrist_display);
R.xml.devicesettings_expose_hr_thirdparty, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_bt_connected_advertisement, health.add(R.xml.devicesettings_heartrate_sleep);
R.xml.devicesettings_buttonactions_with_longpress, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_device_actions, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_phone_silent_mode, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_high_mtu, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_transliteration final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_disconnectnotification);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_high_mtu);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
}
@Override
public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{
"auto",
"zh_CN",
"zh_TW",
"en_US",
"es_ES",
"de_DE",
"it_IT",
"fr_FR",
"pt_BR",
"tr_TR",
"cs_CZ",
"ru_RU",
}; };
} }
@ -104,7 +130,6 @@ public class AmazfitGTRCoordinator extends HuamiCoordinator {
return AmazfitGTRSupport.class; return AmazfitGTRSupport.class;
} }
@Override @Override
public int getDeviceNameResource() { public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gtr; return R.string.devicetype_amazfit_gtr;

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr.Ama
public class AmazfitGTRFWHelper extends HuamiFWHelper { public class AmazfitGTRFWHelper extends HuamiFWHelper {
public AmazfitGTRFWHelper(Uri uri, Context context) throws IOException { public AmazfitGTRFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitGTRFWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitGTRFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitGTRFWInstallHandler(Uri uri, Context context) { AmazfitGTRFWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitGTRFWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitGTRFWHelper(uri, context); return new AmazfitGTRFWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITGTR; return device.getType() == DeviceType.AMAZFITGTR;
} }
} }

View File

@ -22,31 +22,27 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr.AmazfitGTRLiteSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr.AmazfitGTRLiteSupport;
public class AmazfitGTRLiteCoordinator extends HuamiCoordinator { public class AmazfitGTRLiteCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTRLiteCoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit GTR L", Pattern.CASE_INSENSITIVE); return Pattern.compile("Amazfit GTR L", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitGTRLiteFWInstallHandler handler = new AmazfitGTRLiteFWInstallHandler(uri, context); final AmazfitGTRLiteFWInstallHandler handler = new AmazfitGTRLiteFWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@ -56,15 +52,10 @@ public class AmazfitGTRLiteCoordinator extends HuamiCoordinator {
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@Override
public boolean supportsActivityTracks() {
return false;
}
@Override @Override
public boolean supportsWeather() { public boolean supportsWeather() {
return true; return true;
@ -75,25 +66,54 @@ public class AmazfitGTRLiteCoordinator extends HuamiCoordinator {
return true; return true;
} }
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { @Override
return new int[]{ public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
R.xml.devicesettings_amazfitgtsgtr, final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_heartrate_sleep, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_goal_notification, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_timeformat, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_liftwrist_display, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_inactivity_dnd, display.add(R.xml.devicesettings_amazfitgtsgtr);
R.xml.devicesettings_disconnectnotification, display.add(R.xml.devicesettings_liftwrist_display);
R.xml.devicesettings_sync_calendar, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_reserve_reminders_calendar, health.add(R.xml.devicesettings_heartrate_sleep);
R.xml.devicesettings_expose_hr_thirdparty, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_bt_connected_advertisement, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_phone_silent_mode, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_transliteration notifications.add(R.xml.devicesettings_transliteration);
final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_disconnectnotification);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
}
@Override
public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{
"auto",
"zh_CN",
"zh_TW",
"en_US",
"es_ES",
"de_DE",
"it_IT",
"fr_FR",
"pt_BR",
"tr_TR",
"cs_CZ",
"ru_RU",
}; };
} }
@ -103,7 +123,6 @@ public class AmazfitGTRLiteCoordinator extends HuamiCoordinator {
return AmazfitGTRLiteSupport.class; return AmazfitGTRLiteSupport.class;
} }
@Override @Override
public int getDeviceNameResource() { public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gtr_lite; return R.string.devicetype_amazfit_gtr_lite;

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr.Ama
public class AmazfitGTRLiteFWHelper extends HuamiFWHelper { public class AmazfitGTRLiteFWHelper extends HuamiFWHelper {
public AmazfitGTRLiteFWHelper(Uri uri, Context context) throws IOException { public AmazfitGTRLiteFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitGTRLiteFWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitGTRLiteFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitGTRLiteFWInstallHandler(Uri uri, Context context) { AmazfitGTRLiteFWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitGTRLiteFWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitGTRLiteFWHelper(uri, context); return new AmazfitGTRLiteFWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITGTR_LITE; return device.getType() == DeviceType.AMAZFITGTR_LITE;
} }
} }

View File

@ -22,31 +22,27 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr2.AmazfitGTR2Support; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr2.AmazfitGTR2Support;
public class AmazfitGTR2Coordinator extends HuamiCoordinator { public class AmazfitGTR2Coordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTR2Coordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit GTR 2", Pattern.CASE_INSENSITIVE); return Pattern.compile("Amazfit GTR 2", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitGTR2FWInstallHandler handler = new AmazfitGTR2FWInstallHandler(uri, context); final AmazfitGTR2FWInstallHandler handler = new AmazfitGTR2FWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@ -56,7 +52,7 @@ public class AmazfitGTR2Coordinator extends HuamiCoordinator {
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -80,27 +76,56 @@ public class AmazfitGTR2Coordinator extends HuamiCoordinator {
return true; return true;
} }
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { @Override
return new int[]{ public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
R.xml.devicesettings_amazfitgtsgtr2, final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_heartrate_sleep, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_goal_notification, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_timeformat, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_liftwrist_display, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_inactivity_dnd, display.add(R.xml.devicesettings_amazfitgtsgtr2);
R.xml.devicesettings_disconnectnotification, display.add(R.xml.devicesettings_liftwrist_display);
R.xml.devicesettings_sync_calendar, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_reserve_reminders_calendar, health.add(R.xml.devicesettings_heartrate_sleep);
R.xml.devicesettings_expose_hr_thirdparty, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_bt_connected_advertisement, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_device_actions, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_phone_silent_mode, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_high_mtu, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
R.xml.devicesettings_transliteration calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_disconnectnotification);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_high_mtu);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
}
@Override
public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{
"auto",
"zh_CN",
"zh_TW",
"en_US",
"es_ES",
"de_DE",
"it_IT",
"fr_FR",
"pt_BR",
"tr_TR",
"cs_CZ",
"ru_RU",
}; };
} }

View File

@ -27,7 +27,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr2.Am
public class AmazfitGTR2FWHelper extends HuamiFWHelper { public class AmazfitGTR2FWHelper extends HuamiFWHelper {
public AmazfitGTR2FWHelper(Uri uri, Context context) throws IOException { public AmazfitGTR2FWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitGTR2FWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitGTR2FWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitGTR2FWInstallHandler(Uri uri, Context context) { AmazfitGTR2FWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitGTR2FWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitGTR2FWHelper(uri, context); return new AmazfitGTR2FWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITGTR2; return device.getType() == DeviceType.AMAZFITGTR2;
} }
} }

View File

@ -22,31 +22,27 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr2.AmazfitGTR2eSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr2.AmazfitGTR2eSupport;
public class AmazfitGTR2eCoordinator extends HuamiCoordinator { public class AmazfitGTR2eCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTR2eCoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit GTR 2e", Pattern.CASE_INSENSITIVE); return Pattern.compile("Amazfit GTR 2e", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitGTR2eFWInstallHandler handler = new AmazfitGTR2eFWInstallHandler(uri, context); final AmazfitGTR2eFWInstallHandler handler = new AmazfitGTR2eFWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@ -56,7 +52,7 @@ public class AmazfitGTR2eCoordinator extends HuamiCoordinator {
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -80,27 +76,56 @@ public class AmazfitGTR2eCoordinator extends HuamiCoordinator {
return true; return true;
} }
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { @Override
return new int[]{ public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
R.xml.devicesettings_amazfitgtsgtr2, final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_heartrate_sleep, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_goal_notification, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_timeformat, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_liftwrist_display, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_inactivity_dnd, display.add(R.xml.devicesettings_amazfitgtsgtr2);
R.xml.devicesettings_disconnectnotification, display.add(R.xml.devicesettings_liftwrist_display);
R.xml.devicesettings_sync_calendar, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_reserve_reminders_calendar, health.add(R.xml.devicesettings_heartrate_sleep);
R.xml.devicesettings_expose_hr_thirdparty, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_bt_connected_advertisement, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_device_actions, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_phone_silent_mode, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_high_mtu, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
R.xml.devicesettings_transliteration calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_disconnectnotification);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_high_mtu);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
}
@Override
public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{
"auto",
"zh_CN",
"zh_TW",
"en_US",
"es_ES",
"de_DE",
"it_IT",
"fr_FR",
"pt_BR",
"tr_TR",
"cs_CZ",
"ru_RU",
}; };
} }
@ -110,7 +135,6 @@ public class AmazfitGTR2eCoordinator extends HuamiCoordinator {
return AmazfitGTR2eSupport.class; return AmazfitGTR2eSupport.class;
} }
@Override @Override
public int getDeviceNameResource() { public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gtr2e; return R.string.devicetype_amazfit_gtr2e;

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr2.Am
public class AmazfitGTR2eFWHelper extends HuamiFWHelper { public class AmazfitGTR2eFWHelper extends HuamiFWHelper {
public AmazfitGTR2eFWHelper(Uri uri, Context context) throws IOException { public AmazfitGTR2eFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitGTR2eFWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitGTR2eFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitGTR2eFWInstallHandler(Uri uri, Context context) { AmazfitGTR2eFWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitGTR2eFWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitGTR2eFWHelper(uri, context); return new AmazfitGTR2eFWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITGTR2E; return device.getType() == DeviceType.AMAZFITGTR2E;
} }
} }

View File

@ -22,31 +22,27 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts.AmazfitGTSSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts.AmazfitGTSSupport;
public class AmazfitGTSCoordinator extends HuamiCoordinator { public class AmazfitGTSCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTSCoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit GTS", Pattern.CASE_INSENSITIVE); return Pattern.compile("Amazfit GTS", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitGTSFWInstallHandler handler = new AmazfitGTSFWInstallHandler(uri, context); final AmazfitGTSFWInstallHandler handler = new AmazfitGTSFWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@ -56,7 +52,7 @@ public class AmazfitGTSCoordinator extends HuamiCoordinator {
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -75,27 +71,56 @@ public class AmazfitGTSCoordinator extends HuamiCoordinator {
return true; return true;
} }
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { @Override
return new int[]{ public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
R.xml.devicesettings_amazfitgtsgtr, final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_heartrate_sleep, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_goal_notification, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_timeformat, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_liftwrist_display, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_inactivity_dnd, display.add(R.xml.devicesettings_amazfitgtsgtr);
R.xml.devicesettings_disconnectnotification, display.add(R.xml.devicesettings_liftwrist_display);
R.xml.devicesettings_sync_calendar, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_reserve_reminders_calendar, health.add(R.xml.devicesettings_heartrate_sleep);
R.xml.devicesettings_expose_hr_thirdparty, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_bt_connected_advertisement, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_device_actions, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_phone_silent_mode, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_high_mtu, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
R.xml.devicesettings_transliteration calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_disconnectnotification);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_high_mtu);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
}
@Override
public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{
"auto",
"zh_CN",
"zh_TW",
"en_US",
"es_ES",
"de_DE",
"it_IT",
"fr_FR",
"pt_BR",
"tr_TR",
"cs_CZ",
"ru_RU",
}; };
} }
@ -105,13 +130,11 @@ public class AmazfitGTSCoordinator extends HuamiCoordinator {
return AmazfitGTSSupport.class; return AmazfitGTSSupport.class;
} }
@Override @Override
public int getDeviceNameResource() { public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gts; return R.string.devicetype_amazfit_gts;
} }
@Override @Override
public int getDefaultIconResource() { public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip; return R.drawable.ic_device_amazfit_bip;

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts.Ama
public class AmazfitGTSFWHelper extends HuamiFWHelper { public class AmazfitGTSFWHelper extends HuamiFWHelper {
public AmazfitGTSFWHelper(Uri uri, Context context) throws IOException { public AmazfitGTSFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitGTSFWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitGTSFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitGTSFWInstallHandler(Uri uri, Context context) { AmazfitGTSFWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitGTSFWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitGTSFWHelper(uri, context); return new AmazfitGTSFWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITGTS; return device.getType() == DeviceType.AMAZFITGTS;
} }
} }

View File

@ -22,31 +22,27 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts2.AmazfitGTS2Support; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts2.AmazfitGTS2Support;
public class AmazfitGTS2Coordinator extends HuamiCoordinator { public class AmazfitGTS2Coordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTS2Coordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit GTS 2", Pattern.CASE_INSENSITIVE); return Pattern.compile("Amazfit GTS 2", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitGTS2FWInstallHandler handler = new AmazfitGTS2FWInstallHandler(uri, context); final AmazfitGTS2FWInstallHandler handler = new AmazfitGTS2FWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@ -56,7 +52,7 @@ public class AmazfitGTS2Coordinator extends HuamiCoordinator {
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -80,27 +76,56 @@ public class AmazfitGTS2Coordinator extends HuamiCoordinator {
return true; return true;
} }
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { @Override
return new int[]{ public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
R.xml.devicesettings_amazfitgtsgtr2, final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_heartrate_sleep, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_goal_notification, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_timeformat, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_liftwrist_display, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_inactivity_dnd, display.add(R.xml.devicesettings_amazfitgtsgtr2);
R.xml.devicesettings_disconnectnotification, display.add(R.xml.devicesettings_liftwrist_display);
R.xml.devicesettings_sync_calendar, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_reserve_reminders_calendar, health.add(R.xml.devicesettings_heartrate_sleep);
R.xml.devicesettings_expose_hr_thirdparty, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_bt_connected_advertisement, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_device_actions, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_phone_silent_mode, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_high_mtu, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
R.xml.devicesettings_transliteration calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_disconnectnotification);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_high_mtu);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
}
@Override
public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{
"auto",
"zh_CN",
"zh_TW",
"en_US",
"es_ES",
"de_DE",
"it_IT",
"fr_FR",
"pt_BR",
"tr_TR",
"cs_CZ",
"ru_RU",
}; };
} }
@ -110,13 +135,11 @@ public class AmazfitGTS2Coordinator extends HuamiCoordinator {
return AmazfitGTS2Support.class; return AmazfitGTS2Support.class;
} }
@Override @Override
public int getDeviceNameResource() { public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gts2; return R.string.devicetype_amazfit_gts2;
} }
@Override @Override
public int getDefaultIconResource() { public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip; return R.drawable.ic_device_amazfit_bip;

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts2.Am
public class AmazfitGTS2FWHelper extends HuamiFWHelper { public class AmazfitGTS2FWHelper extends HuamiFWHelper {
public AmazfitGTS2FWHelper(Uri uri, Context context) throws IOException { public AmazfitGTS2FWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitGTS2FWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitGTS2FWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitGTS2FWInstallHandler(Uri uri, Context context) { AmazfitGTS2FWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitGTS2FWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitGTS2FWHelper(uri, context); return new AmazfitGTS2FWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITGTS2; return device.getType() == DeviceType.AMAZFITGTS2;
} }
} }

View File

@ -22,55 +22,62 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts2.AmazfitGTS2MiniSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts2.AmazfitGTS2MiniSupport;
public class AmazfitGTS2MiniCoordinator extends AmazfitGTS2Coordinator { public class AmazfitGTS2MiniCoordinator extends AmazfitGTS2Coordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTS2MiniCoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit GTS2 mini", Pattern.CASE_INSENSITIVE); return Pattern.compile("Amazfit GTS2 mini", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitGTS2MiniFWInstallHandler handler = new AmazfitGTS2MiniFWInstallHandler(uri, context); final AmazfitGTS2MiniFWInstallHandler handler = new AmazfitGTS2MiniFWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { @Override
return new int[]{ public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
R.xml.devicesettings_amazfitgts2mini, final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_heartrate_sleep, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_goal_notification, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_timeformat, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_liftwrist_display, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_inactivity_dnd, display.add(R.xml.devicesettings_amazfitgts2mini);
R.xml.devicesettings_disconnectnotification, display.add(R.xml.devicesettings_liftwrist_display);
R.xml.devicesettings_sync_calendar, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_reserve_reminders_calendar, health.add(R.xml.devicesettings_heartrate_sleep);
R.xml.devicesettings_expose_hr_thirdparty, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_bt_connected_advertisement, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_device_actions, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_phone_silent_mode, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_high_mtu, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
R.xml.devicesettings_transliteration calendar.add(R.xml.devicesettings_sync_calendar);
}; calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_disconnectnotification);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_high_mtu);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
} }
@Override @Override
@ -78,17 +85,6 @@ public class AmazfitGTS2MiniCoordinator extends AmazfitGTS2Coordinator {
return R.string.devicetype_amazfit_gts2_mini; return R.string.devicetype_amazfit_gts2_mini;
} }
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
@NonNull @NonNull
@Override @Override
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts2.Am
public class AmazfitGTS2MiniFWHelper extends HuamiFWHelper { public class AmazfitGTS2MiniFWHelper extends HuamiFWHelper {
public AmazfitGTS2MiniFWHelper(Uri uri, Context context) throws IOException { public AmazfitGTS2MiniFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitGTS2MiniFWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitGTS2MiniFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitGTS2MiniFWInstallHandler(Uri uri, Context context) { AmazfitGTS2MiniFWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitGTS2MiniFWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitGTS2MiniFWHelper(uri, context); return new AmazfitGTS2MiniFWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITGTS2_MINI; return device.getType() == DeviceType.AMAZFITGTS2_MINI;
} }
} }

View File

@ -22,31 +22,27 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts2.AmazfitGTS2eSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts2.AmazfitGTS2eSupport;
public class AmazfitGTS2eCoordinator extends HuamiCoordinator { public class AmazfitGTS2eCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTS2eCoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit GTS 2e", Pattern.CASE_INSENSITIVE); return Pattern.compile("Amazfit GTS 2e", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitGTS2eFWInstallHandler handler = new AmazfitGTS2eFWInstallHandler(uri, context); final AmazfitGTS2eFWInstallHandler handler = new AmazfitGTS2eFWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@ -56,7 +52,7 @@ public class AmazfitGTS2eCoordinator extends HuamiCoordinator {
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -80,27 +76,56 @@ public class AmazfitGTS2eCoordinator extends HuamiCoordinator {
return true; return true;
} }
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { @Override
return new int[]{ public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
R.xml.devicesettings_amazfitgtsgtr2, final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_heartrate_sleep, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_goal_notification, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_timeformat, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_liftwrist_display_sensitivity, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_inactivity_dnd, display.add(R.xml.devicesettings_amazfitgtsgtr2);
R.xml.devicesettings_disconnectnotification, display.add(R.xml.devicesettings_liftwrist_display_sensitivity);
R.xml.devicesettings_sync_calendar, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_reserve_reminders_calendar, health.add(R.xml.devicesettings_heartrate_sleep);
R.xml.devicesettings_expose_hr_thirdparty, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_bt_connected_advertisement, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_device_actions, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_phone_silent_mode, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_high_mtu, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
R.xml.devicesettings_transliteration calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_disconnectnotification);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_high_mtu);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
}
@Override
public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{
"auto",
"zh_CN",
"zh_TW",
"en_US",
"es_ES",
"de_DE",
"it_IT",
"fr_FR",
"pt_BR",
"tr_TR",
"cs_CZ",
"ru_RU",
}; };
} }
@ -110,13 +135,11 @@ public class AmazfitGTS2eCoordinator extends HuamiCoordinator {
return AmazfitGTS2eSupport.class; return AmazfitGTS2eSupport.class;
} }
@Override @Override
public int getDeviceNameResource() { public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gts2e; return R.string.devicetype_amazfit_gts2e;
} }
@Override @Override
public int getDefaultIconResource() { public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip; return R.drawable.ic_device_amazfit_bip;

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts2.Am
public class AmazfitGTS2eFWHelper extends HuamiFWHelper { public class AmazfitGTS2eFWHelper extends HuamiFWHelper {
public AmazfitGTS2eFWHelper(Uri uri, Context context) throws IOException { public AmazfitGTS2eFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitGTS2eFWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitGTS2eFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitGTS2eFWInstallHandler(Uri uri, Context context) { AmazfitGTS2eFWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitGTS2eFWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitGTS2eFWHelper(uri, context); return new AmazfitGTS2eFWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITGTS2E; return device.getType() == DeviceType.AMAZFITGTS2E;
} }
} }

View File

@ -22,40 +22,35 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.capabilities.HeartRateCapability; import nodomain.freeyourgadget.gadgetbridge.capabilities.HeartRateCapability;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitneo.AmazfitNeoSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitneo.AmazfitNeoSupport;
public class AmazfitNeoCoordinator extends HuamiCoordinator { public class AmazfitNeoCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitNeoCoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile(HuamiConst.AMAZFIT_NEO_NAME, Pattern.CASE_INSENSITIVE); return Pattern.compile(HuamiConst.AMAZFIT_NEO_NAME, Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitNeoFWInstallHandler handler = new AmazfitNeoFWInstallHandler(uri, context); final AmazfitNeoFWInstallHandler handler = new AmazfitNeoFWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -69,11 +64,6 @@ public class AmazfitNeoCoordinator extends HuamiCoordinator {
return true; return true;
} }
@Override
public boolean supportsActivityTracks() {
return false;
}
@Override @Override
public int getWorldClocksSlotCount() { public int getWorldClocksSlotCount() {
return 20; // max in Zepp app return 20; // max in Zepp app
@ -85,26 +75,37 @@ public class AmazfitNeoCoordinator extends HuamiCoordinator {
} }
@Override @Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
return new int[]{ final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_amazfitneo,
R.xml.devicesettings_wearlocation, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_heartrate_sleep_activity, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_goal_notification, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_timeformat, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_world_clocks, dateTime.add(R.xml.devicesettings_world_clocks);
R.xml.devicesettings_liftwrist_display, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_inactivity_dnd, display.add(R.xml.devicesettings_amazfitneo_display);
R.xml.devicesettings_hourly_chime, display.add(R.xml.devicesettings_liftwrist_display);
R.xml.devicesettings_expose_hr_thirdparty, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_bt_connected_advertisement, health.add(R.xml.devicesettings_heartrate_sleep_activity);
R.xml.devicesettings_device_actions, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_phone_silent_mode, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_high_mtu, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_transliteration final List<Integer> sound = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.SOUND);
}; sound.add(R.xml.devicesettings_amazfitneo_sound);
sound.add(R.xml.devicesettings_hourly_chime);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_high_mtu);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
} }
@Override @Override
@ -129,13 +130,11 @@ public class AmazfitNeoCoordinator extends HuamiCoordinator {
return AmazfitNeoSupport.class; return AmazfitNeoSupport.class;
} }
@Override @Override
public int getDeviceNameResource() { public int getDeviceNameResource() {
return R.string.devicetype_amazfit_neo; return R.string.devicetype_amazfit_neo;
} }
@Override @Override
public int getDefaultIconResource() { public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip; return R.drawable.ic_device_amazfit_bip;

View File

@ -27,7 +27,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitneo.Ama
public class AmazfitNeoFWHelper extends HuamiFWHelper { public class AmazfitNeoFWHelper extends HuamiFWHelper {
public AmazfitNeoFWHelper(Uri uri, Context context) throws IOException { public AmazfitNeoFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -29,7 +29,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitNeoFWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitNeoFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitNeoFWInstallHandler(Uri uri, Context context) { AmazfitNeoFWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -39,12 +39,12 @@ class AmazfitNeoFWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitNeoFWHelper(uri, context); return new AmazfitNeoFWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITNEO; return device.getType() == DeviceType.AMAZFITNEO;
} }
} }

View File

@ -21,30 +21,23 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbipu.AmazfitBipUCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbipu.AmazfitBipUCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitpop.AmazfitPopSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitpop.AmazfitPopSupport;
public class AmazfitPopCoordinator extends AmazfitBipUCoordinator { public class AmazfitPopCoordinator extends AmazfitBipUCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitPopCoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit Pop", Pattern.CASE_INSENSITIVE); return Pattern.compile("Amazfit Pop", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitPopFWInstallHandler handler = new AmazfitPopFWInstallHandler(uri, context); final AmazfitPopFWInstallHandler handler = new AmazfitPopFWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@ -53,7 +46,6 @@ public class AmazfitPopCoordinator extends AmazfitBipUCoordinator {
return R.string.devicetype_amazfit_pop; return R.string.devicetype_amazfit_pop;
} }
@Override @Override
public int getDefaultIconResource() { public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip; return R.drawable.ic_device_amazfit_bip;

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitpoppro.
public class AmazfitPopFWHelper extends HuamiFWHelper { public class AmazfitPopFWHelper extends HuamiFWHelper {
public AmazfitPopFWHelper(Uri uri, Context context) throws IOException { public AmazfitPopFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitPopFWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitPopFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitPopFWInstallHandler(Uri uri, Context context) { AmazfitPopFWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitPopFWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitPopFWHelper(uri, context); return new AmazfitPopFWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITPOP; return device.getType() == DeviceType.AMAZFITPOP;
} }
} }

View File

@ -21,30 +21,23 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbipupro.AmazfitBipUProCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbipupro.AmazfitBipUProCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitpoppro.AmazfitPopProSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitpoppro.AmazfitPopProSupport;
public class AmazfitPopProCoordinator extends AmazfitBipUProCoordinator { public class AmazfitPopProCoordinator extends AmazfitBipUProCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitPopProCoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit Pop Pro", Pattern.CASE_INSENSITIVE); return Pattern.compile("Amazfit Pop Pro", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitPopProFWInstallHandler handler = new AmazfitPopProFWInstallHandler(uri, context); final AmazfitPopProFWInstallHandler handler = new AmazfitPopProFWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@ -53,17 +46,6 @@ public class AmazfitPopProCoordinator extends AmazfitBipUProCoordinator {
return R.string.devicetype_amazfit_pop_pro; return R.string.devicetype_amazfit_pop_pro;
} }
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
@NonNull @NonNull
@Override @Override
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitpoppro.
public class AmazfitPopProFWHelper extends HuamiFWHelper { public class AmazfitPopProFWHelper extends HuamiFWHelper {
public AmazfitPopProFWHelper(Uri uri, Context context) throws IOException { public AmazfitPopProFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitPopProFWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitPopProFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitPopProFWInstallHandler(Uri uri, Context context) { AmazfitPopProFWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitPopProFWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitPopProFWHelper(uri, context); return new AmazfitPopProFWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITPOPPRO; return device.getType() == DeviceType.AMAZFITPOPPRO;
} }
} }

View File

@ -22,31 +22,27 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfittrex.AmazfitTRexSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfittrex.AmazfitTRexSupport;
public class AmazfitTRexCoordinator extends HuamiCoordinator { public class AmazfitTRexCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitTRexCoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit T-Rex", Pattern.CASE_INSENSITIVE); return Pattern.compile("Amazfit T-Rex", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitTRexFWInstallHandler handler = new AmazfitTRexFWInstallHandler(uri, context); final AmazfitTRexFWInstallHandler handler = new AmazfitTRexFWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@ -56,7 +52,7 @@ public class AmazfitTRexCoordinator extends HuamiCoordinator {
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -74,27 +70,57 @@ public class AmazfitTRexCoordinator extends HuamiCoordinator {
public boolean supportsMusicInfo() { public boolean supportsMusicInfo() {
return true; return true;
} }
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{ @Override
R.xml.devicesettings_amazfittrex, public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
R.xml.devicesettings_vibrationpatterns, final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_goal_notification, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_timeformat, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_liftwrist_display, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_inactivity_dnd, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_disconnectnotification, display.add(R.xml.devicesettings_amazfittrex);
R.xml.devicesettings_sync_calendar, display.add(R.xml.devicesettings_liftwrist_display);
R.xml.devicesettings_reserve_reminders_calendar, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_expose_hr_thirdparty, health.add(R.xml.devicesettings_heartrate_sleep);
R.xml.devicesettings_bt_connected_advertisement, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_device_actions, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_phone_silent_mode, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_high_mtu, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_transliteration final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_disconnectnotification);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_high_mtu);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
}
@Override
public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{
"auto",
"zh_CN",
"zh_TW",
"en_US",
"es_ES",
"de_DE",
"it_IT",
"fr_FR",
"pt_BR",
"tr_TR",
"cs_CZ",
"ru_RU",
}; };
} }

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfittrex.Am
public class AmazfitTRexFWHelper extends HuamiFWHelper { public class AmazfitTRexFWHelper extends HuamiFWHelper {
public AmazfitTRexFWHelper(Uri uri, Context context) throws IOException { public AmazfitTRexFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitTRexFWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitTRexFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitTRexFWInstallHandler(Uri uri, Context context) { AmazfitTRexFWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitTRexFWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitTRexFWHelper(uri, context); return new AmazfitTRexFWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITTREX; return device.getType() == DeviceType.AMAZFITTREX;
} }
} }

View File

@ -22,31 +22,27 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfittrexpro.AmazfitTRexProSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfittrexpro.AmazfitTRexProSupport;
public class AmazfitTRexProCoordinator extends HuamiCoordinator { public class AmazfitTRexProCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitTRexProCoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit T-Rex Pro", Pattern.CASE_INSENSITIVE); return Pattern.compile("Amazfit T-Rex Pro", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitTRexProFWInstallHandler handler = new AmazfitTRexProFWInstallHandler(uri, context); final AmazfitTRexProFWInstallHandler handler = new AmazfitTRexProFWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@ -56,7 +52,7 @@ public class AmazfitTRexProCoordinator extends HuamiCoordinator {
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -74,27 +70,57 @@ public class AmazfitTRexProCoordinator extends HuamiCoordinator {
public boolean supportsMusicInfo() { public boolean supportsMusicInfo() {
return true; return true;
} }
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{ @Override
R.xml.devicesettings_amazfittrexpro, public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
R.xml.devicesettings_vibrationpatterns, final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_goal_notification, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_timeformat, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_liftwrist_display_sensitivity, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_inactivity_dnd, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_disconnectnotification, display.add(R.xml.devicesettings_amazfittrexpro);
R.xml.devicesettings_sync_calendar, display.add(R.xml.devicesettings_liftwrist_display_sensitivity);
R.xml.devicesettings_reserve_reminders_calendar, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_expose_hr_thirdparty, health.add(R.xml.devicesettings_heartrate_sleep);
R.xml.devicesettings_bt_connected_advertisement, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_device_actions, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_phone_silent_mode, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_high_mtu, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_transliteration final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_disconnectnotification);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_high_mtu);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
}
@Override
public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{
"auto",
"zh_CN",
"zh_TW",
"en_US",
"es_ES",
"de_DE",
"it_IT",
"fr_FR",
"pt_BR",
"tr_TR",
"cs_CZ",
"ru_RU",
}; };
} }

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfittrexpro
public class AmazfitTRexProFWHelper extends HuamiFWHelper { public class AmazfitTRexProFWHelper extends HuamiFWHelper {
public AmazfitTRexProFWHelper(Uri uri, Context context) throws IOException { public AmazfitTRexProFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitTRexProFWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitTRexProFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitTRexProFWInstallHandler(Uri uri, Context context) { AmazfitTRexProFWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitTRexProFWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitTRexProFWHelper(uri, context); return new AmazfitTRexProFWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITTREXPRO; return device.getType() == DeviceType.AMAZFITTREXPRO;
} }
} }

View File

@ -21,31 +21,27 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitvergel.AmazfitVergeLSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitvergel.AmazfitVergeLSupport;
public class AmazfitVergeLCoordinator extends HuamiCoordinator { public class AmazfitVergeLCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitVergeLCoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit Verge L", Pattern.CASE_INSENSITIVE); return Pattern.compile("Amazfit Verge L", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
AmazfitVergeLFWInstallHandler handler = new AmazfitVergeLFWInstallHandler(uri, context); final AmazfitVergeLFWInstallHandler handler = new AmazfitVergeLFWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@ -55,7 +51,7 @@ public class AmazfitVergeLCoordinator extends HuamiCoordinator {
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -75,27 +71,38 @@ public class AmazfitVergeLCoordinator extends HuamiCoordinator {
} }
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { @Override
return new int[]{ public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
R.xml.devicesettings_amazfitvergel, final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_heartrate_sleep, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_goal_notification, generic.add(R.xml.devicesettings_buttonactions_with_longpress);
R.xml.devicesettings_liftwrist_display, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_inactivity_dnd, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_timeformat, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_sync_calendar, display.add(R.xml.devicesettings_amazfitvergel);
R.xml.devicesettings_reserve_reminders_calendar, display.add(R.xml.devicesettings_liftwrist_display);
R.xml.devicesettings_expose_hr_thirdparty, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_disconnectnotification, health.add(R.xml.devicesettings_heartrate_sleep);
R.xml.devicesettings_bt_connected_advertisement, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_buttonactions_with_longpress, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_phone_silent_mode, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_transliteration notifications.add(R.xml.devicesettings_transliteration);
}; final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_disconnectnotification);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
} }
@NonNull @NonNull
@ -104,13 +111,11 @@ public class AmazfitVergeLCoordinator extends HuamiCoordinator {
return AmazfitVergeLSupport.class; return AmazfitVergeLSupport.class;
} }
@Override @Override
public int getDeviceNameResource() { public int getDeviceNameResource() {
return R.string.devicetype_amazfit_vergel; return R.string.devicetype_amazfit_vergel;
} }
@Override @Override
public int getDefaultIconResource() { public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip; return R.drawable.ic_device_amazfit_bip;

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitvergel.
public class AmazfitVergeLFWHelper extends HuamiFWHelper { public class AmazfitVergeLFWHelper extends HuamiFWHelper {
public AmazfitVergeLFWHelper(Uri uri, Context context) throws IOException { public AmazfitVergeLFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitVergeLFWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitVergeLFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitVergeLFWInstallHandler(Uri uri, Context context) { AmazfitVergeLFWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class AmazfitVergeLFWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitVergeLFWHelper(uri, context); return new AmazfitVergeLFWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITVERGEL; return device.getType() == DeviceType.AMAZFITVERGEL;
} }
} }

View File

@ -22,39 +22,35 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitx.AmazfitXSupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitx.AmazfitXSupport;
public class AmazfitXCoordinator extends HuamiCoordinator { public class AmazfitXCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitXCoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile(HuamiConst.AMAZFIT_X, Pattern.CASE_INSENSITIVE); return Pattern.compile(HuamiConst.AMAZFIT_X, Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
// TOOD Need to be checked first // TOOD Need to be checked first
AmazfitXFWInstallHandler handler = new AmazfitXFWInstallHandler(uri, context); final AmazfitXFWInstallHandler handler = new AmazfitXFWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
// return null; // return null;
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -74,35 +70,45 @@ public class AmazfitXCoordinator extends HuamiCoordinator {
} }
@Override @Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
return new int[]{ final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_amazfitx,
R.xml.devicesettings_vibrationpatterns, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_wearlocation, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_heartrate_sleep, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_goal_notification, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_custom_emoji_font, dateTime.add(R.xml.devicesettings_dateformat);
R.xml.devicesettings_timeformat, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_dateformat, display.add(R.xml.devicesettings_amazfitx);
R.xml.devicesettings_nightmode, display.add(R.xml.devicesettings_nightmode);
R.xml.devicesettings_liftwrist_display, display.add(R.xml.devicesettings_liftwrist_display);
R.xml.devicesettings_inactivity_dnd, display.add(R.xml.devicesettings_swipeunlock);
R.xml.devicesettings_swipeunlock, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_sync_calendar, health.add(R.xml.devicesettings_heartrate_sleep);
R.xml.devicesettings_reserve_reminders_calendar, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_expose_hr_thirdparty, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_bt_connected_advertisement, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_device_actions, notifications.add(R.xml.devicesettings_custom_emoji_font);
R.xml.devicesettings_phone_silent_mode, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_high_mtu, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
R.xml.devicesettings_transliteration calendar.add(R.xml.devicesettings_sync_calendar);
}; calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_high_mtu);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
} }
@Override @Override
public String[] getSupportedLanguageSettings(GBDevice device) { public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{ return new String[]{
"auto", "auto",
"en_US", "en_US",
@ -122,13 +128,11 @@ public class AmazfitXCoordinator extends HuamiCoordinator {
return BONDING_STYLE_REQUIRE_KEY; return BONDING_STYLE_REQUIRE_KEY;
} }
@Override @Override
public int getDeviceNameResource() { public int getDeviceNameResource() {
return R.string.devicetype_amazfit_x; return R.string.devicetype_amazfit_x;
} }
@Override @Override
public int getDefaultIconResource() { public int getDefaultIconResource() {
return R.drawable.ic_device_miband2; return R.drawable.ic_device_miband2;

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitx.Amazf
public class AmazfitXFWHelper extends HuamiFWHelper { public class AmazfitXFWHelper extends HuamiFWHelper {
public AmazfitXFWHelper(Uri uri, Context context) throws IOException { public AmazfitXFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -29,7 +29,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitXFWInstallHandler extends AbstractMiBandFWInstallHandler { class AmazfitXFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitXFWInstallHandler(Uri uri, Context context) { AmazfitXFWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -39,12 +39,12 @@ class AmazfitXFWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new AmazfitXFWHelper(uri, context); return new AmazfitXFWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITX; return device.getType() == DeviceType.AMAZFITX;
} }
} }

View File

@ -23,10 +23,13 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsCustomizer; import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsCustomizer;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
@ -42,13 +45,13 @@ public class MiBand2Coordinator extends HuamiCoordinator {
return Pattern.compile(HuamiConst.MI_BAND2_NAME, Pattern.CASE_INSENSITIVE); return Pattern.compile(HuamiConst.MI_BAND2_NAME, Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
MiBand2FWInstallHandler handler = new MiBand2FWInstallHandler(uri, context); final MiBand2FWInstallHandler handler = new MiBand2FWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -63,25 +66,37 @@ public class MiBand2Coordinator extends HuamiCoordinator {
} }
@Override @Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
return new int[]{ final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_miband2,
R.xml.devicesettings_wearlocation, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_heartrate_sleep, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_goal_notification, generic.add(R.xml.devicesettings_buttonactions);
R.xml.devicesettings_timeformat, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_donotdisturb_withauto, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_liftwrist_display, dateTime.add(R.xml.devicesettings_miband2_dateformat);
R.xml.devicesettings_inactivity_dnd, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_rotatewrist_cycleinfo, display.add(R.xml.devicesettings_miband2_display);
R.xml.devicesettings_buttonactions, display.add(R.xml.devicesettings_liftwrist_display);
R.xml.devicesettings_miband_vibrationpatterns, display.add(R.xml.devicesettings_rotatewrist_cycleinfo);
R.xml.devicesettings_reserve_alarms_calendar, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_bt_connected_advertisement, health.add(R.xml.devicesettings_heartrate_sleep);
R.xml.devicesettings_overwrite_settings_on_connection, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_transliteration final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
}; notifications.add(R.xml.devicesettings_donotdisturb_withauto);
notifications.add(R.xml.devicesettings_miband_vibrationpatterns);
notifications.add(R.xml.devicesettings_transliteration);
final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
//calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_alarms_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
} }
@Override @Override

View File

@ -27,7 +27,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband2.Mi2Fir
public class MiBand2FWHelper extends HuamiFWHelper { public class MiBand2FWHelper extends HuamiFWHelper {
public MiBand2FWHelper(Uri uri, Context context) throws IOException { public MiBand2FWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -37,7 +37,7 @@ import nodomain.freeyourgadget.gadgetbridge.util.Version;
public class MiBand2FWInstallHandler extends AbstractMiBandFWInstallHandler { public class MiBand2FWInstallHandler extends AbstractMiBandFWInstallHandler {
private static final Logger LOG = LoggerFactory.getLogger(MiBand2FWInstallHandler.class); private static final Logger LOG = LoggerFactory.getLogger(MiBand2FWInstallHandler.class);
MiBand2FWInstallHandler(Uri uri, Context context) { MiBand2FWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -86,7 +86,7 @@ public class MiBand2FWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
} }
private Version getFirmwareVersionOf(GBDevice device) { private Version getFirmwareVersionOf(final GBDevice device) {
String version = device.getFirmwareVersion(); String version = device.getFirmwareVersion();
if (version == null || version.length() == 0) { if (version == null || version.length() == 0) {
return null; return null;
@ -111,12 +111,12 @@ public class MiBand2FWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new MiBand2FWHelper(uri, context); return new MiBand2FWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.MIBAND2 || device.getType() == DeviceType.MIBAND2_HRX; return device.getType() == DeviceType.MIBAND2 || device.getType() == DeviceType.MIBAND2_HRX;
} }
} }

View File

@ -23,10 +23,13 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsCustomizer; import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsCustomizer;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
@ -46,7 +49,7 @@ public class MiBand2HRXCoordinator extends HuamiCoordinator {
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
return null; return null;
} }
@ -61,21 +64,31 @@ public class MiBand2HRXCoordinator extends HuamiCoordinator {
} }
@Override @Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
return new int[]{ final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_miband2,
R.xml.devicesettings_wearlocation, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_heartrate_sleep, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_goal_notification, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_donotdisturb_withauto, dateTime.add(R.xml.devicesettings_miband2_dateformat);
R.xml.devicesettings_liftwrist_display, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_inactivity_dnd, display.add(R.xml.devicesettings_miband2_display);
R.xml.devicesettings_rotatewrist_cycleinfo, display.add(R.xml.devicesettings_liftwrist_display);
R.xml.devicesettings_miband_vibrationpatterns, display.add(R.xml.devicesettings_rotatewrist_cycleinfo);
R.xml.devicesettings_overwrite_settings_on_connection, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, health.add(R.xml.devicesettings_heartrate_sleep);
R.xml.devicesettings_transliteration health.add(R.xml.devicesettings_inactivity_dnd);
}; health.add(R.xml.devicesettings_goal_notification);
final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
notifications.add(R.xml.devicesettings_donotdisturb_withauto);
notifications.add(R.xml.devicesettings_miband_vibrationpatterns);
notifications.add(R.xml.devicesettings_transliteration);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
} }
@Override @Override

View File

@ -22,28 +22,24 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Date; import java.util.Date;
import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.GBApplication; import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst; import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband3.MiBand3Support; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband3.MiBand3Support;
import nodomain.freeyourgadget.gadgetbridge.util.Prefs; import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
public class MiBand3Coordinator extends HuamiCoordinator { public class MiBand3Coordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(MiBand3Coordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile( return Pattern.compile(
@ -53,13 +49,13 @@ public class MiBand3Coordinator extends HuamiCoordinator {
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
MiBand3FWInstallHandler handler = new MiBand3FWInstallHandler(uri, context); final MiBand3FWInstallHandler handler = new MiBand3FWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -73,49 +69,59 @@ public class MiBand3Coordinator extends HuamiCoordinator {
return true; return true;
} }
public static String getNightMode(String deviceAddress) { public static String getNightMode(final String deviceAddress) {
Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(deviceAddress)); Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(deviceAddress));
return prefs.getString(MiBandConst.PREF_NIGHT_MODE, MiBandConst.PREF_NIGHT_MODE_OFF); return prefs.getString(MiBandConst.PREF_NIGHT_MODE, MiBandConst.PREF_NIGHT_MODE_OFF);
} }
public static Date getNightModeStart(String deviceAddress) { public static Date getNightModeStart(final String deviceAddress) {
return getTimePreference(MiBandConst.PREF_NIGHT_MODE_START, "16:00", deviceAddress); return getTimePreference(MiBandConst.PREF_NIGHT_MODE_START, "16:00", deviceAddress);
} }
public static Date getNightModeEnd(String deviceAddress) { public static Date getNightModeEnd(final String deviceAddress) {
return getTimePreference(MiBandConst.PREF_NIGHT_MODE_END, "07:00", deviceAddress); return getTimePreference(MiBandConst.PREF_NIGHT_MODE_END, "07:00", deviceAddress);
} }
@Override @Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
return new int[]{ final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_miband3,
R.xml.devicesettings_wearlocation, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_heartrate_sleep, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_goal_notification, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_timeformat, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_dateformat, dateTime.add(R.xml.devicesettings_dateformat);
R.xml.devicesettings_nightmode, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_donotdisturb_withauto, display.add(R.xml.devicesettings_miband3);
R.xml.devicesettings_liftwrist_display, display.add(R.xml.devicesettings_nightmode);
R.xml.devicesettings_inactivity_dnd, display.add(R.xml.devicesettings_liftwrist_display);
R.xml.devicesettings_donotdisturb_lift_wrist, display.add(R.xml.devicesettings_donotdisturb_lift_wrist);
R.xml.devicesettings_swipeunlock, display.add(R.xml.devicesettings_swipeunlock);
R.xml.devicesettings_sync_calendar, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_reserve_reminders_calendar, health.add(R.xml.devicesettings_heartrate_sleep);
R.xml.devicesettings_expose_hr_thirdparty, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_bt_connected_advertisement, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_device_actions, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_phone_silent_mode, notifications.add(R.xml.devicesettings_donotdisturb_withauto);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_transliteration final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
}; calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
} }
@Override @Override
public String[] getSupportedLanguageSettings(GBDevice device) { public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{ return new String[]{
"auto", "auto",
"ar_SA", "ar_SA",
@ -146,13 +152,11 @@ public class MiBand3Coordinator extends HuamiCoordinator {
return MiBand3Support.class; return MiBand3Support.class;
} }
@Override @Override
public int getDeviceNameResource() { public int getDeviceNameResource() {
return R.string.devicetype_miband3; return R.string.devicetype_miband3;
} }
@Override @Override
public int getDefaultIconResource() { public int getDefaultIconResource() {
return R.drawable.ic_device_miband2; return R.drawable.ic_device_miband2;

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband3.MiBand
public class MiBand3FWHelper extends HuamiFWHelper { public class MiBand3FWHelper extends HuamiFWHelper {
public MiBand3FWHelper(Uri uri, Context context) throws IOException { public MiBand3FWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class MiBand3FWInstallHandler extends AbstractMiBandFWInstallHandler { class MiBand3FWInstallHandler extends AbstractMiBandFWInstallHandler {
MiBand3FWInstallHandler(Uri uri, Context context) { MiBand3FWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class MiBand3FWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new MiBand3FWHelper(uri, context); return new MiBand3FWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.MIBAND3; return device.getType() == DeviceType.MIBAND3;
} }
} }

View File

@ -22,41 +22,36 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.capabilities.HeartRateCapability; import nodomain.freeyourgadget.gadgetbridge.capabilities.HeartRateCapability;
import nodomain.freeyourgadget.gadgetbridge.capabilities.password.PasswordCapabilityImpl; import nodomain.freeyourgadget.gadgetbridge.capabilities.password.PasswordCapabilityImpl;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband4.MiBand4Support; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband4.MiBand4Support;
public class MiBand4Coordinator extends HuamiCoordinator { public class MiBand4Coordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(MiBand4Coordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile(HuamiConst.MI_BAND4_NAME, Pattern.CASE_INSENSITIVE); return Pattern.compile(HuamiConst.MI_BAND4_NAME, Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
MiBand4FWInstallHandler handler = new MiBand4FWInstallHandler(uri, context); final MiBand4FWInstallHandler handler = new MiBand4FWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -76,37 +71,48 @@ public class MiBand4Coordinator extends HuamiCoordinator {
} }
@Override @Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
return new int[]{ final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_miband3,
R.xml.devicesettings_vibrationpatterns, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_wearlocation, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_heartrate_sleep_activity, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_goal_notification, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_custom_emoji_font, dateTime.add(R.xml.devicesettings_dateformat);
R.xml.devicesettings_timeformat, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_dateformat, display.add(R.xml.devicesettings_miband3);
R.xml.devicesettings_nightmode, display.add(R.xml.devicesettings_nightmode);
R.xml.devicesettings_liftwrist_display_sensitivity, display.add(R.xml.devicesettings_liftwrist_display_sensitivity);
R.xml.devicesettings_inactivity_dnd, display.add(R.xml.devicesettings_swipeunlock);
R.xml.devicesettings_workout_start_on_phone, display.add(R.xml.devicesettings_password);
R.xml.devicesettings_workout_send_gps_to_band, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_swipeunlock, health.add(R.xml.devicesettings_heartrate_sleep_activity);
R.xml.devicesettings_password, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_sync_calendar, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_reserve_reminders_calendar, final List<Integer> workout = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.WORKOUT);
R.xml.devicesettings_expose_hr_thirdparty, workout.add(R.xml.devicesettings_workout_start_on_phone);
R.xml.devicesettings_bt_connected_advertisement, workout.add(R.xml.devicesettings_workout_send_gps_to_band);
R.xml.devicesettings_device_actions, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_high_mtu, notifications.add(R.xml.devicesettings_custom_emoji_font);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_transliteration final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
}; calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_high_mtu);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
} }
@Override @Override
public String[] getSupportedLanguageSettings(GBDevice device) { public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{ return new String[]{
"auto", "auto",
"ar_SA", "ar_SA",
@ -156,13 +162,11 @@ public class MiBand4Coordinator extends HuamiCoordinator {
return MiBand4Support.class; return MiBand4Support.class;
} }
@Override @Override
public int getDeviceNameResource() { public int getDeviceNameResource() {
return R.string.devicetype_miband4; return R.string.devicetype_miband4;
} }
@Override @Override
public int getDefaultIconResource() { public int getDefaultIconResource() {
return R.drawable.ic_device_miband2; return R.drawable.ic_device_miband2;

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband4.MiBand
public class MiBand4FWHelper extends HuamiFWHelper { public class MiBand4FWHelper extends HuamiFWHelper {
public MiBand4FWHelper(Uri uri, Context context) throws IOException { public MiBand4FWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -29,7 +29,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class MiBand4FWInstallHandler extends AbstractMiBandFWInstallHandler { class MiBand4FWInstallHandler extends AbstractMiBandFWInstallHandler {
MiBand4FWInstallHandler(Uri uri, Context context) { MiBand4FWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -39,12 +39,12 @@ class MiBand4FWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new MiBand4FWHelper(uri, context); return new MiBand4FWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.MIBAND4; return device.getType() == DeviceType.MIBAND4;
} }
} }

View File

@ -22,41 +22,35 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.Arrays; import java.util.Arrays;
import java.util.List; import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.capabilities.HeartRateCapability; import nodomain.freeyourgadget.gadgetbridge.capabilities.HeartRateCapability;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband5.MiBand5Support; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband5.MiBand5Support;
public class MiBand5Coordinator extends HuamiCoordinator { public class MiBand5Coordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(MiBand5Coordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile(HuamiConst.MI_BAND5_NAME, Pattern.CASE_INSENSITIVE); return Pattern.compile(HuamiConst.MI_BAND5_NAME, Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
MiBand5FWInstallHandler handler = new MiBand5FWInstallHandler(uri, context); final MiBand5FWInstallHandler handler = new MiBand5FWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -96,38 +90,49 @@ public class MiBand5Coordinator extends HuamiCoordinator {
} }
@Override @Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
return new int[]{ final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_miband5,
R.xml.devicesettings_vibrationpatterns, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_wearlocation, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_heartrate_sleep_alert_activity_stress, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_goal_notification, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_custom_emoji_font, dateTime.add(R.xml.devicesettings_dateformat);
R.xml.devicesettings_timeformat, dateTime.add(R.xml.devicesettings_world_clocks);
R.xml.devicesettings_dateformat, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_world_clocks, display.add(R.xml.devicesettings_miband5);
R.xml.devicesettings_nightmode, display.add(R.xml.devicesettings_nightmode);
R.xml.devicesettings_liftwrist_display_sensitivity, display.add(R.xml.devicesettings_liftwrist_display_sensitivity);
R.xml.devicesettings_inactivity_dnd, display.add(R.xml.devicesettings_swipeunlock);
R.xml.devicesettings_workout_start_on_phone, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_workout_send_gps_to_band, health.add(R.xml.devicesettings_heartrate_sleep_alert_activity_stress);
R.xml.devicesettings_swipeunlock, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_sync_calendar, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_reserve_reminders_calendar, final List<Integer> workout = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.WORKOUT);
R.xml.devicesettings_expose_hr_thirdparty, workout.add(R.xml.devicesettings_workout_start_on_phone);
R.xml.devicesettings_bt_connected_advertisement, workout.add(R.xml.devicesettings_workout_send_gps_to_band);
R.xml.devicesettings_device_actions, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_phone_silent_mode, notifications.add(R.xml.devicesettings_custom_emoji_font);
R.xml.devicesettings_high_mtu, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_transliteration final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
}; calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_high_mtu);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
} }
@Override @Override
public String[] getSupportedLanguageSettings(GBDevice device) { public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{ return new String[]{
"auto", "auto",
"ar_SA", "ar_SA",
@ -176,13 +181,11 @@ public class MiBand5Coordinator extends HuamiCoordinator {
return MiBand5Support.class; return MiBand5Support.class;
} }
@Override @Override
public int getDeviceNameResource() { public int getDeviceNameResource() {
return R.string.devicetype_miband5; return R.string.devicetype_miband5;
} }
@Override @Override
public int getDefaultIconResource() { public int getDefaultIconResource() {
return R.drawable.ic_device_miband2; return R.drawable.ic_device_miband2;

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband5.MiBand
public class MiBand5FWHelper extends HuamiFWHelper { public class MiBand5FWHelper extends HuamiFWHelper {
public MiBand5FWHelper(Uri uri, Context context) throws IOException { public MiBand5FWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -29,7 +29,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class MiBand5FWInstallHandler extends AbstractMiBandFWInstallHandler { class MiBand5FWInstallHandler extends AbstractMiBandFWInstallHandler {
MiBand5FWInstallHandler(Uri uri, Context context) { MiBand5FWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -39,12 +39,12 @@ class MiBand5FWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new MiBand5FWHelper(uri, context); return new MiBand5FWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.MIBAND5; return device.getType() == DeviceType.MIBAND5;
} }
} }

View File

@ -30,6 +30,8 @@ import java.util.List;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.capabilities.HeartRateCapability; import nodomain.freeyourgadget.gadgetbridge.capabilities.HeartRateCapability;
import nodomain.freeyourgadget.gadgetbridge.capabilities.password.PasswordCapabilityImpl; import nodomain.freeyourgadget.gadgetbridge.capabilities.password.PasswordCapabilityImpl;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
@ -48,13 +50,13 @@ public class MiBand6Coordinator extends HuamiCoordinator {
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
MiBand6FWInstallHandler handler = new MiBand6FWInstallHandler(uri, context); final MiBand6FWInstallHandler handler = new MiBand6FWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -99,35 +101,45 @@ public class MiBand6Coordinator extends HuamiCoordinator {
} }
@Override @Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
return new int[]{ final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_miband6,
R.xml.devicesettings_miband6_new_protocol, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_vibrationpatterns, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_wearlocation, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_heartrate_sleep_alert_activity_stress, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_goal_notification, dateTime.add(R.xml.devicesettings_dateformat);
R.xml.devicesettings_custom_emoji_font, dateTime.add(R.xml.devicesettings_world_clocks);
R.xml.devicesettings_timeformat, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_dateformat, display.add(R.xml.devicesettings_miband6);
R.xml.devicesettings_world_clocks, display.add(R.xml.devicesettings_nightmode);
R.xml.devicesettings_nightmode, display.add(R.xml.devicesettings_liftwrist_display_sensitivity);
R.xml.devicesettings_liftwrist_display_sensitivity, display.add(R.xml.devicesettings_swipeunlock);
R.xml.devicesettings_inactivity_dnd, display.add(R.xml.devicesettings_password);
R.xml.devicesettings_workout_start_on_phone, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_workout_send_gps_to_band, health.add(R.xml.devicesettings_heartrate_sleep_alert_activity_stress);
R.xml.devicesettings_swipeunlock, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_password, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_sync_calendar, final List<Integer> workout = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.WORKOUT);
R.xml.devicesettings_reserve_reminders_calendar, workout.add(R.xml.devicesettings_workout_start_on_phone);
R.xml.devicesettings_expose_hr_thirdparty, workout.add(R.xml.devicesettings_workout_send_gps_to_band);
R.xml.devicesettings_bt_connected_advertisement, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_phone_silent_mode, notifications.add(R.xml.devicesettings_custom_emoji_font);
R.xml.devicesettings_high_mtu, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, notifications.add(R.xml.devicesettings_transliteration);
R.xml.devicesettings_transliteration final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
}; calendar.add(R.xml.devicesettings_sync_calendar);
calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_high_mtu);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
} }
@Override @Override
@ -140,7 +152,7 @@ public class MiBand6Coordinator extends HuamiCoordinator {
} }
@Override @Override
public String[] getSupportedLanguageSettings(GBDevice device) { public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{ return new String[]{
"auto", "auto",
"ar_SA", "ar_SA",

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband6.MiBand
public class MiBand6FWHelper extends HuamiFWHelper { public class MiBand6FWHelper extends HuamiFWHelper {
public MiBand6FWHelper(Uri uri, Context context) throws IOException { public MiBand6FWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -29,7 +29,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class MiBand6FWInstallHandler extends AbstractMiBandFWInstallHandler { class MiBand6FWInstallHandler extends AbstractMiBandFWInstallHandler {
MiBand6FWInstallHandler(Uri uri, Context context) { MiBand6FWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -39,12 +39,12 @@ class MiBand6FWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new MiBand6FWHelper(uri, context); return new MiBand6FWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.MIBAND6; return device.getType() == DeviceType.MIBAND6;
} }
} }

View File

@ -22,31 +22,27 @@ import android.net.Uri;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import org.slf4j.Logger; import java.util.List;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern; import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport; import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppe.ZeppESupport; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppe.ZeppESupport;
public class ZeppECoordinator extends HuamiCoordinator { public class ZeppECoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(ZeppECoordinator.class);
@Override @Override
protected Pattern getSupportedDeviceName() { protected Pattern getSupportedDeviceName() {
return Pattern.compile("Zepp E", Pattern.CASE_INSENSITIVE); return Pattern.compile("Zepp E", Pattern.CASE_INSENSITIVE);
} }
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(final Uri uri, final Context context) {
ZeppEFWInstallHandler handler = new ZeppEFWInstallHandler(uri, context); final ZeppEFWInstallHandler handler = new ZeppEFWInstallHandler(uri, context);
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@ -56,7 +52,7 @@ public class ZeppECoordinator extends HuamiCoordinator {
} }
@Override @Override
public boolean supportsHeartRateMeasurement(GBDevice device) { public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true; return true;
} }
@ -74,26 +70,57 @@ public class ZeppECoordinator extends HuamiCoordinator {
public boolean supportsMusicInfo() { public boolean supportsMusicInfo() {
return true; return true;
} }
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{ @Override
R.xml.devicesettings_amazfitgtsgtr, public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
R.xml.devicesettings_vibrationpatterns, final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep, final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
R.xml.devicesettings_goal_notification, generic.add(R.xml.devicesettings_wearlocation);
R.xml.devicesettings_timeformat, final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
R.xml.devicesettings_liftwrist_display, dateTime.add(R.xml.devicesettings_timeformat);
R.xml.devicesettings_inactivity_dnd, final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
R.xml.devicesettings_disconnectnotification, display.add(R.xml.devicesettings_amazfitgtsgtr);
R.xml.devicesettings_sync_calendar, display.add(R.xml.devicesettings_liftwrist_display);
R.xml.devicesettings_expose_hr_thirdparty, final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
R.xml.devicesettings_bt_connected_advertisement, health.add(R.xml.devicesettings_heartrate_sleep);
R.xml.devicesettings_device_actions, health.add(R.xml.devicesettings_inactivity_dnd);
R.xml.devicesettings_phone_silent_mode, health.add(R.xml.devicesettings_goal_notification);
R.xml.devicesettings_high_mtu, final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
R.xml.devicesettings_overwrite_settings_on_connection, notifications.add(R.xml.devicesettings_vibrationpatterns);
R.xml.devicesettings_huami2021_fetch_operation_time_unit, notifications.add(R.xml.devicesettings_phone_silent_mode);
R.xml.devicesettings_transliteration notifications.add(R.xml.devicesettings_transliteration);
final List<Integer> calendar = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CALENDAR);
calendar.add(R.xml.devicesettings_sync_calendar);
//calendar.add(R.xml.devicesettings_reserve_reminders_calendar);
final List<Integer> connection = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.CONNECTION);
connection.add(R.xml.devicesettings_disconnectnotification);
connection.add(R.xml.devicesettings_expose_hr_thirdparty);
connection.add(R.xml.devicesettings_bt_connected_advertisement);
connection.add(R.xml.devicesettings_device_actions);
connection.add(R.xml.devicesettings_high_mtu);
connection.add(R.xml.devicesettings_overwrite_settings_on_connection);
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
developer.add(R.xml.devicesettings_huami2021_fetch_operation_time_unit);
return deviceSpecificSettings;
}
@Override
public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{
"auto",
"zh_CN",
"zh_TW",
"en_US",
"es_ES",
"de_DE",
"it_IT",
"fr_FR",
"pt_BR",
"tr_TR",
"cs_CZ",
"ru_RU",
}; };
} }
@ -103,7 +130,6 @@ public class ZeppECoordinator extends HuamiCoordinator {
return ZeppESupport.class; return ZeppESupport.class;
} }
@Override @Override
public int getDeviceNameResource() { public int getDeviceNameResource() {
return R.string.devicetype_zepp_e; return R.string.devicetype_zepp_e;

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppe.ZeppEFir
public class ZeppEFWHelper extends HuamiFWHelper { public class ZeppEFWHelper extends HuamiFWHelper {
public ZeppEFWHelper(Uri uri, Context context) throws IOException { public ZeppEFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context); super(uri, context);
} }

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class ZeppEFWInstallHandler extends AbstractMiBandFWInstallHandler { class ZeppEFWInstallHandler extends AbstractMiBandFWInstallHandler {
ZeppEFWInstallHandler(Uri uri, Context context) { ZeppEFWInstallHandler(final Uri uri, final Context context) {
super(uri, context); super(uri, context);
} }
@ -38,12 +38,12 @@ class ZeppEFWInstallHandler extends AbstractMiBandFWInstallHandler {
} }
@Override @Override
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException { protected AbstractMiBandFWHelper createHelper(final Uri uri, final Context context) throws IOException {
return new ZeppEFWHelper(uri, context); return new ZeppEFWHelper(uri, context);
} }
@Override @Override
protected boolean isSupportedDeviceType(GBDevice device) { protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.ZEPP_E; return device.getType() == DeviceType.ZEPP_E;
} }
} }

View File

@ -28,7 +28,6 @@ import java.util.ArrayList;
import java.util.Arrays; import java.util.Arrays;
import java.util.Collections; import java.util.Collections;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Map; import java.util.Map;
import java.util.Set; import java.util.Set;
@ -36,7 +35,6 @@ import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R; import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.appmanager.AppManagerActivity; import nodomain.freeyourgadget.gadgetbridge.activities.appmanager.AppManagerActivity;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsUtils;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen; import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings; import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsCustomizer; import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsCustomizer;
@ -45,7 +43,6 @@ import nodomain.freeyourgadget.gadgetbridge.capabilities.password.PasswordCapabi
import nodomain.freeyourgadget.gadgetbridge.GBException; import nodomain.freeyourgadget.gadgetbridge.GBException;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider; import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
import nodomain.freeyourgadget.gadgetbridge.service.SleepAsAndroidSender;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiExtendedSampleProvider; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiExtendedSampleProvider;
import nodomain.freeyourgadget.gadgetbridge.entities.AbstractActivitySample; import nodomain.freeyourgadget.gadgetbridge.entities.AbstractActivitySample;
@ -75,7 +72,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiLanguageT
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiVibrationPatternNotificationType; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.HuamiVibrationPatternNotificationType;
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.services.ZeppOsPhoneService; import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.services.ZeppOsPhoneService;
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils; import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
import nodomain.freeyourgadget.gadgetbridge.devices.SleepAsAndroidFeature; import nodomain.freeyourgadget.gadgetbridge.devices.SleepAsAndroidFeature;
public abstract class ZeppOsCoordinator extends HuamiCoordinator { public abstract class ZeppOsCoordinator extends HuamiCoordinator {
@ -145,11 +141,6 @@ public abstract class ZeppOsCoordinator extends HuamiCoordinator {
return false; return false;
} }
@Override
public boolean supportsRealtimeData() {
return true;
}
@Override @Override
public boolean supportsWeather() { public boolean supportsWeather() {
return true; return true;
@ -176,7 +167,7 @@ public abstract class ZeppOsCoordinator extends HuamiCoordinator {
} }
@Override @Override
public boolean supportsSpo2(GBDevice device) { public boolean supportsSpo2(final GBDevice device) {
return true; return true;
} }
@ -255,11 +246,6 @@ public abstract class ZeppOsCoordinator extends HuamiCoordinator {
return true; return true;
} }
@Override
public boolean supportsAppReordering() {
return false;
}
@Override @Override
public boolean supportsCalendarEvents() { public boolean supportsCalendarEvents() {
return true; return true;
@ -607,10 +593,6 @@ public abstract class ZeppOsCoordinator extends HuamiCoordinator {
return ZeppOsConfigService.deviceHasConfig(getPrefs(device), config); return ZeppOsConfigService.deviceHasConfig(getPrefs(device), config);
} }
public static boolean deviceHasConfig(final Prefs devicePrefs, final ZeppOsConfigService.ConfigArg config) {
return devicePrefs.getBoolean(DeviceSettingsUtils.getPrefKnownConfig(config.name()), false);
}
public static boolean experimentalFeatures(final GBDevice device) { public static boolean experimentalFeatures(final GBDevice device) {
return getPrefs(device).getBoolean("zepp_os_experimental_features", false); return getPrefs(device).getBoolean("zepp_os_experimental_features", false);
} }

View File

@ -204,6 +204,7 @@
<string name="pref_header_health">Health</string> <string name="pref_header_health">Health</string>
<string name="pref_header_sound_vibration">Sound &amp; Vibration</string> <string name="pref_header_sound_vibration">Sound &amp; Vibration</string>
<string name="pref_header_offline_voice">Offline Voice</string> <string name="pref_header_offline_voice">Offline Voice</string>
<string name="pref_header_sound">Sound</string>
<string name="pref_header_time">Time</string> <string name="pref_header_time">Time</string>
<string name="pref_header_workout">Workout</string> <string name="pref_header_workout">Workout</string>
<string name="pref_header_equalizer">Equalizer</string> <string name="pref_header_equalizer">Equalizer</string>

View File

@ -20,12 +20,4 @@
android:persistent="true" android:persistent="true"
android:summary="@string/bip_prefs_shotcuts_summary" android:summary="@string/bip_prefs_shotcuts_summary"
android:title="@string/bip_prefs_shortcuts" /> android:title="@string/bip_prefs_shortcuts" />
<ListPreference
android:icon="@drawable/ic_language"
android:defaultValue="auto"
android:entries="@array/pref_amazfitbip_language"
android:entryValues="@array/pref_amazfitbip_language_values"
android:key="language"
android:summary="%s"
android:title="@string/pref_title_language" />
</androidx.preference.PreferenceScreen> </androidx.preference.PreferenceScreen>

View File

@ -20,12 +20,4 @@
android:persistent="true" android:persistent="true"
android:summary="@string/bip_prefs_shotcuts_summary" android:summary="@string/bip_prefs_shotcuts_summary"
android:title="@string/bip_prefs_shortcuts" /> android:title="@string/bip_prefs_shortcuts" />
<ListPreference
android:icon="@drawable/ic_language"
android:defaultValue="auto"
android:entries="@array/pref_amazfitbip_language"
android:entryValues="@array/pref_amazfitbip_language_values"
android:key="language"
android:summary="%s"
android:title="@string/pref_title_language" />
</androidx.preference.PreferenceScreen> </androidx.preference.PreferenceScreen>

Some files were not shown because too many files have changed in this diff Show More