1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-27 20:36:51 +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);
}
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() {
final List<Integer> allScreens = new ArrayList<>(rootScreens);
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),
HEALTH("pref_screen_health", R.xml.devicesettings_root_health),
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;

View File

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

View File

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

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitBand5FWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitBand5FWInstallHandler(Uri uri, Context context) {
AmazfitBand5FWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitBand5FWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITBAND5;
}
}

View File

@ -22,36 +22,32 @@ import android.net.Uri;
import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.regex.Pattern;
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.huami.HuamiCoordinator;
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.devices.huami.amazfitbip.AmazfitBipSupport;
public class AmazfitBipCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipCoordinator.class);
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit Bip Watch", Pattern.CASE_INSENSITIVE);
}
@Override
public InstallHandler findInstallHandler(Uri uri, Context context) {
AmazfitBipFWInstallHandler handler = new AmazfitBipFWInstallHandler(uri, context);
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
final AmazfitBipFWInstallHandler handler = new AmazfitBipFWInstallHandler(uri, context);
return handler.isValid() ? handler : null;
}
@Override
public boolean supportsHeartRateMeasurement(GBDevice device) {
public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true;
}
@ -66,26 +62,54 @@ public class AmazfitBipCoordinator extends HuamiCoordinator {
}
@Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{
R.xml.devicesettings_amazfitbip,
R.xml.devicesettings_timeformat,
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep,
R.xml.devicesettings_goal_notification,
R.xml.devicesettings_custom_emoji_font,
R.xml.devicesettings_liftwrist_display,
R.xml.devicesettings_inactivity_dnd,
R.xml.devicesettings_disconnectnotification,
R.xml.devicesettings_sync_calendar,
R.xml.devicesettings_reserve_reminders_calendar,
R.xml.devicesettings_bt_connected_advertisement,
R.xml.devicesettings_buttonactions_with_longpress,
R.xml.devicesettings_device_actions,
R.xml.devicesettings_phone_silent_mode,
R.xml.devicesettings_overwrite_settings_on_connection,
R.xml.devicesettings_huami2021_fetch_operation_time_unit,
R.xml.devicesettings_transliteration
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
generic.add(R.xml.devicesettings_wearlocation);
generic.add(R.xml.devicesettings_buttonactions_with_longpress);
final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
dateTime.add(R.xml.devicesettings_timeformat);
final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
display.add(R.xml.devicesettings_amazfitbip);
display.add(R.xml.devicesettings_liftwrist_display);
final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
health.add(R.xml.devicesettings_heartrate_sleep);
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_custom_emoji_font);
notifications.add(R.xml.devicesettings_phone_silent_mode);
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_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;
}
@Override
public int getDefaultIconResource() {
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 AmazfitBipFWHelper(Uri uri, Context context) throws IOException {
public AmazfitBipFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context);
}

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitBipFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitBipFWInstallHandler(Uri uri, Context context) {
AmazfitBipFWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitBipFWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITBIP;
}
}

View File

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

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.Ama
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);
}

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitBipLiteFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitBipLiteFWInstallHandler(Uri uri, Context context) {
AmazfitBipLiteFWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitBipLiteFWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITBIP_LITE;
}
}

View File

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

View File

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

View File

@ -22,12 +22,12 @@ import android.net.Uri;
import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.regex.Pattern;
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.huami.HuamiCoordinator;
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;
public class AmazfitBipSCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipSCoordinator.class);
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit Bip S", Pattern.CASE_INSENSITIVE);
}
@Override
public InstallHandler findInstallHandler(Uri uri, Context context) {
AmazfitBipSFWInstallHandler handler = new AmazfitBipSFWInstallHandler(uri, context);
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
final AmazfitBipSFWInstallHandler handler = new AmazfitBipSFWInstallHandler(uri, context);
return handler.isValid() ? handler : null;
}
@Override
public boolean supportsHeartRateMeasurement(GBDevice device) {
public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true;
}
@ -79,27 +77,55 @@ public class AmazfitBipSCoordinator extends HuamiCoordinator {
}
@Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{
R.xml.devicesettings_amazfitbips,
R.xml.devicesettings_timeformat,
R.xml.devicesettings_world_clocks,
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep,
R.xml.devicesettings_goal_notification,
R.xml.devicesettings_custom_emoji_font,
R.xml.devicesettings_liftwrist_display,
R.xml.devicesettings_inactivity_dnd,
R.xml.devicesettings_sync_calendar,
R.xml.devicesettings_reserve_reminders_calendar,
R.xml.devicesettings_expose_hr_thirdparty,
R.xml.devicesettings_bt_connected_advertisement,
R.xml.devicesettings_high_mtu,
R.xml.devicesettings_device_actions,
R.xml.devicesettings_phone_silent_mode,
R.xml.devicesettings_overwrite_settings_on_connection,
R.xml.devicesettings_huami2021_fetch_operation_time_unit,
R.xml.devicesettings_transliteration
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
generic.add(R.xml.devicesettings_wearlocation);
final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
dateTime.add(R.xml.devicesettings_timeformat);
dateTime.add(R.xml.devicesettings_world_clocks);
final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
display.add(R.xml.devicesettings_amazfitbips);
display.add(R.xml.devicesettings_liftwrist_display);
final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
health.add(R.xml.devicesettings_heartrate_sleep);
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_custom_emoji_font);
notifications.add(R.xml.devicesettings_phone_silent_mode);
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_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;
}
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_bips;
}
@Override
public int getDefaultIconResource() {
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 AmazfitBipSFWHelper(Uri uri, Context context) throws IOException {
public AmazfitBipSFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context);
}

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitBipSFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitBipSFWInstallHandler(Uri uri, Context context) {
AmazfitBipSFWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitBipSFWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITBIPS;
}
}

View File

@ -21,29 +21,22 @@ import android.net.Uri;
import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R;
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.devices.huami.amazfitbips.AmazfitBipSLiteSupport;
public class AmazfitBipSLiteCoordinator extends AmazfitBipSCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipSLiteCoordinator.class);
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("Bip S Lite", Pattern.CASE_INSENSITIVE);
}
@Override
public InstallHandler findInstallHandler(Uri uri, Context context) {
AmazfitBipSLiteFWInstallHandler handler = new AmazfitBipSLiteFWInstallHandler(uri, context);
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
final AmazfitBipSLiteFWInstallHandler handler = new AmazfitBipSLiteFWInstallHandler(uri, context);
return handler.isValid() ? handler : null;
}
@ -52,17 +45,6 @@ public class AmazfitBipSLiteCoordinator extends AmazfitBipSCoordinator {
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
@Override
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 AmazfitBipSLiteFWHelper(Uri uri, Context context) throws IOException {
public AmazfitBipSLiteFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context);
}

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitBipSLiteFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitBipSLiteFWInstallHandler(Uri uri, Context context) {
AmazfitBipSLiteFWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitBipSLiteFWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITBIPS_LITE;
}
}

