reformat code though Android Studio
This commit is contained in:
parent
b3410dcebe
commit
4be1926459
|
@ -80,7 +80,7 @@ public class AppManagerActivity extends Activity {
|
||||||
List<GBDeviceApp> systemApps = new ArrayList<>();
|
List<GBDeviceApp> systemApps = new ArrayList<>();
|
||||||
systemApps.add(new GBDeviceApp(UUID.fromString("4dab81a6-d2fc-458a-992c-7a1f3b96a970"), "Sports (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
systemApps.add(new GBDeviceApp(UUID.fromString("4dab81a6-d2fc-458a-992c-7a1f3b96a970"), "Sports (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
||||||
systemApps.add(new GBDeviceApp(UUID.fromString("cf1e816a-9db0-4511-bbb8-f60c48ca8fac"), "Golf (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
systemApps.add(new GBDeviceApp(UUID.fromString("cf1e816a-9db0-4511-bbb8-f60c48ca8fac"), "Golf (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
||||||
if (mGBDevice != null && !"aplite".equals(PebbleUtils.getPlatformName(mGBDevice.getFirmwareVersion()))) {
|
if (mGBDevice != null && !"aplite".equals(PebbleUtils.getPlatformName(mGBDevice.getFirmwareVersion()))) {
|
||||||
systemApps.add(new GBDeviceApp(PebbleProtocol.UUID_PEBBLE_HEALTH, "Health (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
systemApps.add(new GBDeviceApp(PebbleProtocol.UUID_PEBBLE_HEALTH, "Health (System)", "Pebble Inc.", "", GBDeviceApp.Type.APP_SYSTEM));
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -100,6 +100,7 @@ public class ExternalPebbleJSActivity extends Activity {
|
||||||
return super.onConsoleMessage(consoleMessage);
|
return super.onConsoleMessage(consoleMessage);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private class GBWebClient extends WebViewClient {
|
private class GBWebClient extends WebViewClient {
|
||||||
@Override
|
@Override
|
||||||
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
public boolean shouldOverrideUrlLoading(WebView view, String url) {
|
||||||
|
|
|
@ -16,7 +16,6 @@ import com.github.mikephil.charting.components.YAxis;
|
||||||
import com.github.mikephil.charting.data.BarData;
|
import com.github.mikephil.charting.data.BarData;
|
||||||
import com.github.mikephil.charting.data.BarDataSet;
|
import com.github.mikephil.charting.data.BarDataSet;
|
||||||
import com.github.mikephil.charting.data.BarEntry;
|
import com.github.mikephil.charting.data.BarEntry;
|
||||||
import com.github.mikephil.charting.data.ChartData;
|
|
||||||
import com.github.mikephil.charting.data.CombinedData;
|
import com.github.mikephil.charting.data.CombinedData;
|
||||||
import com.github.mikephil.charting.data.Entry;
|
import com.github.mikephil.charting.data.Entry;
|
||||||
import com.github.mikephil.charting.data.LineData;
|
import com.github.mikephil.charting.data.LineData;
|
||||||
|
|
|
@ -12,14 +12,12 @@ import android.widget.ListView;
|
||||||
import android.widget.ProgressBar;
|
import android.widget.ProgressBar;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
import java.text.Collator;
|
|
||||||
import java.util.Collections;
|
import java.util.Collections;
|
||||||
import java.util.List;
|
import java.util.List;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.BatteryState;
|
import nodomain.freeyourgadget.gadgetbridge.model.BatteryState;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.GenericItem;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.ItemWithDetails;
|
import nodomain.freeyourgadget.gadgetbridge.model.ItemWithDetails;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -126,7 +124,7 @@ public class GBDeviceAdapter extends ArrayAdapter<GBDevice> {
|
||||||
return view;
|
return view;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void justifyListViewHeightBasedOnChildren (ListView listView) {
|
public void justifyListViewHeightBasedOnChildren(ListView listView) {
|
||||||
ArrayAdapter adapter = (ArrayAdapter) listView.getAdapter();
|
ArrayAdapter adapter = (ArrayAdapter) listView.getAdapter();
|
||||||
|
|
||||||
if (adapter == null) {
|
if (adapter == null) {
|
||||||
|
|
|
@ -30,6 +30,7 @@ public class ItemWithDetailsAdapter extends ArrayAdapter<ItemWithDetails> {
|
||||||
public void setHorizontalAlignment(boolean horizontalAlignment) {
|
public void setHorizontalAlignment(boolean horizontalAlignment) {
|
||||||
this.horizontalAlignment = horizontalAlignment;
|
this.horizontalAlignment = horizontalAlignment;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public View getView(int position, View view, ViewGroup parent) {
|
public View getView(int position, View view, ViewGroup parent) {
|
||||||
ItemWithDetails item = getItem(position);
|
ItemWithDetails item = getItem(position);
|
||||||
|
|
|
@ -1,13 +1,5 @@
|
||||||
package nodomain.freeyourgadget.gadgetbridge.database.schema;
|
package nodomain.freeyourgadget.gadgetbridge.database.schema;
|
||||||
|
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.database.DBHelper;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.database.DBUpdateScript;
|
|
||||||
|
|
||||||
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.KEY_CUSTOM_SHORT;
|
|
||||||
import static nodomain.freeyourgadget.gadgetbridge.database.DBConstants.TABLE_GBACTIVITYSAMPLES;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bugfix for users who installed 0.8.1 cleanly, i.e. without any previous
|
* Bugfix for users who installed 0.8.1 cleanly, i.e. without any previous
|
||||||
* database. Perform Update script 6 again.
|
* database. Perform Update script 6 again.
|
||||||
|
|
|
@ -26,8 +26,12 @@ public class MiBandFWHelper {
|
||||||
|
|
||||||
private final Uri uri;
|
private final Uri uri;
|
||||||
private final ContentResolver cr;
|
private final ContentResolver cr;
|
||||||
private final @NonNull AbstractMiFirmwareInfo firmwareInfo;
|
private final
|
||||||
private final @NonNull byte[] fw;
|
@NonNull
|
||||||
|
AbstractMiFirmwareInfo firmwareInfo;
|
||||||
|
private final
|
||||||
|
@NonNull
|
||||||
|
byte[] fw;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Provides a different notification API which is also used on Mi1A devices.
|
* Provides a different notification API which is also used on Mi1A devices.
|
||||||
|
@ -125,12 +129,13 @@ public class MiBandFWHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param wholeFirmwareBytes
|
* @param wholeFirmwareBytes
|
||||||
* @return
|
* @return
|
||||||
* @throws IllegalArgumentException when the data is not recognized as firmware data
|
* @throws IllegalArgumentException when the data is not recognized as firmware data
|
||||||
*/
|
*/
|
||||||
public static @NonNull AbstractMiFirmwareInfo determineFirmwareInfoFor(byte[] wholeFirmwareBytes) {
|
public static
|
||||||
|
@NonNull
|
||||||
|
AbstractMiFirmwareInfo determineFirmwareInfoFor(byte[] wholeFirmwareBytes) {
|
||||||
return AbstractMiFirmwareInfo.determineFirmwareInfoFor(wholeFirmwareBytes);
|
return AbstractMiFirmwareInfo.determineFirmwareInfoFor(wholeFirmwareBytes);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -5,11 +5,11 @@ import nodomain.freeyourgadget.gadgetbridge.model.ActivityKind;
|
||||||
|
|
||||||
public class MiBandSampleProvider implements SampleProvider {
|
public class MiBandSampleProvider implements SampleProvider {
|
||||||
public static final int TYPE_DEEP_SLEEP = 5;
|
public static final int TYPE_DEEP_SLEEP = 5;
|
||||||
public static final int TYPE_LIGHT_SLEEP = 4;
|
public static final int TYPE_LIGHT_SLEEP = 4;
|
||||||
public static final int TYPE_ACTIVITY = -1;
|
public static final int TYPE_ACTIVITY = -1;
|
||||||
public static final int TYPE_UNKNOWN = -1;
|
public static final int TYPE_UNKNOWN = -1;
|
||||||
public static final int TYPE_NONWEAR = 3;
|
public static final int TYPE_NONWEAR = 3;
|
||||||
public static final int TYPE_CHARGING = 6;
|
public static final int TYPE_CHARGING = 6;
|
||||||
|
|
||||||
// public static final byte TYPE_NREM = 5; // DEEP SLEEP
|
// public static final byte TYPE_NREM = 5; // DEEP SLEEP
|
||||||
// public static final byte TYPE_ONBED = 7;
|
// public static final byte TYPE_ONBED = 7;
|
||||||
|
|
|
@ -11,6 +11,7 @@ public interface ItemWithDetails extends Parcelable, Comparable<ItemWithDetails>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Equality is based on #getName() only.
|
* Equality is based on #getName() only.
|
||||||
|
*
|
||||||
* @param other
|
* @param other
|
||||||
*/
|
*/
|
||||||
boolean equals(Object other);
|
boolean equals(Object other);
|
||||||
|
|
|
@ -3,7 +3,6 @@ package nodomain.freeyourgadget.gadgetbridge.service;
|
||||||
import android.app.NotificationManager;
|
import android.app.NotificationManager;
|
||||||
import android.app.Service;
|
import android.app.Service;
|
||||||
import android.content.BroadcastReceiver;
|
import android.content.BroadcastReceiver;
|
||||||
import android.content.ContentResolver;
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
|
|
|
@ -5,9 +5,6 @@ import android.support.annotation.NonNull;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandConst;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Some helper methods for Mi1 and Mi1A firmware.
|
* Some helper methods for Mi1 and Mi1A firmware.
|
||||||
*/
|
*/
|
||||||
|
@ -21,18 +18,15 @@ public abstract class AbstractMi1FirmwareInfo extends AbstractMiFirmwareInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFirmwareOffset()
|
public int getFirmwareOffset() {
|
||||||
{
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFirmwareLength()
|
public int getFirmwareLength() {
|
||||||
{
|
|
||||||
return wholeFirmwareBytes.length;
|
return wholeFirmwareBytes.length;
|
||||||
}
|
}
|
||||||
|
|
||||||
public int getFirmwareVersion()
|
public int getFirmwareVersion() {
|
||||||
{
|
|
||||||
return (wholeFirmwareBytes[getOffsetFirmwareVersionMajor()] << 24)
|
return (wholeFirmwareBytes[getOffsetFirmwareVersionMajor()] << 24)
|
||||||
| (wholeFirmwareBytes[getOffsetFirmwareVersionMinor()] << 16)
|
| (wholeFirmwareBytes[getOffsetFirmwareVersionMinor()] << 16)
|
||||||
| (wholeFirmwareBytes[getOffsetFirmwareVersionRevision()] << 8)
|
| (wholeFirmwareBytes[getOffsetFirmwareVersionRevision()] << 8)
|
||||||
|
|
|
@ -8,12 +8,13 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
|
|
||||||
public abstract class AbstractMiFirmwareInfo {
|
public abstract class AbstractMiFirmwareInfo {
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @param wholeFirmwareBytes
|
* @param wholeFirmwareBytes
|
||||||
* @return
|
* @return
|
||||||
* @throws IllegalArgumentException when the data is not recognized as firmware data
|
* @throws IllegalArgumentException when the data is not recognized as firmware data
|
||||||
*/
|
*/
|
||||||
public static @NonNull AbstractMiFirmwareInfo determineFirmwareInfoFor(byte[] wholeFirmwareBytes) {
|
public static
|
||||||
|
@NonNull
|
||||||
|
AbstractMiFirmwareInfo determineFirmwareInfoFor(byte[] wholeFirmwareBytes) {
|
||||||
AbstractMiFirmwareInfo[] candidates = getFirmwareInfoCandidatesFor(wholeFirmwareBytes);
|
AbstractMiFirmwareInfo[] candidates = getFirmwareInfoCandidatesFor(wholeFirmwareBytes);
|
||||||
if (candidates.length == 0) {
|
if (candidates.length == 0) {
|
||||||
throw new IllegalArgumentException("Unsupported data (maybe not even a firmware?).");
|
throw new IllegalArgumentException("Unsupported data (maybe not even a firmware?).");
|
||||||
|
@ -59,7 +60,9 @@ public abstract class AbstractMiFirmwareInfo {
|
||||||
|
|
||||||
public abstract boolean isGenerallyCompatibleWith(GBDevice device);
|
public abstract boolean isGenerallyCompatibleWith(GBDevice device);
|
||||||
|
|
||||||
public @NonNull byte[] getFirmwareBytes() {
|
public
|
||||||
|
@NonNull
|
||||||
|
byte[] getFirmwareBytes() {
|
||||||
return Arrays.copyOfRange(wholeFirmwareBytes, getFirmwareOffset(), getFirmwareLength());
|
return Arrays.copyOfRange(wholeFirmwareBytes, getFirmwareOffset(), getFirmwareLength());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -85,6 +88,7 @@ public abstract class AbstractMiFirmwareInfo {
|
||||||
}
|
}
|
||||||
throw new UnsupportedOperationException(getClass().getName() + " must override getFirst() and getSecond()");
|
throw new UnsupportedOperationException(getClass().getName() + " must override getFirst() and getSecond()");
|
||||||
}
|
}
|
||||||
|
|
||||||
public AbstractMiFirmwareInfo getSecond() {
|
public AbstractMiFirmwareInfo getSecond() {
|
||||||
if (isSingleMiBandFirmware()) {
|
if (isSingleMiBandFirmware()) {
|
||||||
throw new UnsupportedOperationException(getClass().getName() + " only supports on firmware");
|
throw new UnsupportedOperationException(getClass().getName() + " only supports on firmware");
|
||||||
|
|
|
@ -87,7 +87,7 @@ public class DeviceInfo extends AbstractInfo {
|
||||||
", hwVersion=" + hwVersion +
|
", hwVersion=" + hwVersion +
|
||||||
", feature=" + feature +
|
", feature=" + feature +
|
||||||
", appearance=" + appearance +
|
", appearance=" + appearance +
|
||||||
", fw2Version (hr)=" + fw2Version+
|
", fw2Version (hr)=" + fw2Version +
|
||||||
'}';
|
'}';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -31,7 +31,9 @@ public class Mi1SFirmwareInfo extends AbstractMi1SFirmwareInfo {
|
||||||
return fw2Info;
|
return fw2Info;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static @Nullable Mi1SFirmwareInfo getInstance(byte[] wholeFirmwareBytes) {
|
public static
|
||||||
|
@Nullable
|
||||||
|
Mi1SFirmwareInfo getInstance(byte[] wholeFirmwareBytes) {
|
||||||
Mi1SFirmwareInfo info = new Mi1SFirmwareInfo(wholeFirmwareBytes);
|
Mi1SFirmwareInfo info = new Mi1SFirmwareInfo(wholeFirmwareBytes);
|
||||||
if (info.isGenerallySupportedFirmware()) {
|
if (info.isGenerallySupportedFirmware()) {
|
||||||
return info;
|
return info;
|
||||||
|
|
|
@ -15,8 +15,7 @@ public class Mi1SFirmwareInfoFW1 extends AbstractMi1SFirmwareInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFirmwareOffset()
|
public int getFirmwareOffset() {
|
||||||
{
|
|
||||||
return (wholeFirmwareBytes[12] & 255) << 24
|
return (wholeFirmwareBytes[12] & 255) << 24
|
||||||
| (wholeFirmwareBytes[13] & 255) << 16
|
| (wholeFirmwareBytes[13] & 255) << 16
|
||||||
| (wholeFirmwareBytes[14] & 255) << 8
|
| (wholeFirmwareBytes[14] & 255) << 8
|
||||||
|
@ -24,8 +23,7 @@ public class Mi1SFirmwareInfoFW1 extends AbstractMi1SFirmwareInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFirmwareLength()
|
public int getFirmwareLength() {
|
||||||
{
|
|
||||||
return (wholeFirmwareBytes[16] & 255) << 24
|
return (wholeFirmwareBytes[16] & 255) << 24
|
||||||
| (wholeFirmwareBytes[17] & 255) << 16
|
| (wholeFirmwareBytes[17] & 255) << 16
|
||||||
| (wholeFirmwareBytes[18] & 255) << 8
|
| (wholeFirmwareBytes[18] & 255) << 8
|
||||||
|
@ -33,15 +31,14 @@ public class Mi1SFirmwareInfoFW1 extends AbstractMi1SFirmwareInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFirmwareVersion()
|
public int getFirmwareVersion() {
|
||||||
{
|
|
||||||
return (wholeFirmwareBytes[8] & 255) << 24
|
return (wholeFirmwareBytes[8] & 255) << 24
|
||||||
| (wholeFirmwareBytes[9] & 255) << 16
|
| (wholeFirmwareBytes[9] & 255) << 16
|
||||||
| (wholeFirmwareBytes[10] & 255) << 8
|
| (wholeFirmwareBytes[10] & 255) << 8
|
||||||
| wholeFirmwareBytes[11] & 255;
|
| wholeFirmwareBytes[11] & 255;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected boolean isGenerallySupportedFirmware() {
|
protected boolean isGenerallySupportedFirmware() {
|
||||||
try {
|
try {
|
||||||
int majorVersion = getFirmwareVersionMajor();
|
int majorVersion = getFirmwareVersionMajor();
|
||||||
|
@ -49,5 +46,5 @@ public class Mi1SFirmwareInfoFW1 extends AbstractMi1SFirmwareInfo {
|
||||||
} catch (IllegalArgumentException e) {
|
} catch (IllegalArgumentException e) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,8 +13,7 @@ public class Mi1SFirmwareInfoFW2 extends AbstractMi1SFirmwareInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFirmwareOffset()
|
public int getFirmwareOffset() {
|
||||||
{
|
|
||||||
return (wholeFirmwareBytes[26] & 255) << 24
|
return (wholeFirmwareBytes[26] & 255) << 24
|
||||||
| (wholeFirmwareBytes[27] & 255) << 16
|
| (wholeFirmwareBytes[27] & 255) << 16
|
||||||
| (wholeFirmwareBytes[28] & 255) << 8
|
| (wholeFirmwareBytes[28] & 255) << 8
|
||||||
|
@ -22,8 +21,7 @@ public class Mi1SFirmwareInfoFW2 extends AbstractMi1SFirmwareInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFirmwareLength()
|
public int getFirmwareLength() {
|
||||||
{
|
|
||||||
return (wholeFirmwareBytes[30] & 255) << 24
|
return (wholeFirmwareBytes[30] & 255) << 24
|
||||||
| (wholeFirmwareBytes[31] & 255) << 16
|
| (wholeFirmwareBytes[31] & 255) << 16
|
||||||
| (wholeFirmwareBytes[32] & 255) << 8
|
| (wholeFirmwareBytes[32] & 255) << 8
|
||||||
|
@ -41,8 +39,7 @@ public class Mi1SFirmwareInfoFW2 extends AbstractMi1SFirmwareInfo {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public int getFirmwareVersion()
|
public int getFirmwareVersion() {
|
||||||
{
|
|
||||||
return (wholeFirmwareBytes[22] & 255) << 24
|
return (wholeFirmwareBytes[22] & 255) << 24
|
||||||
| (wholeFirmwareBytes[23] & 255) << 16
|
| (wholeFirmwareBytes[23] & 255) << 16
|
||||||
| (wholeFirmwareBytes[24] & 255) << 8
|
| (wholeFirmwareBytes[24] & 255) << 8
|
||||||
|
|
|
@ -30,7 +30,6 @@ import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandDateConverter;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandFWHelper;
|
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandFWHelper;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandService;
|
import nodomain.freeyourgadget.gadgetbridge.devices.miband.MiBandService;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.miband.VibrationProfile;
|
import nodomain.freeyourgadget.gadgetbridge.devices.miband.VibrationProfile;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBAlarm;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice.State;
|
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice.State;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.model.Alarm;
|
import nodomain.freeyourgadget.gadgetbridge.model.Alarm;
|
||||||
|
|
|
@ -10,7 +10,6 @@ import java.util.ArrayList;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventSendBytes;
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.devices.pebble.PebbleColor;
|
import nodomain.freeyourgadget.gadgetbridge.devices.pebble.PebbleColor;
|
||||||
|
|
||||||
public class AppMessageHandlerPebStyle extends AppMessageHandler {
|
public class AppMessageHandlerPebStyle extends AppMessageHandler {
|
||||||
|
|
|
@ -11,7 +11,6 @@ import java.util.ArrayList;
|
||||||
import java.util.UUID;
|
import java.util.UUID;
|
||||||
|
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent;
|
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEvent;
|
||||||
import nodomain.freeyourgadget.gadgetbridge.deviceevents.GBDeviceEventSendBytes;
|
|
||||||
|
|
||||||
public class AppMessageHandlerTimeStylePebble extends AppMessageHandler {
|
public class AppMessageHandlerTimeStylePebble extends AppMessageHandler {
|
||||||
public static final int KEY_SETTING_SIDEBAR_LEFT = 9;
|
public static final int KEY_SETTING_SIDEBAR_LEFT = 9;
|
||||||
|
|
|
@ -12,6 +12,7 @@ public class PebbleUtils {
|
||||||
}
|
}
|
||||||
return platformName;
|
return platformName;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getModel(String hwRev) {
|
public static String getModel(String hwRev) {
|
||||||
//TODO: get real data?
|
//TODO: get real data?
|
||||||
String model;
|
String model;
|
||||||
|
|
|
@ -28,7 +28,7 @@ public abstract class AbstractServiceTestCase<T extends Service> {
|
||||||
private NotificationManager mNotificationManager;
|
private NotificationManager mNotificationManager;
|
||||||
private MockHelper mMockHelper;
|
private MockHelper mMockHelper;
|
||||||
|
|
||||||
protected AbstractServiceTestCase(Class<T> serviceClass) {
|
protected AbstractServiceTestCase(Class<T> serviceClass) {
|
||||||
mServiceClass = serviceClass;
|
mServiceClass = serviceClass;
|
||||||
Assert.assertNotNull(serviceClass);
|
Assert.assertNotNull(serviceClass);
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ public class TestDeviceSupport extends AbstractDeviceSupport {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onNotification(NotificationSpec notificationSpec) {
|
public void onNotification(NotificationSpec notificationSpec) {
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -25,7 +25,7 @@ public class FirmwareTest {
|
||||||
private static final int DOUBLE = 2;
|
private static final int DOUBLE = 2;
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFirmwareMi1() throws Exception{
|
public void testFirmwareMi1() throws Exception {
|
||||||
byte[] wholeFw = getFirmwareMi();
|
byte[] wholeFw = getFirmwareMi();
|
||||||
Assert.assertNotNull(wholeFw);
|
Assert.assertNotNull(wholeFw);
|
||||||
|
|
||||||
|
@ -38,7 +38,7 @@ public class FirmwareTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFirmwareMi1A() throws Exception{
|
public void testFirmwareMi1A() throws Exception {
|
||||||
byte[] wholeFw = getFirmwareMi1A();
|
byte[] wholeFw = getFirmwareMi1A();
|
||||||
Assert.assertNotNull(wholeFw);
|
Assert.assertNotNull(wholeFw);
|
||||||
|
|
||||||
|
@ -51,7 +51,7 @@ public class FirmwareTest {
|
||||||
}
|
}
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
public void testFirmwareMi1S() throws Exception{
|
public void testFirmwareMi1S() throws Exception {
|
||||||
byte[] wholeFw = getFirmwareMi1S();
|
byte[] wholeFw = getFirmwareMi1S();
|
||||||
Assert.assertNotNull(wholeFw);
|
Assert.assertNotNull(wholeFw);
|
||||||
|
|
||||||
|
@ -84,7 +84,8 @@ public class FirmwareTest {
|
||||||
try {
|
try {
|
||||||
info.getFirmwareVersion();
|
info.getFirmwareVersion();
|
||||||
Assert.fail("should not get fw version from AbstractMi1SFirmwareInfo");
|
Assert.fail("should not get fw version from AbstractMi1SFirmwareInfo");
|
||||||
} catch (UnsupportedOperationException expected) {}
|
} catch (UnsupportedOperationException expected) {
|
||||||
|
}
|
||||||
|
|
||||||
Assert.assertNotEquals(info.getFirst().getFirmwareOffset(), info.getSecond().getFirmwareOffset());
|
Assert.assertNotEquals(info.getFirst().getFirmwareOffset(), info.getSecond().getFirmwareOffset());
|
||||||
Assert.assertFalse(Arrays.equals(info.getFirst().getFirmwareBytes(), info.getSecond().getFirmwareBytes()));
|
Assert.assertFalse(Arrays.equals(info.getFirst().getFirmwareBytes(), info.getSecond().getFirmwareBytes()));
|
||||||
|
@ -99,7 +100,8 @@ public class FirmwareTest {
|
||||||
try {
|
try {
|
||||||
info.getSecond();
|
info.getSecond();
|
||||||
Assert.fail("should throw UnsuportedOperationException");
|
Assert.fail("should throw UnsuportedOperationException");
|
||||||
} catch (UnsupportedOperationException expected) {}
|
} catch (UnsupportedOperationException expected) {
|
||||||
|
}
|
||||||
int calculatedLength = info.getFirmwareLength();
|
int calculatedLength = info.getFirmwareLength();
|
||||||
Assert.assertTrue("Unexpected firmware length: " + wholeFw.length, calculatedLength <= wholeFw.length);
|
Assert.assertTrue("Unexpected firmware length: " + wholeFw.length, calculatedLength <= wholeFw.length);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -19,6 +19,7 @@ public class GBMockApplication extends MockApplication {
|
||||||
public Context getApplicationContext() {
|
public Context getApplicationContext() {
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PackageManager getPackageManager() {
|
public PackageManager getPackageManager() {
|
||||||
return mPackageManager;
|
return mPackageManager;
|
||||||
|
|
|
@ -12,7 +12,7 @@ import java.util.Map;
|
||||||
|
|
||||||
public class GBMockIntent extends Intent {
|
public class GBMockIntent extends Intent {
|
||||||
private String mAction;
|
private String mAction;
|
||||||
private final Map<String,Object> extras = new HashMap<>();
|
private final Map<String, Object> extras = new HashMap<>();
|
||||||
|
|
||||||
@NonNull
|
@NonNull
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Reference in New Issue