Updates to address findings on PR

This commit is contained in:
foxstidious 2023-10-08 21:03:32 -04:00 committed by José Rebelo
parent 4dc10d1d02
commit 85d0722ffe
7 changed files with 49 additions and 53 deletions

View File

@ -40,9 +40,7 @@ import nodomain.freeyourgadget.gadgetbridge.entities.CasioGBX100ActivitySampleDa
import nodomain.freeyourgadget.gadgetbridge.entities.DaoSession;
import nodomain.freeyourgadget.gadgetbridge.entities.Device;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
import nodomain.freeyourgadget.gadgetbridge.impl.GBDeviceCandidate;
import nodomain.freeyourgadget.gadgetbridge.model.ActivitySample;
import nodomain.freeyourgadget.gadgetbridge.model.DeviceType;
import nodomain.freeyourgadget.gadgetbridge.service.DeviceSupport;
import nodomain.freeyourgadget.gadgetbridge.service.devices.casio.gbx100.CasioGBX100DeviceSupport;
@ -59,11 +57,25 @@ public class CasioGBX100DeviceCoordinator extends CasioDeviceCoordinator {
/** Sub-model string for GBD-H1000 in GB Device name */
public static final String GBD_H1000_SUB_MODEL = "GBD-H1000";
public static final String[] VARIANTS = {
GBX_100_SUB_MODEL,
GBD_200_SUB_MODEL,
GBD_100_SUB_MODEL,
GBD_H1000_SUB_MODEL};
protected static final Logger LOG = LoggerFactory.getLogger(CasioGBX100DeviceCoordinator.class);
@Override
protected Pattern getSupportedDeviceName() {
return Pattern.compile("CASIO.*(" + GBX_100_SUB_MODEL + "|" + GBD_100_SUB_MODEL + "|" + GBD_200_SUB_MODEL + "|" + GBD_H1000_SUB_MODEL + ")");
String pattern = CASIO_IDENTIFIER + ".*(";
for (int i = 0; i < VARIANTS.length; i++) {
pattern += VARIANTS[i];
if (i < VARIANTS.length - 1) {
pattern += "|";
}
}
pattern += ")";
return Pattern.compile(pattern);
}
@Override
@ -166,11 +178,7 @@ public class CasioGBX100DeviceCoordinator extends CasioDeviceCoordinator {
R.xml.devicesettings_autoremove_message,
R.xml.devicesettings_transliteration,
R.xml.devicesettings_preview_message_in_title,
R.xml.devicesettings_casio_alert_calendar,
R.xml.devicesettings_casio_alert_call,
R.xml.devicesettings_casio_alert_email,
R.xml.devicesettings_casio_alert_other,
R.xml.devicesettings_casio_alert_sms
R.xml.devicesettings_casio_alert
};
}

View File

@ -0,0 +1,33 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<SwitchPreference
android:defaultValue="true"
android:icon="@android:drawable/ic_menu_my_calendar"
android:key="casio_alert_calendar"
android:summary="@string/pref_summary_casio_alert_calendar"
android:title="@string/pref_title_casio_alert_calendar" />
<SwitchPreference
android:defaultValue="true"
android:icon="@android:drawable/ic_menu_call"
android:key="casio_alert_call"
android:summary="@string/pref_summary_casio_alert_call"
android:title="@string/pref_title_casio_alert_call" />
<SwitchPreference
android:defaultValue="true"
android:icon="@drawable/ic_email"
android:key="casio_alert_email"
android:summary="@string/pref_summary_casio_alert_email"
android:title="@string/pref_title_casio_alert_email" />
<SwitchPreference
android:defaultValue="true"
android:icon="@android:drawable/ic_menu_help"
android:key="casio_alert_other"
android:summary="@string/pref_summary_casio_alert_other"
android:title="@string/pref_title_casio_alert_other" />
<SwitchPreference
android:defaultValue="true"
android:icon="@drawable/ic_message_outline"
android:key="casio_alert_sms"
android:summary="@string/pref_summary_casio_alert_other"
android:title="@string/pref_title_casio_alert_other" />
</androidx.preference.PreferenceScreen>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<SwitchPreference
android:defaultValue="true"
android:icon="@android:drawable/ic_menu_my_calendar"
android:key="casio_alert_calendar"
android:summary="@string/pref_summary_casio_alert_calendar"
android:title="@string/pref_title_casio_alert_calendar" />
</androidx.preference.PreferenceScreen>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<SwitchPreference
android:defaultValue="true"
android:icon="@android:drawable/ic_menu_call"
android:key="casio_alert_call"
android:summary="@string/pref_summary_casio_alert_call"
android:title="@string/pref_title_casio_alert_call" />
</androidx.preference.PreferenceScreen>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<SwitchPreference
android:defaultValue="true"
android:icon="@android:drawable/ic_dialog_email"
android:key="casio_alert_email"
android:summary="@string/pref_summary_casio_alert_email"
android:title="@string/pref_title_casio_alert_email" />
</androidx.preference.PreferenceScreen>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<SwitchPreference
android:defaultValue="true"
android:icon="@android:drawable/ic_menu_help"
android:key="casio_alert_other"
android:summary="@string/pref_summary_casio_alert_other"
android:title="@string/pref_title_casio_alert_other" />
</androidx.preference.PreferenceScreen>

View File

@ -1,9 +0,0 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
<SwitchPreference
android:defaultValue="true"
android:icon="@drawable/ic_message_outline"
android:key="casio_alert_other"
android:summary="@string/pref_summary_casio_alert_other"
android:title="@string/pref_title_casio_alert_other" />
</androidx.preference.PreferenceScreen>