mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-29 13:26:50 +01:00
Zepp OS: Fix AGPS and gpx route upload compatibility detection
This commit is contained in:
parent
55cef71d3a
commit
5b2ebeb4c4
@ -28,10 +28,13 @@ import java.io.InputStream;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.activities.InstallActivity;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.GenericItem;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.operations.ZeppOsAgpsFile;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.UriHelper;
|
||||
|
||||
@ -76,6 +79,20 @@ public class ZeppOsAgpsInstallHandler implements InstallHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device);
|
||||
if (!(coordinator instanceof Huami2021Coordinator)) {
|
||||
LOG.warn("Coordinator is not a Huami2021Coordinator: {}", coordinator.getClass());
|
||||
installActivity.setInfoText(mContext.getString(R.string.fwapp_install_device_not_supported));
|
||||
installActivity.setInstallEnabled(false);
|
||||
return;
|
||||
}
|
||||
final Huami2021Coordinator huami2021coordinator = (Huami2021Coordinator) coordinator;
|
||||
if (!huami2021coordinator.supportsAgpsUpdates()) {
|
||||
installActivity.setInfoText(mContext.getString(R.string.fwapp_install_device_not_supported));
|
||||
installActivity.setInstallEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!device.isInitialized()) {
|
||||
installActivity.setInfoText(mContext.getString(R.string.fwapp_install_device_not_ready));
|
||||
installActivity.setInstallEnabled(false);
|
||||
|
@ -28,10 +28,13 @@ import java.io.InputStream;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.activities.InstallActivity;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.GenericItem;
|
||||
import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.zeppos.operations.ZeppOsGpxRouteFile;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.FileUtils;
|
||||
import nodomain.freeyourgadget.gadgetbridge.util.UriHelper;
|
||||
|
||||
@ -75,6 +78,20 @@ public class ZeppOsGpxRouteInstallHandler implements InstallHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device);
|
||||
if (!(coordinator instanceof Huami2021Coordinator)) {
|
||||
LOG.warn("Coordinator is not a Huami2021Coordinator: {}", coordinator.getClass());
|
||||
installActivity.setInfoText(mContext.getString(R.string.fwapp_install_device_not_supported));
|
||||
installActivity.setInstallEnabled(false);
|
||||
return;
|
||||
}
|
||||
final Huami2021Coordinator huami2021coordinator = (Huami2021Coordinator) coordinator;
|
||||
if (!huami2021coordinator.supportsGpxUploads()) {
|
||||
installActivity.setInfoText(mContext.getString(R.string.fwapp_install_device_not_supported));
|
||||
installActivity.setInstallEnabled(false);
|
||||
return;
|
||||
}
|
||||
|
||||
if (!device.isInitialized()) {
|
||||
installActivity.setInfoText(mContext.getString(R.string.fwapp_install_device_not_ready));
|
||||
installActivity.setInstallEnabled(false);
|
||||
|
@ -77,7 +77,11 @@ public abstract class AbstractMiBandFWInstallHandler implements InstallHandler {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isSupportedDeviceType(device) || !device.isInitialized()) {
|
||||
if (!isSupportedDeviceType(device)) {
|
||||
installActivity.setInfoText(mContext.getString(R.string.fwapp_install_device_not_supported));
|
||||
installActivity.setInstallEnabled(false);
|
||||
return;
|
||||
} else if (!device.isInitialized()) {
|
||||
installActivity.setInfoText(mContext.getString(R.string.fwapp_install_device_not_ready));
|
||||
installActivity.setInstallEnabled(false);
|
||||
return;
|
||||
|
@ -785,6 +785,7 @@
|
||||
<string name="devicestatus_upload_failed">Upload has failed</string>
|
||||
<string name="firmware_update_progress">Upload is in progress\n%1d%% at %.2fkbps (average %.2fkbps)\nPart %1d of %1d</string>
|
||||
<string name="updating_firmware">Flashing firmware…</string>
|
||||
<string name="fwapp_install_device_not_supported">File cannot be installed, device not supported.</string>
|
||||
<string name="fwapp_install_device_not_ready">File cannot be installed, device not ready.</string>
|
||||
<string name="installhandler_firmware_name">%1$s: %2$s %3$s</string>
|
||||
<string name="miband_fwinstaller_compatible_version">Compatible version</string>
|
||||
|
Loading…
Reference in New Issue
Block a user