In Control Center, do not show alarm configuration in context menu if device does not support it
This commit is contained in:
parent
c5a7ca4b5b
commit
dbeded8d04
|
@ -212,6 +212,9 @@ public class ControlCenter extends Activity {
|
||||||
if (!coordinator.supportsScreenshots()) {
|
if (!coordinator.supportsScreenshots()) {
|
||||||
menu.removeItem(R.id.controlcenter_take_screenshot);
|
menu.removeItem(R.id.controlcenter_take_screenshot);
|
||||||
}
|
}
|
||||||
|
if (!coordinator.supportsAlarmConfiguration()) {
|
||||||
|
menu.removeItem(R.id.controlcenter_configure_alarms);
|
||||||
|
}
|
||||||
|
|
||||||
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);
|
||||||
|
|
|
@ -100,4 +100,11 @@ public interface DeviceCoordinator {
|
||||||
* @return
|
* @return
|
||||||
*/
|
*/
|
||||||
boolean supportsScreenshots();
|
boolean supportsScreenshots();
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns true if this device/coordinator supports settig alarms.
|
||||||
|
*
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
boolean supportsAlarmConfiguration();
|
||||||
}
|
}
|
||||||
|
|
|
@ -83,4 +83,9 @@ public class UnknownDeviceCoordinator extends AbstractDeviceCoordinator {
|
||||||
public boolean supportsScreenshots() {
|
public boolean supportsScreenshots() {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsAlarmConfiguration() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -74,6 +74,11 @@ public class MiBandCoordinator extends AbstractDeviceCoordinator {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsAlarmConfiguration() {
|
||||||
|
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 {
|
||||||
|
|
|
@ -76,4 +76,9 @@ public class PebbleCoordinator extends AbstractDeviceCoordinator {
|
||||||
public boolean supportsScreenshots() {
|
public boolean supportsScreenshots() {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public boolean supportsAlarmConfiguration() {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue