mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-25 18:15:49 +01:00
Huami: Add preference to overwrite band settings on connection
This commit is contained in:
parent
2e1e433b5d
commit
2efc564d21
@ -347,6 +347,11 @@ public abstract class HuamiCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
return prefs.getBoolean(DeviceSettingsPreferenceConst.PREF_BT_CONNECTED_ADVERTISEMENT, false);
|
||||
}
|
||||
|
||||
public static boolean getOverwriteSettingsOnConnection(String deviceAddress) {
|
||||
Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(deviceAddress));
|
||||
return prefs.getBoolean("overwrite_settings_on_connection", true);
|
||||
}
|
||||
|
||||
public static VibrationProfile getVibrationProfile(String deviceAddress, HuamiVibrationPatternNotificationType notificationType) {
|
||||
final String defaultVibrationProfileId;
|
||||
final int defaultVibrationCount;
|
||||
|
@ -119,6 +119,7 @@ public class AmazfitBand5Coordinator extends HuamiCoordinator {
|
||||
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_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -94,6 +94,7 @@ public class AmazfitBipCoordinator extends HuamiCoordinator {
|
||||
R.xml.devicesettings_bt_connected_advertisement,
|
||||
R.xml.devicesettings_buttonactions_with_longpress,
|
||||
R.xml.devicesettings_device_actions,
|
||||
R.xml.devicesettings_overwrite_settings_on_connection,
|
||||
R.xml.devicesettings_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -84,6 +84,7 @@ public class AmazfitBipLiteCoordinator extends AmazfitBipCoordinator {
|
||||
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_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -110,6 +110,7 @@ public class AmazfitBipSCoordinator extends HuamiCoordinator {
|
||||
R.xml.devicesettings_bt_connected_advertisement,
|
||||
R.xml.devicesettings_high_mtu,
|
||||
R.xml.devicesettings_device_actions,
|
||||
R.xml.devicesettings_overwrite_settings_on_connection,
|
||||
R.xml.devicesettings_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -125,6 +125,7 @@ public class AmazfitBipUCoordinator extends HuamiCoordinator {
|
||||
R.xml.devicesettings_bt_connected_advertisement,
|
||||
R.xml.devicesettings_high_mtu,
|
||||
R.xml.devicesettings_device_actions,
|
||||
R.xml.devicesettings_overwrite_settings_on_connection,
|
||||
R.xml.devicesettings_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -122,6 +122,7 @@ public class AmazfitBipUProCoordinator extends HuamiCoordinator {
|
||||
R.xml.devicesettings_bt_connected_advertisement,
|
||||
R.xml.devicesettings_high_mtu,
|
||||
R.xml.devicesettings_device_actions,
|
||||
R.xml.devicesettings_overwrite_settings_on_connection,
|
||||
R.xml.devicesettings_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -102,6 +102,7 @@ public class AmazfitCorCoordinator extends HuamiCoordinator {
|
||||
R.xml.devicesettings_reserve_reminders_calendar,
|
||||
R.xml.devicesettings_bt_connected_advertisement,
|
||||
R.xml.devicesettings_device_actions,
|
||||
R.xml.devicesettings_overwrite_settings_on_connection,
|
||||
R.xml.devicesettings_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -104,6 +104,7 @@ public class AmazfitCor2Coordinator extends HuamiCoordinator {
|
||||
R.xml.devicesettings_reserve_reminders_calendar,
|
||||
R.xml.devicesettings_bt_connected_advertisement,
|
||||
R.xml.devicesettings_device_actions,
|
||||
R.xml.devicesettings_overwrite_settings_on_connection,
|
||||
R.xml.devicesettings_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -103,6 +103,7 @@ public class AmazfitGTRCoordinator extends HuamiCoordinator {
|
||||
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_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -102,6 +102,7 @@ public class AmazfitGTRLiteCoordinator extends HuamiCoordinator {
|
||||
R.xml.devicesettings_reserve_reminders_calendar,
|
||||
R.xml.devicesettings_expose_hr_thirdparty,
|
||||
R.xml.devicesettings_bt_connected_advertisement,
|
||||
R.xml.devicesettings_overwrite_settings_on_connection,
|
||||
R.xml.devicesettings_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -109,6 +109,7 @@ public class AmazfitGTR2Coordinator extends HuamiCoordinator {
|
||||
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_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -109,6 +109,7 @@ public class AmazfitGTR2eCoordinator extends HuamiCoordinator {
|
||||
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_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -103,6 +103,7 @@ public class AmazfitGTSCoordinator extends HuamiCoordinator {
|
||||
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_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -109,6 +109,7 @@ public class AmazfitGTS2Coordinator extends HuamiCoordinator {
|
||||
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_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -78,6 +78,7 @@ public class AmazfitGTS2MiniCoordinator extends AmazfitGTS2Coordinator {
|
||||
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_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -109,6 +109,7 @@ public class AmazfitGTS2eCoordinator extends HuamiCoordinator {
|
||||
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_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -102,6 +102,7 @@ public class AmazfitNeoCoordinator extends HuamiCoordinator {
|
||||
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_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -103,6 +103,7 @@ public class AmazfitTRexCoordinator extends HuamiCoordinator {
|
||||
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_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -103,6 +103,7 @@ public class AmazfitTRexProCoordinator extends HuamiCoordinator {
|
||||
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_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -103,6 +103,7 @@ public class AmazfitVergeLCoordinator extends HuamiCoordinator {
|
||||
R.xml.devicesettings_disconnectnotification,
|
||||
R.xml.devicesettings_bt_connected_advertisement,
|
||||
R.xml.devicesettings_buttonactions_with_longpress,
|
||||
R.xml.devicesettings_overwrite_settings_on_connection,
|
||||
R.xml.devicesettings_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -109,6 +109,7 @@ public class AmazfitXCoordinator extends HuamiCoordinator {
|
||||
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_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -94,6 +94,7 @@ public class MiBand2Coordinator extends HuamiCoordinator {
|
||||
R.xml.devicesettings_buttonactions,
|
||||
R.xml.devicesettings_reserve_alarms_calendar,
|
||||
R.xml.devicesettings_bt_connected_advertisement,
|
||||
R.xml.devicesettings_overwrite_settings_on_connection,
|
||||
R.xml.devicesettings_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -96,6 +96,7 @@ public class MiBand2HRXCoordinator extends HuamiCoordinator {
|
||||
R.xml.devicesettings_liftwrist_display,
|
||||
R.xml.devicesettings_inactivity_dnd,
|
||||
R.xml.devicesettings_rotatewrist_cycleinfo,
|
||||
R.xml.devicesettings_overwrite_settings_on_connection,
|
||||
R.xml.devicesettings_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -118,6 +118,7 @@ public class MiBand3Coordinator extends HuamiCoordinator {
|
||||
R.xml.devicesettings_expose_hr_thirdparty,
|
||||
R.xml.devicesettings_bt_connected_advertisement,
|
||||
R.xml.devicesettings_device_actions,
|
||||
R.xml.devicesettings_overwrite_settings_on_connection,
|
||||
R.xml.devicesettings_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -114,6 +114,7 @@ public class MiBand4Coordinator extends HuamiCoordinator {
|
||||
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_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -128,6 +128,7 @@ public class MiBand5Coordinator extends HuamiCoordinator {
|
||||
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_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -109,6 +109,7 @@ public class MiBand6Coordinator extends HuamiCoordinator {
|
||||
R.xml.devicesettings_reserve_reminders_calendar,
|
||||
R.xml.devicesettings_expose_hr_thirdparty,
|
||||
R.xml.devicesettings_high_mtu,
|
||||
R.xml.devicesettings_overwrite_settings_on_connection,
|
||||
R.xml.devicesettings_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -102,6 +102,7 @@ public class ZeppECoordinator extends HuamiCoordinator {
|
||||
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_transliteration
|
||||
};
|
||||
}
|
||||
|
@ -4024,36 +4024,40 @@ public abstract class HuamiSupport extends AbstractBTLEDeviceSupport implements
|
||||
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(gbDevice);
|
||||
|
||||
LOG.info("phase3Initialize...");
|
||||
setDateDisplay(builder);
|
||||
setTimeFormat(builder);
|
||||
setUserInfo(builder);
|
||||
setDistanceUnit(builder);
|
||||
setWearLocation(builder);
|
||||
setFitnessGoal(builder);
|
||||
setDisplayItems(builder);
|
||||
setDoNotDisturb(builder);
|
||||
setRotateWristToSwitchInfo(builder);
|
||||
setActivateDisplayOnLiftWrist(builder);
|
||||
setDisplayCaller(builder);
|
||||
setGoalNotification(builder);
|
||||
setInactivityWarnings(builder);
|
||||
setHourlyChime(builder);
|
||||
setHeartrateSleepSupport(builder);
|
||||
setHeartrateActivityMonitoring(builder);
|
||||
setHeartrateAlert(builder);
|
||||
setHeartrateStressMonitoring(builder);
|
||||
setDisconnectNotification(builder);
|
||||
setExposeHRThirdParty(builder);
|
||||
setHeartrateMeasurementInterval(builder, HuamiCoordinator.getHeartRateMeasurementInterval(getDevice().getAddress()));
|
||||
sendReminders(builder);
|
||||
setWorldClocks(builder);
|
||||
for (final HuamiVibrationPatternNotificationType type : HuamiVibrationPatternNotificationType.values()) {
|
||||
final String typeKey = type.name().toLowerCase(Locale.ROOT);
|
||||
setVibrationPattern(builder, HuamiConst.PREF_HUAMI_VIBRATION_PROFILE_PREFIX + typeKey);
|
||||
}
|
||||
if (!PasswordCapabilityImpl.Mode.NONE.equals(coordinator.getPasswordCapability())) {
|
||||
setPassword(builder);
|
||||
|
||||
if (HuamiCoordinator.getOverwriteSettingsOnConnection(getDevice().getAddress())) {
|
||||
setDateDisplay(builder);
|
||||
setTimeFormat(builder);
|
||||
setUserInfo(builder);
|
||||
setDistanceUnit(builder);
|
||||
setWearLocation(builder);
|
||||
setFitnessGoal(builder);
|
||||
setDisplayItems(builder);
|
||||
setDoNotDisturb(builder);
|
||||
setRotateWristToSwitchInfo(builder);
|
||||
setActivateDisplayOnLiftWrist(builder);
|
||||
setDisplayCaller(builder);
|
||||
setGoalNotification(builder);
|
||||
setInactivityWarnings(builder);
|
||||
setHourlyChime(builder);
|
||||
setHeartrateSleepSupport(builder);
|
||||
setHeartrateActivityMonitoring(builder);
|
||||
setHeartrateAlert(builder);
|
||||
setHeartrateStressMonitoring(builder);
|
||||
setDisconnectNotification(builder);
|
||||
setExposeHRThirdParty(builder);
|
||||
setHeartrateMeasurementInterval(builder, HuamiCoordinator.getHeartRateMeasurementInterval(getDevice().getAddress()));
|
||||
sendReminders(builder);
|
||||
setWorldClocks(builder);
|
||||
for (final HuamiVibrationPatternNotificationType type : HuamiVibrationPatternNotificationType.values()) {
|
||||
final String typeKey = type.name().toLowerCase(Locale.ROOT);
|
||||
setVibrationPattern(builder, HuamiConst.PREF_HUAMI_VIBRATION_PROFILE_PREFIX + typeKey);
|
||||
}
|
||||
if (!PasswordCapabilityImpl.Mode.NONE.equals(coordinator.getPasswordCapability())) {
|
||||
setPassword(builder);
|
||||
}
|
||||
}
|
||||
|
||||
requestAlarms(builder);
|
||||
}
|
||||
|
||||
|
@ -19,9 +19,6 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitband5;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
@ -31,8 +28,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband5.MiBand5Support;
|
||||
|
||||
public class AmazfitBand5Support extends MiBand5Support {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBand5Support.class);
|
||||
|
||||
@Override
|
||||
protected AmazfitBand5Support setDisplayItems(TransactionBuilder builder) {
|
||||
setDisplayItemsNew(builder, false, true, R.array.pref_amazfitband5_display_items_default);
|
||||
@ -49,16 +44,4 @@ public class AmazfitBand5Support extends MiBand5Support {
|
||||
public HuamiFWHelper createFWHelper(Uri uri, Context context) throws IOException {
|
||||
return new AmazfitBand5FWHelper(uri, context);
|
||||
}
|
||||
@Override
|
||||
public boolean supportsSunriseSunsetWindHumidity() {
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void phase3Initialize(TransactionBuilder builder) {
|
||||
super.phase3Initialize(builder);
|
||||
LOG.info("phase3Initialize...");
|
||||
setActivateDisplayOnLiftWristSensitivity(builder); // TODO? Move this to HuamiSupport?
|
||||
setWorkoutActivityTypes(builder); // TODO: Supported by other bands?
|
||||
}
|
||||
}
|
||||
|
@ -28,6 +28,7 @@ import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbip.AmazfitBipFWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.CallSpec;
|
||||
@ -109,7 +110,11 @@ public class AmazfitBipSupport extends HuamiSupport {
|
||||
public void phase2Initialize(TransactionBuilder builder) {
|
||||
super.phase2Initialize(builder);
|
||||
LOG.info("phase2Initialize...");
|
||||
setLanguage(builder);
|
||||
|
||||
if (HuamiCoordinator.getOverwriteSettingsOnConnection(getDevice().getAddress())) {
|
||||
setLanguage(builder);
|
||||
}
|
||||
|
||||
requestGPSVersion(builder);
|
||||
}
|
||||
|
||||
|
@ -21,6 +21,7 @@ import android.net.Uri;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitgtr.AmazfitGTRLiteFWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
|
||||
@ -40,7 +41,10 @@ public class AmazfitGTRLiteSupport extends AmazfitGTSSupport {
|
||||
@Override
|
||||
public void phase2Initialize(TransactionBuilder builder) {
|
||||
super.phase2Initialize(builder);
|
||||
setLanguage(builder);
|
||||
|
||||
if (HuamiCoordinator.getOverwriteSettingsOnConnection(getDevice().getAddress())) {
|
||||
setLanguage(builder);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -18,31 +18,22 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband3;
|
||||
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
import android.widget.Toast;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.util.Calendar;
|
||||
import java.util.Date;
|
||||
import java.util.GregorianCalendar;
|
||||
import java.util.LinkedHashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiService;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband3.MiBand3Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband3.MiBand3FWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband3.MiBand3Service;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.AmazfitBipSupport;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.GB;
|
||||
|
||||
public class MiBand3Support extends AmazfitBipSupport {
|
||||
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MiBand3Support.class);
|
||||
|
||||
@Override
|
||||
@ -70,10 +61,12 @@ public class MiBand3Support extends AmazfitBipSupport {
|
||||
public void phase2Initialize(TransactionBuilder builder) {
|
||||
super.phase2Initialize(builder);
|
||||
LOG.info("phase2Initialize...");
|
||||
setLanguage(builder);
|
||||
setBandScreenUnlock(builder);
|
||||
setNightMode(builder);
|
||||
setDateFormat(builder);
|
||||
if (HuamiCoordinator.getOverwriteSettingsOnConnection(getDevice().getAddress())) {
|
||||
setLanguage(builder);
|
||||
setBandScreenUnlock(builder);
|
||||
setNightMode(builder);
|
||||
setDateFormat(builder);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -19,16 +19,21 @@ package nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband4;
|
||||
import android.content.Context;
|
||||
import android.net.Uri;
|
||||
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband4.MiBand4FWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.NotificationSpec;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband3.MiBand3Support;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.operations.UpdateFirmwareOperation;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.operations.UpdateFirmwareOperationNew;
|
||||
|
||||
public class MiBand4Support extends MiBand3Support {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(MiBand4Support.class);
|
||||
|
||||
@Override
|
||||
public byte getCryptFlags() {
|
||||
@ -49,4 +54,13 @@ public class MiBand4Support extends MiBand3Support {
|
||||
public UpdateFirmwareOperation createUpdateFirmwareOperation(Uri uri) {
|
||||
return new UpdateFirmwareOperationNew(uri, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void phase3Initialize(TransactionBuilder builder) {
|
||||
super.phase3Initialize(builder);
|
||||
LOG.info("phase3Initialize...");
|
||||
if (HuamiCoordinator.getOverwriteSettingsOnConnection(getDevice().getAddress())) {
|
||||
setActivateDisplayOnLiftWristSensitivity(builder); // TODO? Move this to HuamiSupport?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -25,6 +25,7 @@ import org.slf4j.LoggerFactory;
|
||||
import java.io.IOException;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband5.MiBand5FWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.btle.TransactionBuilder;
|
||||
@ -64,7 +65,8 @@ public class MiBand5Support extends MiBand4Support {
|
||||
public void phase3Initialize(TransactionBuilder builder) {
|
||||
super.phase3Initialize(builder);
|
||||
LOG.info("phase3Initialize...");
|
||||
setActivateDisplayOnLiftWristSensitivity(builder); // TODO? Move this to HuamiSupport?
|
||||
setWorkoutActivityTypes(builder); // TODO: Supported by other bands?
|
||||
if (HuamiCoordinator.getOverwriteSettingsOnConnection(getDevice().getAddress())) {
|
||||
setWorkoutActivityTypes(builder); // TODO: Supported by other bands?
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -304,6 +304,8 @@
|
||||
<string name="pref_summary_use_custom_font">Enable this if your device has a custom font firmware for emoji support</string>
|
||||
<string name="pref_title_allow_high_mtu">Allow high MTU</string>
|
||||
<string name="pref_summary_allow_high_mtu">Increases transfer speed, but might not work on some Android devices.</string>
|
||||
<string name="pref_title_overwrite_settings_on_connection">Overwrite settings on connection</string>
|
||||
<string name="pref_summary_overwrite_settings_on_connection">When connecting to the band, overwrite all the settings on it.</string>
|
||||
<string name="pref_title_device_internet_access">Allow Internet Access</string>
|
||||
<string name="pref_summary_device_internet_access">Allow apps on this device to access the internet</string>
|
||||
<string name="pref_title_device_intents">Allow Intents</string>
|
||||
|
@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<SwitchPreference
|
||||
android:defaultValue="true"
|
||||
android:icon="@drawable/ic_settings_applications"
|
||||
android:key="overwrite_settings_on_connection"
|
||||
android:summary="@string/pref_summary_overwrite_settings_on_connection"
|
||||
android:title="@string/pref_title_overwrite_settings_on_connection" />
|
||||
</androidx.preference.PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user