View File

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

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitBipUFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitBipUFWInstallHandler(Uri uri, Context context) {
AmazfitBipUFWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitBipUFWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITBIPU;
}
}

View File

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

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitBipUProFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitBipUProFWInstallHandler(Uri uri, Context context) {
AmazfitBipUProFWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitBipUProFWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITBIPUPRO;
}
}

View File

@ -25,9 +25,12 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.regex.Pattern;
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.huami.HuamiCoordinator;
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;
public class AmazfitCorCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitCorCoordinator.class);
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit Band|Amazfit Cor", Pattern.CASE_INSENSITIVE);
}
@Override
public InstallHandler findInstallHandler(Uri uri, Context context) {
AmazfitCorFWInstallHandler handler = new AmazfitCorFWInstallHandler(uri, context);
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
final AmazfitCorFWInstallHandler handler = new AmazfitCorFWInstallHandler(uri, context);
return handler.isValid() ? handler : null;
}
@Override
public boolean supportsHeartRateMeasurement(GBDevice device) {
public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true;
}
@ -71,29 +72,59 @@ public class AmazfitCorCoordinator extends HuamiCoordinator {
}
@Override
public boolean supportsUnicodeEmojis() { return true; }
public boolean supportsUnicodeEmojis() {
return true;
}
@Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{
R.xml.devicesettings_amazfitcor,
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep,
R.xml.devicesettings_goal_notification,
R.xml.devicesettings_timeformat,
R.xml.devicesettings_custom_emoji_font,
R.xml.devicesettings_liftwrist_display,
R.xml.devicesettings_inactivity_dnd,
R.xml.devicesettings_disconnectnotification,
R.xml.devicesettings_sync_calendar,
R.xml.devicesettings_reserve_reminders_calendar,
R.xml.devicesettings_bt_connected_advertisement,
R.xml.devicesettings_device_actions,
R.xml.devicesettings_phone_silent_mode,
R.xml.devicesettings_overwrite_settings_on_connection,
R.xml.devicesettings_huami2021_fetch_operation_time_unit,
R.xml.devicesettings_transliteration
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
generic.add(R.xml.devicesettings_wearlocation);
final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
dateTime.add(R.xml.devicesettings_timeformat);
final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
display.add(R.xml.devicesettings_amazfitcor);
display.add(R.xml.devicesettings_liftwrist_display);
final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
health.add(R.xml.devicesettings_heartrate_sleep);
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_custom_emoji_font);
notifications.add(R.xml.devicesettings_vibrationpatterns);
notifications.add(R.xml.devicesettings_phone_silent_mode);
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_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 AmazfitCorFWHelper(Uri uri, Context context) throws IOException {
public AmazfitCorFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context);
}

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitCorFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitCorFWInstallHandler(Uri uri, Context context) {
AmazfitCorFWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitCorFWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITCOR;
}
}

View File

@ -22,36 +22,32 @@ import android.net.Uri;
import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.regex.Pattern;
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.huami.HuamiCoordinator;
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.devices.huami.amazfitcor2.AmazfitCor2Support;
public class AmazfitCor2Coordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitCor2Coordinator.class);
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit Band 2|Amazfit Cor 2", Pattern.CASE_INSENSITIVE);
}
@Override
public InstallHandler findInstallHandler(Uri uri, Context context) {
AmazfitCor2FWInstallHandler handler = new AmazfitCor2FWInstallHandler(uri, context);
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
final AmazfitCor2FWInstallHandler handler = new AmazfitCor2FWInstallHandler(uri, context);
return handler.isValid() ? handler : null;
}
@Override
public boolean supportsHeartRateMeasurement(GBDevice device) {
public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true;
}
@ -76,26 +72,54 @@ public class AmazfitCor2Coordinator extends HuamiCoordinator {
}
@Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{
R.xml.devicesettings_amazfitcor,
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep,
R.xml.devicesettings_goal_notification,
R.xml.devicesettings_timeformat,
R.xml.devicesettings_custom_emoji_font,
R.xml.devicesettings_liftwrist_display,
R.xml.devicesettings_inactivity_dnd,
R.xml.devicesettings_disconnectnotification,
R.xml.devicesettings_sync_calendar,
R.xml.devicesettings_reserve_reminders_calendar,
R.xml.devicesettings_bt_connected_advertisement,
R.xml.devicesettings_device_actions,
R.xml.devicesettings_phone_silent_mode,
R.xml.devicesettings_overwrite_settings_on_connection,
R.xml.devicesettings_huami2021_fetch_operation_time_unit,
R.xml.devicesettings_transliteration
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
generic.add(R.xml.devicesettings_wearlocation);
final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
dateTime.add(R.xml.devicesettings_timeformat);
final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
display.add(R.xml.devicesettings_amazfitcor);
display.add(R.xml.devicesettings_liftwrist_display);
final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
health.add(R.xml.devicesettings_heartrate_sleep);
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_custom_emoji_font);
notifications.add(R.xml.devicesettings_vibrationpatterns);
notifications.add(R.xml.devicesettings_phone_silent_mode);
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_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;
}
@Override
public int getDefaultIconResource() {
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 AmazfitCor2FWHelper(Uri uri, Context context) throws IOException {
public AmazfitCor2FWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context);
}

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitCor2FWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitCor2FWInstallHandler(Uri uri, Context context) {
AmazfitCor2FWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitCor2FWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITCOR2;
}
}

View File

