diff options
author | John Spurlock <jspurlock@google.com> | 2014-11-03 11:01:51 -0500 |
---|---|---|
committer | John Spurlock <jspurlock@google.com> | 2014-11-05 08:46:01 -0500 |
commit | 37bc92cc2332eb6f864977381135c19d6a081a92 (patch) | |
tree | c563109a324acd911f3ca8b50e09c6090ef36772 /packages | |
parent | 18b055e106d5452ef390716d3ea8d1641a225361 (diff) | |
download | frameworks_base-37bc92cc2332eb6f864977381135c19d6a081a92.zip frameworks_base-37bc92cc2332eb6f864977381135c19d6a081a92.tar.gz frameworks_base-37bc92cc2332eb6f864977381135c19d6a081a92.tar.bz2 |
Zen: Create a new exit condition for "next alarm".
- If the user's next alarm is in the next 12 hrs, provide
this as an exit condition trigger for leaving none/priority.
- Don't display the next alarm condition when downtime is active.
- When the next-alarm exit condition is active, follow changes
to the next alarm, assuming it remains within the 12-hr window.
- Tweak the downtime condition strings to be consistent.
Bug: 16373455
Change-Id: I4020b91d323dead998e62d655132eca07438b148
Diffstat (limited to 'packages')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java index c840f17..28ecbf9 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java +++ b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java @@ -69,6 +69,7 @@ public class ZenModePanel extends LinearLayout { private static final int TIME_CONDITION_INDEX = 1; private static final int FIRST_CONDITION_INDEX = 2; private static final float SILENT_HINT_PULSE_SCALE = 1.1f; + private static final long SELECT_DEFAULT_DELAY = 300; public static final Intent ZEN_SETTINGS = new Intent(Settings.ACTION_ZEN_MODE_SETTINGS); @@ -373,8 +374,9 @@ public class ZenModePanel extends LinearLayout { if (isDowntime(mSessionExitCondition) && !foundDowntime) { bind(mSessionExitCondition, null); } - // ensure something is selected - checkForDefault(); + // ensure something is selected, after waiting for providers to respond + mHandler.removeMessages(H.SELECT_DEFAULT); + mHandler.sendEmptyMessageDelayed(H.SELECT_DEFAULT, SELECT_DEFAULT_DELAY); } private static boolean isDowntime(Condition c) { @@ -385,7 +387,8 @@ public class ZenModePanel extends LinearLayout { return (ConditionTag) mZenConditions.getChildAt(index).getTag(); } - private void checkForDefault() { + private void handleSelectDefault() { + if (!mExpanded) return; // are we left without anything selected? if so, set a default for (int i = 0; i < mZenConditions.getChildCount(); i++) { if (getConditionTagAt(i).rb.isChecked()) { @@ -638,6 +641,7 @@ public class ZenModePanel extends LinearLayout { private static final int UPDATE_CONDITIONS = 1; private static final int EXIT_CONDITION_CHANGED = 2; private static final int UPDATE_ZEN = 3; + private static final int SELECT_DEFAULT = 4; private H() { super(Looper.getMainLooper()); @@ -651,6 +655,8 @@ public class ZenModePanel extends LinearLayout { handleExitConditionChanged((Condition) msg.obj); } else if (msg.what == UPDATE_ZEN) { handleUpdateZen(msg.arg1); + } else if (msg.what == SELECT_DEFAULT) { + handleSelectDefault(); } } } |