mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-02-24 16:31:13 +01:00
Mi Band 4: Fix notification icons and cut-off text
This commit is contained in:
parent
044f6c11cd
commit
5ff5561772
@ -57,9 +57,11 @@ public class MiBand4Coordinator extends HuamiCoordinator {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public InstallHandler findInstallHandler(Uri uri, Context context) {
|
||||
return null;
|
||||
MiBand4FWInstallHandler handler = new MiBand4FWInstallHandler(uri, context);
|
||||
return handler.isValid() ? handler : null;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -49,6 +49,8 @@ public abstract class HuamiFirmwareInfo {
|
||||
};
|
||||
|
||||
protected static final int FONT_TYPE_OFFSET = 0x9;
|
||||
protected static final int COMPRESSED_RES_HEADER_OFFSET = 0x9;
|
||||
protected static final int COMPRESSED_RES_HEADER_OFFSET_NEW = 0xd;
|
||||
|
||||
private HuamiFirmwareType firmwareType;
|
||||
|
||||
|
@ -137,16 +137,25 @@ public class AmazfitBipSupport extends HuamiSupport {
|
||||
appSuffix = appName.getBytes();
|
||||
suffixlength = appSuffix.length;
|
||||
}
|
||||
if (gbDevice.getType() == DeviceType.MIBAND4) {
|
||||
prefixlength += 4;
|
||||
}
|
||||
|
||||
byte[] rawmessage = message.getBytes();
|
||||
int length = Math.min(rawmessage.length, maxLength - prefixlength);
|
||||
|
||||
byte[] command = new byte[length + prefixlength + suffixlength];
|
||||
|
||||
command[0] = (byte) alertCategory.getId();
|
||||
command[1] = (byte) (gbDevice.getType() == DeviceType.MIBAND4 ? 0 : 1); // FIXME: remove hack
|
||||
int pos = 0;
|
||||
command[pos++] = (byte) alertCategory.getId();
|
||||
if (gbDevice.getType() == DeviceType.MIBAND4) {
|
||||
command[pos++] = 0; // TODO
|
||||
command[pos++] = 0;
|
||||
command[pos++] = 0;
|
||||
command[pos++] = 0;
|
||||
}
|
||||
command[pos++] = 1;
|
||||
if (alertCategory == AlertCategory.CustomHuami) {
|
||||
command[2] = customIconId;
|
||||
command[pos] = customIconId;
|
||||
}
|
||||
|
||||
System.arraycopy(rawmessage, 0, command, prefixlength, length);
|
||||
|
@ -31,9 +31,6 @@ public class AmazfitCor2FirmwareInfo extends HuamiFirmwareInfo {
|
||||
0x00, (byte) 0x98, 0x00, 0x20, (byte) 0xA5, 0x04, 0x00, 0x20, (byte) 0xAD, 0x04, 0x00, 0x20, (byte) 0xC5, 0x04, 0x00, 0x20
|
||||
};
|
||||
|
||||
private static final int COMPRESSED_RES_HEADER_OFFSET = 0x9;
|
||||
private static final int COMPRESSED_RES_HEADER_OFFSET_NEW = 0xd;
|
||||
|
||||
private static Map<Integer, String> crcToVersion = new HashMap<>();
|
||||
|
||||
static {
|
||||
|
@ -22,6 +22,7 @@ import android.net.Uri;
|
||||
import java.io.IOException;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiFWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.miband4.MiBand4FWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband3.MiBand3Support;
|
||||
|
||||
public class MiBand4Support extends MiBand3Support {
|
||||
@ -33,6 +34,6 @@ public class MiBand4Support extends MiBand3Support {
|
||||
|
||||
@Override
|
||||
public HuamiFWHelper createFWHelper(Uri uri, Context context) throws IOException {
|
||||
return null;
|
||||
return new MiBand4FWHelper(uri, context);
|
||||
}
|
||||
}
|
||||
|
@ -57,7 +57,8 @@
|
||||
<string name="fw_upgrade_notice_amazfitbip">You are about to install the %s firmware on your Amazfit Bip.\n\nPlease make sure to install the .fw file, then the .res file, and finally the .gps file. Your watch will reboot after installing the .fw file.\n\nNote: You do not have to install .res and .gps if these files are exactly the same as the ones previously installed.\n\nPROCEED AT YOUR OWN RISK!</string>
|
||||
<string name="fw_upgrade_notice_amazfitcor">You are about to install the %s firmware on your Amazfit Cor.\n\nPlease make sure to install the .fw file, and after that the .res file. Your band will reboot after installing the .fw file.\n\nNote: You do not have to install .res if it is exactly the same as the one previously installed.\n\nPROCEED AT YOUR OWN RISK!</string>
|
||||
<string name="fw_upgrade_notice_amazfitcor2">You are about to install the %s firmware on your Amazfit Cor 2.\n\nPlease make sure to install the .fw file, and after that the .res file. Your band will reboot after installing the .fw file.\n\nNote: You do not have to install .res if it is exactly the same as the one previously installed.\n\nPROCEED AT YOUR OWN RISK!\n\nCOMPLETELY UNTESTED, PROBABLY YOU NEED TO FLASH A BEATS_W FIRMWARE IF YOUR DEVICE NAME is \"Amazfit Band 2\!"</string>
|
||||
<string name="fw_upgrade_notice_miband3">You are about to install the %s firmware on your Mi Band 3.\n\nPlease make sure to install the .fw file, and after that the .res file. Your watch will reboot after installing the .fw file.\n\nNote: You do not have to install .res if it is exactly the same as the one previously installed.\n\nPROCEED AT YOUR OWN RISK!</string>
|
||||
<string name="fw_upgrade_notice_miband3">You are about to install the %s firmware on your Mi Band 3.\n\nPlease make sure to install the .fw file, and after that the .res file. Your band will reboot after installing the .fw file.\n\nNote: You do not have to install .res if it is exactly the same as the one previously installed.\n\nPROCEED AT YOUR OWN RISK!</string>
|
||||
<string name="fw_upgrade_notice_miband4">You are about to install the %s firmware on your Mi Band 4.\n\nPlease make sure to install the .fw file, and after that the .res file. Your band will reboot after installing the .fw file.\n\nNote: You do not have to install .res if it is exactly the same as the one previously installed.\n\nPROCEED AT YOUR OWN RISK!</string>
|
||||
<string name="fw_multi_upgrade_notice">You are about to install the %1$s and %2$s firmware, instead of the ones currently on your Mi Band.</string>
|
||||
<string name="miband_firmware_known">This firmware has been tested and is known to be compatible with Gadgetbridge.</string>
|
||||
<string name="miband_firmware_unknown_warning">"This firmware is untested and may not be compatible with Gadgetbridge.\n\nYou are DISCOURAGED from flashing it!"</string>
|
||||
@ -225,6 +226,10 @@
|
||||
<string name="pref_title_authkey">Auth Key</string>
|
||||
<string name="pref_summary_authkey">Change the auth key to a common key on all your Android devices from which you would like to connect from. The previous default key for all devices is 0123456789@ABCDE</string>
|
||||
|
||||
<string name="prefs_hr_alarm_activity">Heart rate alarm during sports activity</string>
|
||||
<string name="prefs_hr_alarm_low">Low limit</string>
|
||||
<string name="prefs_hr_alarm_high">High limit</string>
|
||||
|
||||
<!-- Auto export preferences -->
|
||||
<string name="pref_header_auto_export">Auto export</string>
|
||||
<string name="pref_title_auto_export_enabled">Auto export enabled</string>
|
||||
|
Loading…
x
Reference in New Issue
Block a user