@ -22,30 +22,26 @@ import android.net.Uri;
import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.regex.Pattern;
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.huami.HuamiCoordinator;
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.devices.huami.amazfitgtr.AmazfitGTRSupport;
public class AmazfitGTRCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTRCoordinator.class);
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit GTR", Pattern.CASE_INSENSITIVE);
}
@Override
public InstallHandler findInstallHandler(Uri uri, Context context) {
AmazfitGTRFWInstallHandler handler = new AmazfitGTRFWInstallHandler(uri, context);
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
final AmazfitGTRFWInstallHandler handler = new AmazfitGTRFWInstallHandler(uri, context);
return handler.isValid() ? handler : null;
}
@ -55,7 +51,7 @@ public class AmazfitGTRCoordinator extends HuamiCoordinator {
}
@Override
public boolean supportsHeartRateMeasurement(GBDevice device) {
public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true;
}
@ -73,28 +69,58 @@ public class AmazfitGTRCoordinator extends HuamiCoordinator {
public boolean supportsMusicInfo() {
return true;
}
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{
R.xml.devicesettings_amazfitgtsgtr,
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep,
R.xml.devicesettings_goal_notification,
R.xml.devicesettings_timeformat,
R.xml.devicesettings_liftwrist_display,
R.xml.devicesettings_inactivity_dnd,
R.xml.devicesettings_disconnectnotification,
R.xml.devicesettings_sync_calendar,
R.xml.devicesettings_reserve_reminders_calendar,
R.xml.devicesettings_expose_hr_thirdparty,
R.xml.devicesettings_bt_connected_advertisement,
R.xml.devicesettings_buttonactions_with_longpress,
R.xml.devicesettings_device_actions,
R.xml.devicesettings_phone_silent_mode,
R.xml.devicesettings_high_mtu,
R.xml.devicesettings_overwrite_settings_on_connection,
R.xml.devicesettings_huami2021_fetch_operation_time_unit,
R.xml.devicesettings_transliteration
@Override
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
generic.add(R.xml.devicesettings_wearlocation);
generic.add(R.xml.devicesettings_buttonactions_with_longpress);
final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
dateTime.add(R.xml.devicesettings_timeformat);
final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
display.add(R.xml.devicesettings_amazfitgtsgtr);
display.add(R.xml.devicesettings_liftwrist_display);
final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
health.add(R.xml.devicesettings_heartrate_sleep);
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_vibrationpatterns);
notifications.add(R.xml.devicesettings_phone_silent_mode);
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",
};
}
@ -104,7 +130,6 @@ public class AmazfitGTRCoordinator extends HuamiCoordinator {
return AmazfitGTRSupport.class;
}
@Override
public int getDeviceNameResource() {
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 AmazfitGTRFWHelper(Uri uri, Context context) throws IOException {
public AmazfitGTRFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context);
}

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitGTRFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitGTRFWInstallHandler(Uri uri, Context context) {
AmazfitGTRFWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitGTRFWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITGTR;
}
}

View File

@ -22,31 +22,27 @@ import android.net.Uri;
import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.regex.Pattern;
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.huami.HuamiCoordinator;
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.devices.huami.amazfitgtr.AmazfitGTRLiteSupport;
public class AmazfitGTRLiteCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTRLiteCoordinator.class);
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit GTR L", Pattern.CASE_INSENSITIVE);
}
@Override
public InstallHandler findInstallHandler(Uri uri, Context context) {
AmazfitGTRLiteFWInstallHandler handler = new AmazfitGTRLiteFWInstallHandler(uri, context);
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
final AmazfitGTRLiteFWInstallHandler handler = new AmazfitGTRLiteFWInstallHandler(uri, context);
return handler.isValid() ? handler : null;
}
@ -56,15 +52,10 @@ public class AmazfitGTRLiteCoordinator extends HuamiCoordinator {
}
@Override
public boolean supportsHeartRateMeasurement(GBDevice device) {
public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true;
}
@Override
public boolean supportsActivityTracks() {
return false;
}
@Override
public boolean supportsWeather() {
return true;
@ -75,25 +66,54 @@ public class AmazfitGTRLiteCoordinator extends HuamiCoordinator {
return true;
}
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{
R.xml.devicesettings_amazfitgtsgtr,
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep,
R.xml.devicesettings_goal_notification,
R.xml.devicesettings_timeformat,
R.xml.devicesettings_liftwrist_display,
R.xml.devicesettings_inactivity_dnd,
R.xml.devicesettings_disconnectnotification,
R.xml.devicesettings_sync_calendar,
R.xml.devicesettings_reserve_reminders_calendar,
R.xml.devicesettings_expose_hr_thirdparty,
R.xml.devicesettings_bt_connected_advertisement,
R.xml.devicesettings_phone_silent_mode,
R.xml.devicesettings_overwrite_settings_on_connection,
R.xml.devicesettings_huami2021_fetch_operation_time_unit,
R.xml.devicesettings_transliteration
@Override
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
generic.add(R.xml.devicesettings_wearlocation);
final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
dateTime.add(R.xml.devicesettings_timeformat);
final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
display.add(R.xml.devicesettings_amazfitgtsgtr);
display.add(R.xml.devicesettings_liftwrist_display);
final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
health.add(R.xml.devicesettings_heartrate_sleep);
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_vibrationpatterns);
notifications.add(R.xml.devicesettings_phone_silent_mode);
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;
}
@Override
public int getDeviceNameResource() {
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 AmazfitGTRLiteFWHelper(Uri uri, Context context) throws IOException {
public AmazfitGTRLiteFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context);
}

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitGTRLiteFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitGTRLiteFWInstallHandler(Uri uri, Context context) {
AmazfitGTRLiteFWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitGTRLiteFWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITGTR_LITE;
}
}

View File

@ -22,31 +22,27 @@ import android.net.Uri;
import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.regex.Pattern;
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.huami.HuamiCoordinator;
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.devices.huami.amazfitgtr2.AmazfitGTR2Support;
public class AmazfitGTR2Coordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTR2Coordinator.class);
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit GTR 2", Pattern.CASE_INSENSITIVE);
}
@Override
public InstallHandler findInstallHandler(Uri uri, Context context) {
AmazfitGTR2FWInstallHandler handler = new AmazfitGTR2FWInstallHandler(uri, context);
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
final AmazfitGTR2FWInstallHandler handler = new AmazfitGTR2FWInstallHandler(uri, context);
return handler.isValid() ? handler : null;
}
@ -56,7 +52,7 @@ public class AmazfitGTR2Coordinator extends HuamiCoordinator {
}
@Override
public boolean supportsHeartRateMeasurement(GBDevice device) {
public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true;
}
@ -80,27 +76,56 @@ public class AmazfitGTR2Coordinator extends HuamiCoordinator {
return true;
}
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{
R.xml.devicesettings_amazfitgtsgtr2,
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep,
R.xml.devicesettings_goal_notification,
R.xml.devicesettings_timeformat,
R.xml.devicesettings_liftwrist_display,
R.xml.devicesettings_inactivity_dnd,
R.xml.devicesettings_disconnectnotification,
R.xml.devicesettings_sync_calendar,
R.xml.devicesettings_reserve_reminders_calendar,
R.xml.devicesettings_expose_hr_thirdparty,
R.xml.devicesettings_bt_connected_advertisement,
R.xml.devicesettings_device_actions,
R.xml.devicesettings_phone_silent_mode,
R.xml.devicesettings_high_mtu,
R.xml.devicesettings_overwrite_settings_on_connection,
R.xml.devicesettings_huami2021_fetch_operation_time_unit,
R.xml.devicesettings_transliteration
@Override
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
generic.add(R.xml.devicesettings_wearlocation);
final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
dateTime.add(R.xml.devicesettings_timeformat);
final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
display.add(R.xml.devicesettings_amazfitgtsgtr2);
display.add(R.xml.devicesettings_liftwrist_display);
final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
health.add(R.xml.devicesettings_heartrate_sleep);
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_vibrationpatterns);
notifications.add(R.xml.devicesettings_phone_silent_mode);
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",
};
}

