diff --git a/app/src/main/AndroidManifest.xml b/app/src/main/AndroidManifest.xml
index d83ef107c..cfb9881e3 100644
--- a/app/src/main/AndroidManifest.xml
+++ b/app/src/main/AndroidManifest.xml
@@ -60,24 +60,67 @@
android:value=".ControlCenter" />
+ android:name=".activities.FwAppInstallerActivity"
+ android:label="@string/title_activity_fw_app_insaller">
-
+ android:value="nodomain.freeyourgadget.gadgetbridge.ControlCenter" />
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractChartFragment.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractChartFragment.java
index b96ae41a5..d6d290a86 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractChartFragment.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/AbstractChartFragment.java
@@ -22,7 +22,6 @@ import java.util.List;
import nodomain.freeyourgadget.gadgetbridge.DeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.DeviceHelper;
-import nodomain.freeyourgadget.gadgetbridge.GBActivitySample;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.R;
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/PebbleAppInstallerActivity.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/FwAppInstallerActivity.java
similarity index 63%
rename from app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/PebbleAppInstallerActivity.java
rename to app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/FwAppInstallerActivity.java
index f6b978794..716aa05f7 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/PebbleAppInstallerActivity.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/activities/FwAppInstallerActivity.java
@@ -1,4 +1,4 @@
-package nodomain.freeyourgadget.gadgetbridge.pebble;
+package nodomain.freeyourgadget.gadgetbridge.activities;
import android.app.Activity;
import android.content.BroadcastReceiver;
@@ -19,19 +19,25 @@ import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.BluetoothCommunicationService;
import nodomain.freeyourgadget.gadgetbridge.ControlCenter;
+import nodomain.freeyourgadget.gadgetbridge.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.GBDeviceApp;
import nodomain.freeyourgadget.gadgetbridge.R;
+import nodomain.freeyourgadget.gadgetbridge.miband.MiBandFWHelper;
+import nodomain.freeyourgadget.gadgetbridge.pebble.PBWReader;
-public class PebbleAppInstallerActivity extends Activity {
+public class FwAppInstallerActivity extends Activity {
- private static final Logger LOG = LoggerFactory.getLogger(PebbleAppInstallerActivity.class);
+ private static final Logger LOG = LoggerFactory.getLogger(FwAppInstallerActivity.class);
- TextView debugTextView;
+ TextView fwAppInstallTextView;
Button installButton;
+ // FIXME: abstraction for these would make code cleaner in this class
private PBWReader mPBWReader = null;
+ private MiBandFWHelper mFwReader = null;
+
private BroadcastReceiver mReceiver = new BroadcastReceiver() {
@Override
public void onReceive(Context context, Intent intent) {
@@ -40,7 +46,7 @@ public class PebbleAppInstallerActivity extends Activity {
finish();
} else if (action.equals(GBDevice.ACTION_DEVICE_CHANGED)) {
GBDevice dev = intent.getParcelableExtra("device");
- if (mPBWReader != null) {
+ if (dev.getType() == DeviceType.PEBBLE && mPBWReader != null) {
if (mPBWReader.isFirmware()) {
String hwRevision = mPBWReader.getHWRevision();
if (hwRevision != null && hwRevision.equals(dev.getHardwareVersion()) && dev.isConnected()) {
@@ -51,6 +57,8 @@ public class PebbleAppInstallerActivity extends Activity {
} else {
installButton.setEnabled(dev.isConnected());
}
+ } else if (dev.getType() == DeviceType.MIBAND && mFwReader != null) {
+ installButton.setEnabled(dev.isInitialized());
}
}
}
@@ -62,7 +70,7 @@ public class PebbleAppInstallerActivity extends Activity {
setContentView(R.layout.activity_appinstaller);
getActionBar().setDisplayHomeAsUpEnabled(true);
- debugTextView = (TextView) findViewById(R.id.debugTextView);
+ fwAppInstallTextView = (TextView) findViewById(R.id.debugTextView);
installButton = (Button) findViewById(R.id.installButton);
IntentFilter filter = new IntentFilter();
filter.addAction(ControlCenter.ACTION_QUIT);
@@ -71,19 +79,33 @@ public class PebbleAppInstallerActivity extends Activity {
final Uri uri = getIntent().getData();
mPBWReader = new PBWReader(uri, getApplicationContext());
- GBDeviceApp app = mPBWReader.getGBDeviceApp();
+ if (mPBWReader.isValid()) {
+ GBDeviceApp app = mPBWReader.getGBDeviceApp();
- if (mPBWReader.isFirmware()) {
- debugTextView.setText(getString(R.string.firmware_install_warning, mPBWReader.getHWRevision()));
+ if (mPBWReader.isFirmware()) {
+ fwAppInstallTextView.setText(getString(R.string.firmware_install_warning, mPBWReader.getHWRevision()));
- } else if (app != null) {
- debugTextView.setText(getString(R.string.app_install_info, app.getName(), app.getVersion(), app.getCreator()));
+ } else if (app != null) {
+ fwAppInstallTextView.setText(getString(R.string.app_install_info, app.getName(), app.getVersion(), app.getCreator()));
+ }
+ } else {
+ mPBWReader = null;
+ mFwReader = new MiBandFWHelper(uri, getApplicationContext());
+
+ fwAppInstallTextView.setText(getString(R.string.fw_upgrade_notice, mFwReader.getHumanFirmwareVersion()));
+
+ if (mFwReader.isFirmwareWhitelisted()) {
+ fwAppInstallTextView.append(" " + getString(R.string.miband_firmware_known));
+ } else {
+ fwAppInstallTextView.append(" " + getString(R.string.miband_firmware_unknown_warning) + " " +
+ getString(R.string.miband_firmware_suggest_whitelist, mFwReader.getFirmwareVersion()));
+ }
}
installButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
- Intent startIntent = new Intent(PebbleAppInstallerActivity.this, BluetoothCommunicationService.class);
+ Intent startIntent = new Intent(FwAppInstallerActivity.this, BluetoothCommunicationService.class);
startIntent.setAction(BluetoothCommunicationService.ACTION_INSTALL);
startIntent.putExtra("uri", uri.toString());
startService(startIntent);
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/charts/ActivityKind.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/charts/ActivityKind.java
index 789ff6109..366565fdb 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/charts/ActivityKind.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/charts/ActivityKind.java
@@ -2,7 +2,6 @@ package nodomain.freeyourgadget.gadgetbridge.charts;
import java.util.Arrays;
-import nodomain.freeyourgadget.gadgetbridge.GBActivitySample;
import nodomain.freeyourgadget.gadgetbridge.model.SampleProvider;
public class ActivityKind {
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/charts/SleepUtils.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/charts/SleepUtils.java
index 7ba331f52..a6ebf86da 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/charts/SleepUtils.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/charts/SleepUtils.java
@@ -1,7 +1,5 @@
package nodomain.freeyourgadget.gadgetbridge.charts;
-import nodomain.freeyourgadget.gadgetbridge.GBActivitySample;
-
public class SleepUtils {
public static final float Y_VALUE_DEEP_SLEEP = 0.01f;
public static final float Y_VALUE_LIGHT_SLEEP = 0.016f;
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/database/ActivityDatabaseHandler.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/database/ActivityDatabaseHandler.java
index 7701df299..7cb5bdb58 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/database/ActivityDatabaseHandler.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/database/ActivityDatabaseHandler.java
@@ -107,11 +107,12 @@ public class ActivityDatabaseHandler extends SQLiteOpenHelper {
/**
* Adds the a new sample to the database
+ *
* @param timestamp the timestamp of the same, second-based!
- * @param provider the SampleProvider ID
+ * @param provider the SampleProvider ID
* @param intensity the sample's raw intensity value
- * @param steps the sample's steps value
- * @param kind the raw activity kind of the sample
+ * @param steps the sample's steps value
+ * @param kind the raw activity kind of the sample
*/
public void addGBActivitySample(int timestamp, byte provider, short intensity, byte steps, byte kind) {
try (SQLiteDatabase db = this.getWritableDatabase()) {
@@ -145,7 +146,7 @@ public class ActivityDatabaseHandler extends SQLiteOpenHelper {
* @param timestamp_from
* @param timestamp_to
* @param activityTypes ORed combination of #TYPE_DEEP_SLEEP, #TYPE_LIGHT_SLEEP, #TYPE_ACTIVITY
- * @param provider the producer of the samples to be sought
+ * @param provider the producer of the samples to be sought
* @return
*/
private ArrayList getGBActivitySamples(int timestamp_from, int timestamp_to, int activityTypes, SampleProvider provider) {
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/FwUpgrade.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/FwUpgrade.java
deleted file mode 100644
index 1f5c4e4d5..000000000
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/FwUpgrade.java
+++ /dev/null
@@ -1,106 +0,0 @@
-package nodomain.freeyourgadget.gadgetbridge.miband;
-
-import android.app.Activity;
-import android.content.BroadcastReceiver;
-import android.content.Context;
-import android.content.Intent;
-import android.content.IntentFilter;
-import android.net.Uri;
-import android.os.Bundle;
-import android.support.v4.app.NavUtils;
-import android.support.v4.content.LocalBroadcastManager;
-import android.view.MenuItem;
-import android.view.View;
-import android.widget.Button;
-import android.widget.TextView;
-
-import nodomain.freeyourgadget.gadgetbridge.BluetoothCommunicationService;
-import nodomain.freeyourgadget.gadgetbridge.ControlCenter;
-import nodomain.freeyourgadget.gadgetbridge.DeviceType;
-import nodomain.freeyourgadget.gadgetbridge.GBDevice;
-import nodomain.freeyourgadget.gadgetbridge.R;
-
-
-/*
-TODO: This could be moved to activities package and merged with pebble/PebbleAppInstallerActivity.java
- */
-
-public class FwUpgrade extends Activity {
-
-
- TextView fwUpgradeTextView;
- Button installButton;
-
- private MiBandFWHelper mFwReader = null;
- private GBDevice dev;
-
- private BroadcastReceiver mReceiver = new BroadcastReceiver() {
- @Override
- public void onReceive(Context context, Intent intent) {
- String action = intent.getAction();
- if (action.equals(ControlCenter.ACTION_QUIT)) {
- finish();
- } else if (action.equals(GBDevice.ACTION_DEVICE_CHANGED)) {
- dev = intent.getParcelableExtra("device");
- if(dev.getType() == DeviceType.MIBAND) {
- if (dev.isInitialized() && mFwReader != null) {
- installButton.setEnabled(true);
- }
- }
- }
- }
- };
-
- @Override
- protected void onCreate(Bundle savedInstanceState) {
- super.onCreate(savedInstanceState);
- setContentView(R.layout.activity_fw_upgrade);
-
- fwUpgradeTextView = (TextView) findViewById(R.id.fwUpgradeTextView);
- installButton = (Button) findViewById(R.id.installButton);
-
- IntentFilter filter = new IntentFilter();
- filter.addAction(ControlCenter.ACTION_QUIT);
- filter.addAction(GBDevice.ACTION_DEVICE_CHANGED);
- LocalBroadcastManager.getInstance(this).registerReceiver(mReceiver, filter);
-
- final Uri uri = getIntent().getData();
- mFwReader = new MiBandFWHelper(uri, getApplicationContext());
-
- fwUpgradeTextView.setText(getString(R.string.fw_upgrade_notice, mFwReader.getHumanFirmwareVersion()));
-
- if (mFwReader.isFirmwareWhitelisted()) {
- fwUpgradeTextView.append(" " + getString(R.string.miband_firmware_known));
- }else {
- fwUpgradeTextView.append(" " + getString(R.string.miband_firmware_unknown_warning) + " " +
- getString(R.string.miband_firmware_suggest_whitelist, mFwReader.getFirmwareVersion()));
- }
-
- installButton.setOnClickListener(new View.OnClickListener() {
- @Override
- public void onClick(View v) {
- Intent startIntent = new Intent(FwUpgrade.this, BluetoothCommunicationService.class);
- startIntent.setAction(BluetoothCommunicationService.ACTION_INSTALL);
- startIntent.putExtra("uri", uri.toString());
- startService(startIntent);
- }
- });
-
- }
-
- @Override
- public boolean onOptionsItemSelected(MenuItem item) {
- switch (item.getItemId()) {
- case android.R.id.home:
- NavUtils.navigateUpFromSameTask(this);
- return true;
- }
- return super.onOptionsItemSelected(item);
- }
-
- @Override
- protected void onDestroy() {
- LocalBroadcastManager.getInstance(this).unregisterReceiver(mReceiver);
- super.onDestroy();
- }
-}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandFWHelper.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandFWHelper.java
index 2759f0970..126b28d01 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandFWHelper.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandFWHelper.java
@@ -18,14 +18,14 @@ public class MiBandFWHelper {
private final ContentResolver cr;
private byte[] fw;
- private final int firmwareVersionBuild = 1056;
+ private final int firmwareVersionBuild = 1056;
private final int firmwareVersionRevision = 1057;
- private final int firmwareVersionMinor = 1058;
- private final int firmwareVersionMajor = 1059;
+ private final int firmwareVersionMinor = 1058;
+ private final int firmwareVersionMajor = 1059;
private final int[] whitelistedFirmwareVersion = {
- 16779534, // 1.0.9.14 tested by developer
- 16779547 //1.0.9.27 testd by developer
+ 16779534, // 1.0.9.14 tested by developer
+ 16779547 //1.0.9.27 testd by developer
};
public MiBandFWHelper(Uri uri, Context context) {
@@ -45,7 +45,7 @@ public class MiBandFWHelper {
this.fw = null;
}
- if (fw[firmwareVersionMajor] != 1 ) {
+ if (fw[firmwareVersionMajor] != 1) {
LOG.error("Firmware major version should be 1, probably this isn't a MiBand firmware.");
this.fw = null;
}
@@ -53,14 +53,14 @@ public class MiBandFWHelper {
}
public int getFirmwareVersion() {
- if(fw == null) {
+ if (fw == null) {
return -1;
}
return (fw[firmwareVersionMajor] << 24) | (fw[firmwareVersionMinor] << 16) | (fw[firmwareVersionRevision] << 8) | fw[firmwareVersionBuild];
}
public String getHumanFirmwareVersion() {
- if(fw == null) {
+ if (fw == null) {
return "UNK";
}
return String.format(Locale.US, "%d.%d.%d.%d", fw[firmwareVersionMajor], fw[firmwareVersionMinor], fw[firmwareVersionRevision], fw[firmwareVersionBuild]);
@@ -83,8 +83,8 @@ public class MiBandFWHelper {
public int getCRC16(byte[] seq) {
int crc = 0xFFFF;
- for (int j = 0; j < seq.length ; j++) {
- crc = ((crc >>> 8) | (crc << 8) )& 0xffff;
+ for (int j = 0; j < seq.length; j++) {
+ crc = ((crc >>> 8) | (crc << 8)) & 0xffff;
crc ^= (seq[j] & 0xff);//byte to int, trunc sign
crc ^= ((crc & 0xff) >> 4);
crc ^= (crc << 12) & 0xffff;
@@ -94,4 +94,4 @@ public class MiBandFWHelper {
return crc;
}
- }
+}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandSampleProvider.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandSampleProvider.java
index efc1ec753..3982cd3bd 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandSampleProvider.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandSampleProvider.java
@@ -33,7 +33,7 @@ public class MiBandSampleProvider implements SampleProvider {
return ActivityKind.TYPE_ACTIVITY;
default:
// case TYPE_UNKNOWN: // fall through
- return ActivityKind.TYPE_UNKNOWN;
+ return ActivityKind.TYPE_UNKNOWN;
}
}
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandSupport.java
index 22d8637b8..f43e96dad 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandSupport.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/miband/MiBandSupport.java
@@ -21,7 +21,6 @@ import java.util.UUID;
import java.util.concurrent.TimeUnit;
import nodomain.freeyourgadget.gadgetbridge.GB;
-import nodomain.freeyourgadget.gadgetbridge.GBActivitySample;
import nodomain.freeyourgadget.gadgetbridge.GBAlarm;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.GBCommand;
@@ -543,7 +542,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
int oldFwVersion = mDeviceInfo.getFirmwareVersion();
int checksum = (Integer.decode("0x" + mMacOctets[4]) << 8 | Integer.decode("0x" + mMacOctets[5])) ^ mFwHelper.getCRC16(mFwHelper.getFw());
- sendFirmwareInfo(oldFwVersion,newFwVersion, mFwHelper.getFw().length, checksum);
+ sendFirmwareInfo(oldFwVersion, newFwVersion, mFwHelper.getFw().length, checksum);
sendFirmwareData(mFwHelper.getFw());
onReboot();
@@ -900,7 +899,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
firmwareProgress += packetLength;
if ((i > 0) && (i % 50 == 0)) {
- if(!sendFirmwareSync()) {
+ if (!sendFirmwareSync()) {
LOG.error("Firmware sync failed");
return;
}
@@ -918,9 +917,9 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
firmwareProgress += len % packetLength;
}
- LOG.info("Firmware update progress:" + firmwareProgress +" total lenL:"+ len + " progress:" + firmwareProgress/len);
+ LOG.info("Firmware update progress:" + firmwareProgress + " total lenL:" + len + " progress:" + firmwareProgress / len);
- if(!sendFirmwareSync()) {
+ if (!sendFirmwareSync()) {
LOG.error("Firmware sync failed");
return;
}
@@ -942,7 +941,7 @@ public class MiBandSupport extends AbstractBTLEDeviceSupport {
private boolean sendFirmwareSync() {
try {
TransactionBuilder builder = performInitialized("send firmware sync");
- builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_CONTROL_POINT), new byte[] {MiBandService.COMMAND_SYNC});
+ builder.write(getCharacteristic(MiBandService.UUID_CHARACTERISTIC_CONTROL_POINT), new byte[]{MiBandService.COMMAND_SYNC});
builder.queue(getQueue());
} catch (IOException ex) {
LOG.error("Unable to send firmware sync to MI", ex);
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/ActivitySample.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/ActivitySample.java
index 4e5123aaa..92ced2217 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/ActivitySample.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/model/ActivitySample.java
@@ -5,6 +5,7 @@ import nodomain.freeyourgadget.gadgetbridge.charts.ActivityKind;
public interface ActivitySample {
/**
* Returns the provider of the data.
+ *
* @return who created the sample data
*/
SampleProvider getProvider();
@@ -21,6 +22,7 @@ public interface ActivitySample {
/**
* Returns the activity kind value as recorded by the SampleProvider
+ *
* @see ActivityKind
*/
int getKind();
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/GadgetbridgePblSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/GadgetbridgePblSupport.java
index f4a6520d2..d801bb7d6 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/GadgetbridgePblSupport.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/GadgetbridgePblSupport.java
@@ -12,7 +12,6 @@ import java.util.SimpleTimeZone;
import java.util.TimeZone;
import java.util.UUID;
-import nodomain.freeyourgadget.gadgetbridge.GBActivitySample;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent;
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventSendBytes;
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/MorpheuzSampleProvider.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/MorpheuzSampleProvider.java
index c45ed8fab..2b1087b64 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/MorpheuzSampleProvider.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/MorpheuzSampleProvider.java
@@ -44,7 +44,7 @@ public class MorpheuzSampleProvider implements SampleProvider {
@Override
public float normalizeIntensity(short rawIntensity) {
- return rawIntensity/movementDivisor;
+ return rawIntensity / movementDivisor;
}
@Override
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/MorpheuzSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/MorpheuzSupport.java
index 9ca4b0391..fbfd6ad7a 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/MorpheuzSupport.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/MorpheuzSupport.java
@@ -11,7 +11,6 @@ import java.util.SimpleTimeZone;
import java.util.TimeZone;
import java.util.UUID;
-import nodomain.freeyourgadget.gadgetbridge.GBActivitySample;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent;
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventSendBytes;
diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/PBWReader.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/PBWReader.java
index 99ce9d9a9..bfd98b45f 100644
--- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/PBWReader.java
+++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/pebble/PBWReader.java
@@ -47,6 +47,7 @@ public class PBWReader {
private GBDeviceApp app;
private ArrayList pebbleInstallables;
private boolean isFirmware = false;
+ private boolean isValid = false;
private String hwRevision = null;
public PBWReader(Uri uri, Context context) {
@@ -102,12 +103,14 @@ public class PBWReader {
byte type = entry.getValue();
pebbleInstallables.add(new PebbleInstallable(name, size, (int) crc, type));
LOG.info("found file to install: " + name);
+ isValid = true;
} catch (JSONException e) {
// not fatal
}
}
} catch (JSONException e) {
// no JSON at all that is a problem
+ isValid = false;
e.printStackTrace();
break;
}
@@ -132,9 +135,11 @@ public class PBWReader {
if (appName != null && appCreator != null && appVersion != null) {
// FIXME: dont assume WATCHFACE
app = new GBDeviceApp(uuid, appName, appCreator, appVersion, GBDeviceApp.Type.WATCHFACE);
+ isValid = true;
}
} catch (JSONException e) {
+ isValid = false;
e.printStackTrace();
break;
}
@@ -146,10 +151,14 @@ public class PBWReader {
}
}
- protected boolean isFirmware() {
+ public boolean isFirmware() {
return isFirmware;
}
+ public boolean isValid() {
+ return isValid;
+ }
+
public GBDeviceApp getGBDeviceApp() {
return app;
}
diff --git a/app/src/main/res/layout/activity_appinstaller.xml b/app/src/main/res/layout/activity_appinstaller.xml
index 046af67aa..87769c0c2 100644
--- a/app/src/main/res/layout/activity_appinstaller.xml
+++ b/app/src/main/res/layout/activity_appinstaller.xml
@@ -6,7 +6,7 @@
android:paddingLeft="@dimen/activity_horizontal_margin"
android:paddingRight="@dimen/activity_horizontal_margin"
android:paddingTop="@dimen/activity_vertical_margin"
- tools:context="nodomain.freeyourgadget.gadgetbridge.pebble.PebbleAppInstallerActivity">
+ tools:context="nodomain.freeyourgadget.gadgetbridge.activities.FwAppInstallerActivity">
-
-
-
-
diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml
index 1de3435bb..7efc98a01 100644
--- a/app/src/main/res/values/strings.xml
+++ b/app/src/main/res/values/strings.xml
@@ -18,8 +18,12 @@
App Manager
Delete
-
- App Installer
+
+ FW/App installer
+ You are about to install firmware %s instead of the one currently on your MiBand.
+ This firmware has been tested and is known to be compatible with GadgetBridge.
+ "This firmware is untested and may not be compatible with GadgetBridge. You are not encouraged to flash it to your MiBand. "
+ If you still want to proceed and things continue to work properly afterwards, please tell the GadgetBridge developers to whitelist firmware version: %s
Settings
@@ -153,9 +157,4 @@
Alarms sent to device!
No data. Synchronize device?
About to transfer %1$s of data starting from %2$s
- FwUpgrade
- You are about to install firmware %s instead of the one currently on your MiBand.
- This firmware has been tested and is known to be compatible with GadgetBridge.
- "This firmware is untested and may not be compatible with GadgetBridge. You are not encouraged to flash it to your MiBand. "
- If you still want to proceed and things continue to work properly afterwards, please tell the GadgetBridge developers to whitelist firmware version: %s