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

Allow devices to not support being found

This commit is contained in:
José Rebelo 2018-07-26 20:57:12 +01:00
parent 2147ab4948
commit a43934651a
No known key found for this signature in database
GPG Key ID: DFAE4C0A5CD69D29
13 changed files with 62 additions and 1 deletions

View File

@ -249,7 +249,7 @@ public class GBDeviceAdapterv2 extends RecyclerView.Adapter<GBDeviceAdapterv2.Vi
);
holder.findDevice.setVisibility(device.isInitialized() ? View.VISIBLE : View.GONE);
holder.findDevice.setVisibility(device.isInitialized() && coordinator.supportsFindDevice() ? View.VISIBLE : View.GONE);
holder.findDevice.setOnClickListener(new View.OnClickListener()
{

View File

@ -242,4 +242,10 @@ public interface DeviceCoordinator {
* forecast display.
*/
boolean supportsWeather();
/**
* Indicates whether the device supports being found by vibrating,
* making some sound or lighting up
*/
boolean supportsFindDevice();
}

View File

@ -181,4 +181,9 @@ public class UnknownDeviceCoordinator extends AbstractDeviceCoordinator {
public boolean supportsWeather() {
return false;
}
@Override
public boolean supportsFindDevice() {
return false;
}
}

View File

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

View File

@ -263,4 +263,9 @@ public abstract class HuamiCoordinator extends AbstractDeviceCoordinator {
public boolean supportsSmartWakeup(GBDevice device) {
return false;
}
@Override
public boolean supportsFindDevice() {
return true;
}
}

View File

@ -89,6 +89,11 @@ public class TeclastH30Coordinator extends AbstractDeviceCoordinator {
return false;
}
@Override
public boolean supportsFindDevice() {
return true;
}
@Override
public DeviceType getDeviceType() {
return DeviceType.TECLASTH30;

View File

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

View File

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

View File

@ -152,6 +152,11 @@ public class No1F1Coordinator extends AbstractDeviceCoordinator {
return false;
}
@Override
public boolean supportsFindDevice() {
return true;
}
@Override
protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) throws GBException {
Long deviceId = device.getId();

View File

@ -160,4 +160,9 @@ public class PebbleCoordinator extends AbstractDeviceCoordinator {
public boolean supportsWeather() {
return true;
}
@Override
public boolean supportsFindDevice() {
return true;
}
}

View File

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

View File

@ -130,4 +130,9 @@ public class XWatchCoordinator extends AbstractDeviceCoordinator {
public boolean supportsWeather() {
return false;
}
@Override
public boolean supportsFindDevice() {
return true;
}
}

View File

@ -67,6 +67,11 @@ public class ZeTimeCoordinator extends AbstractDeviceCoordinator {
return true;
}
@Override
public boolean supportsFindDevice() {
return true;
}
@Override
public InstallHandler findInstallHandler(Uri uri, Context context) {
return null;