View File

@ -27,7 +27,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr2.Am
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);
}

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitGTR2FWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitGTR2FWInstallHandler(Uri uri, Context context) {
AmazfitGTR2FWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitGTR2FWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITGTR2;
}
}

View File

@ -22,31 +22,27 @@ import android.net.Uri;
import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.regex.Pattern;
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.huami.HuamiCoordinator;
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.devices.huami.amazfitgtr2.AmazfitGTR2eSupport;
public class AmazfitGTR2eCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTR2eCoordinator.class);
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit GTR 2e", Pattern.CASE_INSENSITIVE);
}
@Override
public InstallHandler findInstallHandler(Uri uri, Context context) {
AmazfitGTR2eFWInstallHandler handler = new AmazfitGTR2eFWInstallHandler(uri, context);
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
final AmazfitGTR2eFWInstallHandler handler = new AmazfitGTR2eFWInstallHandler(uri, context);
return handler.isValid() ? handler : null;
}
@ -56,7 +52,7 @@ public class AmazfitGTR2eCoordinator extends HuamiCoordinator {
}
@Override
public boolean supportsHeartRateMeasurement(GBDevice device) {
public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true;
}
@ -80,27 +76,56 @@ public class AmazfitGTR2eCoordinator extends HuamiCoordinator {
return true;
}
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{
R.xml.devicesettings_amazfitgtsgtr2,
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep,
R.xml.devicesettings_goal_notification,
R.xml.devicesettings_timeformat,
R.xml.devicesettings_liftwrist_display,
R.xml.devicesettings_inactivity_dnd,
R.xml.devicesettings_disconnectnotification,
R.xml.devicesettings_sync_calendar,
R.xml.devicesettings_reserve_reminders_calendar,
R.xml.devicesettings_expose_hr_thirdparty,
R.xml.devicesettings_bt_connected_advertisement,
R.xml.devicesettings_device_actions,
R.xml.devicesettings_phone_silent_mode,
R.xml.devicesettings_high_mtu,
R.xml.devicesettings_overwrite_settings_on_connection,
R.xml.devicesettings_huami2021_fetch_operation_time_unit,
R.xml.devicesettings_transliteration
@Override
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
generic.add(R.xml.devicesettings_wearlocation);
final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
dateTime.add(R.xml.devicesettings_timeformat);
final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
display.add(R.xml.devicesettings_amazfitgtsgtr2);
display.add(R.xml.devicesettings_liftwrist_display);
final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
health.add(R.xml.devicesettings_heartrate_sleep);
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_vibrationpatterns);
notifications.add(R.xml.devicesettings_phone_silent_mode);
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",
};
}
@ -110,7 +135,6 @@ public class AmazfitGTR2eCoordinator extends HuamiCoordinator {
return AmazfitGTR2eSupport.class;
}
@Override
public int getDeviceNameResource() {
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 AmazfitGTR2eFWHelper(Uri uri, Context context) throws IOException {
public AmazfitGTR2eFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context);
}

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitGTR2eFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitGTR2eFWInstallHandler(Uri uri, Context context) {
AmazfitGTR2eFWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitGTR2eFWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITGTR2E;
}
}

View File

@ -22,31 +22,27 @@ import android.net.Uri;
import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.regex.Pattern;
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.huami.HuamiCoordinator;
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.devices.huami.amazfitgts.AmazfitGTSSupport;
public class AmazfitGTSCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTSCoordinator.class);
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit GTS", Pattern.CASE_INSENSITIVE);
}
@Override
public InstallHandler findInstallHandler(Uri uri, Context context) {
AmazfitGTSFWInstallHandler handler = new AmazfitGTSFWInstallHandler(uri, context);
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
final AmazfitGTSFWInstallHandler handler = new AmazfitGTSFWInstallHandler(uri, context);
return handler.isValid() ? handler : null;
}
@ -56,7 +52,7 @@ public class AmazfitGTSCoordinator extends HuamiCoordinator {
}
@Override
public boolean supportsHeartRateMeasurement(GBDevice device) {
public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true;
}
@ -75,27 +71,56 @@ public class AmazfitGTSCoordinator extends HuamiCoordinator {
return true;
}
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{
R.xml.devicesettings_amazfitgtsgtr,
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep,
R.xml.devicesettings_goal_notification,
R.xml.devicesettings_timeformat,
R.xml.devicesettings_liftwrist_display,
R.xml.devicesettings_inactivity_dnd,
R.xml.devicesettings_disconnectnotification,
R.xml.devicesettings_sync_calendar,
R.xml.devicesettings_reserve_reminders_calendar,
R.xml.devicesettings_expose_hr_thirdparty,
R.xml.devicesettings_bt_connected_advertisement,
R.xml.devicesettings_device_actions,
R.xml.devicesettings_phone_silent_mode,
R.xml.devicesettings_high_mtu,
R.xml.devicesettings_overwrite_settings_on_connection,
R.xml.devicesettings_huami2021_fetch_operation_time_unit,
R.xml.devicesettings_transliteration
@Override
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
generic.add(R.xml.devicesettings_wearlocation);
final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
dateTime.add(R.xml.devicesettings_timeformat);
final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
display.add(R.xml.devicesettings_amazfitgtsgtr);
display.add(R.xml.devicesettings_liftwrist_display);
final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
health.add(R.xml.devicesettings_heartrate_sleep);
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_vibrationpatterns);
notifications.add(R.xml.devicesettings_phone_silent_mode);
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",
};
}
@ -105,13 +130,11 @@ public class AmazfitGTSCoordinator extends HuamiCoordinator {
return AmazfitGTSSupport.class;
}
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gts;
}
@Override
public int getDefaultIconResource() {
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 AmazfitGTSFWHelper(Uri uri, Context context) throws IOException {
public AmazfitGTSFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context);
}

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitGTSFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitGTSFWInstallHandler(Uri uri, Context context) {
AmazfitGTSFWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitGTSFWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITGTS;
}
}

View File

