diff --git a/packages/SystemUI/res/values/strings.xml b/packages/SystemUI/res/values/strings.xml index 9498fe4808621..5ac9486aa54ad 100644 --- a/packages/SystemUI/res/values/strings.xml +++ b/packages/SystemUI/res/values/strings.xml @@ -24,17 +24,6 @@ all of the currently visible notifications. [CHAR LIMIT=10]--> Clear - - Do not disturb - - - Show notifications - Remove from list @@ -436,13 +425,6 @@ application --> App info - - Notifications off - - - Tap here to turn notifications back on. - Screen will rotate automatically. diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/DoNotDisturb.java b/packages/SystemUI/src/com/android/systemui/statusbar/DoNotDisturb.java deleted file mode 100644 index 75204343a73ac..0000000000000 --- a/packages/SystemUI/src/com/android/systemui/statusbar/DoNotDisturb.java +++ /dev/null @@ -1,56 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.systemui.statusbar; - -import android.app.StatusBarManager; -import android.content.Context; -import android.content.SharedPreferences; - -import com.android.systemui.statusbar.policy.Prefs; - -public class DoNotDisturb implements SharedPreferences.OnSharedPreferenceChangeListener { - private Context mContext; - private StatusBarManager mStatusBar; - SharedPreferences mPrefs; - private boolean mDoNotDisturb; - - public DoNotDisturb(Context context) { - mContext = context; - mStatusBar = (StatusBarManager)context.getSystemService(Context.STATUS_BAR_SERVICE); - mPrefs = Prefs.read(context); - mPrefs.registerOnSharedPreferenceChangeListener(this); - mDoNotDisturb = mPrefs.getBoolean(Prefs.DO_NOT_DISTURB_PREF, Prefs.DO_NOT_DISTURB_DEFAULT); - updateDisableRecord(); - } - - public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { - final boolean val = prefs.getBoolean(Prefs.DO_NOT_DISTURB_PREF, - Prefs.DO_NOT_DISTURB_DEFAULT); - if (val != mDoNotDisturb) { - mDoNotDisturb = val; - updateDisableRecord(); - } - } - - private void updateDisableRecord() { - final int disabled = StatusBarManager.DISABLE_NOTIFICATION_ICONS - | StatusBarManager.DISABLE_NOTIFICATION_ALERTS - | StatusBarManager.DISABLE_NOTIFICATION_TICKER; - mStatusBar.disable(mDoNotDisturb ? disabled : 0); - } -} - diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DoNotDisturbController.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/DoNotDisturbController.java deleted file mode 100644 index 8612c8f399421..0000000000000 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/DoNotDisturbController.java +++ /dev/null @@ -1,71 +0,0 @@ -/* - * Copyright (C) 2010 The Android Open Source Project - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -package com.android.systemui.statusbar.policy; - -import android.content.Context; -import android.content.SharedPreferences; -import android.widget.CompoundButton; - -public class DoNotDisturbController implements CompoundButton.OnCheckedChangeListener, - SharedPreferences.OnSharedPreferenceChangeListener { - private static final String TAG = "StatusBar.DoNotDisturbController"; - - SharedPreferences mPrefs; - private Context mContext; - private CompoundButton mCheckBox; - - private boolean mDoNotDisturb; - - public DoNotDisturbController(Context context, CompoundButton checkbox) { - mContext = context; - - mPrefs = Prefs.read(context); - mPrefs.registerOnSharedPreferenceChangeListener(this); - mDoNotDisturb = mPrefs.getBoolean(Prefs.DO_NOT_DISTURB_PREF, Prefs.DO_NOT_DISTURB_DEFAULT); - - mCheckBox = checkbox; - checkbox.setOnCheckedChangeListener(this); - - checkbox.setChecked(!mDoNotDisturb); - } - - // The checkbox is ON for notifications coming in and OFF for Do not disturb, so we - // don't have a double negative. - public void onCheckedChanged(CompoundButton view, boolean checked) { - //Log.d(TAG, "onCheckedChanged checked=" + checked + " mDoNotDisturb=" + mDoNotDisturb); - final boolean value = !checked; - if (value != mDoNotDisturb) { - SharedPreferences.Editor editor = Prefs.edit(mContext); - editor.putBoolean(Prefs.DO_NOT_DISTURB_PREF, value); - editor.apply(); - } - } - - public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { - final boolean val = prefs.getBoolean(Prefs.DO_NOT_DISTURB_PREF, - Prefs.DO_NOT_DISTURB_DEFAULT); - if (val != mDoNotDisturb) { - mDoNotDisturb = val; - mCheckBox.setChecked(!val); - } - } - - public void release() { - mPrefs.unregisterOnSharedPreferenceChangeListener(this); - } -} - diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Prefs.java b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Prefs.java index a759bba31910c..d03f6ce2c68a4 100644 --- a/packages/SystemUI/src/com/android/systemui/statusbar/policy/Prefs.java +++ b/packages/SystemUI/src/com/android/systemui/statusbar/policy/Prefs.java @@ -22,10 +22,6 @@ import android.content.SharedPreferences; public class Prefs { private static final String SHARED_PREFS_NAME = "status_bar"; - // a boolean - public static final String DO_NOT_DISTURB_PREF = "do_not_disturb"; - public static final boolean DO_NOT_DISTURB_DEFAULT = false; - public static final String SHOWN_COMPAT_MODE_HELP = "shown_compat_mode_help"; public static final String SHOWN_QUICK_SETTINGS_HELP = "shown_quick_settings_help";