1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-30 14:02:56 +01:00

Only show realtime chart on device supporting it

This commit is contained in:
Andreas Shimokawa 2017-06-02 21:59:46 +02:00
parent fb8f866031
commit a4e35b49b2
10 changed files with 43 additions and 2 deletions

View File

@ -8,6 +8,7 @@
* HPlus: Fix Unicode handling * HPlus: Fix Unicode handling
* HPlus: Initial not work detection * HPlus: Initial not work detection
* Fix memory leak * Fix memory leak
* Only show Realtime Chart on devices supporting it
#### Version 0.19.2 #### Version 0.19.2
* Pebble: Fix recurring calendar events only appearing once per week * Pebble: Fix recurring calendar events only appearing once per week

View File

@ -342,8 +342,12 @@ public class ChartsActivity extends AbstractGBFragmentActivity implements Charts
@Override @Override
public int getCount() { public int getCount() {
// Show 5 total pages. // Show 4 or 5 total pages. (always hide speed zones)
return 5; // hide "Speed Zones" for now DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(mGBDevice);
if (coordinator.supportsRealtimeData()) {
return 5;
}
return 4;
} }
@Override @Override

View File

@ -232,4 +232,9 @@ public interface DeviceCoordinator {
*/ */
boolean supportsCalendarEvents(); boolean supportsCalendarEvents();
/**
* Indicates whether the device supports getting a stream of live data.
* This can be live HR, steps etc.
*/
boolean supportsRealtimeData();
} }

View File

@ -176,4 +176,9 @@ public class UnknownDeviceCoordinator extends AbstractDeviceCoordinator {
public boolean supportsCalendarEvents() { public boolean supportsCalendarEvents() {
return false; return false;
} }
@Override
public boolean supportsRealtimeData() {
return false;
}
} }

View File

@ -92,6 +92,11 @@ public class HPlusCoordinator extends AbstractDeviceCoordinator {
return false; return false;
} }
@Override
public boolean supportsRealtimeData() {
return true;
}
@Override @Override
public DeviceType getDeviceType() { public DeviceType getDeviceType() {
return DeviceType.HPLUS; return DeviceType.HPLUS;

View File

@ -119,6 +119,11 @@ public class LiveviewCoordinator extends AbstractDeviceCoordinator {
return false; return false;
} }
@Override
public boolean supportsRealtimeData() {
return false;
}
@Override @Override
protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) throws GBException { protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) throws GBException {
// nothing to delete, yet // nothing to delete, yet

View File

@ -171,6 +171,11 @@ public class MiBandCoordinator extends AbstractDeviceCoordinator {
return false; return false;
} }
@Override
public boolean supportsRealtimeData() {
return true;
}
public static boolean hasValidUserInfo() { public static boolean hasValidUserInfo() {
String dummyMacAddress = MiBandService.MAC_ADDRESS_FILTER_1_1A + ":00:00:00"; String dummyMacAddress = MiBandService.MAC_ADDRESS_FILTER_1_1A + ":00:00:00";
try { try {

View File

@ -156,4 +156,9 @@ public class PebbleCoordinator extends AbstractDeviceCoordinator {
public boolean supportsCalendarEvents() { public boolean supportsCalendarEvents() {
return true; return true;
} }
@Override
public boolean supportsRealtimeData() {
return false;
}
} }

View File

@ -120,6 +120,11 @@ public class VibratissimoCoordinator extends AbstractDeviceCoordinator {
return false; return false;
} }
@Override
public boolean supportsRealtimeData() {
return false; // hmmm well, it has a temperature sensor :D
}
@Override @Override
protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) throws GBException { protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) throws GBException {
// nothing to delete, yet // nothing to delete, yet

View File

@ -8,6 +8,7 @@
<change>HPlus: Fix Unicode handling</change> <change>HPlus: Fix Unicode handling</change>
<change>HPlus: Initial not work detection</change> <change>HPlus: Initial not work detection</change>
<change>Fix memory leak</change> <change>Fix memory leak</change>
<change>Only show Realtime Chart on devices supporting it</change>
</release> </release>
<release version="0.19.2" versioncode="95"> <release version="0.19.2" versioncode="95">
<change>Pebble: Fix recurring calendar events only appearing once per week</change> <change>Pebble: Fix recurring calendar events only appearing once per week</change>