@ -22,31 +22,27 @@ import android.net.Uri;
import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.regex.Pattern;
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.huami.HuamiCoordinator;
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.devices.huami.amazfitgts2.AmazfitGTS2Support;
public class AmazfitGTS2Coordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTS2Coordinator.class);
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit GTS 2", Pattern.CASE_INSENSITIVE);
}
@Override
public InstallHandler findInstallHandler(Uri uri, Context context) {
AmazfitGTS2FWInstallHandler handler = new AmazfitGTS2FWInstallHandler(uri, context);
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
final AmazfitGTS2FWInstallHandler handler = new AmazfitGTS2FWInstallHandler(uri, context);
return handler.isValid() ? handler : null;
}
@ -56,7 +52,7 @@ public class AmazfitGTS2Coordinator extends HuamiCoordinator {
}
@Override
public boolean supportsHeartRateMeasurement(GBDevice device) {
public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true;
}
@ -80,27 +76,56 @@ public class AmazfitGTS2Coordinator extends HuamiCoordinator {
return true;
}
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{
R.xml.devicesettings_amazfitgtsgtr2,
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep,
R.xml.devicesettings_goal_notification,
R.xml.devicesettings_timeformat,
R.xml.devicesettings_liftwrist_display,
R.xml.devicesettings_inactivity_dnd,
R.xml.devicesettings_disconnectnotification,
R.xml.devicesettings_sync_calendar,
R.xml.devicesettings_reserve_reminders_calendar,
R.xml.devicesettings_expose_hr_thirdparty,
R.xml.devicesettings_bt_connected_advertisement,
R.xml.devicesettings_device_actions,
R.xml.devicesettings_phone_silent_mode,
R.xml.devicesettings_high_mtu,
R.xml.devicesettings_overwrite_settings_on_connection,
R.xml.devicesettings_huami2021_fetch_operation_time_unit,
R.xml.devicesettings_transliteration
@Override
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
generic.add(R.xml.devicesettings_wearlocation);
final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
dateTime.add(R.xml.devicesettings_timeformat);
final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
display.add(R.xml.devicesettings_amazfitgtsgtr2);
display.add(R.xml.devicesettings_liftwrist_display);
final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
health.add(R.xml.devicesettings_heartrate_sleep);
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_vibrationpatterns);
notifications.add(R.xml.devicesettings_phone_silent_mode);
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",
};
}
@ -110,13 +135,11 @@ public class AmazfitGTS2Coordinator extends HuamiCoordinator {
return AmazfitGTS2Support.class;
}
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gts2;
}
@Override
public int getDefaultIconResource() {
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 AmazfitGTS2FWHelper(Uri uri, Context context) throws IOException {
public AmazfitGTS2FWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context);
}

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitGTS2FWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitGTS2FWInstallHandler(Uri uri, Context context) {
AmazfitGTS2FWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitGTS2FWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITGTS2;
}
}

View File

@ -22,55 +22,62 @@ import android.net.Uri;
import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.regex.Pattern;
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.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.devices.huami.amazfitgts2.AmazfitGTS2MiniSupport;
public class AmazfitGTS2MiniCoordinator extends AmazfitGTS2Coordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTS2MiniCoordinator.class);
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit GTS2 mini", Pattern.CASE_INSENSITIVE);
}
@Override
public InstallHandler findInstallHandler(Uri uri, Context context) {
AmazfitGTS2MiniFWInstallHandler handler = new AmazfitGTS2MiniFWInstallHandler(uri, context);
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
final AmazfitGTS2MiniFWInstallHandler handler = new AmazfitGTS2MiniFWInstallHandler(uri, context);
return handler.isValid() ? handler : null;
}
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{
R.xml.devicesettings_amazfitgts2mini,
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep,
R.xml.devicesettings_goal_notification,
R.xml.devicesettings_timeformat,
R.xml.devicesettings_liftwrist_display,
R.xml.devicesettings_inactivity_dnd,
R.xml.devicesettings_disconnectnotification,
R.xml.devicesettings_sync_calendar,
R.xml.devicesettings_reserve_reminders_calendar,
R.xml.devicesettings_expose_hr_thirdparty,
R.xml.devicesettings_bt_connected_advertisement,
R.xml.devicesettings_device_actions,
R.xml.devicesettings_phone_silent_mode,
R.xml.devicesettings_high_mtu,
R.xml.devicesettings_overwrite_settings_on_connection,
R.xml.devicesettings_huami2021_fetch_operation_time_unit,
R.xml.devicesettings_transliteration
};
@Override
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
generic.add(R.xml.devicesettings_wearlocation);
final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
dateTime.add(R.xml.devicesettings_timeformat);
final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
display.add(R.xml.devicesettings_amazfitgts2mini);
display.add(R.xml.devicesettings_liftwrist_display);
final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
health.add(R.xml.devicesettings_heartrate_sleep);
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_vibrationpatterns);
notifications.add(R.xml.devicesettings_phone_silent_mode);
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
@ -78,17 +85,6 @@ public class AmazfitGTS2MiniCoordinator extends AmazfitGTS2Coordinator {
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
@Override
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 AmazfitGTS2MiniFWHelper(Uri uri, Context context) throws IOException {
public AmazfitGTS2MiniFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context);
}

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitGTS2MiniFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitGTS2MiniFWInstallHandler(Uri uri, Context context) {
AmazfitGTS2MiniFWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitGTS2MiniFWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITGTS2_MINI;
}
}

View File

@ -22,31 +22,27 @@ import android.net.Uri;
import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.regex.Pattern;
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.huami.HuamiCoordinator;
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.devices.huami.amazfitgts2.AmazfitGTS2eSupport;
public class AmazfitGTS2eCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTS2eCoordinator.class);
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit GTS 2e", Pattern.CASE_INSENSITIVE);
}
@Override
public InstallHandler findInstallHandler(Uri uri, Context context) {
AmazfitGTS2eFWInstallHandler handler = new AmazfitGTS2eFWInstallHandler(uri, context);
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
final AmazfitGTS2eFWInstallHandler handler = new AmazfitGTS2eFWInstallHandler(uri, context);
return handler.isValid() ? handler : null;
}
@ -56,7 +52,7 @@ public class AmazfitGTS2eCoordinator extends HuamiCoordinator {
}
@Override
public boolean supportsHeartRateMeasurement(GBDevice device) {
public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true;
}
@ -80,27 +76,56 @@ public class AmazfitGTS2eCoordinator extends HuamiCoordinator {
return true;
}
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{
R.xml.devicesettings_amazfitgtsgtr2,
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep,
R.xml.devicesettings_goal_notification,
R.xml.devicesettings_timeformat,
R.xml.devicesettings_liftwrist_display_sensitivity,
R.xml.devicesettings_inactivity_dnd,
R.xml.devicesettings_disconnectnotification,
R.xml.devicesettings_sync_calendar,
R.xml.devicesettings_reserve_reminders_calendar,
R.xml.devicesettings_expose_hr_thirdparty,
R.xml.devicesettings_bt_connected_advertisement,
R.xml.devicesettings_device_actions,
R.xml.devicesettings_phone_silent_mode,
R.xml.devicesettings_high_mtu,
R.xml.devicesettings_overwrite_settings_on_connection,
R.xml.devicesettings_huami2021_fetch_operation_time_unit,
R.xml.devicesettings_transliteration
@Override
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
generic.add(R.xml.devicesettings_wearlocation);
final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
dateTime.add(R.xml.devicesettings_timeformat);
final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
display.add(R.xml.devicesettings_amazfitgtsgtr2);
display.add(R.xml.devicesettings_liftwrist_display_sensitivity);
final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
health.add(R.xml.devicesettings_heartrate_sleep);
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_vibrationpatterns);
notifications.add(R.xml.devicesettings_phone_silent_mode);
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",
};
}
@ -110,13 +135,11 @@ public class AmazfitGTS2eCoordinator extends HuamiCoordinator {
return AmazfitGTS2eSupport.class;
}
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gts2e;
}
@Override
public int getDefaultIconResource() {
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 AmazfitGTS2eFWHelper(Uri uri, Context context) throws IOException {
public AmazfitGTS2eFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context);
}

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitGTS2eFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitGTS2eFWInstallHandler(Uri uri, Context context) {
AmazfitGTS2eFWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitGTS2eFWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITGTS2E;
}
}

