mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-12-29 03:55:49 +01:00
Amazfit Bip: add instructions and warning to the firmware installation screen
This commit is contained in:
parent
1ff8fbac55
commit
455dfde63d
@ -21,16 +21,28 @@ import android.net.Uri;
|
||||
|
||||
import java.io.IOException;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.AbstractMiBandFWHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.AbstractMiBandFWInstallHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.GenericItem;
|
||||
|
||||
class AmazfitBipFWInstallHandler extends AbstractMiBandFWInstallHandler {
|
||||
AmazfitBipFWInstallHandler(Uri uri, Context context) {
|
||||
super(uri, context);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected GenericItem createInstallItem() {
|
||||
return new GenericItem(mContext.getString(R.string.amazfitbip_firmware), helper.getHumanFirmwareVersion());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected String getFwUpgradeNotice() {
|
||||
return mContext.getString(R.string.fw_upgrade_notice_amazfitbip, helper.getHumanFirmwareVersion());
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException {
|
||||
return new AmazfitBipFWHelper(uri, context);
|
||||
|
@ -33,8 +33,8 @@ import nodomain.freeyourgadget.gadgetbridge.model.GenericItem;
|
||||
public abstract class AbstractMiBandFWInstallHandler implements InstallHandler {
|
||||
private static final Logger LOG = LoggerFactory.getLogger(AbstractMiBandFWInstallHandler.class);
|
||||
|
||||
private final Context mContext;
|
||||
private AbstractMiBandFWHelper helper;
|
||||
protected final Context mContext;
|
||||
protected AbstractMiBandFWHelper helper;
|
||||
private String errorMessage;
|
||||
|
||||
public AbstractMiBandFWInstallHandler(Uri uri, Context context) {
|
||||
@ -58,6 +58,13 @@ public abstract class AbstractMiBandFWInstallHandler implements InstallHandler {
|
||||
|
||||
protected abstract AbstractMiBandFWHelper createHelper(Uri uri, Context context) throws IOException;
|
||||
|
||||
protected GenericItem createInstallItem() {
|
||||
return new GenericItem(mContext.getString(R.string.miband_installhandler_miband_firmware, helper.getHumanFirmwareVersion()));
|
||||
}
|
||||
|
||||
protected String getFwUpgradeNotice() {
|
||||
return mContext.getString(R.string.fw_upgrade_notice, helper.getHumanFirmwareVersion());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void validateInstallation(InstallActivity installActivity, GBDevice device) {
|
||||
@ -81,7 +88,7 @@ public abstract class AbstractMiBandFWInstallHandler implements InstallHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
GenericItem fwItem = new GenericItem(mContext.getString(R.string.miband_installhandler_miband_firmware, helper.getHumanFirmwareVersion()));
|
||||
GenericItem fwItem = createInstallItem();
|
||||
fwItem.setIcon(device.getType().getIcon());
|
||||
|
||||
if (!helper.isFirmwareGenerallyCompatibleWith(device)) {
|
||||
@ -92,7 +99,8 @@ public abstract class AbstractMiBandFWInstallHandler implements InstallHandler {
|
||||
}
|
||||
StringBuilder builder = new StringBuilder();
|
||||
if (helper.isSingleFirmware()) {
|
||||
builder.append(mContext.getString(R.string.fw_upgrade_notice, helper.getHumanFirmwareVersion()));
|
||||
getFwUpgradeNotice();
|
||||
builder.append(getFwUpgradeNotice());
|
||||
} else {
|
||||
builder.append(mContext.getString(R.string.fw_multi_upgrade_notice, helper.getHumanFirmwareVersion(), helper.getHumanFirmwareVersion2()));
|
||||
}
|
||||
|
@ -53,6 +53,7 @@
|
||||
<!-- Strings related to FwAppInstaller -->
|
||||
<string name="title_activity_fw_app_insaller">FW/App installer</string>
|
||||
<string name="fw_upgrade_notice">You are about to install firmware %s instead of the one currently on your Mi Band.</string>
|
||||
<string name="fw_upgrade_notice_amazfitbip">You are about to install firmware %s instead of the one currently on your Amazfit Bip.\n\nPlease make sure to install the .gps firmware, then the .res file, and finally the .fw 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\nEXPERIMENTAL, PROCEED AT YOUR OWN RISK</string>
|
||||
<string name="fw_multi_upgrade_notice">You are about to install firmwares %1$s and %2$s 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 NOT encouraged to flash it to your Mi Band!"</string>
|
||||
@ -305,6 +306,7 @@
|
||||
<string name="updating_firmware">Updating Firmware…</string>
|
||||
<string name="fwapp_install_device_not_ready">File cannot be installed, device not ready.</string>
|
||||
<string name="miband_installhandler_miband_firmware">Mi Band Firmware %1$s</string>
|
||||
<string name="amazfitbip_firmware">Amazfit Bip Firmware %1$s</string>
|
||||
<string name="miband_fwinstaller_compatible_version">Compatible version</string>
|
||||
<string name="miband_fwinstaller_untested_version">Untested version!</string>
|
||||
<string name="fwappinstaller_connection_state">Connection to device: %1$s</string>
|
||||
|
Loading…
Reference in New Issue
Block a user