Adapt the Firmware installer activity to the new FirmwareHelper

This commit is contained in:
Daniele Gobbetti 2015-08-05 17:31:11 +02:00
parent e92c9dbbb5
commit 65fc6f6866
1 changed files with 16 additions and 7 deletions

View File

@ -13,10 +13,13 @@ import android.view.MenuItem;
import android.view.View;
import android.widget.Button;
import android.widget.TextView;
import android.widget.Toast;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceCommunicationService;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -24,6 +27,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceApp;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandFWHelper;
import nodomain.freeyourgadget.gadgetbridge.devices.pebble.PBWReader;
import nodomain.freeyourgadget.gadgetbridge.util.GB;
public class FwAppInstallerActivity extends Activity {
@ -89,6 +93,7 @@ public class FwAppInstallerActivity extends Activity {
}
} else {
mPBWReader = null;
try {
mFwReader = new MiBandFWHelper(uri, getApplicationContext());
fwAppInstallTextView.setText(getString(R.string.fw_upgrade_notice, mFwReader.getHumanFirmwareVersion()));
@ -99,6 +104,10 @@ public class FwAppInstallerActivity extends Activity {
fwAppInstallTextView.append(" " + getString(R.string.miband_firmware_unknown_warning) + " " +
getString(R.string.miband_firmware_suggest_whitelist, mFwReader.getFirmwareVersion()));
}
} catch (IOException ex) {
GB.toast(getApplicationContext(), "Firmware cannot be installed: " + ex.getMessage(), Toast.LENGTH_LONG, GB.ERROR);
}
}
installButton.setOnClickListener(new View.OnClickListener() {