View File

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

View File

@ -29,7 +29,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitNeoFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitNeoFWInstallHandler(Uri uri, Context context) {
AmazfitNeoFWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -39,12 +39,12 @@ class AmazfitNeoFWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITNEO;
}
}

View File

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

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitPopFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitPopFWInstallHandler(Uri uri, Context context) {
AmazfitPopFWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitPopFWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITPOP;
}
}

View File

@ -21,30 +21,23 @@ import android.net.Uri;
import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
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.devices.huami.amazfitpoppro.AmazfitPopProSupport;
public class AmazfitPopProCoordinator extends AmazfitBipUProCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitPopProCoordinator.class);
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit Pop Pro", Pattern.CASE_INSENSITIVE);
}
@Override
public InstallHandler findInstallHandler(Uri uri, Context context) {
AmazfitPopProFWInstallHandler handler = new AmazfitPopProFWInstallHandler(uri, context);
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
final AmazfitPopProFWInstallHandler handler = new AmazfitPopProFWInstallHandler(uri, context);
return handler.isValid() ? handler : null;
}
@ -53,17 +46,6 @@ public class AmazfitPopProCoordinator extends AmazfitBipUProCoordinator {
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
@Override
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 AmazfitPopProFWHelper(Uri uri, Context context) throws IOException {
public AmazfitPopProFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context);
}

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitPopProFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitPopProFWInstallHandler(Uri uri, Context context) {
AmazfitPopProFWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitPopProFWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITPOPPRO;
}
}

View File

@ -22,31 +22,27 @@ import android.net.Uri;
import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.regex.Pattern;
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.huami.HuamiCoordinator;
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.devices.huami.amazfittrex.AmazfitTRexSupport;
public class AmazfitTRexCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitTRexCoordinator.class);
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit T-Rex", Pattern.CASE_INSENSITIVE);
}
@Override
public InstallHandler findInstallHandler(Uri uri, Context context) {
AmazfitTRexFWInstallHandler handler = new AmazfitTRexFWInstallHandler(uri, context);
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
final AmazfitTRexFWInstallHandler handler = new AmazfitTRexFWInstallHandler(uri, context);
return handler.isValid() ? handler : null;
}
@ -56,7 +52,7 @@ public class AmazfitTRexCoordinator extends HuamiCoordinator {
}
@Override
public boolean supportsHeartRateMeasurement(GBDevice device) {
public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true;
}
@ -74,27 +70,57 @@ public class AmazfitTRexCoordinator extends HuamiCoordinator {
public boolean supportsMusicInfo() {
return true;
}
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{
R.xml.devicesettings_amazfittrex,
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep,
R.xml.devicesettings_goal_notification,
R.xml.devicesettings_timeformat,
R.xml.devicesettings_liftwrist_display,
R.xml.devicesettings_inactivity_dnd,
R.xml.devicesettings_disconnectnotification,
R.xml.devicesettings_sync_calendar,
R.xml.devicesettings_reserve_reminders_calendar,
R.xml.devicesettings_expose_hr_thirdparty,
R.xml.devicesettings_bt_connected_advertisement,
R.xml.devicesettings_device_actions,
R.xml.devicesettings_phone_silent_mode,
R.xml.devicesettings_high_mtu,
R.xml.devicesettings_overwrite_settings_on_connection,
R.xml.devicesettings_huami2021_fetch_operation_time_unit,
R.xml.devicesettings_transliteration
@Override
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
generic.add(R.xml.devicesettings_wearlocation);
final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
dateTime.add(R.xml.devicesettings_timeformat);
final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
display.add(R.xml.devicesettings_amazfittrex);
display.add(R.xml.devicesettings_liftwrist_display);
final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
health.add(R.xml.devicesettings_heartrate_sleep);
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_vibrationpatterns);
notifications.add(R.xml.devicesettings_phone_silent_mode);
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",
};
}

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfittrex.Am
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);
}

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitTRexFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitTRexFWInstallHandler(Uri uri, Context context) {
AmazfitTRexFWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitTRexFWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITTREX;
}
}

View File

