summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/notification/ZenModeRuleSettingsBase.java
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2015-04-30 09:26:15 -0400
committerJohn Spurlock <jspurlock@google.com>2015-04-30 11:28:27 -0400
commitf57bad7d5b0f9044231fc52351ed27e14013f491 (patch)
treec2b4e92ca1c90193672919dad665340fe29b3361 /src/com/android/settings/notification/ZenModeRuleSettingsBase.java
parent0423aed775d0b00cbdf6cc1b422ede704830d43a (diff)
downloadpackages_apps_Settings-f57bad7d5b0f9044231fc52351ed27e14013f491.zip
packages_apps_Settings-f57bad7d5b0f9044231fc52351ed27e14013f491.tar.gz
packages_apps_Settings-f57bad7d5b0f9044231fc52351ed27e14013f491.tar.bz2
Settings: Do not disturb automatic rule updates.
- Remove FAB for adding rules, move to last preference. - Add first-class event condition type and config sub-page. - Always show radio buttons when adding rules. - Add new data model for event rules. - Add stub condition provider for event rules (always false for now). - Add rule-type icons to rule preference rows. Bug: 20064962 Change-Id: Id5acde371eb2e7d22b1f195459897614db5ba80a
Diffstat (limited to 'src/com/android/settings/notification/ZenModeRuleSettingsBase.java')
-rw-r--r--src/com/android/settings/notification/ZenModeRuleSettingsBase.java15
1 files changed, 14 insertions, 1 deletions
diff --git a/src/com/android/settings/notification/ZenModeRuleSettingsBase.java b/src/com/android/settings/notification/ZenModeRuleSettingsBase.java
index f6bc75f..cf66da8 100644
--- a/src/com/android/settings/notification/ZenModeRuleSettingsBase.java
+++ b/src/com/android/settings/notification/ZenModeRuleSettingsBase.java
@@ -59,11 +59,13 @@ public abstract class ZenModeRuleSettingsBase extends ZenModeSettingsBase
private Preference mRuleName;
private SwitchBar mSwitchBar;
private DropDownPreference mZenMode;
+ private Toast mEnabledToast;
abstract protected void onCreateInternal();
abstract protected boolean setRule(ZenRule rule);
abstract protected String getZenModeDependency();
abstract protected void updateControlsInternal();
+ abstract protected int getEnabledToastText();
@Override
public void onCreate(Bundle icicle) {
@@ -154,6 +156,17 @@ public abstract class ZenModeRuleSettingsBase extends ZenModeSettingsBase
mRule.enabled = enabled;
mRule.snoozing = false;
setZenModeConfig(mConfig);
+ if (enabled) {
+ final int toastText = getEnabledToastText();
+ if (toastText != 0) {
+ mEnabledToast = Toast.makeText(mContext, toastText, Toast.LENGTH_SHORT);
+ mEnabledToast.show();
+ }
+ } else {
+ if (mEnabledToast != null) {
+ mEnabledToast.cancel();
+ }
+ }
}
protected void updateRule(Uri newConditionId) {
@@ -247,10 +260,10 @@ public abstract class ZenModeRuleSettingsBase extends ZenModeSettingsBase
updateRuleName();
updateControlsInternal();
mZenMode.setSelectedValue(mRule.zenMode);
- mDisableListeners = false;
if (mSwitchBar != null) {
mSwitchBar.setChecked(mRule.enabled);
}
+ mDisableListeners = false;
}
}