mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge.git
synced 2025-01-10 17:11:56 +01:00
Mi Band 3/4, Amazfit Cor/Bip: set language immediately when changing it (not only on connect)
Helps testing
This commit is contained in:
parent
97540d734f
commit
aefd7520f3
@ -16,18 +16,20 @@ import org.slf4j.LoggerFactory;
|
||||
import java.util.Objects;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.XTimePreference;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.XTimePreferenceFragment;
|
||||
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_ACTIVATE_DISPLAY_ON_LIFT;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DATEFORMAT;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISCONNECT_NOTIFICATION;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISCONNECT_NOTIFICATION_END;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISCONNECT_NOTIFICATION_START;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISPLAY_ITEMS;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISPLAY_ON_LIFT_END;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_DISPLAY_ON_LIFT_START;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst.PREF_LANGUAGE;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_DO_NOT_DISTURB;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_DO_NOT_DISTURB_END;
|
||||
import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst.PREF_DO_NOT_DISTURB_OFF;
|
||||
@ -282,8 +284,9 @@ public class DeviceSpecificSettingsFragment extends PreferenceFragmentCompat {
|
||||
|
||||
addPreferenceHandlerFor(PREF_SWIPE_UNLOCK);
|
||||
addPreferenceHandlerFor(PREF_MI2_DATEFORMAT);
|
||||
addPreferenceHandlerFor("dateformat");
|
||||
addPreferenceHandlerFor(HuamiConst.PREF_DISPLAY_ITEMS);
|
||||
addPreferenceHandlerFor(PREF_DATEFORMAT);
|
||||
addPreferenceHandlerFor(PREF_DISPLAY_ITEMS);
|
||||
addPreferenceHandlerFor(PREF_LANGUAGE);
|
||||
|
||||
String displayOnLiftState = prefs.getString(PREF_ACTIVATE_DISPLAY_ON_LIFT, PREF_DO_NOT_DISTURB_OFF);
|
||||
boolean displayOnLiftScheduled = displayOnLiftState.equals(PREF_DO_NOT_DISTURB_SCHEDULED);
|
||||
|
@ -59,6 +59,9 @@ public class HuamiConst {
|
||||
public static final String PREF_DISCONNECT_NOTIFICATION_END = "disconnect_notification_end";
|
||||
|
||||
public static final String PREF_DISPLAY_ITEMS = "display_items";
|
||||
public static final String PREF_LANGUAGE = "language";
|
||||
public static final String PREF_DATEFORMAT = "dateformat";
|
||||
|
||||
|
||||
public static int toActivityKind(int rawType) {
|
||||
switch (rawType) {
|
||||
|
@ -49,6 +49,8 @@ public class HuamiService {
|
||||
// service uuid fee1
|
||||
public static final UUID UUID_CHARACTERISTIC_AUTH = UUID.fromString("00000009-0000-3512-2118-0009af100700");
|
||||
public static final UUID UUID_CHARACTERISTIC_DEVICEEVENT = UUID.fromString("00000010-0000-3512-2118-0009af100700");
|
||||
public static final UUID UUID_CHARACTERISTIC_AUDIO = UUID.fromString("00000012-0000-3512-2118-0009af100700");
|
||||
public static final UUID UUID_CHARACTERISTIC_AUDIODATA = UUID.fromString("00000013-0000-3512-2118-0009af100700");
|
||||
|
||||
public static final UUID UUID_CHARACTERISTIC_CHUNKEDTRANSFER = UUID.fromString("00000020-0000-3512-2118-0009af100700");
|
||||
|
||||
|
@ -301,6 +301,8 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport {
|
||||
builder.notify(getCharacteristic(HuamiService.UUID_CHARACTERISTIC_3_CONFIGURATION), enable);
|
||||
builder.notify(getCharacteristic(HuamiService.UUID_CHARACTERISTIC_6_BATTERY_INFO), enable);
|
||||
builder.notify(getCharacteristic(HuamiService.UUID_CHARACTERISTIC_DEVICEEVENT), enable);
|
||||
builder.notify(getCharacteristic(HuamiService.UUID_CHARACTERISTIC_AUDIO), enable);
|
||||
builder.notify(getCharacteristic(HuamiService.UUID_CHARACTERISTIC_AUDIODATA), enable);
|
||||
|
||||
return this;
|
||||
}
|
||||
@ -682,7 +684,7 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport {
|
||||
sendCalendarEvents(builder);
|
||||
builder.queue(getQueue());
|
||||
} catch (IOException ex) {
|
||||
LOG.error("Unable to set time on MI device", ex);
|
||||
LOG.error("Unable to set time on Huami device", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -878,7 +880,7 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport {
|
||||
builder.write(characteristicHRControlPoint, startHeartMeasurementManual);
|
||||
builder.queue(getQueue());
|
||||
} catch (IOException ex) {
|
||||
LOG.error("Unable to read heart rate with MI2", ex);
|
||||
LOG.error("Unable to read heart rate from Huami device", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -939,7 +941,7 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport {
|
||||
try {
|
||||
new FetchActivityOperation(this).perform();
|
||||
} catch (IOException ex) {
|
||||
LOG.error("Unable to fetch MI activity data", ex);
|
||||
LOG.error("Unable to fetch activity data", ex);
|
||||
}
|
||||
}
|
||||
|
||||
@ -1557,9 +1559,12 @@ public class HuamiSupport extends AbstractBTLEDeviceSupport {
|
||||
case MiBandConst.PREF_SWIPE_UNLOCK:
|
||||
setBandScreenUnlock(builder);
|
||||
break;
|
||||
case "dateformat":
|
||||
case HuamiConst.PREF_DATEFORMAT:
|
||||
setDateFormat(builder);
|
||||
break;
|
||||
case HuamiConst.PREF_LANGUAGE:
|
||||
setLanguage(builder);
|
||||
break;
|
||||
}
|
||||
builder.queue(getQueue());
|
||||
} catch (IOException e) {
|
||||
|
Loading…
Reference in New Issue
Block a user