@ -22,31 +22,27 @@ import android.net.Uri;
import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.regex.Pattern;
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.huami.HuamiCoordinator;
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.devices.huami.amazfittrexpro.AmazfitTRexProSupport;
public class AmazfitTRexProCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitTRexProCoordinator.class);
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("Amazfit T-Rex Pro", Pattern.CASE_INSENSITIVE);
}
@Override
public InstallHandler findInstallHandler(Uri uri, Context context) {
AmazfitTRexProFWInstallHandler handler = new AmazfitTRexProFWInstallHandler(uri, context);
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
final AmazfitTRexProFWInstallHandler handler = new AmazfitTRexProFWInstallHandler(uri, context);
return handler.isValid() ? handler : null;
}
@ -56,7 +52,7 @@ public class AmazfitTRexProCoordinator extends HuamiCoordinator {
}
@Override
public boolean supportsHeartRateMeasurement(GBDevice device) {
public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true;
}
@ -74,27 +70,57 @@ public class AmazfitTRexProCoordinator extends HuamiCoordinator {
public boolean supportsMusicInfo() {
return true;
}
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{
R.xml.devicesettings_amazfittrexpro,
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep,
R.xml.devicesettings_goal_notification,
R.xml.devicesettings_timeformat,
R.xml.devicesettings_liftwrist_display_sensitivity,
R.xml.devicesettings_inactivity_dnd,
R.xml.devicesettings_disconnectnotification,
R.xml.devicesettings_sync_calendar,
R.xml.devicesettings_reserve_reminders_calendar,
R.xml.devicesettings_expose_hr_thirdparty,
R.xml.devicesettings_bt_connected_advertisement,
R.xml.devicesettings_device_actions,
R.xml.devicesettings_phone_silent_mode,
R.xml.devicesettings_high_mtu,
R.xml.devicesettings_overwrite_settings_on_connection,
R.xml.devicesettings_huami2021_fetch_operation_time_unit,
R.xml.devicesettings_transliteration
@Override
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
generic.add(R.xml.devicesettings_wearlocation);
final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
dateTime.add(R.xml.devicesettings_timeformat);
final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
display.add(R.xml.devicesettings_amazfittrexpro);
display.add(R.xml.devicesettings_liftwrist_display_sensitivity);
final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
health.add(R.xml.devicesettings_heartrate_sleep);
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_vibrationpatterns);
notifications.add(R.xml.devicesettings_phone_silent_mode);
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",
};
}

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfittrexpro
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);
}

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitTRexProFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitTRexProFWInstallHandler(Uri uri, Context context) {
AmazfitTRexProFWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitTRexProFWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITTREXPRO;
}
}

View File

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

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitVergeLFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitVergeLFWInstallHandler(Uri uri, Context context) {
AmazfitVergeLFWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class AmazfitVergeLFWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITVERGEL;
}
}

View File

@ -22,39 +22,35 @@ import android.net.Uri;
import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.regex.Pattern;
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.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
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.devices.huami.amazfitx.AmazfitXSupport;
public class AmazfitXCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitXCoordinator.class);
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile(HuamiConst.AMAZFIT_X, Pattern.CASE_INSENSITIVE);
}
@Override
public InstallHandler findInstallHandler(Uri uri, Context context) {
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
// 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 null;
}
@Override
public boolean supportsHeartRateMeasurement(GBDevice device) {
public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true;
}
@ -74,35 +70,45 @@ public class AmazfitXCoordinator extends HuamiCoordinator {
}
@Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{
R.xml.devicesettings_amazfitx,
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep,
R.xml.devicesettings_goal_notification,
R.xml.devicesettings_custom_emoji_font,
R.xml.devicesettings_timeformat,
R.xml.devicesettings_dateformat,
R.xml.devicesettings_nightmode,
R.xml.devicesettings_liftwrist_display,
R.xml.devicesettings_inactivity_dnd,
R.xml.devicesettings_swipeunlock,
R.xml.devicesettings_sync_calendar,
R.xml.devicesettings_reserve_reminders_calendar,
R.xml.devicesettings_expose_hr_thirdparty,
R.xml.devicesettings_bt_connected_advertisement,
R.xml.devicesettings_device_actions,
R.xml.devicesettings_phone_silent_mode,
R.xml.devicesettings_high_mtu,
R.xml.devicesettings_overwrite_settings_on_connection,
R.xml.devicesettings_huami2021_fetch_operation_time_unit,
R.xml.devicesettings_transliteration
};
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
generic.add(R.xml.devicesettings_wearlocation);
final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
dateTime.add(R.xml.devicesettings_timeformat);
dateTime.add(R.xml.devicesettings_dateformat);
final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
display.add(R.xml.devicesettings_amazfitx);
display.add(R.xml.devicesettings_nightmode);
display.add(R.xml.devicesettings_liftwrist_display);
display.add(R.xml.devicesettings_swipeunlock);
final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
health.add(R.xml.devicesettings_heartrate_sleep);
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_custom_emoji_font);
notifications.add(R.xml.devicesettings_vibrationpatterns);
notifications.add(R.xml.devicesettings_phone_silent_mode);
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_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(GBDevice device) {
public String[] getSupportedLanguageSettings(final GBDevice device) {
return new String[]{
"auto",
"en_US",
@ -122,13 +128,11 @@ public class AmazfitXCoordinator extends HuamiCoordinator {
return BONDING_STYLE_REQUIRE_KEY;
}
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_x;
}
@Override
public int getDefaultIconResource() {
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 AmazfitXFWHelper(Uri uri, Context context) throws IOException {
public AmazfitXFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context);
}

View File

@ -29,7 +29,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class AmazfitXFWInstallHandler extends AbstractMiBandFWInstallHandler {
AmazfitXFWInstallHandler(Uri uri, Context context) {
AmazfitXFWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -39,12 +39,12 @@ class AmazfitXFWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.AMAZFITX;
}
}

View File

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

View File

@ -27,7 +27,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband2.Mi2Fir
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);
}

View File

