mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-23 18:36:50 +01:00
Hybrid HR: Enabled configuring middle long press on FW 3.0 and newer
This commit is contained in:
parent
e02cd2dc32
commit
e476b8a701
@ -28,6 +28,7 @@ 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;
|
||||
|
||||
@ -244,24 +245,26 @@ public class QHybridCoordinator extends AbstractBLEDeviceCoordinator {
|
||||
|
||||
@Override
|
||||
public int[] getSupportedDeviceSpecificSettings(GBDevice device) {
|
||||
if (isHybridHR() && getFirmwareVersion() != null && getFirmwareVersion().smallerThan(new Version("2.20"))) {
|
||||
return new int[]{
|
||||
R.xml.devicesettings_fossilhybridhr_pre_fw20,
|
||||
if (!isHybridHR()) {
|
||||
return new int[0];
|
||||
}
|
||||
//Settings applicable to all firmware versions
|
||||
int[] supportedSettings = new int[]{
|
||||
R.xml.devicesettings_fossilhybridhr,
|
||||
R.xml.devicesettings_autoremove_notifications,
|
||||
R.xml.devicesettings_canned_dismisscall_16,
|
||||
R.xml.devicesettings_transliteration
|
||||
};
|
||||
//Firmware specific settings
|
||||
if (getFirmwareVersion() != null && getFirmwareVersion().smallerThan(new Version("3.0"))) {
|
||||
supportedSettings = ArrayUtils.insert(0, supportedSettings, R.xml.devicesettings_fossilhybridhr_buttonconfiguration_pre_fw30);
|
||||
} else {
|
||||
supportedSettings = ArrayUtils.insert(0, supportedSettings, R.xml.devicesettings_fossilhybridhr_buttonconfiguration);
|
||||
}
|
||||
if (isHybridHR()) {
|
||||
return new int[]{
|
||||
R.xml.devicesettings_fossilhybridhr,
|
||||
R.xml.devicesettings_autoremove_notifications,
|
||||
R.xml.devicesettings_canned_dismisscall_16,
|
||||
};
|
||||
if (getFirmwareVersion() != null && getFirmwareVersion().smallerThan(new Version("2.20"))) {
|
||||
supportedSettings = ArrayUtils.insert(1, supportedSettings, R.xml.devicesettings_fossilhybridhr_pre_fw20);
|
||||
}
|
||||
return new int[]{
|
||||
};
|
||||
return supportedSettings;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -1502,12 +1502,14 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
||||
if (firmwareVersion != null && firmwareVersion.smallerThan(new Version("2.19"))) {
|
||||
singlePressEvent = "single_click";
|
||||
}
|
||||
ArrayList<ButtonConfiguration> configs = new ArrayList<>(5);
|
||||
ArrayList<ButtonConfiguration> configs = new ArrayList<>(6);
|
||||
configs.add(new ButtonConfiguration("top_" + singlePressEvent, prefs.getString(DeviceSettingsPreferenceConst.PREF_BUTTON_1_FUNCTION_SHORT, "weatherApp")));
|
||||
configs.add(new ButtonConfiguration("top_hold", prefs.getString(DeviceSettingsPreferenceConst.PREF_BUTTON_1_FUNCTION_LONG, "weatherApp")));
|
||||
// configs.add(new ButtonConfiguration("top_double_click", prefs.getString(DeviceSettingsPreferenceConst.PREF_BUTTON_1_FUNCTION_DOUBLE, "weatherApp")));
|
||||
configs.add(new ButtonConfiguration("middle_" + singlePressEvent, prefs.getString(DeviceSettingsPreferenceConst.PREF_BUTTON_2_FUNCTION_SHORT, "commuteApp")));
|
||||
// configs.add(new ButtonConfiguration("middle_hold", prefs.getString(DeviceSettingsPreferenceConst.PREF_BUTTON_2_FUNCTION_LONG, "commuteApp")));
|
||||
if (firmwareVersion != null && firmwareVersion.greaterOrEqualThan(new Version("3.0"))) {
|
||||
configs.add(new ButtonConfiguration("middle_hold", prefs.getString(DeviceSettingsPreferenceConst.PREF_BUTTON_2_FUNCTION_LONG, "launcherApp")));
|
||||
}
|
||||
// configs.add(new ButtonConfiguration("middle_double_click", prefs.getString(DeviceSettingsPreferenceConst.PREF_BUTTON_2_FUNCTION_DOUBLE, "commuteApp")));
|
||||
configs.add(new ButtonConfiguration("bottom_" + singlePressEvent, prefs.getString(DeviceSettingsPreferenceConst.PREF_BUTTON_3_FUNCTION_SHORT, "musicApp")));
|
||||
configs.add(new ButtonConfiguration("bottom_hold", prefs.getString(DeviceSettingsPreferenceConst.PREF_BUTTON_3_FUNCTION_LONG, "musicApp")));
|
||||
|
@ -2,59 +2,6 @@
|
||||
<androidx.preference.PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<PreferenceScreen
|
||||
android:key="button_configuration"
|
||||
android:icon="@drawable/ic_smart_button"
|
||||
android:title="@string/pref_title_physical_buttons"
|
||||
android:summary="@string/pref_summary_physical_buttons">
|
||||
<ListPreference
|
||||
android:defaultValue="weatherApp"
|
||||
android:entries="@array/pref_hybridhr_buttonfunctions"
|
||||
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
|
||||
android:key="button_1_function_short"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_title_upper_button_function_short" />
|
||||
<ListPreference
|
||||
android:defaultValue="weatherApp"
|
||||
android:entries="@array/pref_hybridhr_buttonfunctions"
|
||||
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
|
||||
android:key="button_1_function_long"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_title_upper_button_function_long" />
|
||||
<ListPreference
|
||||
android:defaultValue="commuteApp"
|
||||
android:entries="@array/pref_hybridhr_buttonfunctions"
|
||||
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
|
||||
android:key="button_2_function_short"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_title_middle_button_function_short" />
|
||||
<Preference
|
||||
android:selectable="false"
|
||||
android:persistent="false"
|
||||
android:key="button_2_function_long"
|
||||
android:summary="@string/menuitem_menu"
|
||||
android:title="@string/pref_title_middle_button_function_long" />
|
||||
<ListPreference
|
||||
android:defaultValue="musicApp"
|
||||
android:entries="@array/pref_hybridhr_buttonfunctions"
|
||||
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
|
||||
android:key="button_3_function_short"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_title_lower_button_function_short" />
|
||||
<ListPreference
|
||||
android:defaultValue="musicApp"
|
||||
android:entries="@array/pref_hybridhr_buttonfunctions"
|
||||
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
|
||||
android:key="button_3_function_long"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_title_lower_button_function_long" />
|
||||
<Preference
|
||||
android:selectable="false"
|
||||
android:persistent="false"
|
||||
android:key="button_1_function_long_warning"
|
||||
android:summary="@string/fossil_hr_button_config_info" />
|
||||
</PreferenceScreen>
|
||||
|
||||
<PreferenceScreen
|
||||
android:icon="@drawable/ic_activity_unknown_small"
|
||||
android:title="@string/prefs_activity_recognition"
|
||||
|
@ -0,0 +1,59 @@
|
||||
<?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">
|
||||
|
||||
<PreferenceScreen
|
||||
android:key="button_configuration"
|
||||
android:icon="@drawable/ic_smart_button"
|
||||
android:title="@string/pref_title_physical_buttons"
|
||||
android:summary="@string/pref_summary_physical_buttons">
|
||||
<ListPreference
|
||||
android:defaultValue="weatherApp"
|
||||
android:entries="@array/pref_hybridhr_buttonfunctions"
|
||||
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
|
||||
android:key="button_1_function_short"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_title_upper_button_function_short" />
|
||||
<ListPreference
|
||||
android:defaultValue="weatherApp"
|
||||
android:entries="@array/pref_hybridhr_buttonfunctions"
|
||||
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
|
||||
android:key="button_1_function_long"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_title_upper_button_function_long" />
|
||||
<ListPreference
|
||||
android:defaultValue="launcherApp"
|
||||
android:entries="@array/pref_hybridhr_buttonfunctions"
|
||||
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
|
||||
android:key="button_2_function_short"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_title_middle_button_function_short" />
|
||||
<ListPreference
|
||||
android:defaultValue="launcherApp"
|
||||
android:entries="@array/pref_hybridhr_buttonfunctions"
|
||||
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
|
||||
android:key="button_2_function_long"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_title_middle_button_function_long" />
|
||||
<ListPreference
|
||||
android:defaultValue="musicApp"
|
||||
android:entries="@array/pref_hybridhr_buttonfunctions"
|
||||
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
|
||||
android:key="button_3_function_short"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_title_lower_button_function_short" />
|
||||
<ListPreference
|
||||
android:defaultValue="musicApp"
|
||||
android:entries="@array/pref_hybridhr_buttonfunctions"
|
||||
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
|
||||
android:key="button_3_function_long"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_title_lower_button_function_long" />
|
||||
<Preference
|
||||
android:selectable="false"
|
||||
android:persistent="false"
|
||||
android:key="button_1_function_long_warning"
|
||||
android:summary="@string/fossil_hr_button_config_info" />
|
||||
</PreferenceScreen>
|
||||
|
||||
</androidx.preference.PreferenceScreen>
|
@ -0,0 +1,58 @@
|
||||
<?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">
|
||||
|
||||
<PreferenceScreen
|
||||
android:key="button_configuration"
|
||||
android:icon="@drawable/ic_smart_button"
|
||||
android:title="@string/pref_title_physical_buttons"
|
||||
android:summary="@string/pref_summary_physical_buttons">
|
||||
<ListPreference
|
||||
android:defaultValue="weatherApp"
|
||||
android:entries="@array/pref_hybridhr_buttonfunctions"
|
||||
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
|
||||
android:key="button_1_function_short"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_title_upper_button_function_short" />
|
||||
<ListPreference
|
||||
android:defaultValue="weatherApp"
|
||||
android:entries="@array/pref_hybridhr_buttonfunctions"
|
||||
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
|
||||
android:key="button_1_function_long"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_title_upper_button_function_long" />
|
||||
<ListPreference
|
||||
android:defaultValue="commuteApp"
|
||||
android:entries="@array/pref_hybridhr_buttonfunctions"
|
||||
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
|
||||
android:key="button_2_function_short"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_title_middle_button_function_short" />
|
||||
<Preference
|
||||
android:selectable="false"
|
||||
android:persistent="false"
|
||||
android:key="button_2_function_long"
|
||||
android:summary="@string/menuitem_menu"
|
||||
android:title="@string/pref_title_middle_button_function_long" />
|
||||
<ListPreference
|
||||
android:defaultValue="musicApp"
|
||||
android:entries="@array/pref_hybridhr_buttonfunctions"
|
||||
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
|
||||
android:key="button_3_function_short"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_title_lower_button_function_short" />
|
||||
<ListPreference
|
||||
android:defaultValue="musicApp"
|
||||
android:entries="@array/pref_hybridhr_buttonfunctions"
|
||||
android:entryValues="@array/pref_hybridhr_buttonfunctions_values"
|
||||
android:key="button_3_function_long"
|
||||
android:summary="%s"
|
||||
android:title="@string/pref_title_lower_button_function_long" />
|
||||
<Preference
|
||||
android:selectable="false"
|
||||
android:persistent="false"
|
||||
android:key="button_1_function_long_warning"
|
||||
android:summary="@string/fossil_hr_button_config_info" />
|
||||
</PreferenceScreen>
|
||||
|
||||
</androidx.preference.PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user