Remove ZEN notification visibility settings
Bug: 15286335 Change-Id: I927948458cfa4cddb8ebffda2f4c81fa003f8004
This commit is contained in:
@@ -5193,15 +5193,6 @@
|
|||||||
[CHAR LIMIT=50] -->
|
[CHAR LIMIT=50] -->
|
||||||
<string name="lock_screen_notifications_summary_disable">Don\'t show notifications at all</string>
|
<string name="lock_screen_notifications_summary_disable">Don\'t show notifications at all</string>
|
||||||
|
|
||||||
<!-- Sound & notifications > Showing notifications: Title for the option managing notification display in zen mode. [CHAR LIMIT=30] -->
|
|
||||||
<string name="zen_mode_notifications_title">When do not disturb is on</string>
|
|
||||||
|
|
||||||
<!-- Sound & notifications > Showing notifications: Value for zen mode notifications: notifications will be suppressed in zen mode [CHAR LIMIT=50] -->
|
|
||||||
<string name="zen_mode_notifications_summary_hide">Hide new notifications from the list</string>
|
|
||||||
|
|
||||||
<!-- Sound & notifications > Showing notifications: Value for zen mode notifications: notifications will be displayed in zen mode [CHAR LIMIT=50] -->
|
|
||||||
<string name="zen_mode_notifications_summary_show">Show all notifications in the list</string>
|
|
||||||
|
|
||||||
<!-- Sound & notifications > Showing notifications: Title for the option managing notifications per application. [CHAR LIMIT=30] -->
|
<!-- Sound & notifications > Showing notifications: Title for the option managing notifications per application. [CHAR LIMIT=30] -->
|
||||||
<string name="app_notifications_title">App notifications</string>
|
<string name="app_notifications_title">App notifications</string>
|
||||||
|
|
||||||
|
@@ -33,12 +33,6 @@
|
|||||||
android:title="@string/lock_screen_notifications_title"
|
android:title="@string/lock_screen_notifications_title"
|
||||||
android:persistent="false" />
|
android:persistent="false" />
|
||||||
|
|
||||||
<!-- When do not disturb is on -->
|
|
||||||
<com.android.settings.notification.DropDownPreference
|
|
||||||
android:key="zen_mode_notifications"
|
|
||||||
android:title="@string/zen_mode_notifications_title"
|
|
||||||
android:persistent="false" />
|
|
||||||
|
|
||||||
<!-- App notifications -->
|
<!-- App notifications -->
|
||||||
<PreferenceScreen
|
<PreferenceScreen
|
||||||
android:key="app_notifications"
|
android:key="app_notifications"
|
||||||
|
@@ -36,14 +36,12 @@ public class NotificationDisplaySettings extends SettingsPreferenceFragment {
|
|||||||
|
|
||||||
private static final String KEY_NOTIFICATION_PULSE = "notification_pulse";
|
private static final String KEY_NOTIFICATION_PULSE = "notification_pulse";
|
||||||
private static final String KEY_LOCK_SCREEN_NOTIFICATIONS = "lock_screen_notifications";
|
private static final String KEY_LOCK_SCREEN_NOTIFICATIONS = "lock_screen_notifications";
|
||||||
private static final String KEY_ZEN_MODE_NOTIFICATIONS = "zen_mode_notifications";
|
|
||||||
|
|
||||||
private final Handler mHandler = new Handler();
|
private final Handler mHandler = new Handler();
|
||||||
private final SettingsObserver mSettingsObserver = new SettingsObserver();
|
private final SettingsObserver mSettingsObserver = new SettingsObserver();
|
||||||
|
|
||||||
private TwoStatePreference mNotificationPulse;
|
private TwoStatePreference mNotificationPulse;
|
||||||
private DropDownPreference mLockscreen;
|
private DropDownPreference mLockscreen;
|
||||||
private DropDownPreference mZenModeNotifications;
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
@@ -54,7 +52,6 @@ public class NotificationDisplaySettings extends SettingsPreferenceFragment {
|
|||||||
final PreferenceScreen root = getPreferenceScreen();
|
final PreferenceScreen root = getPreferenceScreen();
|
||||||
initPulse(root);
|
initPulse(root);
|
||||||
initLockscreenNotifications(root);
|
initLockscreenNotifications(root);
|
||||||
initZenModeNotifications(root);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
@@ -148,32 +145,6 @@ public class NotificationDisplaySettings extends SettingsPreferenceFragment {
|
|||||||
Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 0) != 0;
|
Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS, 0) != 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
// === Zen mode notifications ===
|
|
||||||
|
|
||||||
private void initZenModeNotifications(PreferenceScreen parent) {
|
|
||||||
mZenModeNotifications = (DropDownPreference)
|
|
||||||
parent.findPreference(KEY_ZEN_MODE_NOTIFICATIONS);
|
|
||||||
if (mZenModeNotifications == null) return;
|
|
||||||
mZenModeNotifications.addItem(R.string.zen_mode_notifications_summary_hide, 0);
|
|
||||||
mZenModeNotifications.addItem(R.string.zen_mode_notifications_summary_show, 1);
|
|
||||||
updateZenModeNotifications();
|
|
||||||
mZenModeNotifications.setCallback(new DropDownPreference.Callback() {
|
|
||||||
@Override
|
|
||||||
public boolean onItemSelected(int pos, Object value) {
|
|
||||||
final int val = (Integer) value;
|
|
||||||
Settings.Secure.putInt(getContentResolver(),
|
|
||||||
Settings.Secure.DISPLAY_INTERCEPTED_NOTIFICATIONS, val);
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
});
|
|
||||||
}
|
|
||||||
|
|
||||||
private void updateZenModeNotifications() {
|
|
||||||
if (mZenModeNotifications == null) return;
|
|
||||||
mZenModeNotifications.setSelectedValue(Settings.Secure.getInt(getContentResolver(),
|
|
||||||
Settings.Secure.DISPLAY_INTERCEPTED_NOTIFICATIONS, 0));
|
|
||||||
}
|
|
||||||
|
|
||||||
// === Callbacks ===
|
// === Callbacks ===
|
||||||
|
|
||||||
private final class SettingsObserver extends ContentObserver {
|
private final class SettingsObserver extends ContentObserver {
|
||||||
@@ -183,8 +154,6 @@ public class NotificationDisplaySettings extends SettingsPreferenceFragment {
|
|||||||
Settings.Secure.getUriFor(Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS);
|
Settings.Secure.getUriFor(Settings.Secure.LOCK_SCREEN_ALLOW_PRIVATE_NOTIFICATIONS);
|
||||||
private final Uri LOCK_SCREEN_SHOW_URI =
|
private final Uri LOCK_SCREEN_SHOW_URI =
|
||||||
Settings.Global.getUriFor(Settings.Global.LOCK_SCREEN_SHOW_NOTIFICATIONS);
|
Settings.Global.getUriFor(Settings.Global.LOCK_SCREEN_SHOW_NOTIFICATIONS);
|
||||||
private final Uri DISPLAY_INTERCEPTED_NOTIFICATIONS_URI =
|
|
||||||
Settings.Secure.getUriFor(Settings.Secure.DISPLAY_INTERCEPTED_NOTIFICATIONS);
|
|
||||||
|
|
||||||
public SettingsObserver() {
|
public SettingsObserver() {
|
||||||
super(mHandler);
|
super(mHandler);
|
||||||
@@ -196,7 +165,6 @@ public class NotificationDisplaySettings extends SettingsPreferenceFragment {
|
|||||||
cr.registerContentObserver(NOTIFICATION_LIGHT_PULSE_URI, false, this);
|
cr.registerContentObserver(NOTIFICATION_LIGHT_PULSE_URI, false, this);
|
||||||
cr.registerContentObserver(LOCK_SCREEN_PRIVATE_URI, false, this);
|
cr.registerContentObserver(LOCK_SCREEN_PRIVATE_URI, false, this);
|
||||||
cr.registerContentObserver(LOCK_SCREEN_SHOW_URI, false, this);
|
cr.registerContentObserver(LOCK_SCREEN_SHOW_URI, false, this);
|
||||||
cr.registerContentObserver(DISPLAY_INTERCEPTED_NOTIFICATIONS_URI, false, this);
|
|
||||||
} else {
|
} else {
|
||||||
cr.unregisterContentObserver(this);
|
cr.unregisterContentObserver(this);
|
||||||
}
|
}
|
||||||
@@ -211,9 +179,6 @@ public class NotificationDisplaySettings extends SettingsPreferenceFragment {
|
|||||||
if (LOCK_SCREEN_PRIVATE_URI.equals(uri) || LOCK_SCREEN_SHOW_URI.equals(uri)) {
|
if (LOCK_SCREEN_PRIVATE_URI.equals(uri) || LOCK_SCREEN_SHOW_URI.equals(uri)) {
|
||||||
updateLockscreenNotifications();
|
updateLockscreenNotifications();
|
||||||
}
|
}
|
||||||
if (DISPLAY_INTERCEPTED_NOTIFICATIONS_URI.equals(uri)) {
|
|
||||||
updateZenModeNotifications();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user