1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-24 01:25:50 +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: Initial not work detection
* Fix memory leak
* Only show Realtime Chart on devices supporting it
#### Version 0.19.2
* Pebble: Fix recurring calendar events only appearing once per week

View File

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

View File

@ -232,4 +232,9 @@ public interface DeviceCoordinator {
*/
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() {
return false;
}
@Override
public boolean supportsRealtimeData() {
return false;
}
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

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