mirror of
https://code.briarproject.org/briar/briar.git
synced 2026-02-16 20:59:54 +01:00
Merge branch '1186-remove-lock-screen-notification-setting' into 'master'
Remove lockscreen notification setting Closes #1186 See merge request briar/briar!925
This commit is contained in:
@@ -327,9 +327,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
|
|||||||
R.plurals.private_message_notification_text, contactTotal,
|
R.plurals.private_message_notification_text, contactTotal,
|
||||||
contactTotal));
|
contactTotal));
|
||||||
b.setNumber(contactTotal);
|
b.setNumber(contactTotal);
|
||||||
boolean showOnLockScreen =
|
b.setNotificationCategory(CATEGORY_MESSAGE);
|
||||||
settings.getBoolean(PREF_NOTIFY_LOCK_SCREEN, false);
|
|
||||||
b.setLockscreenVisibility(CATEGORY_MESSAGE, showOnLockScreen);
|
|
||||||
if (mayAlertAgain) setAlertProperties(b);
|
if (mayAlertAgain) setAlertProperties(b);
|
||||||
setDeleteIntent(b, CONTACT_URI);
|
setDeleteIntent(b, CONTACT_URI);
|
||||||
Set<ContactId> contacts = contactCounts.keySet();
|
Set<ContactId> contacts = contactCounts.keySet();
|
||||||
@@ -431,9 +429,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
|
|||||||
R.plurals.group_message_notification_text, groupTotal,
|
R.plurals.group_message_notification_text, groupTotal,
|
||||||
groupTotal));
|
groupTotal));
|
||||||
b.setNumber(groupTotal);
|
b.setNumber(groupTotal);
|
||||||
boolean showOnLockScreen =
|
b.setNotificationCategory(CATEGORY_SOCIAL);
|
||||||
settings.getBoolean(PREF_NOTIFY_LOCK_SCREEN, false);
|
|
||||||
b.setLockscreenVisibility(CATEGORY_SOCIAL, showOnLockScreen);
|
|
||||||
if (mayAlertAgain) setAlertProperties(b);
|
if (mayAlertAgain) setAlertProperties(b);
|
||||||
setDeleteIntent(b, GROUP_URI);
|
setDeleteIntent(b, GROUP_URI);
|
||||||
Set<GroupId> groups = groupCounts.keySet();
|
Set<GroupId> groups = groupCounts.keySet();
|
||||||
@@ -504,9 +500,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
|
|||||||
R.plurals.forum_post_notification_text, forumTotal,
|
R.plurals.forum_post_notification_text, forumTotal,
|
||||||
forumTotal));
|
forumTotal));
|
||||||
b.setNumber(forumTotal);
|
b.setNumber(forumTotal);
|
||||||
boolean showOnLockScreen =
|
b.setNotificationCategory(CATEGORY_SOCIAL);
|
||||||
settings.getBoolean(PREF_NOTIFY_LOCK_SCREEN, false);
|
|
||||||
b.setLockscreenVisibility(CATEGORY_SOCIAL, showOnLockScreen);
|
|
||||||
if (mayAlertAgain) setAlertProperties(b);
|
if (mayAlertAgain) setAlertProperties(b);
|
||||||
setDeleteIntent(b, FORUM_URI);
|
setDeleteIntent(b, FORUM_URI);
|
||||||
Set<GroupId> forums = forumCounts.keySet();
|
Set<GroupId> forums = forumCounts.keySet();
|
||||||
@@ -575,9 +569,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
|
|||||||
R.plurals.blog_post_notification_text, blogTotal,
|
R.plurals.blog_post_notification_text, blogTotal,
|
||||||
blogTotal));
|
blogTotal));
|
||||||
b.setNumber(blogTotal);
|
b.setNumber(blogTotal);
|
||||||
boolean showOnLockScreen =
|
b.setNotificationCategory(CATEGORY_SOCIAL);
|
||||||
settings.getBoolean(PREF_NOTIFY_LOCK_SCREEN, false);
|
|
||||||
b.setLockscreenVisibility(CATEGORY_SOCIAL, showOnLockScreen);
|
|
||||||
if (mayAlertAgain) setAlertProperties(b);
|
if (mayAlertAgain) setAlertProperties(b);
|
||||||
setDeleteIntent(b, BLOG_URI);
|
setDeleteIntent(b, BLOG_URI);
|
||||||
// Touching the notification shows the combined blog feed
|
// Touching the notification shows the combined blog feed
|
||||||
@@ -618,9 +610,7 @@ class AndroidNotificationManagerImpl implements AndroidNotificationManager,
|
|||||||
b.setContentText(appContext.getResources().getQuantityString(
|
b.setContentText(appContext.getResources().getQuantityString(
|
||||||
R.plurals.introduction_notification_text, introductionTotal,
|
R.plurals.introduction_notification_text, introductionTotal,
|
||||||
introductionTotal));
|
introductionTotal));
|
||||||
boolean showOnLockScreen =
|
b.setNotificationCategory(CATEGORY_MESSAGE);
|
||||||
settings.getBoolean(PREF_NOTIFY_LOCK_SCREEN, false);
|
|
||||||
b.setLockscreenVisibility(CATEGORY_MESSAGE, showOnLockScreen);
|
|
||||||
setAlertProperties(b);
|
setAlertProperties(b);
|
||||||
setDeleteIntent(b, INTRODUCTION_URI);
|
setDeleteIntent(b, INTRODUCTION_URI);
|
||||||
// Touching the notification shows the contact list
|
// Touching the notification shows the contact list
|
||||||
|
|||||||
@@ -89,7 +89,6 @@ import static org.briarproject.briar.api.android.AndroidNotificationManager.GROU
|
|||||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_BLOG;
|
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_BLOG;
|
||||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_FORUM;
|
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_FORUM;
|
||||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_GROUP;
|
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_GROUP;
|
||||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_LOCK_SCREEN;
|
|
||||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_PRIVATE;
|
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_PRIVATE;
|
||||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_RINGTONE_NAME;
|
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_RINGTONE_NAME;
|
||||||
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_RINGTONE_URI;
|
import static org.briarproject.briar.api.android.AndroidNotificationManager.PREF_NOTIFY_RINGTONE_URI;
|
||||||
@@ -127,7 +126,6 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
|||||||
private SwitchPreference notifyForumPosts;
|
private SwitchPreference notifyForumPosts;
|
||||||
private SwitchPreference notifyBlogPosts;
|
private SwitchPreference notifyBlogPosts;
|
||||||
private SwitchPreference notifyVibration;
|
private SwitchPreference notifyVibration;
|
||||||
private SwitchPreference notifyLockscreen;
|
|
||||||
|
|
||||||
private Preference notifySound;
|
private Preference notifySound;
|
||||||
|
|
||||||
@@ -179,8 +177,6 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
|||||||
"pref_key_notify_blog_posts");
|
"pref_key_notify_blog_posts");
|
||||||
notifyVibration = (SwitchPreference) findPreference(
|
notifyVibration = (SwitchPreference) findPreference(
|
||||||
"pref_key_notify_vibration");
|
"pref_key_notify_vibration");
|
||||||
notifyLockscreen = (SwitchPreference) findPreference(
|
|
||||||
"pref_key_notify_lock_screen");
|
|
||||||
notifySound = findPreference("pref_key_notify_sound");
|
notifySound = findPreference("pref_key_notify_sound");
|
||||||
|
|
||||||
language.setOnPreferenceChangeListener(this);
|
language.setOnPreferenceChangeListener(this);
|
||||||
@@ -207,10 +203,6 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
|||||||
torMobile.setOnPreferenceChangeListener(this);
|
torMobile.setOnPreferenceChangeListener(this);
|
||||||
screenLock.setOnPreferenceChangeListener(this);
|
screenLock.setOnPreferenceChangeListener(this);
|
||||||
screenLockTimeout.setOnPreferenceChangeListener(this);
|
screenLockTimeout.setOnPreferenceChangeListener(this);
|
||||||
if (SDK_INT >= 21) {
|
|
||||||
notifyLockscreen.setVisible(true);
|
|
||||||
notifyLockscreen.setOnPreferenceChangeListener(this);
|
|
||||||
}
|
|
||||||
|
|
||||||
findPreference("pref_key_send_feedback").setOnPreferenceClickListener(
|
findPreference("pref_key_send_feedback").setOnPreferenceClickListener(
|
||||||
preference -> {
|
preference -> {
|
||||||
@@ -380,8 +372,6 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
|||||||
notifyForumPosts.setOnPreferenceChangeListener(this);
|
notifyForumPosts.setOnPreferenceChangeListener(this);
|
||||||
notifyBlogPosts.setOnPreferenceChangeListener(this);
|
notifyBlogPosts.setOnPreferenceChangeListener(this);
|
||||||
notifyVibration.setOnPreferenceChangeListener(this);
|
notifyVibration.setOnPreferenceChangeListener(this);
|
||||||
notifyLockscreen.setChecked(settings.getBoolean(
|
|
||||||
PREF_NOTIFY_LOCK_SCREEN, false));
|
|
||||||
notifySound.setOnPreferenceClickListener(
|
notifySound.setOnPreferenceClickListener(
|
||||||
pref -> onNotificationSoundClicked());
|
pref -> onNotificationSoundClicked());
|
||||||
String text;
|
String text;
|
||||||
@@ -409,7 +399,6 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
|||||||
setupNotificationPreference(notifyBlogPosts, BLOG_CHANNEL_ID,
|
setupNotificationPreference(notifyBlogPosts, BLOG_CHANNEL_ID,
|
||||||
R.string.notify_blog_posts_setting_summary_26);
|
R.string.notify_blog_posts_setting_summary_26);
|
||||||
notifyVibration.setVisible(false);
|
notifyVibration.setVisible(false);
|
||||||
notifyLockscreen.setVisible(false);
|
|
||||||
notifySound.setVisible(false);
|
notifySound.setVisible(false);
|
||||||
}
|
}
|
||||||
setSettingsEnabled(true);
|
setSettingsEnabled(true);
|
||||||
@@ -432,7 +421,6 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
|||||||
notifyForumPosts.setEnabled(enabled);
|
notifyForumPosts.setEnabled(enabled);
|
||||||
notifyBlogPosts.setEnabled(enabled);
|
notifyBlogPosts.setEnabled(enabled);
|
||||||
notifyVibration.setEnabled(enabled);
|
notifyVibration.setEnabled(enabled);
|
||||||
notifyLockscreen.setEnabled(enabled);
|
|
||||||
notifySound.setEnabled(enabled);
|
notifySound.setEnabled(enabled);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -553,10 +541,6 @@ public class SettingsFragment extends PreferenceFragmentCompat
|
|||||||
Settings s = new Settings();
|
Settings s = new Settings();
|
||||||
s.putBoolean(PREF_NOTIFY_VIBRATION, (Boolean) newValue);
|
s.putBoolean(PREF_NOTIFY_VIBRATION, (Boolean) newValue);
|
||||||
storeSettings(s);
|
storeSettings(s);
|
||||||
} else if (preference == notifyLockscreen) {
|
|
||||||
Settings s = new Settings();
|
|
||||||
s.putBoolean(PREF_NOTIFY_LOCK_SCREEN, (Boolean) newValue);
|
|
||||||
storeSettings(s);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,14 @@
|
|||||||
package org.briarproject.briar.android.util;
|
package org.briarproject.briar.android.util;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.os.Build;
|
|
||||||
import android.support.annotation.ColorRes;
|
import android.support.annotation.ColorRes;
|
||||||
import android.support.v4.app.NotificationCompat;
|
import android.support.v4.app.NotificationCompat;
|
||||||
import android.support.v4.content.ContextCompat;
|
import android.support.v4.content.ContextCompat;
|
||||||
|
|
||||||
import org.briarproject.briar.R;
|
import org.briarproject.briar.R;
|
||||||
|
|
||||||
|
import static android.os.Build.VERSION.SDK_INT;
|
||||||
import static android.support.v4.app.NotificationCompat.VISIBILITY_PRIVATE;
|
import static android.support.v4.app.NotificationCompat.VISIBILITY_PRIVATE;
|
||||||
import static android.support.v4.app.NotificationCompat.VISIBILITY_SECRET;
|
|
||||||
|
|
||||||
|
|
||||||
public class BriarNotificationBuilder extends NotificationCompat.Builder {
|
public class BriarNotificationBuilder extends NotificationCompat.Builder {
|
||||||
@@ -22,6 +21,7 @@ public class BriarNotificationBuilder extends NotificationCompat.Builder {
|
|||||||
|
|
||||||
setLights(ContextCompat.getColor(context, R.color.briar_green_light),
|
setLights(ContextCompat.getColor(context, R.color.briar_green_light),
|
||||||
750, 500);
|
750, 500);
|
||||||
|
if (SDK_INT >= 21) setVisibility(VISIBILITY_PRIVATE);
|
||||||
}
|
}
|
||||||
|
|
||||||
public BriarNotificationBuilder setColorRes(@ColorRes int res) {
|
public BriarNotificationBuilder setColorRes(@ColorRes int res) {
|
||||||
@@ -29,13 +29,8 @@ public class BriarNotificationBuilder extends NotificationCompat.Builder {
|
|||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
public BriarNotificationBuilder setLockscreenVisibility(String category,
|
public BriarNotificationBuilder setNotificationCategory(String category) {
|
||||||
boolean show) {
|
if (SDK_INT >= 21) setCategory(category);
|
||||||
if (Build.VERSION.SDK_INT >= 21) {
|
|
||||||
setCategory(category);
|
|
||||||
if (show) setVisibility(VISIBILITY_PRIVATE);
|
|
||||||
else setVisibility(VISIBILITY_SECRET);
|
|
||||||
}
|
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -21,7 +21,6 @@ public interface AndroidNotificationManager {
|
|||||||
String PREF_NOTIFY_RINGTONE_NAME = "notifyRingtoneName";
|
String PREF_NOTIFY_RINGTONE_NAME = "notifyRingtoneName";
|
||||||
String PREF_NOTIFY_RINGTONE_URI = "notifyRingtoneUri";
|
String PREF_NOTIFY_RINGTONE_URI = "notifyRingtoneUri";
|
||||||
String PREF_NOTIFY_VIBRATION = "notifyVibration";
|
String PREF_NOTIFY_VIBRATION = "notifyVibration";
|
||||||
String PREF_NOTIFY_LOCK_SCREEN = "notifyLockScreen";
|
|
||||||
|
|
||||||
// Notification IDs
|
// Notification IDs
|
||||||
int ONGOING_NOTIFICATION_ID = 1;
|
int ONGOING_NOTIFICATION_ID = 1;
|
||||||
|
|||||||
@@ -421,8 +421,6 @@
|
|||||||
<string name="notify_blog_posts_setting_summary">Show alerts for blog posts</string>
|
<string name="notify_blog_posts_setting_summary">Show alerts for blog posts</string>
|
||||||
<string name="notify_blog_posts_setting_summary_26">Configure alerts for blog posts</string>
|
<string name="notify_blog_posts_setting_summary_26">Configure alerts for blog posts</string>
|
||||||
<string name="notify_vibration_setting">Vibrate</string>
|
<string name="notify_vibration_setting">Vibrate</string>
|
||||||
<string name="notify_lock_screen_setting_title">Lock Screen</string>
|
|
||||||
<string name="notify_lock_screen_setting_summary">Show notifications on the lock screen</string>
|
|
||||||
<string name="notify_sound_setting">Sound</string>
|
<string name="notify_sound_setting">Sound</string>
|
||||||
<string name="notify_sound_setting_default">Default ringtone</string>
|
<string name="notify_sound_setting_default">Default ringtone</string>
|
||||||
<string name="notify_sound_setting_disabled">None</string>
|
<string name="notify_sound_setting_disabled">None</string>
|
||||||
|
|||||||
@@ -145,15 +145,6 @@
|
|||||||
android:title="@string/notify_blog_posts_setting_title"
|
android:title="@string/notify_blog_posts_setting_title"
|
||||||
android:widgetLayout="@layout/preference_switch_compat"/>
|
android:widgetLayout="@layout/preference_switch_compat"/>
|
||||||
|
|
||||||
<SwitchPreference
|
|
||||||
android:defaultValue="false"
|
|
||||||
android:key="pref_key_notify_lock_screen"
|
|
||||||
android:persistent="false"
|
|
||||||
android:summary="@string/notify_lock_screen_setting_summary"
|
|
||||||
android:title="@string/notify_lock_screen_setting_title"
|
|
||||||
android:visibility="gone"
|
|
||||||
android:widgetLayout="@layout/preference_switch_compat"/>
|
|
||||||
|
|
||||||
<SwitchPreference
|
<SwitchPreference
|
||||||
android:defaultValue="true"
|
android:defaultValue="true"
|
||||||
android:key="pref_key_notify_vibration"
|
android:key="pref_key_notify_vibration"
|
||||||
|
|||||||
Reference in New Issue
Block a user