diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/amazfitbip/AmazfitBipFWInstallHandler.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/amazfitbip/AmazfitBipFWInstallHandler.java index 0bfce1cd..7193350a 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/amazfitbip/AmazfitBipFWInstallHandler.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/amazfitbip/AmazfitBipFWInstallHandler.java @@ -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); diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/AbstractMiBandFWInstallHandler.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/AbstractMiBandFWInstallHandler.java index ef2f809e..f677ab44 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/AbstractMiBandFWInstallHandler.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/devices/miband/AbstractMiBandFWInstallHandler.java @@ -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())); } diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 7e60207b..b1bccdcf 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -53,6 +53,7 @@ FW/App installer You are about to install firmware %s instead of the one currently on your Mi Band. + 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 You are about to install firmwares %1$s and %2$s instead of the ones currently on your Mi Band. This firmware has been tested and is known to be compatible with Gadgetbridge. "This firmware is untested and may not be compatible with Gadgetbridge.\n\nYou are NOT encouraged to flash it to your Mi Band!" @@ -305,6 +306,7 @@ Updating Firmware… File cannot be installed, device not ready. Mi Band Firmware %1$s + Amazfit Bip Firmware %1$s Compatible version Untested version! Connection to device: %1$s