mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2024-11-29 05:16:51 +01:00
Fossil/Skagen Hybrids: Allow configuring call rejection method
This commit is contained in:
parent
59dafc54b6
commit
a0e6085324
@ -243,6 +243,7 @@ public class DeviceSettingsPreferenceConst {
|
|||||||
public static final String PREF_BLUETOOTH_CALLS_ENABLED = "bluetooth_calls_enabled";
|
public static final String PREF_BLUETOOTH_CALLS_ENABLED = "bluetooth_calls_enabled";
|
||||||
public static final String PREF_DISPLAY_CALLER = "display_caller";
|
public static final String PREF_DISPLAY_CALLER = "display_caller";
|
||||||
public static final String PREF_NOTIFICATION_DELAY_CALLS = "notification_delay_calls";
|
public static final String PREF_NOTIFICATION_DELAY_CALLS = "notification_delay_calls";
|
||||||
|
public static final String PREF_CALL_REJECT_METHOD = "call_reject_method";
|
||||||
|
|
||||||
public static final String WIFI_HOTSPOT_SSID = "wifi_hotspot_ssid";
|
public static final String WIFI_HOTSPOT_SSID = "wifi_hotspot_ssid";
|
||||||
public static final String WIFI_HOTSPOT_PASSWORD = "wifi_hotspot_password";
|
public static final String WIFI_HOTSPOT_PASSWORD = "wifi_hotspot_password";
|
||||||
|
@ -415,6 +415,7 @@ public class DeviceSpecificSettingsFragment extends AbstractPreferenceFragment i
|
|||||||
addPreferenceHandlerFor(PREF_BLUETOOTH_CALLS_ENABLED);
|
addPreferenceHandlerFor(PREF_BLUETOOTH_CALLS_ENABLED);
|
||||||
addPreferenceHandlerFor(PREF_DISPLAY_CALLER);
|
addPreferenceHandlerFor(PREF_DISPLAY_CALLER);
|
||||||
addPreferenceHandlerFor(PREF_NOTIFICATION_DELAY_CALLS);
|
addPreferenceHandlerFor(PREF_NOTIFICATION_DELAY_CALLS);
|
||||||
|
addPreferenceHandlerFor(PREF_CALL_REJECT_METHOD);
|
||||||
|
|
||||||
addPreferenceHandlerFor(PREF_SLEEP_MODE_SLEEP_SCREEN);
|
addPreferenceHandlerFor(PREF_SLEEP_MODE_SLEEP_SCREEN);
|
||||||
addPreferenceHandlerFor(PREF_SLEEP_MODE_SMART_ENABLE);
|
addPreferenceHandlerFor(PREF_SLEEP_MODE_SMART_ENABLE);
|
||||||
|
@ -246,6 +246,7 @@ public class QHybridCoordinator extends AbstractBLEDeviceCoordinator {
|
|||||||
R.xml.devicesettings_fossilhybridhr_all_fw,
|
R.xml.devicesettings_fossilhybridhr_all_fw,
|
||||||
R.xml.devicesettings_autoremove_notifications,
|
R.xml.devicesettings_autoremove_notifications,
|
||||||
R.xml.devicesettings_canned_dismisscall_16,
|
R.xml.devicesettings_canned_dismisscall_16,
|
||||||
|
R.xml.devicesettings_reject_call_method,
|
||||||
R.xml.devicesettings_transliteration,
|
R.xml.devicesettings_transliteration,
|
||||||
R.xml.devicesettings_fossilhybridhr_dev
|
R.xml.devicesettings_fossilhybridhr_dev
|
||||||
};
|
};
|
||||||
|
@ -1982,11 +1982,16 @@ public class FossilHRWatchAdapter extends FossilWatchAdapter {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void handleCallRequest(byte[] value) {
|
private void handleCallRequest(byte[] value) {
|
||||||
|
SharedPreferences prefs = getDeviceSpecificPreferences();
|
||||||
|
String rejectMethodPref = prefs.getString(DeviceSettingsPreferenceConst.PREF_CALL_REJECT_METHOD, "reject");
|
||||||
|
GBDeviceEventCallControl.Event rejectMethod = GBDeviceEventCallControl.Event.REJECT;
|
||||||
|
if (rejectMethodPref.equals("ignore")) rejectMethod = GBDeviceEventCallControl.Event.IGNORE;
|
||||||
|
|
||||||
boolean acceptCall = value[7] == (byte) 0x00;
|
boolean acceptCall = value[7] == (byte) 0x00;
|
||||||
queueWrite(new PlayCallNotificationRequest("", false, false, 0,this));
|
queueWrite(new PlayCallNotificationRequest("", false, false, 0,this));
|
||||||
|
|
||||||
GBDeviceEventCallControl callControlEvent = new GBDeviceEventCallControl();
|
GBDeviceEventCallControl callControlEvent = new GBDeviceEventCallControl();
|
||||||
callControlEvent.event = acceptCall ? GBDeviceEventCallControl.Event.START : GBDeviceEventCallControl.Event.REJECT;
|
callControlEvent.event = acceptCall ? GBDeviceEventCallControl.Event.START : rejectMethod;
|
||||||
|
|
||||||
getDeviceSupport().evaluateGBDeviceEvent(callControlEvent);
|
getDeviceSupport().evaluateGBDeviceEvent(callControlEvent);
|
||||||
}
|
}
|
||||||
|
@ -2,8 +2,9 @@
|
|||||||
android:width="24dp"
|
android:width="24dp"
|
||||||
android:height="24dp"
|
android:height="24dp"
|
||||||
android:viewportWidth="24"
|
android:viewportWidth="24"
|
||||||
android:viewportHeight="24">
|
android:viewportHeight="24"
|
||||||
|
android:tint="#7E7E7E">
|
||||||
<path
|
<path
|
||||||
android:fillColor="#FFFFFFFF"
|
android:fillColor="@android:color/white"
|
||||||
android:pathData="M18.6,15.5v1.8c0.7,0.4 1.3,0.8 1.9,1.3l1.1,-1.1c-0.9,-0.9 -1.9,-1.5 -3,-2m-13.2,0c-1,0.5 -2,1.1 -2.9,1.9l1.1,1.1c0.6,-0.5 1.2,-0.9 1.9,-1.3v-1.7M12,12c4.5,0 8.7,1.7 11.7,4.7 0.2,0.2 0.3,0.4 0.3,0.7 0,0.3 -0.1,0.5 -0.3,0.7l-2.5,2.5c-0.2,0.2 -0.4,0.3 -0.7,0.3 -0.2,0 -0.5,-0.1 -0.7,-0.3 -0.8,-0.7 -1.7,-1.4 -2.7,-1.8 -0.3,-0.2 -0.6,-0.5 -0.6,-0.9v-3.1c-1.5,-0.5 -3,-0.7 -4.6,-0.7 -1.6,0 -3.1,0.2 -4.6,0.7v3.1c0,0.4 -0.2,0.7 -0.6,0.9 -1,0.5 -1.9,1.1 -2.7,1.8 -0.2,0.2 -0.4,0.3 -0.7,0.3 -0.3,0 -0.5,-0.1 -0.7,-0.3L0.1,18.1c0,-0.2 -0.1,-0.5 -0.1,-0.7 0,-0.3 0.1,-0.5 0.3,-0.7C3.3,13.8 7.5,12 12,12zM6.5,5.5V9H5V3h6v1.5H7.5L12,9l6,-6 1,1 -7,7 -5.5,-5.5z"/>
|
android:pathData="M18.6,15.5v1.8c0.7,0.4 1.3,0.8 1.9,1.3l1.1,-1.1c-0.9,-0.9 -1.9,-1.5 -3,-2m-13.2,0c-1,0.5 -2,1.1 -2.9,1.9l1.1,1.1c0.6,-0.5 1.2,-0.9 1.9,-1.3v-1.7M12,12c4.5,0 8.7,1.7 11.7,4.7 0.2,0.2 0.3,0.4 0.3,0.7 0,0.3 -0.1,0.5 -0.3,0.7l-2.5,2.5c-0.2,0.2 -0.4,0.3 -0.7,0.3 -0.2,0 -0.5,-0.1 -0.7,-0.3 -0.8,-0.7 -1.7,-1.4 -2.7,-1.8 -0.3,-0.2 -0.6,-0.5 -0.6,-0.9v-3.1c-1.5,-0.5 -3,-0.7 -4.6,-0.7 -1.6,0 -3.1,0.2 -4.6,0.7v3.1c0,0.4 -0.2,0.7 -0.6,0.9 -1,0.5 -1.9,1.1 -2.7,1.8 -0.2,0.2 -0.4,0.3 -0.7,0.3 -0.3,0 -0.5,-0.1 -0.7,-0.3L0.1,18.1c0,-0.2 -0.1,-0.5 -0.1,-0.7 0,-0.3 0.1,-0.5 0.3,-0.7C3.3,13.8 7.5,12 12,12zM6.5,5.5V9H5V3h6v1.5H7.5L12,9l6,-6 1,1 -7,7 -5.5,-5.5z"/>
|
||||||
</vector>
|
</vector>
|
||||||
|
@ -3466,5 +3466,13 @@
|
|||||||
<item>normal</item>
|
<item>normal</item>
|
||||||
<item>precise</item>
|
<item>precise</item>
|
||||||
</string-array>
|
</string-array>
|
||||||
|
<string-array name="call_rejection_methods">
|
||||||
|
<item>@string/call_rejection_method_reject</item>
|
||||||
|
<item>@string/call_rejection_method_ignore</item>
|
||||||
|
</string-array>
|
||||||
|
<string-array name="call_rejection_methods_values">
|
||||||
|
<item>reject</item>
|
||||||
|
<item>ignore</item>
|
||||||
|
</string-array>
|
||||||
|
|
||||||
</resources>
|
</resources>
|
||||||
|
@ -2390,4 +2390,8 @@
|
|||||||
<string name="temperature_scale_fahrenheit">Fahrenheit</string>
|
<string name="temperature_scale_fahrenheit">Fahrenheit</string>
|
||||||
<string name="fossil_hr_nav_app_not_installed_notify_title">Navigation app not installed on watch</string>
|
<string name="fossil_hr_nav_app_not_installed_notify_title">Navigation app not installed on watch</string>
|
||||||
<string name="fossil_hr_nav_app_not_installed_notify_text">Navigation started but navigationApp not installed on watch. Please install it from the App Manager.</string>
|
<string name="fossil_hr_nav_app_not_installed_notify_text">Navigation started but navigationApp not installed on watch. Please install it from the App Manager.</string>
|
||||||
|
<string name="call_rejection_method_reject">Reject</string>
|
||||||
|
<string name="call_rejection_method_ignore">Ignore (silence)</string>
|
||||||
|
<string name="pref_call_rejection_method_title">Call rejection method</string>
|
||||||
|
<string name="pref_call_rejection_method_summary">Which action is taken when an incoming call is rejected from the watch</string>
|
||||||
</resources>
|
</resources>
|
||||||
|
12
app/src/main/res/xml/devicesettings_reject_call_method.xml
Normal file
12
app/src/main/res/xml/devicesettings_reject_call_method.xml
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
|
<PreferenceScreen xmlns:android="http://schemas.android.com/apk/res/android">
|
||||||
|
<ListPreference
|
||||||
|
android:defaultValue="reject"
|
||||||
|
android:key="call_reject_method"
|
||||||
|
android:title="@string/pref_call_rejection_method_title"
|
||||||
|
android:summary="@string/pref_call_rejection_method_summary"
|
||||||
|
android:icon="@drawable/ic_phone_missed_outline"
|
||||||
|
android:entries="@array/call_rejection_methods"
|
||||||
|
android:entryValues="@array/call_rejection_methods_values"/>
|
||||||
|
|
||||||
|
</PreferenceScreen>
|
Loading…
Reference in New Issue
Block a user