Fossil/Skagen Hybrids: Update device settings to new structure
This commit is contained in:
parent
7a4cd3ea78
commit
cb13c7bc05
|
@ -27,6 +27,7 @@ public enum DeviceSpecificSettingsScreen {
|
|||
CONNECTION("pref_screen_connection", R.xml.devicesettings_root_connection),
|
||||
DEVELOPER("pref_screen_developer", R.xml.devicesettings_root_developer),
|
||||
DISPLAY("pref_screen_display", R.xml.devicesettings_root_display),
|
||||
GENERIC("pref_screen_generic", R.xml.devicesettings_root_generic),
|
||||
NOTIFICATIONS("pref_screen_notifications", R.xml.devicesettings_root_notifications),
|
||||
DATE_TIME("pref_screen_date_time", R.xml.devicesettings_root_date_time),
|
||||
WORKOUT("pref_screen_workout", R.xml.devicesettings_root_workout),
|
||||
|
|
|
@ -27,7 +27,6 @@ import android.os.ParcelUuid;
|
|||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import org.apache.commons.lang3.ArrayUtils;
|
||||
import org.slf4j.Logger;
|
||||
import org.slf4j.LoggerFactory;
|
||||
|
||||
|
@ -41,6 +40,8 @@ import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
|||
import nodomain.freeyourgadget.gadgetbridge.GBException;
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.activities.appmanager.AppManagerActivity;
|
||||
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettings;
|
||||
import nodomain.freeyourgadget.gadgetbridge.activities.devicesettings.DeviceSpecificSettingsScreen;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.AbstractBLEDeviceCoordinator;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.InstallHandler;
|
||||
import nodomain.freeyourgadget.gadgetbridge.devices.SampleProvider;
|
||||
|
@ -246,31 +247,37 @@ public class QHybridCoordinator extends AbstractBLEDeviceCoordinator {
|
|||
}
|
||||
|
||||
@Override
|
||||
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
|
||||
public DeviceSpecificSettings getDeviceSpecificSettings(final GBDevice device) {
|
||||
final DeviceSpecificSettings deviceSpecificSettings = new DeviceSpecificSettings();
|
||||
if (!isHybridHR()) {
|
||||
return new int[0];
|
||||
return deviceSpecificSettings;
|
||||
}
|
||||
//Settings applicable to all firmware versions
|
||||
int[] supportedSettings = new int[]{
|
||||
R.xml.devicesettings_inactivity,
|
||||
R.xml.devicesettings_fossilhybridhr_all_fw,
|
||||
R.xml.devicesettings_autoremove_notifications,
|
||||
R.xml.devicesettings_canned_dismisscall_16,
|
||||
R.xml.devicesettings_reject_call_method,
|
||||
R.xml.devicesettings_transliteration,
|
||||
R.xml.devicesettings_fossilhybridhr_dev
|
||||
};
|
||||
final List<Integer> generic = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.GENERIC);
|
||||
// Firmware version specific settings
|
||||
if (getFirmwareVersion() != null && getFirmwareVersion().smallerThan(new Version("3.0"))) {
|
||||
supportedSettings = ArrayUtils.insert(0, supportedSettings, R.xml.devicesettings_fossilhybridhr_pre_fw300);
|
||||
generic.add(R.xml.devicesettings_fossilhybridhr_pre_fw300);
|
||||
} else {
|
||||
supportedSettings = ArrayUtils.insert(0, supportedSettings, R.xml.devicesettings_fossilhybridhr_post_fw300);
|
||||
generic.add(R.xml.devicesettings_fossilhybridhr_post_fw300);
|
||||
}
|
||||
if (getFirmwareVersion() != null && getFirmwareVersion().smallerThan(new Version("2.20"))) {
|
||||
supportedSettings = ArrayUtils.insert(1, supportedSettings, R.xml.devicesettings_fossilhybridhr_pre_fw220);
|
||||
generic.add(R.xml.devicesettings_fossilhybridhr_pre_fw220);
|
||||
}
|
||||
supportedSettings = ArrayUtils.add(supportedSettings, R.xml.devicesettings_custom_deviceicon);
|
||||
return supportedSettings;
|
||||
// Settings applicable to all firmware versions
|
||||
generic.add(R.xml.devicesettings_fossilhybridhr_calibration);
|
||||
generic.add(R.xml.devicesettings_fossilhybridhr_navigation);
|
||||
final List<Integer> health = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.HEALTH);
|
||||
health.add(R.xml.devicesettings_fossilhybridhr_workout_detection);
|
||||
health.add(R.xml.devicesettings_inactivity);
|
||||
final List<Integer> notifications = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.NOTIFICATIONS);
|
||||
notifications.add(R.xml.devicesettings_fossilhybridhr_vibration);
|
||||
notifications.add(R.xml.devicesettings_autoremove_notifications);
|
||||
notifications.add(R.xml.devicesettings_canned_dismisscall_16);
|
||||
notifications.add(R.xml.devicesettings_reject_call_method);
|
||||
notifications.add(R.xml.devicesettings_transliteration);
|
||||
notifications.add(R.xml.devicesettings_custom_deviceicon);
|
||||
final List<Integer> developer = deviceSpecificSettings.addRootScreen(DeviceSpecificSettingsScreen.DEVELOPER);
|
||||
developer.add(R.xml.devicesettings_fossilhybridhr_dev);
|
||||
return deviceSpecificSettings;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
|
|
|
@ -198,6 +198,7 @@
|
|||
<string name="pref_header_calendar">Calendar</string>
|
||||
<string name="pref_header_connection">Connection</string>
|
||||
<string name="pref_header_display">Display</string>
|
||||
<string name="pref_header_generic">Generic</string>
|
||||
<string name="pref_header_health">Health</string>
|
||||
<string name="pref_header_sound_vibration">Sound & Vibration</string>
|
||||
<string name="pref_header_offline_voice">Offline Voice</string>
|
||||
|
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<Preference
|
||||
android:title="@string/qhybrid_title_calibration"
|
||||
android:icon="@drawable/ic_sensor_calibration"
|
||||
android:summary="@string/qhybrid_summary_calibration">
|
||||
<intent
|
||||
android:targetPackage="@string/applicationId"
|
||||
android:targetClass="nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.CalibrationActivity" />
|
||||
</Preference>
|
||||
|
||||
</androidx.preference.PreferenceScreen>
|
|
@ -2,52 +2,50 @@
|
|||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<PreferenceScreen
|
||||
android:key="developer_settings"
|
||||
android:icon="@drawable/ic_developer_mode"
|
||||
android:title="@string/pref_title_developer_settings"
|
||||
android:summary="@string/pref_summary_developer_settings">
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="save_raw_activity_files"
|
||||
android:layout="@layout/preference_checkbox"
|
||||
android:title="@string/pref_qhybrid_save_raw_activity_files"
|
||||
android:icon="@drawable/ic_date_range" />
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="save_raw_activity_files"
|
||||
android:layout="@layout/preference_checkbox"
|
||||
android:title="@string/pref_qhybrid_save_raw_activity_files" />
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="dangerous_external_intents"
|
||||
android:layout="@layout/preference_checkbox"
|
||||
android:title="@string/qhybrid_pref_title_external_intents"
|
||||
android:summary="@string/qhybrid_pref_summary_external_intents"
|
||||
android:icon="@drawable/ic_warning_gray"/>
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="false"
|
||||
android:key="dangerous_external_intents"
|
||||
android:layout="@layout/preference_checkbox"
|
||||
android:title="@string/qhybrid_pref_title_external_intents"
|
||||
android:summary="@string/qhybrid_pref_summary_external_intents" />
|
||||
<Preference
|
||||
android:title="@string/qhybrid_title_file_management"
|
||||
android:summary="@string/qhybrid_summary_file_management"
|
||||
android:icon="@drawable/ic_file_upload">
|
||||
<intent
|
||||
android:targetPackage="@string/applicationId"
|
||||
android:targetClass="nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.FileManagementActivity" />
|
||||
</Preference>
|
||||
|
||||
<Preference
|
||||
android:title="@string/qhybrid_title_file_management"
|
||||
android:summary="@string/qhybrid_summary_file_management">
|
||||
<intent
|
||||
android:targetPackage="@string/applicationId"
|
||||
android:targetClass="nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.FileManagementActivity" />
|
||||
</Preference>
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="enable_on_device_confirmation"
|
||||
android:layout="@layout/preference_checkbox"
|
||||
android:title="@string/qhybrid_title_on_device_confirmation"
|
||||
android:summary="@string/qhybrid_summary_on_device_confirmation"
|
||||
android:icon="@drawable/ic_vpn_key"/>
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="enable_on_device_confirmation"
|
||||
android:layout="@layout/preference_checkbox"
|
||||
android:title="@string/qhybrid_title_on_device_confirmation"
|
||||
android:summary="@string/qhybrid_summary_on_device_confirmation" />
|
||||
<EditTextPreference
|
||||
android:key="voice_service_package"
|
||||
android:title="@string/voice_service_package_title"
|
||||
android:summary="@string/voice_service_package_summary"
|
||||
android:icon="@drawable/ic_voice"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
<EditTextPreference
|
||||
android:key="voice_service_package"
|
||||
android:title="@string/voice_service_package_title"
|
||||
android:summary="@string/voice_service_package_summary"
|
||||
app:useSimpleSummaryProvider="true"/>
|
||||
|
||||
<EditTextPreference
|
||||
android:key="voice_service_class"
|
||||
android:title="@string/voice_service_class_title"
|
||||
android:summary="@string/voice_service_class_summary"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
</PreferenceScreen>
|
||||
<EditTextPreference
|
||||
android:key="voice_service_class"
|
||||
android:title="@string/voice_service_class_title"
|
||||
android:summary="@string/voice_service_class_summary"
|
||||
android:icon="@drawable/ic_voice"
|
||||
app:useSimpleSummaryProvider="true" />
|
||||
|
||||
</androidx.preference.PreferenceScreen>
|
||||
|
|
|
@ -0,0 +1,27 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<PreferenceScreen
|
||||
android:icon="@drawable/baseline_merge_24"
|
||||
android:title="@string/pref_title_fossil_hr_navigation_instructions"
|
||||
android:summary="@string/pref_summary_fossil_hr_navigation_instructions"
|
||||
android:key="navigation_app_config">
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="fossil_hr_nav_auto_foreground"
|
||||
android:layout="@layout/preference_checkbox"
|
||||
android:title="@string/pref_title_fossil_hr_nav_foreground"
|
||||
android:summary="@string/pref_summary_fossil_hr_nav_foreground"
|
||||
android:icon="@drawable/ic_info"/>
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="fossil_hr_nav_vibrate"
|
||||
android:layout="@layout/preference_checkbox"
|
||||
android:title="@string/pref_title_fossil_hr_nav_vibrate"
|
||||
android:summary="@string/pref_summary_fossil_hr_nav_vibrate"
|
||||
android:icon="@drawable/ic_action_find_lost_device"/>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
</androidx.preference.PreferenceScreen>
|
|
@ -0,0 +1,13 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<SeekBarPreference
|
||||
android:defaultValue="2"
|
||||
android:icon="@drawable/ic_vibration"
|
||||
android:key="vibration_strength"
|
||||
android:max="3"
|
||||
android:title="@string/pref_title_vibration_strength"
|
||||
app:showSeekBarValue="true" />
|
||||
|
||||
</androidx.preference.PreferenceScreen>
|
|
@ -122,44 +122,4 @@
|
|||
|
||||
</PreferenceScreen>
|
||||
|
||||
<SeekBarPreference
|
||||
android:defaultValue="2"
|
||||
android:icon="@drawable/ic_vibration"
|
||||
android:key="vibration_strength"
|
||||
android:max="3"
|
||||
android:title="@string/pref_title_vibration_strength"
|
||||
app:showSeekBarValue="true" />
|
||||
|
||||
<Preference
|
||||
android:title="@string/qhybrid_title_calibration"
|
||||
android:icon="@drawable/ic_sensor_calibration"
|
||||
android:summary="@string/qhybrid_summary_calibration">
|
||||
<intent
|
||||
android:targetPackage="@string/applicationId"
|
||||
android:targetClass="nodomain.freeyourgadget.gadgetbridge.devices.qhybrid.CalibrationActivity" />
|
||||
</Preference>
|
||||
|
||||
<PreferenceScreen
|
||||
android:icon="@drawable/baseline_merge_24"
|
||||
android:title="@string/pref_title_fossil_hr_navigation_instructions"
|
||||
android:summary="@string/pref_summary_fossil_hr_navigation_instructions"
|
||||
android:key="navigation_app_config">
|
||||
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="fossil_hr_nav_auto_foreground"
|
||||
android:layout="@layout/preference_checkbox"
|
||||
android:title="@string/pref_title_fossil_hr_nav_foreground"
|
||||
android:summary="@string/pref_summary_fossil_hr_nav_foreground"
|
||||
android:icon="@drawable/ic_info"/>
|
||||
<SwitchPreferenceCompat
|
||||
android:defaultValue="true"
|
||||
android:key="fossil_hr_nav_vibrate"
|
||||
android:layout="@layout/preference_checkbox"
|
||||
android:title="@string/pref_title_fossil_hr_nav_vibrate"
|
||||
android:summary="@string/pref_summary_fossil_hr_nav_vibrate"
|
||||
android:icon="@drawable/ic_action_find_lost_device"/>
|
||||
|
||||
</PreferenceScreen>
|
||||
|
||||
</androidx.preference.PreferenceScreen>
|
|
@ -0,0 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<PreferenceScreen
|
||||
android:icon="@drawable/ic_settings"
|
||||
android:key="pref_screen_generic"
|
||||
android:persistent="false"
|
||||
android:title="@string/pref_header_generic">
|
||||
</PreferenceScreen>
|
||||
</androidx.preference.PreferenceScreen>
|
Loading…
Reference in New Issue