diff --git a/CHANGELOG.md b/CHANGELOG.md index d61bd2c5d..81966738b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ### Changelog +#### Version 0.21.3 +* Amazfit Bip: Auto-switch language on connect (English, Simplified Chinese, Traditional Chinese), requires FW 0.0.9.14+ + #### Version 0.21.2 * Amazfit Bip: Support flashing CEP and ALM files for AGPS * Amazfit Bip: Initial experimental support for fetching logs from the watch diff --git a/app/build.gradle b/app/build.gradle index 43e1ad617..a839c749a 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -26,8 +26,8 @@ android { targetSdkVersion 25 // note: always bump BOTH versionCode and versionName! - versionName "0.21.2" - versionCode 103 + versionName "0.21.3" + versionCode 104 vectorDrawables.useSupportLibrary = true } buildTypes { diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/amazfitbip/AmazfitBipService.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/amazfitbip/AmazfitBipService.java index fb1c6e3cb..f354e5e83 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/amazfitbip/AmazfitBipService.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/amazfitbip/AmazfitBipService.java @@ -19,6 +19,8 @@ package nodomain.freeyourgadget.gadgetbridge.devices.amazfitbip; import java.util.UUID; +import static nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBand2Service.ENDPOINT_DISPLAY; + public class AmazfitBipService { public static final UUID UUID_CHARACTERISTIC_WEATHER = UUID.fromString("0000000e-0000-3512-2118-0009af100700"); @@ -26,4 +28,8 @@ public class AmazfitBipService { public static final byte[] COMMAND_REQUEST_GPS_VERSION = new byte[]{0x0e}; public static final byte COMMAND_ACTIVITY_DATA_TYPE_DEBUGLOGS = 0x07; + + public static final byte[] COMMAND_SET_LANGUAGE_SIMPLIFIED_CHINESE = new byte[]{ENDPOINT_DISPLAY, 0x13, 0x00, 0x00}; + public static final byte[] COMMAND_SET_LANGUAGE_TRADITIONAL_CHINESE = new byte[]{ENDPOINT_DISPLAY, 0x13, 0x00, 0x01}; + public static final byte[] COMMAND_SET_LANGUAGE_ENGLISH = new byte[]{ENDPOINT_DISPLAY, 0x13, 0x00, 0x02}; } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/amazfitbip/AmazfitBipFirmwareInfo.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/amazfitbip/AmazfitBipFirmwareInfo.java index 5874d0217..c23216a17 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/amazfitbip/AmazfitBipFirmwareInfo.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/amazfitbip/AmazfitBipFirmwareInfo.java @@ -56,11 +56,13 @@ public class AmazfitBipFirmwareInfo extends Mi2FirmwareInfo { crcToVersion.put(27668, "0.0.8.96"); crcToVersion.put(60173, "0.0.8.97"); crcToVersion.put(3462, "0.0.8.98"); + crcToVersion.put(55420, "0.0.9.14"); // resources crcToVersion.put(12586, "RES 0.0.8.74"); crcToVersion.put(34068, "RES 0.0.8.88"); crcToVersion.put(59839, "RES 0.0.8.96-98"); + crcToVersion.put(50401, "RES 0.0.9.14"); // gps crcToVersion.put(61520, "GPS 9367,8f79a91,0,0,"); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/amazfitbip/AmazfitBipSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/amazfitbip/AmazfitBipSupport.java index 2498986bd..646651dc6 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/amazfitbip/AmazfitBipSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/amazfitbip/AmazfitBipSupport.java @@ -27,6 +27,7 @@ import org.slf4j.LoggerFactory; import java.io.IOException; import java.nio.ByteBuffer; import java.nio.ByteOrder; +import java.util.Locale; import java.util.SimpleTimeZone; import java.util.UUID; @@ -55,6 +56,10 @@ public class AmazfitBipSupport extends MiBand2Support { private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipSupport.class); + public AmazfitBipSupport() { + super(LOG); + } + @Override public NotificationStrategy getNotificationStrategy() { return new AmazfitBipTextNotificationStrategy(this); @@ -267,10 +272,31 @@ public class AmazfitBipSupport extends MiBand2Support { return this; } + private AmazfitBipSupport setLanguage(TransactionBuilder builder) { + String language = Locale.getDefault().getLanguage(); + String country = Locale.getDefault().getCountry(); + + LOG.info("Setting watch language, phone language = " + language + " country = " + country); + + byte[] command; + if (language.equals("zh")) { + if (country.equals("TW") || country.equals("HK") || country.equals("MO")) { // Taiwan, Hong Kong, Macao + command = AmazfitBipService.COMMAND_SET_LANGUAGE_TRADITIONAL_CHINESE; + } else { + command = AmazfitBipService.COMMAND_SET_LANGUAGE_SIMPLIFIED_CHINESE; + } + } else { + command = AmazfitBipService.COMMAND_SET_LANGUAGE_ENGLISH; + } + builder.write(getCharacteristic(MiBand2Service.UUID_CHARACTERISTIC_3_CONFIGURATION), command); + return this; + } + @Override public void phase2Initialize(TransactionBuilder builder) { super.phase2Initialize(builder); LOG.info("phase2Initialize..."); + setLanguage(builder); requestGPSVersion(builder); } } diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband2/MiBand2Support.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband2/MiBand2Support.java index 773681f79..e3f5047a7 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband2/MiBand2Support.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/miband2/MiBand2Support.java @@ -154,7 +154,11 @@ public class MiBand2Support extends AbstractBTLEDeviceSupport { private boolean alarmClockRinging; public MiBand2Support() { - super(LOG); + this(LOG); + } + + public MiBand2Support(Logger logger) { + super(logger); addSupportedService(GattService.UUID_SERVICE_GENERIC_ACCESS); addSupportedService(GattService.UUID_SERVICE_GENERIC_ATTRIBUTE); addSupportedService(GattService.UUID_SERVICE_HEART_RATE); diff --git a/app/src/main/res/xml/changelog_master.xml b/app/src/main/res/xml/changelog_master.xml index 2fe026eea..53349e5a1 100644 --- a/app/src/main/res/xml/changelog_master.xml +++ b/app/src/main/res/xml/changelog_master.xml @@ -1,5 +1,8 @@ + + Amazfit Bip: Auto-switch language on connect (English, Simplified Chinese, Traditional Chinese), requires FW 0.0.9.14+ + Amazfit Bip: Support flashing CEP and ALM files for AGPS Amazfit Bip: Initial experimental support for fetching logs from the watch diff --git a/fastlane/metadata/android/en-US/changelogs/104.txt b/fastlane/metadata/android/en-US/changelogs/104.txt new file mode 100644 index 000000000..081dc69cc --- /dev/null +++ b/fastlane/metadata/android/en-US/changelogs/104.txt @@ -0,0 +1 @@ +* Amazfit Bip: Auto-switch language on connect (English, Simplified Chinese, Traditional Chinese), requires FW 0.0.9.14+