diff options
author | John Spurlock <jspurlock@google.com> | 2014-07-11 22:56:26 +0000 |
---|---|---|
committer | Android (Google) Code Review <android-gerrit@google.com> | 2014-07-10 21:35:02 +0000 |
commit | dfd6b4e9f475ef3a8cf7fc7b5451b8c73aecdfff (patch) | |
tree | 9ef3b7ebc3a51069923733f293bd9222bfc43353 /packages/SystemUI/src | |
parent | 61c9ba0de8077ef35597e26bc96dc4b91d720a2d (diff) | |
parent | ea9938ca5f9ce228a7cc5159ccb5ab404ac2b2bb (diff) | |
download | frameworks_base-dfd6b4e9f475ef3a8cf7fc7b5451b8c73aecdfff.zip frameworks_base-dfd6b4e9f475ef3a8cf7fc7b5451b8c73aecdfff.tar.gz frameworks_base-dfd6b4e9f475ef3a8cf7fc7b5451b8c73aecdfff.tar.bz2 |
Merge "Volume: Extend the volume dialog timeout for notifications."
Diffstat (limited to 'packages/SystemUI/src')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java | 17 |
1 files changed, 15 insertions, 2 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java b/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java index 3570257..ad2cf75 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumePanel.java @@ -85,6 +85,7 @@ public class VolumePanel extends Handler { private static final int FREE_DELAY = 10000; private static final int TIMEOUT_DELAY = 3000; private static final int TIMEOUT_DELAY_SHORT = 1500; + private static final int TIMEOUT_DELAY_COLLAPSED = 4500; private static final int TIMEOUT_DELAY_EXPANDED = 10000; private static final int MSG_VOLUME_CHANGED = 0; @@ -591,11 +592,18 @@ public class VolumePanel extends Handler { private void updateTimeoutDelay() { mTimeoutDelay = mActiveStreamType == AudioManager.STREAM_MUSIC ? TIMEOUT_DELAY_SHORT - : mZenPanelExpanded ? TIMEOUT_DELAY_EXPANDED : TIMEOUT_DELAY; + : mZenPanelExpanded ? TIMEOUT_DELAY_EXPANDED + : isZenPanelVisible() ? TIMEOUT_DELAY_COLLAPSED + : TIMEOUT_DELAY; + } + + private boolean isZenPanelVisible() { + return mZenPanel != null && mZenPanel.getVisibility() == View.VISIBLE; } private void setZenPanelVisible(boolean visible) { if (LOGD) Log.d(mTag, "setZenPanelVisible " + visible + " mZenPanel=" + mZenPanel); + final boolean changing = visible != isZenPanelVisible(); if (visible) { if (mZenPanel == null) { mZenPanel = (ZenModePanel) mZenPanelStub.inflate(); @@ -629,6 +637,10 @@ public class VolumePanel extends Handler { mZenPanel.setVisibility(View.GONE); } } + if (changing) { + updateTimeoutDelay(); + resetTimeout(); + } } public void updateStates() { @@ -1198,7 +1210,8 @@ public class VolumePanel extends Handler { } private void resetTimeout() { - if (LOGD) Log.d(mTag, "resetTimeout at " + System.currentTimeMillis()); + if (LOGD) Log.d(mTag, "resetTimeout at " + System.currentTimeMillis() + + " delay=" + mTimeoutDelay); removeMessages(MSG_TIMEOUT); sendEmptyMessageDelayed(MSG_TIMEOUT, mTimeoutDelay); removeMessages(MSG_USER_ACTIVITY); |