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()) {
menu.removeItem(R.id.controlcenter_configure_alarms);
}
if (!coordinator.supportsActivityTracking()) {
menu.removeItem(R.id.controlcenter_start_sleepmonitor);
}
if (selectedDevice.getState() == GBDevice.State.NOT_CONNECTED) {
menu.removeItem(R.id.controlcenter_disconnect);

View File

@ -71,6 +71,14 @@ public interface DeviceCoordinator {
*/
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
* 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;
}
@Override
public boolean supportsActivityTracking() {
return false;
}
@Override
public boolean supportsScreenshots() {
return false;

View File

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

View File

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

View File

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