1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-25 18:15:49 +01:00

remove supportsAlarmConfiguration() in favor of getAlarmSlotCount()

Coordinator that do not support alarms return 0 anyway.
This commit is contained in:
Andreas Shimokawa 2019-01-11 23:26:00 +01:00
parent 6e6f5f45e0
commit e9982ccd56
17 changed files with 7 additions and 97 deletions

View File

@ -196,7 +196,7 @@ public class GBDeviceAdapterv2 extends RecyclerView.Adapter<GBDeviceAdapterv2.Vi
);
//set alarms
holder.setAlarmsView.setVisibility(coordinator.supportsAlarmConfiguration() ? View.VISIBLE : View.GONE);
holder.setAlarmsView.setVisibility(coordinator.getAlarmSlotCount() > 0 ? View.VISIBLE : View.GONE);
holder.setAlarmsView.setOnClickListener(new View.OnClickListener()
{

View File

@ -181,15 +181,10 @@ public interface DeviceCoordinator {
*/
boolean supportsScreenshots();
/**
* Returns true if this device/coordinator supports setting alarms.
*
* @return
*/
boolean supportsAlarmConfiguration();
/**
* Returns the number of alarms this device/coordinator supports
* Shall return 0 also if it is not possible to set alarms via
* protocol, but only on the smart device itself.
*
* @return
*/

View File

@ -137,11 +137,6 @@ public class UnknownDeviceCoordinator extends AbstractDeviceCoordinator {
return false;
}
@Override
public boolean supportsAlarmConfiguration() {
return false;
}
@Override
public int getAlarmSlotCount() {
return 0;

View File

@ -116,14 +116,9 @@ public class CasioGB6900DeviceCoordinator extends AbstractDeviceCoordinator {
return false;
}
@Override
public boolean supportsAlarmConfiguration() {
return false;
}
@Override
public int getAlarmSlotCount() {
return 5; // 4 regular and one snooze but not yet implemented
return 0; // 4 regular and one snooze but not yet implemented
}
@Override

View File

@ -36,7 +36,6 @@ import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.GBException;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.SettingsActivity;
import nodomain.freeyourgadget.gadgetbridge.activities.charts.ChartsActivity;
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractDeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
@ -143,11 +142,6 @@ public class HPlusCoordinator extends AbstractDeviceCoordinator {
return false;
}
@Override
public boolean supportsAlarmConfiguration() {
return true;
}
@Override
public int getAlarmSlotCount() {
return 3; // FIXME - check the real value

View File

@ -103,11 +103,6 @@ public abstract class HuamiCoordinator extends AbstractDeviceCoordinator {
return true;
}
@Override
public boolean supportsAlarmConfiguration() {
return true;
}
@Override
public int getAlarmSlotCount() {
return 10;

View File

@ -105,11 +105,6 @@ public class ID115Coordinator extends AbstractDeviceCoordinator {
return false;
}
@Override
public boolean supportsAlarmConfiguration() {
return false;
}
@Override
public int getAlarmSlotCount() {
return 0;

View File

@ -26,9 +26,7 @@ import android.os.Build;
import android.os.ParcelUuid;
import android.support.annotation.NonNull;
import de.greenrobot.dao.query.QueryBuilder;
import nodomain.freeyourgadget.gadgetbridge.GBException;
import nodomain.freeyourgadget.gadgetbridge.activities.charts.ChartsActivity;
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractDeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
@ -37,7 +35,6 @@ import nodomain.freeyourgadget.gadgetbridge.entities.Device;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.util.Prefs;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import org.slf4j.Logger;
@ -144,14 +141,9 @@ public class TeclastH30Coordinator extends AbstractDeviceCoordinator {
return false;
}
@Override
public boolean supportsAlarmConfiguration() {
return true;
}
@Override
public int getAlarmSlotCount() {
return 3; // FIXME - check the real value
return 3;
}
@Override

View File

@ -79,11 +79,6 @@ public class LiveviewCoordinator extends AbstractDeviceCoordinator {
return false;
}
@Override
public boolean supportsAlarmConfiguration() {
return false;
}
@Override
public int getAlarmSlotCount() {
return 0;

View File

@ -36,8 +36,6 @@ import java.util.Collections;
import de.greenrobot.dao.query.QueryBuilder;
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
import nodomain.freeyourgadget.gadgetbridge.GBException;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.charts.ChartsActivity;
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractDeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
@ -131,11 +129,6 @@ public class MiBandCoordinator extends AbstractDeviceCoordinator {
return false;
}
@Override
public boolean supportsAlarmConfiguration() {
return true;
}
@Override
public int getAlarmSlotCount() {
return 3;

View File

@ -32,7 +32,6 @@ import java.util.Collections;
import de.greenrobot.dao.query.QueryBuilder;
import nodomain.freeyourgadget.gadgetbridge.GBException;
import nodomain.freeyourgadget.gadgetbridge.activities.charts.ChartsActivity;
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractDeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
@ -107,14 +106,9 @@ public class No1F1Coordinator extends AbstractDeviceCoordinator {
return false;
}
@Override
public boolean supportsAlarmConfiguration() {
return true;
}
@Override
public int getAlarmSlotCount() {
return 3; // FIXME - check the real value
return 3;
}
@Override

View File

@ -116,11 +116,6 @@ public class PebbleCoordinator extends AbstractDeviceCoordinator {
return true;
}
@Override
public boolean supportsAlarmConfiguration() {
return false;
}
@Override
public int getAlarmSlotCount() {
return 0;

View File

@ -17,7 +17,6 @@
package nodomain.freeyourgadget.gadgetbridge.devices.roidmi;
import android.app.Activity;
import android.bluetooth.BluetoothDevice;
import android.content.Context;
import android.net.Uri;
import android.support.annotation.NonNull;
@ -83,11 +82,6 @@ public abstract class RoidmiCoordinator extends AbstractDeviceCoordinator {
return false;
}
@Override
public boolean supportsAlarmConfiguration() {
return false;
}
@Override
public int getAlarmSlotCount() {
return 0;

View File

@ -23,8 +23,6 @@ import android.net.Uri;
import android.support.annotation.NonNull;
import nodomain.freeyourgadget.gadgetbridge.GBException;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.VibrationActivity;
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractDeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
@ -80,11 +78,6 @@ public class VibratissimoCoordinator extends AbstractDeviceCoordinator {
return false;
}
@Override
public boolean supportsAlarmConfiguration() {
return false;
}
@Override
public int getAlarmSlotCount() {
return 0;

View File

@ -112,11 +112,6 @@ public class Watch9DeviceCoordinator extends AbstractDeviceCoordinator {
return false;
}
@Override
public boolean supportsAlarmConfiguration() {
return true;
}
@Override
public int getAlarmSlotCount() {
return 3; // FIXME - check the real value

View File

@ -86,14 +86,9 @@ public class XWatchCoordinator extends AbstractDeviceCoordinator {
return false;
}
@Override
public boolean supportsAlarmConfiguration() {
return true;
}
@Override
public int getAlarmSlotCount() {
return 3; // FIXME - check the real value
return 0;
}
@Override

View File

@ -74,11 +74,6 @@ public class ZeTimeCoordinator extends AbstractDeviceCoordinator {
return false;
}
@Override
public boolean supportsAlarmConfiguration() {
return true;
}
@Override
public int getAlarmSlotCount() {
return 3; // FIXME - check the real value