1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-11-28 21:06:50 +01:00

Coordinator: add explicit methods to determine if the device supports app management and which class is responsible for it.

This commit is contained in:
Daniele Gobbetti 2016-10-25 17:39:11 +02:00
parent a39e3a035c
commit 1f77e3e84f
5 changed files with 55 additions and 0 deletions

View File

@ -140,4 +140,19 @@ public interface DeviceCoordinator {
* Returns the readable name of the manufacturer.
*/
String getManufacturer();
/**
* Returns true if this device/coordinator supports managing device apps.
*
* @return
*/
boolean supportsAppsManagement();
/**
* Returns the Activity class that will be used to manage device apps.
*
* @return
*/
Class<? extends Activity> getAppsManagementActivity();
}

View File

@ -142,4 +142,14 @@ public class UnknownDeviceCoordinator extends AbstractDeviceCoordinator {
public String getManufacturer() {
return "unknown";
}
@Override
public boolean supportsAppsManagement() {
return false;
}
@Override
public Class<? extends Activity> getAppsManagementActivity() {
return null;
}
}

View File

@ -119,6 +119,16 @@ public class MiBandCoordinator extends AbstractDeviceCoordinator {
return "Xiaomi";
}
@Override
public boolean supportsAppsManagement() {
return false;
}
@Override
public Class<? extends Activity> getAppsManagementActivity() {
return null;
}
public static boolean hasValidUserInfo() {
String dummyMacAddress = MiBandService.MAC_ADDRESS_FILTER_1_1A + ":00:00:00";
try {

View File

@ -117,4 +117,14 @@ public class PebbleCoordinator extends AbstractDeviceCoordinator {
public String getManufacturer() {
return "Pebble";
}
@Override
public boolean supportsAppsManagement() {
return true;
}
@Override
public Class<? extends Activity> getAppsManagementActivity() {
return AppManagerActivity.class;
}
}

View File

@ -85,6 +85,16 @@ public class VibratissimoCoordinator extends AbstractDeviceCoordinator {
return "Amor AG";
}
@Override
public boolean supportsAppsManagement() {
return false;
}
@Override
public Class<? extends Activity> getAppsManagementActivity() {
return null;
}
@Override
protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) throws GBException {
// nothing to delete, yet