1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-04 09:17:29 +01:00

Do not show "your activity" if activity tracking is not supported

This commit is contained in:
Andreas Shimokawa 2016-09-20 22:02:40 +02:00
parent 1f8cfa5a68
commit 696611d392
6 changed files with 31 additions and 0 deletions

View File

@ -197,6 +197,9 @@ public class ControlCenter extends GBActivity {
if (!coordinator.supportsAlarmConfiguration()) { if (!coordinator.supportsAlarmConfiguration()) {
menu.removeItem(R.id.controlcenter_configure_alarms); menu.removeItem(R.id.controlcenter_configure_alarms);
} }
if (!coordinator.supportsActivityTracking()) {
menu.removeItem(R.id.controlcenter_start_sleepmonitor);
}
if (selectedDevice.getState() == GBDevice.State.NOT_CONNECTED) { if (selectedDevice.getState() == GBDevice.State.NOT_CONNECTED) {
menu.removeItem(R.id.controlcenter_disconnect); menu.removeItem(R.id.controlcenter_disconnect);

View File

@ -71,6 +71,14 @@ public interface DeviceCoordinator {
*/ */
boolean supportsActivityDataFetching(); boolean supportsActivityDataFetching();
/**
* Returns true if activity tracking is supported by the device
* (with this coordinator).
*
* @return
*/
boolean supportsActivityTracking();
/** /**
* Returns true if activity data fetching is supported AND possible at this * Returns true if activity data fetching is supported AND possible at this
* very moment. This will consider the device state (being connected/disconnected/busy...) * very moment. This will consider the device state (being connected/disconnected/busy...)

View File

@ -106,6 +106,11 @@ public class UnknownDeviceCoordinator extends AbstractDeviceCoordinator {
return false; return false;
} }
@Override
public boolean supportsActivityTracking() {
return false;
}
@Override @Override
public boolean supportsScreenshots() { public boolean supportsScreenshots() {
return false; return false;

View File

@ -93,6 +93,11 @@ public class MiBandCoordinator extends AbstractDeviceCoordinator {
return true; return true;
} }
@Override
public boolean supportsActivityTracking() {
return true;
}
@Override @Override
public int getTapString() { public int getTapString() {
return R.string.tap_connected_device_for_activity; return R.string.tap_connected_device_for_activity;

View File

@ -68,6 +68,11 @@ public class PebbleCoordinator extends AbstractDeviceCoordinator {
return false; return false;
} }
@Override
public boolean supportsActivityTracking() {
return true;
}
@Override @Override
public boolean supportsScreenshots() { public boolean supportsScreenshots() {
return true; return true;

View File

@ -47,6 +47,11 @@ public class VibratissimoCoordinator extends AbstractDeviceCoordinator {
return false; return false;
} }
@Override
public boolean supportsActivityTracking() {
return false;
}
@Override @Override
public SampleProvider<? extends ActivitySample> getSampleProvider(GBDevice device, DaoSession session) { public SampleProvider<? extends ActivitySample> getSampleProvider(GBDevice device, DaoSession session) {
return null; return null;