@ -37,7 +37,7 @@ import nodomain.freeyourgadget.gadgetbridge.util.Version;
public class MiBand2FWInstallHandler extends AbstractMiBandFWInstallHandler {
private static final Logger LOG = LoggerFactory.getLogger(MiBand2FWInstallHandler.class);
MiBand2FWInstallHandler(Uri uri, Context context) {
MiBand2FWInstallHandler(final Uri uri, final Context 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();
if (version == null || version.length() == 0) {
return null;
@ -111,12 +111,12 @@ public class MiBand2FWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
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 java.util.EnumSet;
import java.util.List;
import java.util.regex.Pattern;
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.DeviceSpecificSettingsScreen;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
@ -46,7 +49,7 @@ public class MiBand2HRXCoordinator extends HuamiCoordinator {
}
@Override
public InstallHandler findInstallHandler(Uri uri, Context context) {
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
return null;
}
@ -61,21 +64,31 @@ public class MiBand2HRXCoordinator extends HuamiCoordinator {
}
@Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{
R.xml.devicesettings_miband2,
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep,
R.xml.devicesettings_goal_notification,
R.xml.devicesettings_donotdisturb_withauto,
R.xml.devicesettings_liftwrist_display,
R.xml.devicesettings_inactivity_dnd,
R.xml.devicesettings_rotatewrist_cycleinfo,
R.xml.devicesettings_miband_vibrationpatterns,
R.xml.devicesettings_overwrite_settings_on_connection,
R.xml.devicesettings_huami2021_fetch_operation_time_unit,
R.xml.devicesettings_transliteration
};
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
generic.add(R.xml.devicesettings_wearlocation);
final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
dateTime.add(R.xml.devicesettings_miband2_dateformat);
final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
display.add(R.xml.devicesettings_miband2_display);
display.add(R.xml.devicesettings_liftwrist_display);
display.add(R.xml.devicesettings_rotatewrist_cycleinfo);
final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
health.add(R.xml.devicesettings_heartrate_sleep);
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

View File

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

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class MiBand3FWInstallHandler extends AbstractMiBandFWInstallHandler {
MiBand3FWInstallHandler(Uri uri, Context context) {
MiBand3FWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class MiBand3FWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.MIBAND3;
}
}

View File

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

View File

@ -29,7 +29,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class MiBand4FWInstallHandler extends AbstractMiBandFWInstallHandler {
MiBand4FWInstallHandler(Uri uri, Context context) {
MiBand4FWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -39,12 +39,12 @@ class MiBand4FWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.MIBAND4;
}
}

View File

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

View File

@ -29,7 +29,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class MiBand5FWInstallHandler extends AbstractMiBandFWInstallHandler {
MiBand5FWInstallHandler(Uri uri, Context context) {
MiBand5FWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -39,12 +39,12 @@ class MiBand5FWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.MIBAND5;
}
}

View File

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

View File

@ -26,7 +26,7 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband6.MiBand
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);
}

View File

@ -29,7 +29,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class MiBand6FWInstallHandler extends AbstractMiBandFWInstallHandler {
MiBand6FWInstallHandler(Uri uri, Context context) {
MiBand6FWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -39,12 +39,12 @@ class MiBand6FWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.MIBAND6;
}
}

View File

@ -22,31 +22,27 @@ import android.net.Uri;
import androidx.annotation.NonNull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.util.List;
import java.util.regex.Pattern;
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.huami.HuamiCoordinator;
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.devices.huami.zeppe.ZeppESupport;
public class ZeppECoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(ZeppECoordinator.class);
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("Zepp E", Pattern.CASE_INSENSITIVE);
}
@Override
public InstallHandler findInstallHandler(Uri uri, Context context) {
ZeppEFWInstallHandler handler = new ZeppEFWInstallHandler(uri, context);
public InstallHandler findInstallHandler(final Uri uri, final Context context) {
final ZeppEFWInstallHandler handler = new ZeppEFWInstallHandler(uri, context);
return handler.isValid() ? handler : null;
}
@ -56,7 +52,7 @@ public class ZeppECoordinator extends HuamiCoordinator {
}
@Override
public boolean supportsHeartRateMeasurement(GBDevice device) {
public boolean supportsHeartRateMeasurement(final GBDevice device) {
return true;
}
@ -74,26 +70,57 @@ public class ZeppECoordinator extends HuamiCoordinator {
public boolean supportsMusicInfo() {
return true;
}
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{
R.xml.devicesettings_amazfitgtsgtr,
R.xml.devicesettings_vibrationpatterns,
R.xml.devicesettings_wearlocation,
R.xml.devicesettings_heartrate_sleep,
R.xml.devicesettings_goal_notification,
R.xml.devicesettings_timeformat,
R.xml.devicesettings_liftwrist_display,
R.xml.devicesettings_inactivity_dnd,
R.xml.devicesettings_disconnectnotification,
R.xml.devicesettings_sync_calendar,
R.xml.devicesettings_expose_hr_thirdparty,
R.xml.devicesettings_bt_connected_advertisement,
R.xml.devicesettings_device_actions,
R.xml.devicesettings_phone_silent_mode,
R.xml.devicesettings_high_mtu,
R.xml.devicesettings_overwrite_settings_on_connection,
R.xml.devicesettings_huami2021_fetch_operation_time_unit,
R.xml.devicesettings_transliteration
@Override
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
generic.add(R.xml.devicesettings_wearlocation);
final List<Integer> dateTime = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DATE_TIME);
dateTime.add(R.xml.devicesettings_timeformat);
final List<Integer> display = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DISPLAY);
display.add(R.xml.devicesettings_amazfitgtsgtr);
display.add(R.xml.devicesettings_liftwrist_display);
final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
health.add(R.xml.devicesettings_heartrate_sleep);
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_vibrationpatterns);
notifications.add(R.xml.devicesettings_phone_silent_mode);
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;
}
@Override
public int getDeviceNameResource() {
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 ZeppEFWHelper(Uri uri, Context context) throws IOException {
public ZeppEFWHelper(final Uri uri, final Context context) throws IOException {
super(uri, context);
}

View File

@ -28,7 +28,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
class ZeppEFWInstallHandler extends AbstractMiBandFWInstallHandler {
ZeppEFWInstallHandler(Uri uri, Context context) {
ZeppEFWInstallHandler(final Uri uri, final Context context) {
super(uri, context);
}
@ -38,12 +38,12 @@ class ZeppEFWInstallHandler extends AbstractMiBandFWInstallHandler {
}
@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);
}
@Override
protected boolean isSupportedDeviceType(GBDevice device) {
protected boolean isSupportedDeviceType(final GBDevice device) {
return device.getType() == DeviceType.ZEPP_E;
}
}

View File

@ -28,7 +28,6 @@ import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collections;
import java.util.EnumSet;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.Set;
@ -36,7 +35,6 @@ import java.util.regex.Pattern;
import nodomain.freeyourgadget.gadgetbridge.R;
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.DeviceSpecificSettings;
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.devices.InstallHandler;
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.HuamiExtendedSampleProvider;
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.zeppos.services.ZeppOsPhoneService;
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
import nodomain.freeyourgadget.gadgetbridge.devices.SleepAsAndroidFeature;
public abstract class ZeppOsCoordinator extends HuamiCoordinator {
@ -145,11 +141,6 @@ public abstract class ZeppOsCoordinator extends HuamiCoordinator {
return false;
}
@Override
public boolean supportsRealtimeData() {
return true;
}
@Override
public boolean supportsWeather() {
return true;
@ -176,7 +167,7 @@ public abstract class ZeppOsCoordinator extends HuamiCoordinator {
}
@Override
public boolean supportsSpo2(GBDevice device) {
public boolean supportsSpo2(final GBDevice device) {
return true;
}
@ -255,11 +246,6 @@ public abstract class ZeppOsCoordinator extends HuamiCoordinator {
return true;
}
@Override
public boolean supportsAppReordering() {
return false;
}
@Override
public boolean supportsCalendarEvents() {
return true;
@ -607,10 +593,6 @@ public abstract class ZeppOsCoordinator extends HuamiCoordinator {
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) {
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_sound_vibration">Sound &amp; Vibration</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_workout">Workout</string>
<string name="pref_header_equalizer">Equalizer</string>

View File

@ -20,12 +20,4 @@
android:persistent="true"
android:summary="@string/bip_prefs_shotcuts_summary"
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>

View File

@ -20,12 +20,4 @@
android:persistent="true"
android:summary="@string/bip_prefs_shotcuts_summary"
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>

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