mirror of
https://codeberg.org/Freeyourgadget/Gadgetbridge
synced 2025-01-11 18:35:49 +01:00
Pebble: implement privacy modes
The user can choose whether to completely hide the notification text or push it off-screen. This also effects the incoming call notification. Fixes #370
This commit is contained in:
parent
b894c01822
commit
dccd6c1b06
@ -2,6 +2,7 @@
|
||||
|
||||
####Version next
|
||||
* Better integration with android music players
|
||||
* Pebble: Implement notification and incoming call privacy modes
|
||||
|
||||
####Version 0.17.3
|
||||
* HPlus: Improve display of new messages and phone calls
|
||||
|
@ -12,6 +12,7 @@ import java.util.Iterator;
|
||||
import java.util.UUID;
|
||||
|
||||
import nodomain.freeyourgadget.gadgetbridge.GBApplication;
|
||||
import nodomain.freeyourgadget.gadgetbridge.R;
|
||||
import nodomain.freeyourgadget.gadgetbridge.impl.GBDevice;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.Alarm;
|
||||
import nodomain.freeyourgadget.gadgetbridge.model.CalendarEventSpec;
|
||||
@ -113,6 +114,16 @@ public class PebbleSupport extends AbstractSerialDeviceSupport {
|
||||
|
||||
@Override
|
||||
public void onNotification(NotificationSpec notificationSpec) {
|
||||
String currentPrivacyMode = GBApplication.getPrefs().getString("pebble_pref_privacy_mode", getContext().getString(R.string.p_pebble_privacy_mode_off));
|
||||
if (getContext().getString(R.string.p_pebble_privacy_mode_complete).equals(currentPrivacyMode)) {
|
||||
notificationSpec.body = null;
|
||||
notificationSpec.sender = null;
|
||||
notificationSpec.subject = null;
|
||||
notificationSpec.title = null;
|
||||
notificationSpec.phoneNumber = null;
|
||||
} else if (getContext().getString(R.string.p_pebble_privacy_mode_content).equals(currentPrivacyMode)) {
|
||||
notificationSpec.sender = "\n\n\n\n\n" + notificationSpec.sender;
|
||||
}
|
||||
if (reconnect()) {
|
||||
super.onNotification(notificationSpec);
|
||||
}
|
||||
@ -120,6 +131,14 @@ public class PebbleSupport extends AbstractSerialDeviceSupport {
|
||||
|
||||
@Override
|
||||
public void onSetCallState(CallSpec callSpec) {
|
||||
String currentPrivacyMode = GBApplication.getPrefs().getString("pebble_pref_privacy_mode", getContext().getString(R.string.p_pebble_privacy_mode_off));
|
||||
if (getContext().getString(R.string.p_pebble_privacy_mode_complete).equals(currentPrivacyMode)) {
|
||||
callSpec.name = null;
|
||||
callSpec.number = null;
|
||||
} else if (getContext().getString(R.string.p_pebble_privacy_mode_content).equals(currentPrivacyMode)) {
|
||||
callSpec.name = null;
|
||||
}
|
||||
|
||||
if (reconnect()) {
|
||||
if ((callSpec.command != CallSpec.CALL_OUTGOING) || GBApplication.getPrefs().getBoolean("pebble_enable_outgoing_call", true)) {
|
||||
super.onSetCallState(callSpec);
|
||||
|
@ -113,6 +113,19 @@
|
||||
<item>3</item>
|
||||
<item>1</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="pebble_privacymode">
|
||||
<item name="off">@string/pref_pebble_privacy_mode_off</item>
|
||||
<item name="content">@string/pref_pebble_privacy_mode_content</item>
|
||||
<item name="complete">@string/pref_pebble_privacy_mode_complete</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="pebble_privacymode_values">
|
||||
<item>@string/p_pebble_privacy_mode_off</item>
|
||||
<item>@string/p_pebble_privacy_mode_content</item>
|
||||
<item>@string/p_pebble_privacy_mode_complete</item>
|
||||
</string-array>
|
||||
|
||||
<string-array name="mi2_dateformats">
|
||||
<item>@string/dateformat_time</item>
|
||||
<item>@string/dateformat_date_time</item>
|
||||
|
@ -119,6 +119,11 @@
|
||||
<string name="pref_title_autoremove_notifications">Autoremove dismissed Notifications</string>
|
||||
<string name="pref_summary_autoremove_notifications">Notifications are automatically removed from the Pebble when dismissed from the Android device</string>
|
||||
|
||||
<string name="pref_title_pebble_privacy_mode">Privacy mode</string>
|
||||
<string name="pref_pebble_privacy_mode_off">Normal notifications and incoming calls display.</string>
|
||||
<string name="pref_pebble_privacy_mode_content">Shift the notification text off-screen. Hide the caller\'s name on incoming calls.</string>
|
||||
<string name="pref_pebble_privacy_mode_complete">Show only the notification icon. Hide the caller\'s name and number on incoming calls.</string>
|
||||
|
||||
<string name="pref_header_location">Location</string>
|
||||
<string name="pref_title_location_aquire">Acquire Location</string>
|
||||
<string name="pref_title_location_latitude">Latitude</string>
|
||||
|
@ -12,4 +12,8 @@
|
||||
<item name="p_dateformat_time" type="string">dateformat_time</item>
|
||||
<item name="p_dateformat_datetime" type="string">dateformat_datetime</item>
|
||||
|
||||
<item name="p_pebble_privacy_mode_off" type="string">off</item>
|
||||
<item name="p_pebble_privacy_mode_content" type="string">content</item>
|
||||
<item name="p_pebble_privacy_mode_complete" type="string">complete</item>
|
||||
|
||||
</resources>
|
||||
|
@ -2,6 +2,7 @@
|
||||
<changelog>
|
||||
<release version="next">
|
||||
<change>Better integration with android music players</change>
|
||||
<change>Pebble: Implement notification and incoming call privacy modes</change>
|
||||
</release>
|
||||
|
||||
<release version="0.17.3" versioncode="84">
|
||||
|
@ -184,6 +184,13 @@
|
||||
android:key="autoremove_notifications"
|
||||
android:summary="@string/pref_summary_autoremove_notifications"
|
||||
android:title="@string/pref_title_autoremove_notifications" />
|
||||
<ListPreference
|
||||
android:key="pebble_pref_privacy_mode"
|
||||
android:title="@string/pref_title_pebble_privacy_mode"
|
||||
android:entries="@array/pebble_privacymode"
|
||||
android:entryValues="@array/pebble_privacymode_values"
|
||||
android:defaultValue="@string/p_pebble_privacy_mode_off"
|
||||
android:summary="%s" />
|
||||
</PreferenceCategory>
|
||||
<PreferenceCategory android:title="@string/pref_header_activitytrackers">
|
||||
<ListPreference
|
||||
|
Loading…
Reference in New Issue
Block a user