1
0
mirror of https://codeberg.org/Freeyourgadget/Gadgetbridge synced 2024-12-01 14:32:54 +01:00

Device manager: moved device icons and name to Coordinator

This commit is contained in:
Daniel Dakhno 2023-09-28 00:11:02 +03:00
parent 8b01426d57
commit b97b26ce3a
188 changed files with 2064 additions and 1123 deletions

View File

@ -391,9 +391,9 @@ public class ActivitySummariesFilter extends AbstractGBActivity {
try (DBHandler handler = GBApplication.acquireDB()) { try (DBHandler handler = GBApplication.acquireDB()) {
daoSession = handler.getDaoSession(); daoSession = handler.getDaoSession();
for (GBDevice device : devices) { for (GBDevice device : devices) {
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); DeviceCoordinator coordinator = device.getType().getDeviceCoordinator();
Device dbDevice = DBHelper.findDevice(device, daoSession); Device dbDevice = DBHelper.findDevice(device, daoSession);
int icon = device.isInitialized() ? device.getType().getIcon() : device.getType().getDisabledIcon(); int icon = device.getEnabledDisabledIconResource();
if (dbDevice != null && coordinator != null if (dbDevice != null && coordinator != null
&& coordinator.supportsActivityTracks() && coordinator.supportsActivityTracks()
&& !newMap.containsKey(device.getAliasOrName())) { && !newMap.containsKey(device.getAliasOrName())) {

View File

@ -419,7 +419,7 @@ public class ActivitySummaryDetail extends AbstractGBActivity {
} }
private void makeSummaryContent(BaseActivitySummary item) { private void makeSummaryContent(BaseActivitySummary item) {
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(gbDevice); final DeviceCoordinator coordinator = gbDevice.getDeviceCoordinator();
final ActivitySummaryParser summaryParser = coordinator.getActivitySummaryParser(gbDevice); final ActivitySummaryParser summaryParser = coordinator.getActivitySummaryParser(gbDevice);
//make view of data from summaryData of item //make view of data from summaryData of item

View File

@ -150,7 +150,7 @@ public class AlarmDetails extends AbstractGBActivity {
private boolean supportsSmartWakeup() { private boolean supportsSmartWakeup() {
if (device != null) { if (device != null) {
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); DeviceCoordinator coordinator = device.getDeviceCoordinator();
return coordinator.supportsSmartWakeup(device); return coordinator.supportsSmartWakeup(device);
} }
return false; return false;
@ -158,7 +158,7 @@ public class AlarmDetails extends AbstractGBActivity {
private boolean supportsDescription() { private boolean supportsDescription() {
if (device != null) { if (device != null) {
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); DeviceCoordinator coordinator = device.getDeviceCoordinator();
return coordinator.supportsAlarmDescription(device); return coordinator.supportsAlarmDescription(device);
} }
return false; return false;
@ -166,7 +166,7 @@ public class AlarmDetails extends AbstractGBActivity {
private boolean supportsSnoozing() { private boolean supportsSnoozing() {
if (device != null) { if (device != null) {
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); DeviceCoordinator coordinator = device.getDeviceCoordinator();
return coordinator.supportsAlarmSnoozing(); return coordinator.supportsAlarmSnoozing();
} }
return false; return false;

View File

@ -169,13 +169,14 @@ public class BatteryInfoActivity extends AbstractGBActivity {
battery_status_time_span_seekbar.setProgress(2); battery_status_time_span_seekbar.setProgress(2);
DeviceCoordinator coordinator = gbDevice.getDeviceCoordinator();
ImageView battery_status_device_icon = findViewById(R.id.battery_status_device_icon); ImageView battery_status_device_icon = findViewById(R.id.battery_status_device_icon);
battery_status_device_icon.setImageResource(gbDevice.isInitialized() ? gbDevice.getType().getIcon() : gbDevice.getType().getDisabledIcon()); battery_status_device_icon.setImageResource(gbDevice.getEnabledDisabledIconResource());
battery_status_battery_level_text = (TextView) findViewById(R.id.battery_status_battery_level); battery_status_battery_level_text = (TextView) findViewById(R.id.battery_status_battery_level);
battery_status_device_name_text.setText(gbDevice.getAliasOrName()); battery_status_device_name_text.setText(gbDevice.getAliasOrName());
setBatteryLabels(); setBatteryLabels();
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(gbDevice);
for (BatteryConfig batteryConfig : coordinator.getBatteryConfig()) { for (BatteryConfig batteryConfig : coordinator.getBatteryConfig()) {
if (batteryConfig.getBatteryIndex() == batteryIndex) { if (batteryConfig.getBatteryIndex() == batteryIndex) {
battery_status_extra_name.setText(batteryConfig.getBatteryLabel()); battery_status_extra_name.setText(batteryConfig.getBatteryLabel());

View File

@ -119,7 +119,7 @@ public class ConfigureAlarms extends AbstractGBActivity {
} }
private void addMissingAlarms(List<Alarm> alarms) { private void addMissingAlarms(List<Alarm> alarms) {
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(getGbDevice()); DeviceCoordinator coordinator = getGbDevice().getDeviceCoordinator();
int supportedNumAlarms = coordinator.getAlarmSlotCount(getGbDevice()); int supportedNumAlarms = coordinator.getAlarmSlotCount(getGbDevice());
if (supportedNumAlarms > alarms.size()) { if (supportedNumAlarms > alarms.size()) {
try (DBHandler db = GBApplication.acquireDB()) { try (DBHandler db = GBApplication.acquireDB()) {

View File

@ -90,7 +90,7 @@ public class ConfigureContacts extends AbstractGBActivity {
final FloatingActionButton fab = findViewById(R.id.fab); final FloatingActionButton fab = findViewById(R.id.fab);
fab.setOnClickListener(v -> { fab.setOnClickListener(v -> {
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(gbDevice); final DeviceCoordinator coordinator = gbDevice.getDeviceCoordinator();
int deviceSlots = coordinator.getContactsSlotCount(gbDevice); int deviceSlots = coordinator.getContactsSlotCount(gbDevice);

View File

@ -81,7 +81,7 @@ public class ConfigureReminders extends AbstractGBActivity {
fab.setOnClickListener(new View.OnClickListener() { fab.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(gbDevice); final DeviceCoordinator coordinator = gbDevice.getDeviceCoordinator();
final Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress())); final Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()));
int reservedSlots = prefs.getInt(DeviceSettingsPreferenceConst.PREF_RESERVER_REMINDERS_CALENDAR, coordinator.supportsCalendarEvents() ? 0 : 9); int reservedSlots = prefs.getInt(DeviceSettingsPreferenceConst.PREF_RESERVER_REMINDERS_CALENDAR, coordinator.supportsCalendarEvents() ? 0 : 9);

View File

@ -85,7 +85,7 @@ public class ConfigureWorldClocks extends AbstractGBActivity {
fab.setOnClickListener(new View.OnClickListener() { fab.setOnClickListener(new View.OnClickListener() {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(gbDevice); final DeviceCoordinator coordinator = gbDevice.getDeviceCoordinator();
int deviceSlots = coordinator.getWorldClocksSlotCount(); int deviceSlots = coordinator.getWorldClocksSlotCount();

View File

@ -66,7 +66,7 @@ public class ContactDetails extends AbstractGBActivity {
contactNumber = findViewById(R.id.contact_number); contactNumber = findViewById(R.id.contact_number);
device = getIntent().getParcelableExtra(GBDevice.EXTRA_DEVICE); device = getIntent().getParcelableExtra(GBDevice.EXTRA_DEVICE);
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); final DeviceCoordinator coordinator = device.getDeviceCoordinator();
contactName.addTextChangedListener(new TextWatcher() { contactName.addTextChangedListener(new TextWatcher() {
@Override @Override

View File

@ -667,7 +667,7 @@ public class ControlCenterv2 extends AppCompatActivity
@Override @Override
protected void doInBackground(DBHandler db) { protected void doInBackground(DBHandler db) {
for (GBDevice gbDevice : deviceList) { for (GBDevice gbDevice : deviceList) {
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(gbDevice); final DeviceCoordinator coordinator = gbDevice.getDeviceCoordinator();
if (coordinator.supportsActivityTracking()) { if (coordinator.supportsActivityTracking()) {
long[] stepsAndSleepData = getSteps(gbDevice, db); long[] stepsAndSleepData = getSteps(gbDevice, db);
deviceActivityHashMap.put(gbDevice.getAddress(), stepsAndSleepData); deviceActivityHashMap.put(gbDevice.getAddress(), stepsAndSleepData);

View File

@ -1149,10 +1149,10 @@ public class DebugActivity extends AbstractGBActivity {
public static Map<String, Pair<Long, Integer>> getAllSupportedDevices(Context appContext) { public static Map<String, Pair<Long, Integer>> getAllSupportedDevices(Context appContext) {
LinkedHashMap<String, Pair<Long, Integer>> newMap = new LinkedHashMap<>(1); LinkedHashMap<String, Pair<Long, Integer>> newMap = new LinkedHashMap<>(1);
GBApplication app = (GBApplication) appContext; GBApplication app = (GBApplication) appContext;
for (DeviceCoordinator coordinator : DeviceHelper.getInstance().getAllCoordinators()) { for (DeviceType deviceType : DeviceType.values()) {
DeviceType deviceType = coordinator.getDeviceType(); DeviceCoordinator coordinator = deviceType.getDeviceCoordinator();
int icon = deviceType.getIcon(); int icon = coordinator.getDefaultIconResource();
String name = app.getString(deviceType.getName()) + " (" + coordinator.getManufacturer() + ")"; String name = app.getString(coordinator.getDeviceNameResource()) + " (" + coordinator.getManufacturer() + ")";
long deviceId = deviceType.getKey(); long deviceId = deviceType.getKey();
newMap.put(name, new Pair(deviceId, icon)); newMap.put(name, new Pair(deviceId, icon));
} }

View File

@ -50,6 +50,7 @@ import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceManager; import nodomain.freeyourgadget.gadgetbridge.devices.DeviceManager;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.model.GenericItem; import nodomain.freeyourgadget.gadgetbridge.model.GenericItem;
import nodomain.freeyourgadget.gadgetbridge.model.ItemWithDetails; import nodomain.freeyourgadget.gadgetbridge.model.ItemWithDetails;
import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper; import nodomain.freeyourgadget.gadgetbridge.util.DeviceHelper;
@ -261,13 +262,16 @@ public class FwAppInstallerActivity extends AbstractGBActivity implements Instal
private List<DeviceCoordinator> getAllCoordinatorsConnectedFirst() { private List<DeviceCoordinator> getAllCoordinatorsConnectedFirst() {
DeviceManager deviceManager = ((GBApplication) getApplicationContext()).getDeviceManager(); DeviceManager deviceManager = ((GBApplication) getApplicationContext()).getDeviceManager();
List<DeviceCoordinator> connectedCoordinators = new ArrayList<>(); List<DeviceCoordinator> connectedCoordinators = new ArrayList<>();
List<DeviceCoordinator> allCoordinators = DeviceHelper.getInstance().getAllCoordinators(); List<DeviceCoordinator> allCoordinators = new ArrayList<>(DeviceType.values().length);
for(DeviceType type : DeviceType.values()){
allCoordinators.add(type.getDeviceCoordinator());
}
List<DeviceCoordinator> sortedCoordinators = new ArrayList<>(allCoordinators.size()); List<DeviceCoordinator> sortedCoordinators = new ArrayList<>(allCoordinators.size());
List<GBDevice> devices = deviceManager.getSelectedDevices(); List<GBDevice> devices = deviceManager.getSelectedDevices();
for(GBDevice connectedDevice : devices){ for(GBDevice connectedDevice : devices){
if (connectedDevice.isConnected()) { if (connectedDevice.isConnected()) {
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(connectedDevice); DeviceCoordinator coordinator = connectedDevice.getDeviceCoordinator();
if (coordinator != null) { if (coordinator != null) {
connectedCoordinators.add(coordinator); connectedCoordinators.add(coordinator);
} }

View File

@ -89,7 +89,7 @@ public class ReminderDetails extends AbstractGBActivity implements TimePickerDia
reminderText = findViewById(R.id.reminder_message); reminderText = findViewById(R.id.reminder_message);
device = getIntent().getParcelableExtra(GBDevice.EXTRA_DEVICE); device = getIntent().getParcelableExtra(GBDevice.EXTRA_DEVICE);
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); final DeviceCoordinator coordinator = device.getDeviceCoordinator();
final String[] repeatStrings = getResources().getStringArray(R.array.reminder_repeat); final String[] repeatStrings = getResources().getStringArray(R.array.reminder_repeat);
repeatAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, repeatStrings); repeatAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, repeatStrings);

View File

@ -115,9 +115,9 @@ public class SleepAlarmWidgetConfigurationActivity extends Activity implements G
try (DBHandler handler = GBApplication.acquireDB()) { try (DBHandler handler = GBApplication.acquireDB()) {
daoSession = handler.getDaoSession(); daoSession = handler.getDaoSession();
for (GBDevice device : devices) { for (GBDevice device : devices) {
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); DeviceCoordinator coordinator = device.getDeviceCoordinator();
Device dbDevice = DBHelper.findDevice(device, daoSession); Device dbDevice = DBHelper.findDevice(device, daoSession);
int icon = device.isInitialized() ? device.getType().getIcon() : device.getType().getDisabledIcon(); int icon = device.getEnabledDisabledIconResource();
if (dbDevice != null && coordinator != null if (dbDevice != null && coordinator != null
&& (coordinator.getAlarmSlotCount(device) > 0) && (coordinator.getAlarmSlotCount(device) > 0)
&& !newMap.containsKey(device.getAliasOrName())) { && !newMap.containsKey(device.getAliasOrName())) {

View File

@ -109,9 +109,9 @@ public class WidgetConfigurationActivity extends Activity implements GBActivity
try (DBHandler handler = GBApplication.acquireDB()) { try (DBHandler handler = GBApplication.acquireDB()) {
daoSession = handler.getDaoSession(); daoSession = handler.getDaoSession();
for (GBDevice device : devices) { for (GBDevice device : devices) {
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); DeviceCoordinator coordinator = device.getDeviceCoordinator();
Device dbDevice = DBHelper.findDevice(device, daoSession); Device dbDevice = DBHelper.findDevice(device, daoSession);
int icon = device.isInitialized() ? device.getType().getIcon() : device.getType().getDisabledIcon(); int icon = device.getEnabledDisabledIconResource();
if (dbDevice != null && coordinator != null if (dbDevice != null && coordinator != null
&& (coordinator.supportsActivityDataFetching() || coordinator.supportsActivityTracking()) && (coordinator.supportsActivityDataFetching() || coordinator.supportsActivityTracking())
&& !newMap.containsKey(device.getAliasOrName())) { && !newMap.containsKey(device.getAliasOrName())) {

View File

@ -80,7 +80,7 @@ public class WorldClockDetails extends AbstractGBActivity {
worldClockCode = findViewById(R.id.world_clock_code); worldClockCode = findViewById(R.id.world_clock_code);
device = getIntent().getParcelableExtra(GBDevice.EXTRA_DEVICE); device = getIntent().getParcelableExtra(GBDevice.EXTRA_DEVICE);
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); final DeviceCoordinator coordinator = device.getDeviceCoordinator();
final String[] timezoneIDs = TimeZone.getAvailableIDs(); final String[] timezoneIDs = TimeZone.getAvailableIDs();
timezoneAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, timezoneIDs); timezoneAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1, timezoneIDs);
@ -182,7 +182,7 @@ public class WorldClockDetails extends AbstractGBActivity {
} }
public void updateUiFromWorldClock() { public void updateUiFromWorldClock() {
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); final DeviceCoordinator coordinator = device.getDeviceCoordinator();
final int maxLabelLength = coordinator.getWorldClocksLabelLength(); final int maxLabelLength = coordinator.getWorldClocksLabelLength();
worldClockEnabled.setChecked(worldClock.getEnabled() == null || worldClock.getEnabled()); worldClockEnabled.setChecked(worldClock.getEnabled() == null || worldClock.getEnabled());

View File

@ -66,7 +66,7 @@ public class AppSpecificNotificationSettingsDetailActivity extends AbstractGBAct
mSpinnerVibrationCount = findViewById(R.id.spinnerVibraCount); mSpinnerVibrationCount = findViewById(R.id.spinnerVibraCount);
mDevice = getIntent().getParcelableExtra(GBDevice.EXTRA_DEVICE); mDevice = getIntent().getParcelableExtra(GBDevice.EXTRA_DEVICE);
mCoordinator = DeviceHelper.getInstance().getCoordinator(mDevice); mCoordinator = mDevice.getDeviceCoordinator();
mLedPatternValues.clear(); mLedPatternValues.clear();
for(AbstractNotificationPattern p: mCoordinator.getNotificationLedPatterns()) for(AbstractNotificationPattern p: mCoordinator.getNotificationLedPatterns())

View File

@ -414,7 +414,7 @@ public abstract class AbstractAppManagerFragment extends Fragment {
@Override @Override
public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) {
mGBDevice = ((AppManagerActivity) getActivity()).getGBDevice(); mGBDevice = ((AppManagerActivity) getActivity()).getGBDevice();
mCoordinator = DeviceHelper.getInstance().getCoordinator(mGBDevice); mCoordinator = mGBDevice.getDeviceCoordinator();
final FloatingActionButton appListFab = ((FloatingActionButton) getActivity().findViewById(R.id.fab)); final FloatingActionButton appListFab = ((FloatingActionButton) getActivity().findViewById(R.id.fab));
final FloatingActionButton appListFabNew = ((FloatingActionButton) getActivity().findViewById(R.id.fab_new)); final FloatingActionButton appListFabNew = ((FloatingActionButton) getActivity().findViewById(R.id.fab_new));

View File

@ -53,12 +53,12 @@ public abstract class AbstractActivityChartFragment<D extends ChartsData> extend
private static final Logger LOG = LoggerFactory.getLogger(AbstractActivityChartFragment.class); private static final Logger LOG = LoggerFactory.getLogger(AbstractActivityChartFragment.class);
public boolean supportsHeartrate(GBDevice device) { public boolean supportsHeartrate(GBDevice device) {
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); DeviceCoordinator coordinator = device.getDeviceCoordinator();
return coordinator != null && coordinator.supportsHeartRateMeasurement(device); return coordinator != null && coordinator.supportsHeartRateMeasurement(device);
} }
public boolean supportsRemSleep(GBDevice device) { public boolean supportsRemSleep(GBDevice device) {
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); DeviceCoordinator coordinator = device.getDeviceCoordinator();
return coordinator != null && coordinator.supportsRemSleep(); return coordinator != null && coordinator.supportsRemSleep();
} }
@ -145,7 +145,7 @@ public abstract class AbstractActivityChartFragment<D extends ChartsData> extend
} }
protected SampleProvider<? extends AbstractActivitySample> getProvider(DBHandler db, GBDevice device) { protected SampleProvider<? extends AbstractActivitySample> getProvider(DBHandler db, GBDevice device) {
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); DeviceCoordinator coordinator = device.getDeviceCoordinator();
return coordinator.getSampleProvider(device, db.getDaoSession()); return coordinator.getSampleProvider(device, db.getDaoSession());
} }

View File

@ -53,13 +53,13 @@ public class ActivityChartsActivity extends AbstractChartsActivity {
@Override @Override
protected boolean supportsRefresh() { protected boolean supportsRefresh() {
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(getDevice()); final DeviceCoordinator coordinator = getDevice().getDeviceCoordinator();
return coordinator.supportsActivityDataFetching(); return coordinator.supportsActivityDataFetching();
} }
@Override @Override
protected boolean allowRefresh() { protected boolean allowRefresh() {
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(getDevice()); final DeviceCoordinator coordinator = getDevice().getDeviceCoordinator();
return coordinator.allowFetchActivityData(getDevice()) && supportsRefresh(); return coordinator.allowFetchActivityData(getDevice()) && supportsRefresh();
} }
@ -79,7 +79,7 @@ public class ActivityChartsActivity extends AbstractChartsActivity {
} else { } else {
tabList = new ArrayList<>(Arrays.asList(myTabs.split(","))); tabList = new ArrayList<>(Arrays.asList(myTabs.split(",")));
} }
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); final DeviceCoordinator coordinator = device.getDeviceCoordinator();
if (!coordinator.supportsRealtimeData()) { if (!coordinator.supportsRealtimeData()) {
tabList.remove("livestats"); tabList.remove("livestats");
} }

View File

@ -210,7 +210,7 @@ public class ActivityListingDashboard extends MaterialDialogFragment {
} }
SampleProvider<? extends AbstractActivitySample> getProvider(DBHandler db, GBDevice device) { SampleProvider<? extends AbstractActivitySample> getProvider(DBHandler db, GBDevice device) {
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); DeviceCoordinator coordinator = device.getDeviceCoordinator();
return coordinator.getSampleProvider(device, db.getDaoSession()); return coordinator.getSampleProvider(device, db.getDaoSession());
} }

View File

@ -400,7 +400,7 @@ public class PaiChartFragment extends AbstractChartFragment<PaiChartFragment.Pai
private Optional<? extends PaiSample> getSamplePaiForDay(final DBHandler db, final GBDevice device, final Calendar day) { private Optional<? extends PaiSample> getSamplePaiForDay(final DBHandler db, final GBDevice device, final Calendar day) {
final Date dayStart = DateTimeUtils.dayStart(day.getTime()); final Date dayStart = DateTimeUtils.dayStart(day.getTime());
final Date dayEnd = DateTimeUtils.dayEnd(day.getTime()); final Date dayEnd = DateTimeUtils.dayEnd(day.getTime());
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); final DeviceCoordinator coordinator = device.getDeviceCoordinator();
final TimeSampleProvider<? extends PaiSample> sampleProvider = coordinator.getPaiSampleProvider(device, db.getDaoSession()); final TimeSampleProvider<? extends PaiSample> sampleProvider = coordinator.getPaiSampleProvider(device, db.getDaoSession());
final List<? extends PaiSample> daySamples = sampleProvider.getAllSamples(dayStart.getTime(), dayEnd.getTime()); final List<? extends PaiSample> daySamples = sampleProvider.getAllSamples(dayStart.getTime(), dayEnd.getTime());
return Optional.ofNullable(daySamples.isEmpty() ? null : daySamples.get(daySamples.size() - 1)); return Optional.ofNullable(daySamples.isEmpty() ? null : daySamples.get(daySamples.size() - 1));

View File

@ -230,7 +230,7 @@ public class StressChartFragment extends AbstractChartFragment<StressChartFragme
private List<? extends StressSample> getSamples(final DBHandler db, final GBDevice device) { private List<? extends StressSample> getSamples(final DBHandler db, final GBDevice device) {
final int tsStart = getTSStart(); final int tsStart = getTSStart();
final int tsEnd = getTSEnd(); final int tsEnd = getTSEnd();
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); final DeviceCoordinator coordinator = device.getDeviceCoordinator();
final TimeSampleProvider<? extends StressSample> sampleProvider = coordinator.getStressSampleProvider(device, db.getDaoSession()); final TimeSampleProvider<? extends StressSample> sampleProvider = coordinator.getStressSampleProvider(device, db.getDaoSession());
return sampleProvider.getAllSamples(tsStart * 1000L, tsEnd * 1000L); return sampleProvider.getAllSamples(tsStart * 1000L, tsEnd * 1000L);
} }

View File

@ -189,7 +189,7 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
} }
private void setChangeListener() { private void setChangeListener() {
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); final DeviceCoordinator coordinator = device.getDeviceCoordinator();
final Prefs prefs = new Prefs(getPreferenceManager().getSharedPreferences()); final Prefs prefs = new Prefs(getPreferenceManager().getSharedPreferences());
String disconnectNotificationState = prefs.getString(PREF_DISCONNECT_NOTIFICATION, PREF_DO_NOT_DISTURB_OFF); String disconnectNotificationState = prefs.getString(PREF_DISCONNECT_NOTIFICATION, PREF_DO_NOT_DISTURB_OFF);
@ -922,7 +922,7 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
} }
static DeviceSpecificSettingsFragment newInstance(GBDevice device, DeviceSettingsActivity.MENU_ENTRY_POINTS applicationSpecificSettings) { static DeviceSpecificSettingsFragment newInstance(GBDevice device, DeviceSettingsActivity.MENU_ENTRY_POINTS applicationSpecificSettings) {
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); final DeviceCoordinator coordinator = device.getDeviceCoordinator();
int[] supportedSettings = new int[0]; int[] supportedSettings = new int[0];
String[] supportedLanguages = null; String[] supportedLanguages = null;
@ -937,7 +937,7 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
} else if (applicationSpecificSettings.equals(DeviceSettingsActivity.MENU_ENTRY_POINTS.AUTH_SETTINGS)) { //auth settings screen } else if (applicationSpecificSettings.equals(DeviceSettingsActivity.MENU_ENTRY_POINTS.AUTH_SETTINGS)) { //auth settings screen
supportedSettings = ArrayUtils.insert(0, supportedSettings, coordinator.getSupportedDeviceSpecificAuthenticationSettings()); supportedSettings = ArrayUtils.insert(0, supportedSettings, coordinator.getSupportedDeviceSpecificAuthenticationSettings());
supportedSettings = ArrayUtils.addAll(supportedSettings, R.xml.devicesettings_pairingkey_explanation); supportedSettings = ArrayUtils.addAll(supportedSettings, R.xml.devicesettings_pairingkey_explanation);
if (coordinator.getDeviceType() == DeviceType.MIBAND6) { // miband6 might require new protocol and people do not know what to do, hint them: if (device.getType() == DeviceType.MIBAND6) { // miband6 might require new protocol and people do not know what to do, hint them:
supportedSettings = ArrayUtils.addAll(supportedSettings, R.xml.devicesettings_miband6_new_protocol); supportedSettings = ArrayUtils.addAll(supportedSettings, R.xml.devicesettings_miband6_new_protocol);
supportedSettings = ArrayUtils.addAll(supportedSettings, R.xml.devicesettings_miband6_new_auth_protocol_explanation); supportedSettings = ArrayUtils.addAll(supportedSettings, R.xml.devicesettings_miband6_new_auth_protocol_explanation);
} }

View File

@ -403,7 +403,7 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
GBDeviceCandidate candidate = new GBDeviceCandidate(device, rssi, uuids); GBDeviceCandidate candidate = new GBDeviceCandidate(device, rssi, uuids);
candidate.refreshNameIfUnknown(); candidate.refreshNameIfUnknown();
candidate.addUuids(device.getUuids()); candidate.addUuids(device.getUuids());
DeviceType deviceType = DeviceHelper.getInstance().getSupportedType(candidate); DeviceType deviceType = DeviceHelper.getInstance().resolveDeviceType(candidate);
if (deviceType.isSupported() || discoverUnsupported) { if (deviceType.isSupported() || discoverUnsupported) {
candidate.setDeviceType(deviceType); candidate.setDeviceType(deviceType);
LOG.info("Recognized device: " + candidate); LOG.info("Recognized device: " + candidate);
@ -652,8 +652,8 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
private List<ScanFilter> getScanFilters() { private List<ScanFilter> getScanFilters() {
List<ScanFilter> allFilters = new ArrayList<>(); List<ScanFilter> allFilters = new ArrayList<>();
for (DeviceCoordinator coordinator : DeviceHelper.getInstance().getAllCoordinators()) { for (DeviceType type : DeviceType.values()) {
allFilters.addAll(coordinator.createBLEScanFilters()); allFilters.addAll(type.getDeviceCoordinator().createBLEScanFilters());
} }
return allFilters; return allFilters;
} }
@ -769,7 +769,7 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
} }
stopDiscovery(); stopDiscovery();
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(deviceCandidate); DeviceCoordinator coordinator = DeviceHelper.getInstance().resolveCoordinator(deviceCandidate);
LOG.info("Using device candidate " + deviceCandidate + " with coordinator: " + coordinator.getClass()); LOG.info("Using device candidate " + deviceCandidate + " with coordinator: " + coordinator.getClass());
if (coordinator.getBondingStyle() == DeviceCoordinator.BONDING_STYLE_REQUIRE_KEY) { if (coordinator.getBondingStyle() == DeviceCoordinator.BONDING_STYLE_REQUIRE_KEY) {
@ -800,7 +800,7 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
try { try {
this.deviceTarget = deviceCandidate; this.deviceTarget = deviceCandidate;
BondingUtil.initiateCorrectBonding(this, deviceCandidate); BondingUtil.initiateCorrectBonding(this, deviceCandidate, coordinator);
} catch (Exception e) { } catch (Exception e) {
LOG.error("Error pairing device: " + deviceCandidate.getMacAddress()); LOG.error("Error pairing device: " + deviceCandidate.getMacAddress());
} }
@ -862,7 +862,7 @@ public class DiscoveryActivity extends AbstractGBActivity implements AdapterView
return true; return true;
} }
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(deviceCandidate); DeviceCoordinator coordinator = DeviceHelper.getInstance().resolveCoordinator(deviceCandidate);
GBDevice device = DeviceHelper.getInstance().toSupportedDevice(deviceCandidate); GBDevice device = DeviceHelper.getInstance().toSupportedDevice(deviceCandidate);
if (coordinator.getSupportedDeviceSpecificSettings(device) == null) { if (coordinator.getSupportedDeviceSpecificSettings(device) == null) {
return true; return true;

View File

@ -87,6 +87,7 @@ import nodomain.freeyourgadget.gadgetbridge.adapter.SpinnerWithIconItem;
import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.DeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate; import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.util.AndroidUtils; import nodomain.freeyourgadget.gadgetbridge.util.AndroidUtils;
import nodomain.freeyourgadget.gadgetbridge.util.BondingInterface; import nodomain.freeyourgadget.gadgetbridge.util.BondingInterface;
import nodomain.freeyourgadget.gadgetbridge.util.BondingUtil; import nodomain.freeyourgadget.gadgetbridge.util.BondingUtil;
@ -513,8 +514,8 @@ public class DiscoveryActivityV2 extends AbstractGBActivity implements AdapterVi
private List<ScanFilter> getScanFilters() { private List<ScanFilter> getScanFilters() {
final List<ScanFilter> allFilters = new ArrayList<>(); final List<ScanFilter> allFilters = new ArrayList<>();
for (final DeviceCoordinator coordinator : DeviceHelper.getInstance().getAllCoordinators()) { for (DeviceType deviceType : DeviceType.values()) {
allFilters.addAll(coordinator.createBLEScanFilters()); allFilters.addAll(deviceType.getDeviceCoordinator().createBLEScanFilters());
} }
return allFilters; return allFilters;
} }
@ -618,7 +619,7 @@ public class DiscoveryActivityV2 extends AbstractGBActivity implements AdapterVi
stopDiscovery(); stopDiscovery();
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(deviceCandidate); final DeviceCoordinator coordinator = DeviceHelper.getInstance().resolveCoordinator(deviceCandidate);
LOG.info("Using device candidate {} with coordinator {}", deviceCandidate, coordinator.getClass()); LOG.info("Using device candidate {} with coordinator {}", deviceCandidate, coordinator.getClass());
if (coordinator.getBondingStyle() == DeviceCoordinator.BONDING_STYLE_REQUIRE_KEY) { if (coordinator.getBondingStyle() == DeviceCoordinator.BONDING_STYLE_REQUIRE_KEY) {
@ -649,7 +650,7 @@ public class DiscoveryActivityV2 extends AbstractGBActivity implements AdapterVi
try { try {
this.deviceTarget = deviceCandidate; this.deviceTarget = deviceCandidate;
BondingUtil.initiateCorrectBonding(this, deviceCandidate); BondingUtil.initiateCorrectBonding(this, deviceCandidate, coordinator);
} catch (final Exception e) { } catch (final Exception e) {
LOG.error("Error pairing device {}", deviceCandidate.getMacAddress(), e); LOG.error("Error pairing device {}", deviceCandidate.getMacAddress(), e);
} }
@ -689,7 +690,7 @@ public class DiscoveryActivityV2 extends AbstractGBActivity implements AdapterVi
return true; return true;
} }
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(deviceCandidate); final DeviceCoordinator coordinator = deviceCandidate.getDeviceType().getDeviceCoordinator();
final GBDevice device = DeviceHelper.getInstance().toSupportedDevice(deviceCandidate); final GBDevice device = DeviceHelper.getInstance().toSupportedDevice(deviceCandidate);
if (coordinator.getSupportedDeviceSpecificSettings(device) == null) { if (coordinator.getSupportedDeviceSpecificSettings(device) == null) {
return true; return true;

View File

@ -184,7 +184,7 @@ public final class GBScanEventProcessor implements Runnable {
} }
} }
final DeviceType deviceType = DeviceHelper.getInstance().getSupportedType(candidate); final DeviceType deviceType = DeviceHelper.getInstance().resolveDeviceType(candidate);
if (deviceType.isSupported() || discoverUnsupported) { if (deviceType.isSupported() || discoverUnsupported) {
candidate.setDeviceType(deviceType); candidate.setDeviceType(deviceType);

View File

@ -187,7 +187,7 @@ public class ActivitySummariesAdapter extends AbstractActivityListingAdapter<Bas
ImageView activityIconView = view.findViewById(R.id.summary_dashboard_layout_activity_icon); ImageView activityIconView = view.findViewById(R.id.summary_dashboard_layout_activity_icon);
ImageView activityIconBigView = view.findViewById(R.id.summary_dashboard_layout_big_activity_icon); ImageView activityIconBigView = view.findViewById(R.id.summary_dashboard_layout_big_activity_icon);
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); final DeviceCoordinator coordinator = device.getDeviceCoordinator();
for (BaseActivitySummary sportitem : getItems()) { for (BaseActivitySummary sportitem : getItems()) {
if (sportitem.getStartTime() == null) continue; //first item is empty, for dashboard if (sportitem.getStartTime() == null) continue; //first item is empty, for dashboard

View File

@ -62,16 +62,18 @@ public class DeviceCandidateAdapter extends ArrayAdapter<GBDeviceCandidate> {
TextView deviceAddressLabel = view.findViewById(R.id.item_details); TextView deviceAddressLabel = view.findViewById(R.id.item_details);
TextView deviceStatus = view.findViewById(R.id.item_status); TextView deviceStatus = view.findViewById(R.id.item_status);
DeviceCoordinator coordinator = device.getDeviceType().getDeviceCoordinator();
String name = formatDeviceCandidate(device); String name = formatDeviceCandidate(device);
deviceNameLabel.setText(name); deviceNameLabel.setText(name);
deviceAddressLabel.setText(device.getMacAddress()); deviceAddressLabel.setText(device.getMacAddress());
deviceImageView.setImageResource(device.getDeviceType().getIcon()); deviceImageView.setImageResource(coordinator.getDefaultIconResource());
final List<String> statusLines = new ArrayList<>(); final List<String> statusLines = new ArrayList<>();
if (device.isBonded()) { if (device.isBonded()) {
statusLines.add(getContext().getString(R.string.device_is_currently_bonded)); statusLines.add(getContext().getString(R.string.device_is_currently_bonded));
if (!GBApplication.getPrefs().getBoolean("ignore_bonded_devices", true)) { // This could be passed to the constructor instead if (!GBApplication.getPrefs().getBoolean("ignore_bonded_devices", true)) { // This could be passed to the constructor instead
deviceImageView.setImageResource(device.getDeviceType().getDisabledIcon()); deviceImageView.setImageResource(coordinator.getDisabledIconResource());
} }
} }
@ -79,7 +81,6 @@ public class DeviceCandidateAdapter extends ArrayAdapter<GBDeviceCandidate> {
statusLines.add(getContext().getString(R.string.device_unsupported)); statusLines.add(getContext().getString(R.string.device_unsupported));
} }
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device);
if (coordinator.isExperimental()) { if (coordinator.isExperimental()) {
statusLines.add(getContext().getString(R.string.device_experimental)); statusLines.add(getContext().getString(R.string.device_experimental));
} }

View File

@ -279,7 +279,7 @@ public class GBDeviceAdapterv2 extends ListAdapter<GBDevice, GBDeviceAdapterv2.V
dailyTotals = deviceActivityMap.get(device.getAddress()); dailyTotals = deviceActivityMap.get(device.getAddress());
} }
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); final DeviceCoordinator coordinator = device.getDeviceCoordinator();
holder.container.setOnClickListener(new View.OnClickListener() { holder.container.setOnClickListener(new View.OnClickListener() {
@Override @Override
@ -304,7 +304,8 @@ public class GBDeviceAdapterv2 extends ListAdapter<GBDevice, GBDeviceAdapterv2.V
return true; return true;
} }
}); });
holder.deviceImageView.setImageResource(device.isInitialized() ? device.getType().getIcon() : device.getType().getDisabledIcon());
holder.deviceImageView.setImageResource(device.getEnabledDisabledIconResource());
holder.deviceNameLabel.setText(getUniqueDeviceName(device)); holder.deviceNameLabel.setText(getUniqueDeviceName(device));
@ -455,7 +456,7 @@ public class GBDeviceAdapterv2 extends ListAdapter<GBDevice, GBDeviceAdapterv2.V
{ {
@Override @Override
public void onClick(View v) { public void onClick(View v) {
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); DeviceCoordinator coordinator = device.getDeviceCoordinator();
Class<? extends Activity> appsManagementActivity = coordinator.getAppsManagementActivity(); Class<? extends Activity> appsManagementActivity = coordinator.getAppsManagementActivity();
if (appsManagementActivity != null) { if (appsManagementActivity != null) {
Intent startIntent = new Intent(context, appsManagementActivity); Intent startIntent = new Intent(context, appsManagementActivity);
@ -820,7 +821,7 @@ public class GBDeviceAdapterv2 extends ListAdapter<GBDevice, GBDeviceAdapterv2.V
} }
private boolean showInstallerItem(GBDevice device) { private boolean showInstallerItem(GBDevice device) {
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); final DeviceCoordinator coordinator = device.getDeviceCoordinator();
return coordinator.supportsAppsManagement(device) || coordinator.supportsFlashing(); return coordinator.supportsAppsManagement(device) || coordinator.supportsFlashing();
} }
@ -906,7 +907,7 @@ public class GBDeviceAdapterv2 extends ListAdapter<GBDevice, GBDeviceAdapterv2.V
@Override @Override
public void onClick(DialogInterface dialog, int which) { public void onClick(DialogInterface dialog, int which) {
try { try {
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(device); DeviceCoordinator coordinator = device.getDeviceCoordinator();
if (coordinator != null) { if (coordinator != null) {
coordinator.deleteDevice(device); coordinator.deleteDevice(device);
} }
@ -1420,11 +1421,13 @@ public class GBDeviceAdapterv2 extends ListAdapter<GBDevice, GBDeviceAdapterv2.V
ShortcutManager shortcutManager = (ShortcutManager) context.getApplicationContext().getSystemService(Context.SHORTCUT_SERVICE); ShortcutManager shortcutManager = (ShortcutManager) context.getApplicationContext().getSystemService(Context.SHORTCUT_SERVICE);
DeviceCoordinator coordinator = device.getDeviceCoordinator();
shortcutManager.pushDynamicShortcut(new ShortcutInfo.Builder(context, device.getAddress()) shortcutManager.pushDynamicShortcut(new ShortcutInfo.Builder(context, device.getAddress())
.setLongLived(false) .setLongLived(false)
.setShortLabel(device.getAliasOrName()) .setShortLabel(device.getAliasOrName())
.setIntent(intent) .setIntent(intent)
.setIcon(Icon.createWithResource(context, device.getType().getIcon())) .setIcon(Icon.createWithResource(context, coordinator.getDefaultIconResource()))
.build() .build()
); );
} }

View File

@ -435,7 +435,7 @@ public class DBHelper {
device.setIdentifier(gbDevice.getAddress()); device.setIdentifier(gbDevice.getAddress());
device.setName(gbDevice.getName()); device.setName(gbDevice.getName());
device.setAlias(gbDevice.getAlias()); device.setAlias(gbDevice.getAlias());
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(gbDevice); DeviceCoordinator coordinator = gbDevice.getDeviceCoordinator();
device.setManufacturer(coordinator.getManufacturer()); device.setManufacturer(coordinator.getManufacturer());
device.setType(gbDevice.getType().getKey()); device.setType(gbDevice.getType().getKey());
device.setModel(gbDevice.getModel()); device.setModel(gbDevice.getModel());
@ -458,7 +458,7 @@ public class DBHelper {
if (!Objects.equals(device.getAlias(), gbDevice.getAlias())) { if (!Objects.equals(device.getAlias(), gbDevice.getAlias())) {
return false; return false;
} }
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(gbDevice); DeviceCoordinator coordinator = gbDevice.getDeviceCoordinator();
if (!Objects.equals(device.getManufacturer(), coordinator.getManufacturer())) { if (!Objects.equals(device.getManufacturer(), coordinator.getManufacturer())) {
return false; return false;
} }
@ -592,7 +592,7 @@ public class DBHelper {
*/ */
@NonNull @NonNull
public static List<Alarm> getAlarms(@NonNull GBDevice gbDevice) { public static List<Alarm> getAlarms(@NonNull GBDevice gbDevice) {
DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(gbDevice); DeviceCoordinator coordinator = gbDevice.getDeviceCoordinator();
Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress())); Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()));
int reservedSlots = prefs.getInt(DeviceSettingsPreferenceConst.PREF_RESERVER_ALARMS_CALENDAR, 0); int reservedSlots = prefs.getInt(DeviceSettingsPreferenceConst.PREF_RESERVER_ALARMS_CALENDAR, 0);
@ -635,7 +635,7 @@ public class DBHelper {
*/ */
@NonNull @NonNull
public static List<Reminder> getReminders(@NonNull GBDevice gbDevice) { public static List<Reminder> getReminders(@NonNull GBDevice gbDevice) {
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(gbDevice); final DeviceCoordinator coordinator = gbDevice.getDeviceCoordinator();
final Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress())); final Prefs prefs = new Prefs(GBApplication.getDeviceSpecificSharedPrefs(gbDevice.getAddress()));
int reservedSlots = prefs.getInt(DeviceSettingsPreferenceConst.PREF_RESERVER_REMINDERS_CALENDAR, coordinator.supportsCalendarEvents() ? 0 : 9); int reservedSlots = prefs.getInt(DeviceSettingsPreferenceConst.PREF_RESERVER_REMINDERS_CALENDAR, coordinator.supportsCalendarEvents() ? 0 : 9);

View File

@ -25,6 +25,7 @@ import android.bluetooth.BluetoothClass;
import android.bluetooth.BluetoothDevice; import android.bluetooth.BluetoothDevice;
import android.bluetooth.le.ScanFilter; import android.bluetooth.le.ScanFilter;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
@ -60,6 +61,7 @@ import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.AbstractNotificationPattern; import nodomain.freeyourgadget.gadgetbridge.model.AbstractNotificationPattern;
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySummaryParser; import nodomain.freeyourgadget.gadgetbridge.model.ActivitySummaryParser;
import nodomain.freeyourgadget.gadgetbridge.model.BatteryConfig; import nodomain.freeyourgadget.gadgetbridge.model.BatteryConfig;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.model.HeartRateSample; import nodomain.freeyourgadget.gadgetbridge.model.HeartRateSample;
import nodomain.freeyourgadget.gadgetbridge.model.PaiSample; import nodomain.freeyourgadget.gadgetbridge.model.PaiSample;
import nodomain.freeyourgadget.gadgetbridge.model.SleepRespiratoryRateSample; import nodomain.freeyourgadget.gadgetbridge.model.SleepRespiratoryRateSample;
@ -81,11 +83,6 @@ public abstract class AbstractDeviceCoordinator implements DeviceCoordinator {
return ConnectionType.BOTH; return ConnectionType.BOTH;
} }
@Override
public boolean supports(GBDevice device) {
return getDeviceType().equals(device.getType());
}
@NonNull @NonNull
@Override @Override
public Collection<? extends ScanFilter> createBLEScanFilters() { public Collection<? extends ScanFilter> createBLEScanFilters() {
@ -93,8 +90,8 @@ public abstract class AbstractDeviceCoordinator implements DeviceCoordinator {
} }
@Override @Override
public GBDevice createDevice(GBDeviceCandidate candidate) { public GBDevice createDevice(GBDeviceCandidate candidate, DeviceType deviceType) {
GBDevice gbDevice = new GBDevice(candidate.getDevice().getAddress(), candidate.getName(), null, null, getDeviceType()); GBDevice gbDevice = new GBDevice(candidate.getDevice().getAddress(), candidate.getName(), null, null, deviceType);
for (BatteryConfig batteryConfig : getBatteryConfig()) { for (BatteryConfig batteryConfig : getBatteryConfig()) {
gbDevice.setBatteryIcon(batteryConfig.getBatteryIcon(), batteryConfig.getBatteryIndex()); gbDevice.setBatteryIcon(batteryConfig.getBatteryIcon(), batteryConfig.getBatteryIndex());
gbDevice.setBatteryLabel(batteryConfig.getBatteryLabel(), batteryConfig.getBatteryIndex()); gbDevice.setBatteryLabel(batteryConfig.getBatteryLabel(), batteryConfig.getBatteryIndex());
@ -469,11 +466,28 @@ public abstract class AbstractDeviceCoordinator implements DeviceCoordinator {
return false; return false;
} }
@Override
public int getOrderPriority(){
return 0;
}
@Override @Override
public EnumSet<ServiceDeviceSupport.Flags> getInitialFlags() { public EnumSet<ServiceDeviceSupport.Flags> getInitialFlags() {
return EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING); return EnumSet.of(ServiceDeviceSupport.Flags.BUSY_CHECKING);
} }
@Override
@DrawableRes
public int getDefaultIconResource() {
return R.drawable.ic_device_default;
}
@Override
@DrawableRes
public int getDisabledIconResource() {
return R.drawable.ic_device_default_disabled;
}
public boolean supportsNotificationVibrationPatterns() { public boolean supportsNotificationVibrationPatterns() {
return false; return false;
} }

View File

@ -74,7 +74,7 @@ public abstract class AbstractSampleProvider<T extends AbstractActivitySample> i
@Override @Override
public List<T> getSleepSamples(int timestamp_from, int timestamp_to) { public List<T> getSleepSamples(int timestamp_from, int timestamp_to) {
final DeviceCoordinator coordinator = DeviceHelper.getInstance().getCoordinator(getDevice()); final DeviceCoordinator coordinator = getDevice().getDeviceCoordinator();
// If the device does not support REM sleep, we need to exclude its bit from the activity type // If the device does not support REM sleep, we need to exclude its bit from the activity type
int sleepActivityType = ActivityKind.TYPE_SLEEP; int sleepActivityType = ActivityKind.TYPE_SLEEP;

View File

@ -29,8 +29,11 @@ import java.util.Collection;
import java.util.EnumSet; import java.util.EnumSet;
import java.util.List; import java.util.List;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import nodomain.freeyourgadget.gadgetbridge.GBException; import nodomain.freeyourgadget.gadgetbridge.GBException;
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsCustomizer; import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsCustomizer;
import nodomain.freeyourgadget.gadgetbridge.capabilities.HeartRateCapability; import nodomain.freeyourgadget.gadgetbridge.capabilities.HeartRateCapability;
@ -135,14 +138,6 @@ public interface DeviceCoordinator {
*/ */
boolean supports(GBDeviceCandidate candidate); boolean supports(GBDeviceCandidate candidate);
/**
* Checks whether this candidate handles the given device.
*
* @param device
* @return true if this coordinator handles the given device.
*/
boolean supports(GBDevice device);
/** /**
* Returns a list of scan filters that shall be used to discover devices supported * Returns a list of scan filters that shall be used to discover devices supported
* by this coordinator. * by this coordinator.
@ -151,7 +146,7 @@ public interface DeviceCoordinator {
@NonNull @NonNull
Collection<? extends ScanFilter> createBLEScanFilters(); Collection<? extends ScanFilter> createBLEScanFilters();
GBDevice createDevice(GBDeviceCandidate candidate); GBDevice createDevice(GBDeviceCandidate candidate, DeviceType type);
/** /**
* Deletes all information, including all related database content about the * Deletes all information, including all related database content about the
@ -160,13 +155,6 @@ public interface DeviceCoordinator {
*/ */
void deleteDevice(GBDevice device) throws GBException; void deleteDevice(GBDevice device) throws GBException;
/**
* Returns the kind of device type this coordinator supports.
*
* @return
*/
DeviceType getDeviceType();
/** /**
* Returns the Activity class to be started in order to perform a pairing of a * Returns the Activity class to be started in order to perform a pairing of a
* given device after its discovery. * given device after its discovery.
@ -560,11 +548,22 @@ public interface DeviceCoordinator {
boolean supportsNavigation(); boolean supportsNavigation();
int getOrderPriority();
@NonNull @NonNull
Class<? extends DeviceSupport> getDeviceSupportClass(); Class<? extends DeviceSupport> getDeviceSupportClass();
EnumSet<ServiceDeviceSupport.Flags> getInitialFlags(); EnumSet<ServiceDeviceSupport.Flags> getInitialFlags();
@StringRes
int getDeviceNameResource();
@DrawableRes
int getDefaultIconResource();
@DrawableRes
int getDisabledIconResource();
/** /**
* Whether the device supports a variety of vibration patterns for notifications. * Whether the device supports a variety of vibration patterns for notifications.
*/ */

View File

@ -23,9 +23,13 @@ import android.net.Uri;
import java.util.List; import java.util.List;
import androidx.annotation.DrawableRes;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import androidx.annotation.StringRes;
import nodomain.freeyourgadget.gadgetbridge.GBException; import nodomain.freeyourgadget.gadgetbridge.GBException;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.activities.ControlCenterv2; import nodomain.freeyourgadget.gadgetbridge.activities.ControlCenterv2;
import nodomain.freeyourgadget.gadgetbridge.entities.AbstractActivitySample; import nodomain.freeyourgadget.gadgetbridge.entities.AbstractActivitySample;
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession; import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
@ -112,11 +116,6 @@ public class UnknownDeviceCoordinator extends AbstractDeviceCoordinator {
protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) throws GBException { protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) throws GBException {
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.UNKNOWN;
}
@Override @Override
public Class<? extends Activity> getPairingActivity() { public Class<? extends Activity> getPairingActivity() {
return ControlCenterv2.class; return ControlCenterv2.class;
@ -218,4 +217,23 @@ public class UnknownDeviceCoordinator extends AbstractDeviceCoordinator {
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return UnknownDeviceSupport.class; return UnknownDeviceSupport.class;
} }
@Override
@StringRes
public int getDeviceNameResource() {
return R.string.devicetype_unknown;
}
@Override
@DrawableRes
public int getDefaultIconResource() {
return R.drawable.ic_device_unknown;
}
@Override
@DrawableRes
public int getDisabledIconResource() {
return R.drawable.ic_device_unknown_disabled;
}
} }

View File

@ -18,6 +18,7 @@ import java.util.Collection;
import java.util.List; import java.util.List;
import nodomain.freeyourgadget.gadgetbridge.GBException; import nodomain.freeyourgadget.gadgetbridge.GBException;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractDeviceCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.AbstractDeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider; import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
@ -32,10 +33,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.asteroidos.AsteroidO
public class AsteroidOSDeviceCoordinator extends AbstractDeviceCoordinator { public class AsteroidOSDeviceCoordinator extends AbstractDeviceCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AsteroidOSDeviceCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AsteroidOSDeviceCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.ASTEROIDOS;
}
@Override @Override
public String getManufacturer() { public String getManufacturer() {
@ -163,4 +160,9 @@ public class AsteroidOSDeviceCoordinator extends AbstractDeviceCoordinator {
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return AsteroidOSDeviceSupport.class; return AsteroidOSDeviceSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_asteroidos;
}
} }

View File

@ -90,7 +90,7 @@ public class AppsManagementActivity extends AbstractGBActivity {
} else { } else {
throw new IllegalArgumentException("Must provide a device when invoking this activity"); throw new IllegalArgumentException("Must provide a device when invoking this activity");
} }
mCoordinator = DeviceHelper.getInstance().getCoordinator(mGBDevice); mCoordinator = mGBDevice.getDeviceCoordinator();
} }
private void toast(String data) { private void toast(String data) {

View File

@ -49,11 +49,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.banglejs.BangleJSDev
public class BangleJSCoordinator extends AbstractBLEDeviceCoordinator { public class BangleJSCoordinator extends AbstractBLEDeviceCoordinator {
@Override
public DeviceType getDeviceType() {
return DeviceType.BANGLEJS;
}
@Override @Override
public String getManufacturer() { public String getManufacturer() {
return "Espruino"; return "Espruino";
@ -236,4 +231,21 @@ public class BangleJSCoordinator extends AbstractBLEDeviceCoordinator {
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return BangleJSDeviceSupport.class; return BangleJSDeviceSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_banglejs;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_banglejs;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_banglejs_disabled;
}
} }

View File

@ -14,6 +14,7 @@ import java.util.Collection;
import java.util.Collections; import java.util.Collections;
import nodomain.freeyourgadget.gadgetbridge.GBException; import nodomain.freeyourgadget.gadgetbridge.GBException;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider; import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
@ -49,7 +50,7 @@ public class BinarySensorCoordinator extends AbstractBLEDeviceCoordinator {
Log.d("coordinator", "candidate name: " + candidate.getName()); Log.d("coordinator", "candidate name: " + candidate.getName());
for(ParcelUuid service : candidate.getServiceUuids()){ for(ParcelUuid service : candidate.getServiceUuids()){
if(service.getUuid().toString().equals(BinarySensorSupport.BINARY_SENSOR_SERVICE_UUID)){ if(service.getUuid().toString().equals(BinarySensorSupport.BINARY_SENSOR_SERVICE_UUID)){
return getDeviceType(); return DeviceType.BINARY_SENSOR;
}; };
} }
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
@ -60,11 +61,6 @@ public class BinarySensorCoordinator extends AbstractBLEDeviceCoordinator {
return new int[0]; return new int[0];
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.BINARY_SENSOR;
}
@Nullable @Nullable
@Override @Override
public Class<? extends Activity> getPairingActivity() { public Class<? extends Activity> getPairingActivity() {
@ -161,4 +157,21 @@ public class BinarySensorCoordinator extends AbstractBLEDeviceCoordinator {
public int getBondingStyle() { public int getBondingStyle() {
return BONDING_STYLE_NONE; return BONDING_STYLE_NONE;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_binary_sensor;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_unknown;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_unknown_disabled;
}
} }

View File

@ -83,11 +83,6 @@ public class CasioGB6900DeviceCoordinator extends CasioDeviceCoordinator {
return true; return true;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.CASIOGB6900;
}
@Override @Override
public Class<? extends Activity> getPairingActivity() { public Class<? extends Activity> getPairingActivity() {
return null; return null;
@ -161,4 +156,9 @@ public class CasioGB6900DeviceCoordinator extends CasioDeviceCoordinator {
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return CasioGB6900DeviceSupport.class; return CasioGB6900DeviceSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_casiogb6900;
}
} }

View File

@ -88,11 +88,6 @@ public class CasioGBX100DeviceCoordinator extends CasioDeviceCoordinator {
return false; return false;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.CASIOGBX100;
}
@Override @Override
public Class<? extends Activity> getPairingActivity() { public Class<? extends Activity> getPairingActivity() {
return null; return null;
@ -175,4 +170,9 @@ public class CasioGBX100DeviceCoordinator extends CasioDeviceCoordinator {
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return CasioGBX100DeviceSupport.class; return CasioGBX100DeviceSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_casiogbx100;
}
} }

View File

@ -20,6 +20,7 @@ package nodomain.freeyourgadget.gadgetbridge.devices.casio.gwb5600;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate; import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
@ -41,7 +42,7 @@ public class CasioGMWB5000DeviceCoordinator extends CasioGWB5600DeviceCoordinato
} }
@Override @Override
public DeviceType getDeviceType() { public int getDeviceNameResource() {
return DeviceType.CASIOGMWB5000; return R.string.devicetype_casiogmwb5000;
} }
} }

View File

@ -29,6 +29,7 @@ import android.os.ParcelUuid;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider; import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
@ -59,11 +60,6 @@ public class CasioGWB5600DeviceCoordinator extends CasioDeviceCoordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.CASIOGWB5600;
}
@Override @Override
public int getBondingStyle(){ public int getBondingStyle(){
return BONDING_STYLE_BOND; return BONDING_STYLE_BOND;
@ -104,6 +100,11 @@ public class CasioGWB5600DeviceCoordinator extends CasioDeviceCoordinator {
return CasioGWB5600DeviceSupport.class; return CasioGWB5600DeviceSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_casiogwb5600;
}
@Override @Override
public InstallHandler findInstallHandler(Uri uri, Context context) { public InstallHandler findInstallHandler(Uri uri, Context context) {
return null; return null;

View File

@ -25,6 +25,7 @@ import androidx.annotation.NonNull;
import java.util.EnumSet; import java.util.EnumSet;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider; import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
@ -49,11 +50,6 @@ public class DomyosT540Coordinator extends AbstractBLEDeviceCoordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.DOMYOS_T540;
}
@Override @Override
public Class<? extends Activity> getPairingActivity() { public Class<? extends Activity> getPairingActivity() {
return null; return null;
@ -149,4 +145,21 @@ public class DomyosT540Coordinator extends AbstractBLEDeviceCoordinator {
protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) { protected void deleteDevice(@NonNull GBDevice gbDevice, @NonNull Device device, @NonNull DaoSession session) {
// nothing to delete, yet // nothing to delete, yet
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_domyos_t540;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_lovetoy;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_lovetoy_disabled;
}
} }

View File

@ -82,11 +82,6 @@ public class FitProDeviceCoordinator extends AbstractBLEDeviceCoordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.FITPRO;
}
@Override @Override
public int getBondingStyle() { public int getBondingStyle() {
// different devices seem to work differently. // different devices seem to work differently.
@ -202,4 +197,9 @@ public class FitProDeviceCoordinator extends AbstractBLEDeviceCoordinator {
public EnumSet<ServiceDeviceSupport.Flags> getInitialFlags() { public EnumSet<ServiceDeviceSupport.Flags> getInitialFlags() {
return EnumSet.of(ServiceDeviceSupport.Flags.THROTTLING, ServiceDeviceSupport.Flags.BUSY_CHECKING); return EnumSet.of(ServiceDeviceSupport.Flags.THROTTLING, ServiceDeviceSupport.Flags.BUSY_CHECKING);
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_fitpro;
}
} }

View File

@ -10,6 +10,7 @@ import androidx.annotation.Nullable;
import java.util.UUID; import java.util.UUID;
import nodomain.freeyourgadget.gadgetbridge.GBException; import nodomain.freeyourgadget.gadgetbridge.GBException;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider; import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
@ -37,11 +38,6 @@ public class FlipperZeroCoordinator extends AbstractBLEDeviceCoordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.FLIPPER_ZERO;
}
@Nullable @Nullable
@Override @Override
public Class<? extends Activity> getPairingActivity() { public Class<? extends Activity> getPairingActivity() {
@ -123,4 +119,21 @@ public class FlipperZeroCoordinator extends AbstractBLEDeviceCoordinator {
public int getBondingStyle() { public int getBondingStyle() {
return BONDING_STYLE_NONE; return BONDING_STYLE_NONE;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_flipper_zero;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_flipper;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_flipper_disabled;
}
} }

View File

@ -29,10 +29,6 @@ public class GalaxyBuds2DeviceCoordinator extends GalaxyBudsGenericCoordinator {
public DeviceSpecificSettingsCustomizer getDeviceSpecificSettingsCustomizer(final GBDevice device) { public DeviceSpecificSettingsCustomizer getDeviceSpecificSettingsCustomizer(final GBDevice device) {
return new GalaxyBudsSettingsCustomizer(device); return new GalaxyBudsSettingsCustomizer(device);
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.GALAXY_BUDS2;
}
@Override @Override
public int getBatteryCount() { public int getBatteryCount() {
@ -53,4 +49,21 @@ public class GalaxyBuds2DeviceCoordinator extends GalaxyBudsGenericCoordinator {
R.xml.devicesettings_galaxy_buds_2, R.xml.devicesettings_galaxy_buds_2,
}; };
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_galaxybuds_2;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_galaxy_buds_pro;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_galaxy_buds_pro_disabled;
}
} }

View File

@ -29,10 +29,6 @@ public class GalaxyBuds2ProDeviceCoordinator extends GalaxyBudsGenericCoordinato
public DeviceSpecificSettingsCustomizer getDeviceSpecificSettingsCustomizer(final GBDevice device) { public DeviceSpecificSettingsCustomizer getDeviceSpecificSettingsCustomizer(final GBDevice device) {
return new GalaxyBudsSettingsCustomizer(device); return new GalaxyBudsSettingsCustomizer(device);
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.GALAXY_BUDS2_PRO;
}
@Override @Override
public int getBatteryCount() { public int getBatteryCount() {
@ -53,4 +49,21 @@ public class GalaxyBuds2ProDeviceCoordinator extends GalaxyBudsGenericCoordinato
R.xml.devicesettings_galaxy_buds_2_pro, R.xml.devicesettings_galaxy_buds_2_pro,
}; };
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_galaxybuds_2_pro;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_galaxy_buds_pro;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_galaxy_buds_pro_disabled;
}
} }

View File

@ -24,11 +24,6 @@ public class GalaxyBudsDeviceCoordinator extends GalaxyBudsGenericCoordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.GALAXY_BUDS;
}
@Override @Override
public int getBatteryCount() { public int getBatteryCount() {
return 2; return 2;
@ -41,6 +36,11 @@ public class GalaxyBudsDeviceCoordinator extends GalaxyBudsGenericCoordinator {
return new BatteryConfig[]{battery1, battery2}; return new BatteryConfig[]{battery1, battery2};
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_galaxybuds;
}
@Override @Override
public int[] getSupportedDeviceSpecificSettings(GBDevice device) { public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
return new int[]{ return new int[]{

View File

@ -8,6 +8,7 @@ import androidx.annotation.NonNull;
import androidx.annotation.Nullable; import androidx.annotation.Nullable;
import nodomain.freeyourgadget.gadgetbridge.GBException; import nodomain.freeyourgadget.gadgetbridge.GBException;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLClassicDeviceCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLClassicDeviceCoordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider; import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
@ -118,4 +119,14 @@ public abstract class GalaxyBudsGenericCoordinator extends AbstractBLClassicDevi
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return GalaxyBudsDeviceSupport.class; return GalaxyBudsDeviceSupport.class;
} }
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_galaxy_buds;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_galaxy_buds_disabled;
}
} }

View File

@ -24,11 +24,6 @@ public class GalaxyBudsLiveDeviceCoordinator extends GalaxyBudsGenericCoordinato
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.GALAXY_BUDS_LIVE;
}
@Override @Override
public int getBatteryCount() { public int getBatteryCount() {
return 3; return 3;
@ -49,4 +44,21 @@ public class GalaxyBudsLiveDeviceCoordinator extends GalaxyBudsGenericCoordinato
R.xml.devicesettings_galaxy_buds_live, R.xml.devicesettings_galaxy_buds_live,
}; };
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_galaxybuds_live;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_galaxy_buds_live;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_galaxy_buds_live_disabled;
}
} }

View File

@ -29,10 +29,6 @@ public class GalaxyBudsProDeviceCoordinator extends GalaxyBudsGenericCoordinator
public DeviceSpecificSettingsCustomizer getDeviceSpecificSettingsCustomizer(final GBDevice device) { public DeviceSpecificSettingsCustomizer getDeviceSpecificSettingsCustomizer(final GBDevice device) {
return new GalaxyBudsSettingsCustomizer(device); return new GalaxyBudsSettingsCustomizer(device);
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.GALAXY_BUDS_PRO;
}
@Override @Override
public int getBatteryCount() { public int getBatteryCount() {
@ -53,4 +49,21 @@ public class GalaxyBudsProDeviceCoordinator extends GalaxyBudsGenericCoordinator
R.xml.devicesettings_galaxy_buds_pro, R.xml.devicesettings_galaxy_buds_pro,
}; };
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_galaxybuds_pro;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_galaxy_buds_pro;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_galaxy_buds_pro_disabled;
}
} }

View File

@ -22,6 +22,8 @@ package nodomain.freeyourgadget.gadgetbridge.devices.hplus;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate; import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
@ -41,14 +43,13 @@ public class EXRIZUK8Coordinator extends HPlusCoordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.EXRIZUK8;
}
@Override @Override
public String getManufacturer() { public String getManufacturer() {
return "EXRIZU"; return "EXRIZU";
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_exrizu_k8;
}
} }

View File

@ -108,11 +108,6 @@ public class HPlusCoordinator extends AbstractBLEDeviceCoordinator {
return true; return true;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.HPLUS;
}
@Override @Override
public Class<? extends Activity> getPairingActivity() { public Class<? extends Activity> getPairingActivity() {
return null; return null;
@ -336,5 +331,22 @@ public class HPlusCoordinator extends AbstractBLEDeviceCoordinator {
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return HPlusSupport.class; return HPlusSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_hplus;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_hplus;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_hplus_disabled;
}
} }

View File

@ -22,6 +22,8 @@ package nodomain.freeyourgadget.gadgetbridge.devices.hplus;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate; import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
@ -41,14 +43,13 @@ public class MakibesF68Coordinator extends HPlusCoordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.MAKIBESF68;
}
@Override @Override
public String getManufacturer() { public String getManufacturer() {
return "Makibes"; return "Makibes";
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_makibes_f68;
}
} }

View File

@ -22,6 +22,8 @@ package nodomain.freeyourgadget.gadgetbridge.devices.hplus;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate; import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
@ -41,14 +43,13 @@ public class Q8Coordinator extends HPlusCoordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.Q8;
}
@Override @Override
public String getManufacturer() { public String getManufacturer() {
return "Makibes"; return "Makibes";
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_q8;
}
} }

View File

@ -19,6 +19,7 @@ package nodomain.freeyourgadget.gadgetbridge.devices.hplus;
import androidx.annotation.NonNull; import androidx.annotation.NonNull;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate; import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
@ -42,11 +43,6 @@ public class SG2Coordinator extends HPlusCoordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.SG2;
}
@Override @Override
public String getManufacturer() { public String getManufacturer() {
return "Lemfo"; return "Lemfo";
@ -66,4 +62,9 @@ public class SG2Coordinator extends HPlusCoordinator {
public int getBondingStyle() { public int getBondingStyle() {
return BONDING_STYLE_ASK; return BONDING_STYLE_ASK;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_sg2;
}
} }

View File

@ -584,4 +584,14 @@ public abstract class HuamiCoordinator extends AbstractBLEDeviceCoordinator {
public static Date getHourlyChimeEnd(String deviceAddress) { public static Date getHourlyChimeEnd(String deviceAddress) {
return getTimePreference(DeviceSettingsPreferenceConst.PREF_HOURLY_CHIME_END, "22:00", deviceAddress); return getTimePreference(DeviceSettingsPreferenceConst.PREF_HOURLY_CHIME_END, "22:00", deviceAddress);
} }
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_zetime;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_zetime_disabled;
}
} }

View File

@ -38,11 +38,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitband5.A
public class AmazfitBand5Coordinator extends HuamiCoordinator { public class AmazfitBand5Coordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBand5Coordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitBand5Coordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITBAND5;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -170,4 +165,21 @@ public class AmazfitBand5Coordinator extends HuamiCoordinator {
public int getBondingStyle() { public int getBondingStyle() {
return BONDING_STYLE_REQUIRE_KEY; return BONDING_STYLE_REQUIRE_KEY;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_band5;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_miband2;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_miband2_disabled;
}
} }

View File

@ -24,6 +24,7 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -51,11 +52,6 @@ public class AmazfitBand7Coordinator extends Huami2021Coordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITBAND7;
}
@NonNull @NonNull
@Override @Override
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
@ -76,4 +72,21 @@ public class AmazfitBand7Coordinator extends Huami2021Coordinator {
public boolean supportsBluetoothPhoneCalls(final GBDevice device) { public boolean supportsBluetoothPhoneCalls(final GBDevice device) {
return false; return false;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_band7;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_default;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_default_disabled;
}
} }

View File

@ -37,11 +37,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.Ama
public class AmazfitBipCoordinator extends HuamiCoordinator { public class AmazfitBipCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITBIP;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -105,4 +100,20 @@ public class AmazfitBipCoordinator extends HuamiCoordinator {
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return AmazfitBipSupport.class; return AmazfitBipSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_bip;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
} }

View File

@ -36,11 +36,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip.Ama
public class AmazfitBipLiteCoordinator extends AmazfitBipCoordinator { public class AmazfitBipLiteCoordinator extends AmazfitBipCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipLiteCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipLiteCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITBIP_LITE;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -90,6 +85,11 @@ public class AmazfitBipLiteCoordinator extends AmazfitBipCoordinator {
}; };
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_bip_lite;
}
@NonNull @NonNull
@Override @Override
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {

View File

@ -36,11 +36,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbip3pro
public class AmazfitBip3ProCoordinator extends HuamiCoordinator { public class AmazfitBip3ProCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBip3ProCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitBip3ProCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITBIP3PRO;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(final GBDeviceCandidate candidate) { public DeviceType getSupportedType(final GBDeviceCandidate candidate) {
@ -172,4 +167,21 @@ public class AmazfitBip3ProCoordinator extends HuamiCoordinator {
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return AmazfitBip3ProSupport.class; return AmazfitBip3ProSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_bip3_pro;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
} }

View File

@ -24,6 +24,7 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -62,11 +63,6 @@ public class AmazfitBip5Coordinator extends Huami2021Coordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITBIP5;
}
@Override @Override
public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) { public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
return new AmazfitBip5FWInstallHandler(uri, context); return new AmazfitBip5FWInstallHandler(uri, context);
@ -106,4 +102,21 @@ public class AmazfitBip5Coordinator extends Huami2021Coordinator {
public boolean supportsBluetoothPhoneCalls(final GBDevice device) { public boolean supportsBluetoothPhoneCalls(final GBDevice device) {
return true; return true;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_bip5;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
} }

View File

@ -37,11 +37,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbips.Am
public class AmazfitBipSCoordinator extends HuamiCoordinator { public class AmazfitBipSCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipSCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipSCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITBIPS;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -126,4 +121,21 @@ public class AmazfitBipSCoordinator extends HuamiCoordinator {
public int getBondingStyle() { public int getBondingStyle() {
return BONDING_STYLE_REQUIRE_KEY; return BONDING_STYLE_REQUIRE_KEY;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_bips;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
} }

View File

@ -25,6 +25,7 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate; import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType; import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
@ -34,11 +35,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbips.Am
public class AmazfitBipSLiteCoordinator extends AmazfitBipSCoordinator { public class AmazfitBipSLiteCoordinator extends AmazfitBipSCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipSLiteCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipSLiteCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITBIPS_LITE;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -59,6 +55,22 @@ public class AmazfitBipSLiteCoordinator extends AmazfitBipSCoordinator {
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_bips_lite;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
@NonNull @NonNull
@Override @Override
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {

View File

@ -38,11 +38,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbipu.Am
public class AmazfitBipUCoordinator extends HuamiCoordinator { public class AmazfitBipUCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipUCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipUCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITBIPU;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -174,4 +169,21 @@ public class AmazfitBipUCoordinator extends HuamiCoordinator {
public int getBondingStyle() { public int getBondingStyle() {
return BONDING_STYLE_REQUIRE_KEY; return BONDING_STYLE_REQUIRE_KEY;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_bipu;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
} }

View File

@ -38,11 +38,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitbipupro
public class AmazfitBipUProCoordinator extends HuamiCoordinator { public class AmazfitBipUProCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipUProCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitBipUProCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITBIPUPRO;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -165,4 +160,21 @@ public class AmazfitBipUProCoordinator extends HuamiCoordinator {
public int getBondingStyle() { public int getBondingStyle() {
return BONDING_STYLE_REQUIRE_KEY; return BONDING_STYLE_REQUIRE_KEY;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_bipupro;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
} }

View File

@ -24,6 +24,7 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -51,17 +52,17 @@ public class AmazfitCheetahProCoordinator extends Huami2021Coordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITCHEETAHPRO;
}
@NonNull @NonNull
@Override @Override
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return AmazfitCheetahProSupport.class; return AmazfitCheetahProSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_cheetah_pro;
}
@Override @Override
public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) { public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
return new AmazfitCheetahProFWInstallHandler(uri, context); return new AmazfitCheetahProFWInstallHandler(uri, context);

View File

@ -24,6 +24,7 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -47,6 +48,11 @@ public class AmazfitCheetahRoundCoordinator extends Huami2021Coordinator {
return AmazfitCheetahRoundSupport.class; return AmazfitCheetahRoundSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_cheetah_round;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(final GBDeviceCandidate candidate) { public DeviceType getSupportedType(final GBDeviceCandidate candidate) {
@ -62,11 +68,6 @@ public class AmazfitCheetahRoundCoordinator extends Huami2021Coordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITCHEETAHROUND;
}
@Override @Override
public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) { public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
return new AmazfitCheetahRoundFWInstallHandler(uri, context); return new AmazfitCheetahRoundFWInstallHandler(uri, context);

View File

@ -24,6 +24,7 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -62,11 +63,6 @@ public class AmazfitCheetahSquareCoordinator extends Huami2021Coordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITCHEETAHSQUARE;
}
@Override @Override
public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) { public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
return new AmazfitCheetahSquareFWInstallHandler(uri, context); return new AmazfitCheetahSquareFWInstallHandler(uri, context);
@ -111,4 +107,21 @@ public class AmazfitCheetahSquareCoordinator extends Huami2021Coordinator {
public boolean supportsBluetoothPhoneCalls(final GBDevice device) { public boolean supportsBluetoothPhoneCalls(final GBDevice device) {
return true; return true;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_cheetah_square;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
} }

View File

@ -37,11 +37,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcor.Ama
public class AmazfitCorCoordinator extends HuamiCoordinator { public class AmazfitCorCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitCorCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitCorCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITCOR;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -113,4 +108,19 @@ public class AmazfitCorCoordinator extends HuamiCoordinator {
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return AmazfitCorSupport.class; return AmazfitCorSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_cor;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_default;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_default_disabled;
}
} }

View File

@ -37,11 +37,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitcor2.Am
public class AmazfitCor2Coordinator extends HuamiCoordinator { public class AmazfitCor2Coordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitCor2Coordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitCor2Coordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITCOR2;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -115,4 +110,20 @@ public class AmazfitCor2Coordinator extends HuamiCoordinator {
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return AmazfitCor2Support.class; return AmazfitCor2Support.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_cor2;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_default;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_default_disabled;
}
} }

View File

@ -24,6 +24,7 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -47,6 +48,11 @@ public class AmazfitFalconCoordinator extends Huami2021Coordinator {
return AmazfitFalconSupport.class; return AmazfitFalconSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_falcon;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(final GBDeviceCandidate candidate) { public DeviceType getSupportedType(final GBDeviceCandidate candidate) {
@ -62,11 +68,6 @@ public class AmazfitFalconCoordinator extends Huami2021Coordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITFALCON;
}
@Override @Override
public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) { public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
return new AmazfitFalconFWInstallHandler(uri, context); return new AmazfitFalconFWInstallHandler(uri, context);

View File

@ -37,11 +37,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr.Ama
public class AmazfitGTRCoordinator extends HuamiCoordinator { public class AmazfitGTRCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTRCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTRCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITGTR;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -115,4 +110,10 @@ public class AmazfitGTRCoordinator extends HuamiCoordinator {
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return AmazfitGTRSupport.class; return AmazfitGTRSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gtr;
}
} }

View File

@ -37,11 +37,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr.Ama
public class AmazfitGTRLiteCoordinator extends HuamiCoordinator { public class AmazfitGTRLiteCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTRLiteCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTRLiteCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITGTR_LITE;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -113,4 +108,10 @@ public class AmazfitGTRLiteCoordinator extends HuamiCoordinator {
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return AmazfitGTRLiteSupport.class; return AmazfitGTRLiteSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gtr_lite;
}
} }

View File

@ -37,11 +37,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr2.Am
public class AmazfitGTR2Coordinator extends HuamiCoordinator { public class AmazfitGTR2Coordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTR2Coordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTR2Coordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITGTR2;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -120,4 +115,9 @@ public class AmazfitGTR2Coordinator extends HuamiCoordinator {
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return AmazfitGTR2Support.class; return AmazfitGTR2Support.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gtr2;
}
} }

View File

@ -37,11 +37,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgtr2.Am
public class AmazfitGTR2eCoordinator extends HuamiCoordinator { public class AmazfitGTR2eCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTR2eCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTR2eCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITGTR2E;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -120,4 +115,10 @@ public class AmazfitGTR2eCoordinator extends HuamiCoordinator {
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return AmazfitGTR2eSupport.class; return AmazfitGTR2eSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gtr2e;
}
} }

View File

@ -24,6 +24,7 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -51,17 +52,17 @@ public class AmazfitGTR3Coordinator extends Huami2021Coordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITGTR3;
}
@NonNull @NonNull
@Override @Override
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return AmazfitGTR3Support.class; return AmazfitGTR3Support.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gtr3;
}
@Override @Override
public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) { public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
return new AmazfitGTR3FWInstallHandler(uri, context); return new AmazfitGTR3FWInstallHandler(uri, context);

View File

@ -24,6 +24,7 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -51,17 +52,17 @@ public class AmazfitGTR3ProCoordinator extends Huami2021Coordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITGTR3PRO;
}
@NonNull @NonNull
@Override @Override
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return AmazfitGTR3ProSupport.class; return AmazfitGTR3ProSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gtr3_pro;
}
@Override @Override
public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) { public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
return new AmazfitGTR3ProFWInstallHandler(uri, context); return new AmazfitGTR3ProFWInstallHandler(uri, context);

View File

@ -24,6 +24,7 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -51,17 +52,17 @@ public class AmazfitGTR4Coordinator extends Huami2021Coordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITGTR4;
}
@NonNull @NonNull
@Override @Override
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return AmazfitGTR4Support.class; return AmazfitGTR4Support.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gtr4;
}
@Override @Override
public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) { public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
return new AmazfitGTR4FWInstallHandler(uri, context); return new AmazfitGTR4FWInstallHandler(uri, context);

View File

@ -24,6 +24,7 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -42,6 +43,11 @@ public class AmazfitGTRMiniCoordinator extends Huami2021Coordinator {
return AmazfitGTRMiniSupport.class; return AmazfitGTRMiniSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gtr_mini;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(final GBDeviceCandidate candidate) { public DeviceType getSupportedType(final GBDeviceCandidate candidate) {
@ -57,11 +63,6 @@ public class AmazfitGTRMiniCoordinator extends Huami2021Coordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITGTRMINI;
}
@Override @Override
public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) { public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
return new AmazfitGTRMiniFWInstallHandler(uri, context); return new AmazfitGTRMiniFWInstallHandler(uri, context);

View File

@ -36,11 +36,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts.Ama
public class AmazfitGTSCoordinator extends HuamiCoordinator { public class AmazfitGTSCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTSCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTSCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITGTS;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -114,4 +109,21 @@ public class AmazfitGTSCoordinator extends HuamiCoordinator {
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return AmazfitGTSSupport.class; return AmazfitGTSSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gts;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
} }

View File

@ -37,11 +37,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts2.Am
public class AmazfitGTS2Coordinator extends HuamiCoordinator { public class AmazfitGTS2Coordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTS2Coordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTS2Coordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITGTS2;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -120,4 +115,21 @@ public class AmazfitGTS2Coordinator extends HuamiCoordinator {
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return AmazfitGTS2Support.class; return AmazfitGTS2Support.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gts2;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
} }

View File

@ -36,11 +36,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts2.Am
public class AmazfitGTS2MiniCoordinator extends AmazfitGTS2Coordinator { public class AmazfitGTS2MiniCoordinator extends AmazfitGTS2Coordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTS2MiniCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTS2MiniCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITGTS2_MINI;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -84,6 +79,22 @@ public class AmazfitGTS2MiniCoordinator extends AmazfitGTS2Coordinator {
}; };
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gts2_mini;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
@NonNull @NonNull
@Override @Override
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {

View File

@ -37,11 +37,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitgts2.Am
public class AmazfitGTS2eCoordinator extends HuamiCoordinator { public class AmazfitGTS2eCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTS2eCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitGTS2eCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITGTS2E;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -120,4 +115,21 @@ public class AmazfitGTS2eCoordinator extends HuamiCoordinator {
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return AmazfitGTS2eSupport.class; return AmazfitGTS2eSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gts2e;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
} }

View File

@ -24,6 +24,7 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -51,11 +52,6 @@ public class AmazfitGTS3Coordinator extends Huami2021Coordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITGTS3;
}
@NonNull @NonNull
@Override @Override
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
@ -76,4 +72,21 @@ public class AmazfitGTS3Coordinator extends Huami2021Coordinator {
public boolean supportsBluetoothPhoneCalls(final GBDevice device) { public boolean supportsBluetoothPhoneCalls(final GBDevice device) {
return false; return false;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gts3;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
} }

View File

@ -24,6 +24,7 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -51,11 +52,6 @@ public class AmazfitGTS4Coordinator extends Huami2021Coordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITGTS4;
}
@NonNull @NonNull
@Override @Override
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
@ -101,4 +97,21 @@ public class AmazfitGTS4Coordinator extends Huami2021Coordinator {
public boolean supportsBluetoothPhoneCalls(final GBDevice device) { public boolean supportsBluetoothPhoneCalls(final GBDevice device) {
return true; return true;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gts4;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
} }

View File

@ -24,6 +24,7 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -51,11 +52,6 @@ public class AmazfitGTS4MiniCoordinator extends Huami2021Coordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITGTS4MINI;
}
@NonNull @NonNull
@Override @Override
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
@ -76,4 +72,21 @@ public class AmazfitGTS4MiniCoordinator extends Huami2021Coordinator {
public boolean supportsBluetoothPhoneCalls(final GBDevice device) { public boolean supportsBluetoothPhoneCalls(final GBDevice device) {
return false; return false;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_gts4_mini;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
} }

View File

@ -41,11 +41,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitneo.Ama
public class AmazfitNeoCoordinator extends HuamiCoordinator { public class AmazfitNeoCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitNeoCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitNeoCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITNEO;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -140,4 +135,21 @@ public class AmazfitNeoCoordinator extends HuamiCoordinator {
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return AmazfitNeoSupport.class; return AmazfitNeoSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_neo;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
} }

View File

@ -24,6 +24,7 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbipu.AmazfitBipUCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbipu.AmazfitBipUCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate; import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
@ -34,11 +35,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitpop.Ama
public class AmazfitPopCoordinator extends AmazfitBipUCoordinator { public class AmazfitPopCoordinator extends AmazfitBipUCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitPopCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitPopCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITPOP;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -59,6 +55,22 @@ public class AmazfitPopCoordinator extends AmazfitBipUCoordinator {
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_pop;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
@NonNull @NonNull
@Override @Override
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {

View File

@ -24,6 +24,7 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler; import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbipupro.AmazfitBipUProCoordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.amazfitbipupro.AmazfitBipUProCoordinator;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate; import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
@ -34,11 +35,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitpoppro.
public class AmazfitPopProCoordinator extends AmazfitBipUProCoordinator { public class AmazfitPopProCoordinator extends AmazfitBipUProCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitPopProCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitPopProCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITPOPPRO;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -59,6 +55,22 @@ public class AmazfitPopProCoordinator extends AmazfitBipUProCoordinator {
return handler.isValid() ? handler : null; return handler.isValid() ? handler : null;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_pop_pro;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
@NonNull @NonNull
@Override @Override
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {

View File

@ -37,11 +37,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfittrex.Am
public class AmazfitTRexCoordinator extends HuamiCoordinator { public class AmazfitTRexCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitTRexCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitTRexCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITTREX;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -114,4 +109,9 @@ public class AmazfitTRexCoordinator extends HuamiCoordinator {
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return AmazfitTRexSupport.class; return AmazfitTRexSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_trex;
}
} }

View File

@ -24,6 +24,7 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -51,17 +52,17 @@ public class AmazfitTRex2Coordinator extends Huami2021Coordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITTREX2;
}
@NonNull @NonNull
@Override @Override
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return AmazfitTRex2Support.class; return AmazfitTRex2Support.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_trex_2;
}
@Override @Override
public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) { public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
return new AmazfitTRex2FWInstallHandler(uri, context); return new AmazfitTRex2FWInstallHandler(uri, context);

View File

@ -37,11 +37,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfittrexpro
public class AmazfitTRexProCoordinator extends HuamiCoordinator { public class AmazfitTRexProCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitTRexProCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitTRexProCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITTREXPRO;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -114,4 +109,9 @@ public class AmazfitTRexProCoordinator extends HuamiCoordinator {
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return AmazfitTRexProSupport.class; return AmazfitTRexProSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_trex_pro;
}
} }

View File

@ -24,6 +24,7 @@ import androidx.annotation.NonNull;
import org.slf4j.Logger; import org.slf4j.Logger;
import org.slf4j.LoggerFactory; import org.slf4j.LoggerFactory;
import nodomain.freeyourgadget.gadgetbridge.R;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator; import nodomain.freeyourgadget.gadgetbridge.devices.huami.Huami2021Coordinator;
import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst; import nodomain.freeyourgadget.gadgetbridge.devices.huami.HuamiConst;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice; import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
@ -47,6 +48,11 @@ public class AmazfitTRexUltraCoordinator extends Huami2021Coordinator {
return AmazfitTRexUltraSupport.class; return AmazfitTRexUltraSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_trex_ultra;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(final GBDeviceCandidate candidate) { public DeviceType getSupportedType(final GBDeviceCandidate candidate) {
@ -62,11 +68,6 @@ public class AmazfitTRexUltraCoordinator extends Huami2021Coordinator {
return DeviceType.UNKNOWN; return DeviceType.UNKNOWN;
} }
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITTREXULTRA;
}
@Override @Override
public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) { public AbstractHuami2021FWInstallHandler createFwInstallHandler(final Uri uri, final Context context) {
return new AmazfitTRexUltraFWInstallHandler(uri, context); return new AmazfitTRexUltraFWInstallHandler(uri, context);

View File

@ -37,11 +37,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitvergel.
public class AmazfitVergeLCoordinator extends HuamiCoordinator { public class AmazfitVergeLCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitVergeLCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitVergeLCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITVERGEL;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -115,4 +110,21 @@ public class AmazfitVergeLCoordinator extends HuamiCoordinator {
public Class<? extends DeviceSupport> getDeviceSupportClass() { public Class<? extends DeviceSupport> getDeviceSupportClass() {
return AmazfitVergeLSupport.class; return AmazfitVergeLSupport.class;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_vergel;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_amazfit_bip;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_amazfit_bip_disabled;
}
} }

View File

@ -39,11 +39,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.amazfitx.Amazf
public class AmazfitXCoordinator extends HuamiCoordinator { public class AmazfitXCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(AmazfitXCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(AmazfitXCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.AMAZFITX;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -135,4 +130,21 @@ public class AmazfitXCoordinator extends HuamiCoordinator {
public int getBondingStyle() { public int getBondingStyle() {
return BONDING_STYLE_REQUIRE_KEY; return BONDING_STYLE_REQUIRE_KEY;
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_amazfit_x;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_miband2;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_miband2_disabled;
}
} }

View File

@ -41,11 +41,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband2.MiBand
public class MiBand2Coordinator extends HuamiCoordinator { public class MiBand2Coordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(MiBand2Coordinator.class); private static final Logger LOG = LoggerFactory.getLogger(MiBand2Coordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.MIBAND2;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -118,4 +113,20 @@ public class MiBand2Coordinator extends HuamiCoordinator {
public EnumSet<ServiceDeviceSupport.Flags> getInitialFlags() { public EnumSet<ServiceDeviceSupport.Flags> getInitialFlags() {
return EnumSet.of(ServiceDeviceSupport.Flags.THROTTLING, ServiceDeviceSupport.Flags.BUSY_CHECKING); return EnumSet.of(ServiceDeviceSupport.Flags.THROTTLING, ServiceDeviceSupport.Flags.BUSY_CHECKING);
} }
@Override
public int getDeviceNameResource() {
return R.string.devicetype_miband2;
}
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_miband2;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_miband2_disabled;
}
} }

View File

@ -41,11 +41,6 @@ import nodomain.freeyourgadget.gadgetbridge.service.devices.huami.miband2.MiBand
public class MiBand2HRXCoordinator extends HuamiCoordinator { public class MiBand2HRXCoordinator extends HuamiCoordinator {
private static final Logger LOG = LoggerFactory.getLogger(MiBand2HRXCoordinator.class); private static final Logger LOG = LoggerFactory.getLogger(MiBand2HRXCoordinator.class);
@Override
public DeviceType getDeviceType() {
return DeviceType.MIBAND2_HRX;
}
@NonNull @NonNull
@Override @Override
public DeviceType getSupportedType(GBDeviceCandidate candidate) { public DeviceType getSupportedType(GBDeviceCandidate candidate) {
@ -115,4 +110,19 @@ public class MiBand2HRXCoordinator extends HuamiCoordinator {
public EnumSet<ServiceDeviceSupport.Flags> getInitialFlags() { public EnumSet<ServiceDeviceSupport.Flags> getInitialFlags() {
return EnumSet.of(ServiceDeviceSupport.Flags.THROTTLING, ServiceDeviceSupport.Flags.BUSY_CHECKING); return EnumSet.of(ServiceDeviceSupport.Flags.THROTTLING, ServiceDeviceSupport.Flags.BUSY_CHECKING);
} }
@Override
public int getDefaultIconResource() {
return R.drawable.ic_device_miband2;
}
@Override
public int getDisabledIconResource() {
return R.drawable.ic_device_miband2_disabled;
}
@Override
public int getDeviceNameResource() {
return R.string.devicetype_miband2_hrx;
}
} }

Some files were not shown because too many files have changed in this diff Show More