From ff8b38f7e8441b032aa598e36ce5d94ab2a5c0e6 Mon Sep 17 00:00:00 2001 From: Torsten Grote Date: Wed, 14 Mar 2018 10:01:38 -0300 Subject: [PATCH] Use a different notification preference summary for Android 8 --- .../briar/android/settings/SettingsFragment.java | 16 +++++++++++----- briar-android/src/main/res/values/strings.xml | 4 ++++ 2 files changed, 15 insertions(+), 5 deletions(-) diff --git a/briar-android/src/main/java/org/briarproject/briar/android/settings/SettingsFragment.java b/briar-android/src/main/java/org/briarproject/briar/android/settings/SettingsFragment.java index 473dc4f39..1efca2346 100644 --- a/briar-android/src/main/java/org/briarproject/briar/android/settings/SettingsFragment.java +++ b/briar-android/src/main/java/org/briarproject/briar/android/settings/SettingsFragment.java @@ -7,6 +7,7 @@ import android.media.Ringtone; import android.media.RingtoneManager; import android.net.Uri; import android.os.Bundle; +import android.support.annotation.StringRes; import android.support.v7.preference.CheckBoxPreference; import android.support.v7.preference.ListPreference; import android.support.v7.preference.Preference; @@ -240,11 +241,15 @@ public class SettingsFragment extends PreferenceFragmentCompat notifySound.setSummary(text); } else { setupNotificationPreference(notifyPrivateMessages, - CONTACT_CHANNEL_ID); + CONTACT_CHANNEL_ID, + R.string.notify_private_messages_setting_summary_26); setupNotificationPreference(notifyGroupMessages, - GROUP_CHANNEL_ID); - setupNotificationPreference(notifyForumPosts, FORUM_CHANNEL_ID); - setupNotificationPreference(notifyBlogPosts, BLOG_CHANNEL_ID); + GROUP_CHANNEL_ID, + R.string.notify_group_messages_setting_summary_26); + setupNotificationPreference(notifyForumPosts, FORUM_CHANNEL_ID, + R.string.notify_forum_posts_setting_summary_26); + setupNotificationPreference(notifyBlogPosts, BLOG_CHANNEL_ID, + R.string.notify_blog_posts_setting_summary_26); notifyVibration.setVisible(false); notifyLockscreen.setVisible(false); notifySound.setVisible(false); @@ -267,8 +272,9 @@ public class SettingsFragment extends PreferenceFragmentCompat @TargetApi(26) private void setupNotificationPreference(CheckBoxPreference pref, - String channelId) { + String channelId, @StringRes int summary) { pref.setWidgetLayoutResource(0); + pref.setSummary(summary); pref.setOnPreferenceClickListener(clickedPref -> { Intent intent = new Intent(ACTION_CHANNEL_NOTIFICATION_SETTINGS) .putExtra(EXTRA_APP_PACKAGE, getContext().getPackageName()) diff --git a/briar-android/src/main/res/values/strings.xml b/briar-android/src/main/res/values/strings.xml index 14de9071b..70fe23010 100644 --- a/briar-android/src/main/res/values/strings.xml +++ b/briar-android/src/main/res/values/strings.xml @@ -355,12 +355,16 @@ Notifications Private messages Show alerts for private messages + Configure alerts for private messages Group messages Show alerts for group messages + Configure alerts for group messages Forum posts Show alerts for forum posts + Configure alerts for forum posts Blog posts Show alerts for blog posts + Configure alerts for blog posts Vibrate Lock Screen Show notifications on the lock screen