diff options
author | d34d <clark@cyngn.com> | 2016-01-18 11:46:59 -0800 |
---|---|---|
committer | Gerrit Code Review <gerrit@cyanogenmod.org> | 2016-01-22 09:32:19 -0800 |
commit | 24f2e0445984fe9ffaeb1a7a16616820460c1024 (patch) | |
tree | 398b36cfb323ed56a24e7728b5ae1fb9b222bfc1 /packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java | |
parent | c915fbfbc76eff4b31fbfa06bf45734fb73c104d (diff) | |
download | frameworks_base-24f2e0445984fe9ffaeb1a7a16616820460c1024.zip frameworks_base-24f2e0445984fe9ffaeb1a7a16616820460c1024.tar.gz frameworks_base-24f2e0445984fe9ffaeb1a7a16616820460c1024.tar.bz2 |
SysUI: Recreate volume dialog on theme change
Change-Id: Ib58c015558181e32885b53052d4da0d0b16a8497
TICKET: CYNGNOS-1643
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java | 46 |
1 files changed, 26 insertions, 20 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java index aa2f0d3..3ed18c9 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java @@ -959,6 +959,12 @@ public class VolumeDialog { } }; + public void cleanup() { + mController.removeCallback(mControllerCallbackH); + mZenFooter.cleanup(); + mAccessibility.cleanup(); + } + private final class H extends Handler { private static final int SHOW = 1; private static final int DISMISS = 2; @@ -1081,26 +1087,7 @@ public class VolumeDialog { public void init() { mMgr = (AccessibilityManager) mContext.getSystemService(Context.ACCESSIBILITY_SERVICE); - mDialogView.addOnAttachStateChangeListener(new OnAttachStateChangeListener() { - @Override - public void onViewDetachedFromWindow(View v) { - if (D.BUG) Log.d(TAG, "onViewDetachedFromWindow"); - // noop - } - - @Override - public void onViewAttachedToWindow(View v) { - if (D.BUG) Log.d(TAG, "onViewAttachedToWindow"); - updateFeedbackEnabled(); - } - }); - mDialogView.setAccessibilityDelegate(this); - mMgr.addAccessibilityStateChangeListener(new AccessibilityStateChangeListener() { - @Override - public void onAccessibilityStateChanged(boolean enabled) { - updateFeedbackEnabled(); - } - }); + mDialogView.addOnAttachStateChangeListener(mOnAttachStateChangeListener); updateFeedbackEnabled(); } @@ -1111,6 +1098,10 @@ public class VolumeDialog { return super.onRequestSendAccessibilityEvent(host, child, event); } + public void cleanup() { + mDialogView.removeOnAttachStateChangeListener(mOnAttachStateChangeListener); + } + private void updateFeedbackEnabled() { mFeedbackEnabled = computeFeedbackEnabled(); } @@ -1126,6 +1117,21 @@ public class VolumeDialog { } return false; } + + private OnAttachStateChangeListener mOnAttachStateChangeListener = + new OnAttachStateChangeListener() { + @Override + public void onViewDetachedFromWindow(View v) { + if (D.BUG) Log.d(TAG, "onViewDetachedFromWindow"); + // noop + } + + @Override + public void onViewAttachedToWindow(View v) { + if (D.BUG) Log.d(TAG, "onViewAttachedToWindow"); + updateFeedbackEnabled(); + } + }; } private static class VolumeRow { |