diff --git a/CHANGELOG.md b/CHANGELOG.md index 900f61ad..66037df9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleSupport.java b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleSupport.java index 122f6da5..e4f59e85 100644 --- a/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleSupport.java +++ b/app/src/main/java/nodomain/freeyourgadget/gadgetbridge/service/devices/pebble/PebbleSupport.java @@ -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); diff --git a/app/src/main/res/values/arrays.xml b/app/src/main/res/values/arrays.xml index e2aff8f5..db5a7951 100644 --- a/app/src/main/res/values/arrays.xml +++ b/app/src/main/res/values/arrays.xml @@ -113,6 +113,19 @@ 3 1 + + + @string/pref_pebble_privacy_mode_off + @string/pref_pebble_privacy_mode_content + @string/pref_pebble_privacy_mode_complete + + + + @string/p_pebble_privacy_mode_off + @string/p_pebble_privacy_mode_content + @string/p_pebble_privacy_mode_complete + + @string/dateformat_time @string/dateformat_date_time diff --git a/app/src/main/res/values/strings.xml b/app/src/main/res/values/strings.xml index 88226d4c..efc636b9 100644 --- a/app/src/main/res/values/strings.xml +++ b/app/src/main/res/values/strings.xml @@ -119,6 +119,11 @@ Autoremove dismissed Notifications Notifications are automatically removed from the Pebble when dismissed from the Android device + Privacy mode + Normal notifications and incoming calls display. + Shift the notification text off-screen. Hide the caller\'s name on incoming calls. + Show only the notification icon. Hide the caller\'s name and number on incoming calls. + Location Acquire Location Latitude diff --git a/app/src/main/res/values/values.xml b/app/src/main/res/values/values.xml index df90cb5b..84c560b3 100644 --- a/app/src/main/res/values/values.xml +++ b/app/src/main/res/values/values.xml @@ -12,4 +12,8 @@ dateformat_time dateformat_datetime + off + content + complete + diff --git a/app/src/main/res/xml/changelog_master.xml b/app/src/main/res/xml/changelog_master.xml index 5187fa13..887dd32e 100644 --- a/app/src/main/res/xml/changelog_master.xml +++ b/app/src/main/res/xml/changelog_master.xml @@ -2,6 +2,7 @@ Better integration with android music players + Pebble: Implement notification and incoming call privacy modes diff --git a/app/src/main/res/xml/preferences.xml b/app/src/main/res/xml/preferences.xml index 39c7d9ed..9f262213 100644 --- a/app/src/main/res/xml/preferences.xml +++ b/app/src/main/res/xml/preferences.xml @@ -184,6 +184,13 @@ android:key="autoremove_notifications" android:summary="@string/pref_summary_autoremove_notifications" android:title="@string/pref_title_autoremove_notifications" /> +