mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-02-05 05:24:12 +01:00
Moyoung: Implement and improve several device settings
This commit is contained in:
parent
8986cde243
commit
8e69b1a149
@ -35,6 +35,8 @@ import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PR
|
|||||||
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_NIGHT_MODE_SCHEDULED;
|
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_NIGHT_MODE_SCHEDULED;
|
||||||
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_NIGHT_MODE_START;
|
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_NIGHT_MODE_START;
|
||||||
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_SWIPE_UNLOCK;
|
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_SWIPE_UNLOCK;
|
||||||
|
import static nodomain.freeyourgadget.gadgetbridge.devices.moyoung.MoyoungConstants.PREF_MOYOUNG_DEVICE_VERSION;
|
||||||
|
import static nodomain.freeyourgadget.gadgetbridge.devices.moyoung.MoyoungConstants.PREF_MOYOUNG_WATCH_FACE;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
@ -814,6 +816,9 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
|
|||||||
|
|
||||||
addPreferenceHandlerFor(PREF_FEMOMETER_MEASUREMENT_MODE);
|
addPreferenceHandlerFor(PREF_FEMOMETER_MEASUREMENT_MODE);
|
||||||
|
|
||||||
|
addPreferenceHandlerFor(PREF_MOYOUNG_WATCH_FACE);
|
||||||
|
addPreferenceHandlerFor(PREF_MOYOUNG_DEVICE_VERSION);
|
||||||
|
|
||||||
addPreferenceHandlerFor(PREF_QC35_NOISE_CANCELLING_LEVEL);
|
addPreferenceHandlerFor(PREF_QC35_NOISE_CANCELLING_LEVEL);
|
||||||
addPreferenceHandlerFor(PREF_USER_FITNESS_GOAL);
|
addPreferenceHandlerFor(PREF_USER_FITNESS_GOAL);
|
||||||
addPreferenceHandlerFor(PREF_USER_FITNESS_GOAL_NOTIFICATION);
|
addPreferenceHandlerFor(PREF_USER_FITNESS_GOAL_NOTIFICATION);
|
||||||
|
@ -199,9 +199,8 @@ public abstract class AbstractMoyoungDeviceCoordinator extends AbstractBLEDevice
|
|||||||
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
|
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
|
||||||
final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
|
final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
|
||||||
generic.add(R.xml.devicesettings_moyoung_device_version);
|
generic.add(R.xml.devicesettings_moyoung_device_version);
|
||||||
generic.add(R.xml.devicesettings_colmi_r0x);
|
generic.add(R.xml.devicesettings_heartrate_interval);
|
||||||
generic.add(R.xml.devicesettings_timeformat);
|
generic.add(R.xml.devicesettings_timeformat);
|
||||||
generic.add(R.xml.devicesettings_measurementsystem);
|
|
||||||
generic.add(R.xml.devicesettings_moyoung_watchface);
|
generic.add(R.xml.devicesettings_moyoung_watchface);
|
||||||
generic.add(R.xml.devicesettings_liftwrist_display);
|
generic.add(R.xml.devicesettings_liftwrist_display);
|
||||||
generic.add(R.xml.devicesettings_moyoung_sedentary_reminder);
|
generic.add(R.xml.devicesettings_moyoung_sedentary_reminder);
|
||||||
|
@ -402,10 +402,10 @@ public class MoyoungConstants {
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static final String PREF_WATCH_FACE = "moyoung_watch_face";
|
public static final String PREF_MOYOUNG_WATCH_FACE = "moyoung_watch_face";
|
||||||
public static final String PREF_LANGUAGE = "moyoung_language";
|
public static final String PREF_LANGUAGE = "moyoung_language";
|
||||||
public static final String PREF_LANGUAGE_SUPPORT = "moyoung_language_supported";
|
public static final String PREF_LANGUAGE_SUPPORT = "moyoung_language_supported";
|
||||||
public static final String PREF_DEVICE_VERSION = "moyoung_device_version";
|
public static final String PREF_MOYOUNG_DEVICE_VERSION = "moyoung_device_version";
|
||||||
public static final String PREF_SEDENTARY_REMINDER = "sedentary_reminder";
|
public static final String PREF_SEDENTARY_REMINDER = "sedentary_reminder";
|
||||||
public static final String PREF_SEDENTARY_REMINDER_PERIOD = "sedentary_reminder_period";
|
public static final String PREF_SEDENTARY_REMINDER_PERIOD = "sedentary_reminder_period";
|
||||||
public static final String PREF_SEDENTARY_REMINDER_STEPS = "sedentary_reminder_steps";
|
public static final String PREF_SEDENTARY_REMINDER_STEPS = "sedentary_reminder_steps";
|
||||||
|
@ -50,6 +50,7 @@ import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.Logging;
|
import nodomain.freeyourgadget.gadgetbridge.Logging;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.activities.HeartRateUtils;
|
import nodomain.freeyourgadget.gadgetbridge.activities.HeartRateUtils;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.activities.SettingsActivity;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst;
|
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSettingsPreferenceConst;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
import nodomain.freeyourgadget.gadgetbridge.database.DBHandler;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
||||||
@ -57,6 +58,7 @@ import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventBatteryInf
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventCallControl;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventCallControl;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventFindPhone;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventFindPhone;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventMusicControl;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventMusicControl;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventUpdatePreferences;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventVersionInfo;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventVersionInfo;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.AbstractMoyoungDeviceCoordinator;
|
import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.AbstractMoyoungDeviceCoordinator;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.MoyoungConstants;
|
import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.MoyoungConstants;
|
||||||
@ -68,6 +70,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.samples.MoyoungHeart
|
|||||||
import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.samples.MoyoungSpo2SampleProvider;
|
import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.samples.MoyoungSpo2SampleProvider;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.settings.MoyoungEnumDeviceVersion;
|
import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.settings.MoyoungEnumDeviceVersion;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.settings.MoyoungEnumLanguage;
|
import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.settings.MoyoungEnumLanguage;
|
||||||
|
import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.settings.MoyoungEnumMetricSystem;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.settings.MoyoungEnumTimeSystem;
|
import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.settings.MoyoungEnumTimeSystem;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.settings.MoyoungSetting;
|
import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.settings.MoyoungSetting;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.settings.MoyoungSettingEnum;
|
import nodomain.freeyourgadget.gadgetbridge.devices.moyoung.settings.MoyoungSettingEnum;
|
||||||
@ -175,6 +178,7 @@ public class MoyoungDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
builder.notify(getCharacteristic(MoyoungConstants.UUID_CHARACTERISTIC_DATA_IN), true);
|
builder.notify(getCharacteristic(MoyoungConstants.UUID_CHARACTERISTIC_DATA_IN), true);
|
||||||
deviceInfoProfile.requestDeviceInfo(builder);
|
deviceInfoProfile.requestDeviceInfo(builder);
|
||||||
setTime(builder);
|
setTime(builder);
|
||||||
|
setMeasurementSystem(builder);
|
||||||
sendSetting(builder, getSetting("USER_INFO"), new ActivityUser()); // these settings are write-only, so write them just in case because there is no way to know if they desynced somehow
|
sendSetting(builder, getSetting("USER_INFO"), new ActivityUser()); // these settings are write-only, so write them just in case because there is no way to know if they desynced somehow
|
||||||
sendSetting(builder, getSetting("GOAL_STEP"), new ActivityUser().getStepsGoal());
|
sendSetting(builder, getSetting("GOAL_STEP"), new ActivityUser().getStepsGoal());
|
||||||
batteryInfoProfile.requestBatteryInfo(builder);
|
batteryInfoProfile.requestBatteryInfo(builder);
|
||||||
@ -435,6 +439,7 @@ public class MoyoungDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
if (packetType == MoyoungConstants.CMD_QUERY_DISPLAY_WATCH_FACE)
|
if (packetType == MoyoungConstants.CMD_QUERY_DISPLAY_WATCH_FACE)
|
||||||
{
|
{
|
||||||
LOG.info("Watchface changed on watch to nr {}", payload[0]);
|
LOG.info("Watchface changed on watch to nr {}", payload[0]);
|
||||||
|
onReadConfigurationDone(getSetting("DISPLAY_WATCH_FACE"), payload[0], null);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -541,6 +546,26 @@ public class MoyoungDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
sendNotification(MoyoungConstants.NOTIFICATION_TYPE_CALL_OFF_HOOK, "");
|
sendNotification(MoyoungConstants.NOTIFICATION_TYPE_CALL_OFF_HOOK, "");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
private void setMeasurementSystem(TransactionBuilder builder) {
|
||||||
|
Prefs prefs = GBApplication.getPrefs();
|
||||||
|
String unit = prefs.getString(SettingsActivity.PREF_MEASUREMENT_SYSTEM, GBApplication.getContext().getString(R.string.p_unit_metric));
|
||||||
|
|
||||||
|
MoyoungEnumMetricSystem metricSystem = null;
|
||||||
|
if (unit.equals(getContext().getString(R.string.p_unit_metric)))
|
||||||
|
metricSystem = MoyoungEnumMetricSystem.METRIC_SYSTEM;
|
||||||
|
else if (unit.equals(getContext().getString(R.string.p_unit_imperial)))
|
||||||
|
metricSystem = MoyoungEnumMetricSystem.IMPERIAL_SYSTEM;
|
||||||
|
else
|
||||||
|
LOG.warn("Invalid unit preference: {}", unit);
|
||||||
|
|
||||||
|
if (metricSystem != null) {
|
||||||
|
if (builder == null)
|
||||||
|
sendSetting(getSetting("METRIC_SYSTEM"), metricSystem);
|
||||||
|
else
|
||||||
|
sendSetting(builder, getSetting("METRIC_SYSTEM"), metricSystem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
private void setTime(TransactionBuilder builder) {
|
private void setTime(TransactionBuilder builder) {
|
||||||
ByteBuffer buffer = ByteBuffer.allocate(5);
|
ByteBuffer buffer = ByteBuffer.allocate(5);
|
||||||
buffer.putInt(MoyoungConstants.LocalTimeToWatchTime(new Date())); // The watch is hardcoded to GMT+8 internally...
|
buffer.putInt(MoyoungConstants.LocalTimeToWatchTime(new Date())); // The watch is hardcoded to GMT+8 internally...
|
||||||
@ -1285,22 +1310,12 @@ public class MoyoungDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
sendSetting(getSetting("TIME_SYSTEM"), timeSystem);
|
sendSetting(getSetting("TIME_SYSTEM"), timeSystem);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// case DeviceSettingsPreferenceConst.PREF_MEASUREMENTSYSTEM:
|
case SettingsActivity.PREF_MEASUREMENT_SYSTEM:
|
||||||
// String metricSystemPref = prefs.getString(DeviceSettingsPreferenceConst.PREF_MEASUREMENTSYSTEM, getContext().getString(R.string.p_unit_metric));
|
setMeasurementSystem(null);
|
||||||
//
|
break;
|
||||||
// MoyoungEnumMetricSystem metricSystem;
|
|
||||||
// if (metricSystemPref.equals(getContext().getString(R.string.p_unit_metric)))
|
|
||||||
// metricSystem = MoyoungEnumMetricSystem.METRIC_SYSTEM;
|
|
||||||
// else if (metricSystemPref.equals(getContext().getString(R.string.p_unit_imperial)))
|
|
||||||
// metricSystem = MoyoungEnumMetricSystem.IMPERIAL_SYSTEM;
|
|
||||||
// else
|
|
||||||
// throw new IllegalArgumentException();
|
|
||||||
//
|
|
||||||
// sendSetting(getSetting("METRIC_SYSTEM"), metricSystem);
|
|
||||||
// break;
|
|
||||||
|
|
||||||
case MoyoungConstants.PREF_WATCH_FACE:
|
case MoyoungConstants.PREF_MOYOUNG_WATCH_FACE:
|
||||||
String watchFacePref = prefs.getString(MoyoungConstants.PREF_WATCH_FACE, String.valueOf(1));
|
String watchFacePref = prefs.getString(MoyoungConstants.PREF_MOYOUNG_WATCH_FACE, String.valueOf(1));
|
||||||
byte watchFace = Byte.valueOf(watchFacePref);
|
byte watchFace = Byte.valueOf(watchFacePref);
|
||||||
sendSetting(getSetting("DISPLAY_WATCH_FACE"), watchFace);
|
sendSetting(getSetting("DISPLAY_WATCH_FACE"), watchFace);
|
||||||
break;
|
break;
|
||||||
@ -1364,8 +1379,8 @@ public class MoyoungDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
sendSetting(languageSetting, languageSetting.findByValue(languageCode));
|
sendSetting(languageSetting, languageSetting.findByValue(languageCode));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MoyoungConstants.PREF_DEVICE_VERSION:
|
case MoyoungConstants.PREF_MOYOUNG_DEVICE_VERSION:
|
||||||
String versionPref = prefs.getString(MoyoungConstants.PREF_DEVICE_VERSION,
|
String versionPref = prefs.getString(MoyoungConstants.PREF_MOYOUNG_DEVICE_VERSION,
|
||||||
String.valueOf(MoyoungEnumDeviceVersion.INTERNATIONAL_EDITION.value()));
|
String.valueOf(MoyoungEnumDeviceVersion.INTERNATIONAL_EDITION.value()));
|
||||||
byte versionNum = Byte.valueOf(versionPref);
|
byte versionNum = Byte.valueOf(versionPref);
|
||||||
MoyoungSettingEnum<MoyoungEnumDeviceVersion> versionSetting = getSetting("DEVICE_VERSION");
|
MoyoungSettingEnum<MoyoungEnumDeviceVersion> versionSetting = getSetting("DEVICE_VERSION");
|
||||||
@ -1463,7 +1478,7 @@ public class MoyoungDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
// querySetting(getSetting("METRIC_SYSTEM"));
|
// querySetting(getSetting("METRIC_SYSTEM"));
|
||||||
// break;
|
// break;
|
||||||
|
|
||||||
case MoyoungConstants.PREF_WATCH_FACE:
|
case MoyoungConstants.PREF_MOYOUNG_WATCH_FACE:
|
||||||
querySetting(getSetting("DISPLAY_WATCH_FACE"));
|
querySetting(getSetting("DISPLAY_WATCH_FACE"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1471,7 +1486,7 @@ public class MoyoungDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
querySetting(getSetting("DEVICE_LANGUAGE"));
|
querySetting(getSetting("DEVICE_LANGUAGE"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case MoyoungConstants.PREF_DEVICE_VERSION:
|
case MoyoungConstants.PREF_MOYOUNG_DEVICE_VERSION:
|
||||||
querySetting(getSetting("DEVICE_VERSION"));
|
querySetting(getSetting("DEVICE_VERSION"));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
@ -1511,18 +1526,19 @@ public class MoyoungDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
public void onReadConfigurationDone(MoyoungSetting setting, Object value, byte[] data)
|
public void onReadConfigurationDone(MoyoungSetting setting, Object value, byte[] data)
|
||||||
{
|
{
|
||||||
LOG.info("CONFIG " + setting.name + " = " + value);
|
LOG.info("CONFIG " + setting.name + " = " + value);
|
||||||
Prefs prefs = getDevicePrefs();
|
final GBDeviceEventUpdatePreferences eventUpdatePreferences = new GBDeviceEventUpdatePreferences();
|
||||||
Map<String, String> changedProperties = new ArrayMap<>();
|
// Prefs prefs = getDevicePrefs();
|
||||||
SharedPreferences.Editor prefsEditor = prefs.getPreferences().edit();
|
// Map<String, String> changedProperties = new ArrayMap<>();
|
||||||
|
// SharedPreferences.Editor prefsEditor = prefs.getPreferences().edit();
|
||||||
switch (setting.name) {
|
switch (setting.name) {
|
||||||
case "TIME_SYSTEM":
|
case "TIME_SYSTEM":
|
||||||
MoyoungEnumTimeSystem timeSystem = (MoyoungEnumTimeSystem) value;
|
MoyoungEnumTimeSystem timeSystem = (MoyoungEnumTimeSystem) value;
|
||||||
if (timeSystem == MoyoungEnumTimeSystem.TIME_SYSTEM_24)
|
// if (timeSystem == MoyoungEnumTimeSystem.TIME_SYSTEM_24)
|
||||||
changedProperties.put(DeviceSettingsPreferenceConst.PREF_TIMEFORMAT, getContext().getString(R.string.p_timeformat_24h));
|
// changedProperties.put(DeviceSettingsPreferenceConst.PREF_TIMEFORMAT, getContext().getString(R.string.p_timeformat_24h));
|
||||||
else if (timeSystem == MoyoungEnumTimeSystem.TIME_SYSTEM_12)
|
// else if (timeSystem == MoyoungEnumTimeSystem.TIME_SYSTEM_12)
|
||||||
changedProperties.put(DeviceSettingsPreferenceConst.PREF_TIMEFORMAT, getContext().getString(R.string.p_timeformat_am_pm));
|
// changedProperties.put(DeviceSettingsPreferenceConst.PREF_TIMEFORMAT, getContext().getString(R.string.p_timeformat_am_pm));
|
||||||
else
|
// else
|
||||||
throw new IllegalArgumentException("Invalid value");
|
// throw new IllegalArgumentException("Invalid value");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// case "METRIC_SYSTEM":
|
// case "METRIC_SYSTEM":
|
||||||
@ -1536,23 +1552,28 @@ public class MoyoungDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
// break;
|
// break;
|
||||||
|
|
||||||
case "DISPLAY_WATCH_FACE":
|
case "DISPLAY_WATCH_FACE":
|
||||||
byte watchFace = (Byte) value;
|
// byte watchFace = (Byte) value;
|
||||||
changedProperties.put(MoyoungConstants.PREF_WATCH_FACE, String.valueOf(watchFace));
|
// changedProperties.put(MoyoungConstants.PREF_MOYOUNG_WATCH_FACE, String.valueOf(watchFace));
|
||||||
|
eventUpdatePreferences.withPreference(
|
||||||
|
MoyoungConstants.PREF_MOYOUNG_WATCH_FACE,
|
||||||
|
String.valueOf((byte) value)
|
||||||
|
);
|
||||||
|
evaluateGBDeviceEvent(eventUpdatePreferences);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "DEVICE_LANGUAGE":
|
case "DEVICE_LANGUAGE":
|
||||||
MoyoungEnumLanguage language = (MoyoungEnumLanguage) value;
|
MoyoungEnumLanguage language = (MoyoungEnumLanguage) value;
|
||||||
changedProperties.put(MoyoungConstants.PREF_LANGUAGE, String.valueOf(language.value()));
|
// changedProperties.put(MoyoungConstants.PREF_LANGUAGE, String.valueOf(language.value()));
|
||||||
MoyoungEnumLanguage[] supportedLanguages = ((MoyoungSettingLanguage) setting).decodeSupportedValues(data);
|
// MoyoungEnumLanguage[] supportedLanguages = ((MoyoungSettingLanguage) setting).decodeSupportedValues(data);
|
||||||
Set<String> supportedLanguagesList = new HashSet<>();
|
// Set<String> supportedLanguagesList = new HashSet<>();
|
||||||
for(MoyoungEnumLanguage supportedLanguage : supportedLanguages)
|
// for(MoyoungEnumLanguage supportedLanguage : supportedLanguages)
|
||||||
supportedLanguagesList.add(String.valueOf(supportedLanguage.value()));
|
// supportedLanguagesList.add(String.valueOf(supportedLanguage.value()));
|
||||||
prefsEditor.putStringSet(MoyoungConstants.PREF_LANGUAGE_SUPPORT, supportedLanguagesList);
|
// prefsEditor.putStringSet(MoyoungConstants.PREF_LANGUAGE_SUPPORT, supportedLanguagesList);
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "DEVICE_VERSION":
|
case "DEVICE_VERSION":
|
||||||
MoyoungEnumDeviceVersion deviceVersion = (MoyoungEnumDeviceVersion) value;
|
MoyoungEnumDeviceVersion deviceVersion = (MoyoungEnumDeviceVersion) value;
|
||||||
changedProperties.put(MoyoungConstants.PREF_DEVICE_VERSION, String.valueOf(deviceVersion.value()));
|
// changedProperties.put(MoyoungConstants.PREF_MOYOUNG_DEVICE_VERSION, String.valueOf(deviceVersion.value()));
|
||||||
break;
|
break;
|
||||||
|
|
||||||
// case "DO_NOT_DISTURB_TIME":
|
// case "DO_NOT_DISTURB_TIME":
|
||||||
@ -1589,20 +1610,20 @@ public class MoyoungDeviceSupport extends AbstractBTLEDeviceSupport {
|
|||||||
|
|
||||||
case "SEDENTARY_REMINDER":
|
case "SEDENTARY_REMINDER":
|
||||||
boolean sedentaryReminderEnabled = (Boolean) value;
|
boolean sedentaryReminderEnabled = (Boolean) value;
|
||||||
changedProperties.put(MoyoungConstants.PREF_SEDENTARY_REMINDER, sedentaryReminderEnabled ? "on": "off");
|
// changedProperties.put(MoyoungConstants.PREF_SEDENTARY_REMINDER, sedentaryReminderEnabled ? "on": "off");
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case "REMINDERS_TO_MOVE_PERIOD":
|
case "REMINDERS_TO_MOVE_PERIOD":
|
||||||
MoyoungSettingRemindersToMove.RemindersToMove remindersToMove = (MoyoungSettingRemindersToMove.RemindersToMove) value;
|
MoyoungSettingRemindersToMove.RemindersToMove remindersToMove = (MoyoungSettingRemindersToMove.RemindersToMove) value;
|
||||||
changedProperties.put(MoyoungConstants.PREF_SEDENTARY_REMINDER_PERIOD, String.valueOf(remindersToMove.period));
|
// changedProperties.put(MoyoungConstants.PREF_SEDENTARY_REMINDER_PERIOD, String.valueOf(remindersToMove.period));
|
||||||
changedProperties.put(MoyoungConstants.PREF_SEDENTARY_REMINDER_STEPS, String.valueOf(remindersToMove.steps));
|
// changedProperties.put(MoyoungConstants.PREF_SEDENTARY_REMINDER_STEPS, String.valueOf(remindersToMove.steps));
|
||||||
changedProperties.put(MoyoungConstants.PREF_SEDENTARY_REMINDER_START, String.valueOf(remindersToMove.start_h));
|
// changedProperties.put(MoyoungConstants.PREF_SEDENTARY_REMINDER_START, String.valueOf(remindersToMove.start_h));
|
||||||
changedProperties.put(MoyoungConstants.PREF_SEDENTARY_REMINDER_END, String.valueOf(remindersToMove.end_h));
|
// changedProperties.put(MoyoungConstants.PREF_SEDENTARY_REMINDER_END, String.valueOf(remindersToMove.end_h));
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
for (Map.Entry<String, String> property : changedProperties.entrySet())
|
// for (Map.Entry<String, String> property : changedProperties.entrySet())
|
||||||
prefsEditor.putString(property.getKey(), property.getValue());
|
// prefsEditor.putString(property.getKey(), property.getValue());
|
||||||
prefsEditor.apply();
|
// prefsEditor.apply();
|
||||||
// for (Map.Entry<String, String> property : changedProperties.entrySet())
|
// for (Map.Entry<String, String> property : changedProperties.entrySet())
|
||||||
// {
|
// {
|
||||||
// GBDeviceEventConfigurationRead configReadEvent = new GBDeviceEventConfigurationRead();
|
// GBDeviceEventConfigurationRead configReadEvent = new GBDeviceEventConfigurationRead();
|
||||||
|
@ -2645,6 +2645,7 @@
|
|||||||
<item>Watch face 8</item>
|
<item>Watch face 8</item>
|
||||||
<item>Watch face 9</item>
|
<item>Watch face 9</item>
|
||||||
<item>Watch face 10</item>
|
<item>Watch face 10</item>
|
||||||
|
<item>Watch face 11</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="pref_moyoung_watch_face_values">
|
<string-array name="pref_moyoung_watch_face_values">
|
||||||
@ -2658,6 +2659,7 @@
|
|||||||
<item>8</item>
|
<item>8</item>
|
||||||
<item>9</item>
|
<item>9</item>
|
||||||
<item>10</item>
|
<item>10</item>
|
||||||
|
<item>11</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
|
||||||
<string-array name="pref_moyoung_device_version">
|
<string-array name="pref_moyoung_device_version">
|
||||||
|
11
app/src/main/res/xml/devicesettings_heartrate_interval.xml
Normal file
11
app/src/main/res/xml/devicesettings_heartrate_interval.xml
Normal file
@ -0,0 +1,11 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<ListPreference
|
||||||
|
android:defaultValue="0"
|
||||||
|
android:entries="@array/prefs_heartrate_measurement_interval"
|
||||||
|
android:entryValues="@array/prefs_heartrate_measurement_interval_values"
|
||||||
|
android:icon="@drawable/ic_heartrate"
|
||||||
|
android:key="heartrate_measurement_interval"
|
||||||
|
android:summary="%s"
|
||||||
|
android:title="@string/prefs_title_heartrate_measurement_interval" />
|
||||||
|
</androidx.preference.PreferenceScreen>
|
@ -1,12 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
|
||||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
|
||||||
<ListPreference
|
|
||||||
android:icon="@drawable/ic_measurement_system"
|
|
||||||
android:defaultValue="metric"
|
|
||||||
android:entries="@array/pref_entries_unit_system"
|
|
||||||
android:entryValues="@array/pref_values_unit_system"
|
|
||||||
android:key="measurement_system"
|
|
||||||
android:summary="%s"
|
|
||||||
android:title="@string/pref_title_unit_system" />
|
|
||||||
|
|
||||||
</androidx.preference.PreferenceScreen>
|
|
@ -6,5 +6,6 @@
|
|||||||
android:entryValues="@array/pref_moyoung_device_version_values"
|
android:entryValues="@array/pref_moyoung_device_version_values"
|
||||||
android:key="moyoung_device_version"
|
android:key="moyoung_device_version"
|
||||||
android:summary="%s"
|
android:summary="%s"
|
||||||
android:title="@string/pref_device_version" />
|
android:title="@string/pref_device_version"
|
||||||
|
android:icon="@drawable/ic_language" />
|
||||||
</androidx.preference.PreferenceScreen>
|
</androidx.preference.PreferenceScreen>
|
||||||
|
Loading…
Reference in New Issue
Block a user