summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI/src/com/android/systemui/volume
diff options
context:
space:
mode:
authord34d <clark@cyngn.com>2016-01-18 11:46:59 -0800
committerGerrit Code Review <gerrit@cyanogenmod.org>2016-01-22 09:32:19 -0800
commit24f2e0445984fe9ffaeb1a7a16616820460c1024 (patch)
tree398b36cfb323ed56a24e7728b5ae1fb9b222bfc1 /packages/SystemUI/src/com/android/systemui/volume
parentc915fbfbc76eff4b31fbfa06bf45734fb73c104d (diff)
downloadframeworks_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')
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java46
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java9
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java3
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/ZenFooter.java26
4 files changed, 51 insertions, 33 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 {
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java
index 1083f40..742b18b 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java
@@ -43,7 +43,7 @@ public class VolumeDialogComponent implements VolumeComponent {
private final Context mContext;
private final VolumeDialogController mController;
private final ZenModeController mZenModeController;
- private final VolumeDialog mDialog;
+ private VolumeDialog mDialog;
private final VolumePolicy mVolumePolicy = new VolumePolicy(
true, // volumeDownToEnterSilent
true, // volumeUpToExitSilent
@@ -138,4 +138,11 @@ public class VolumeDialogComponent implements VolumeComponent {
}
};
+ public void recreateDialog() {
+ if (mDialog != null) mDialog.cleanup();
+
+ mDialog = new VolumeDialog(mContext, WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY,
+ mController, mZenModeController, mVolumeDialogCallback);
+ applyConfiguration();
+ }
}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java
index e49ff50..fa0de7d 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java
@@ -97,9 +97,8 @@ public class VolumeUI extends SystemUI {
getVolumeComponent().onConfigurationChanged(newConfig);
if (isThemeChange(newConfig)) {
- // TODO: implement initPanel() if needed
- //initPanel();
mContext.recreateTheme();
+ mVolumeComponent.recreateDialog();
}
mConfiguration.setTo(newConfig);
}
diff --git a/packages/SystemUI/src/com/android/systemui/volume/ZenFooter.java b/packages/SystemUI/src/com/android/systemui/volume/ZenFooter.java
index af7ee08..0fb80c0 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/ZenFooter.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/ZenFooter.java
@@ -69,17 +69,19 @@ public class ZenFooter extends LinearLayout {
mSpTexts.add(mEndNowButton);
}
+ private ZenModeController.Callback mZenModeCallback = new ZenModeController.Callback() {
+ @Override
+ public void onZenChanged(int zen) {
+ setZen(zen);
+ }
+ @Override
+ public void onConfigChanged(ZenModeConfig config) {
+ setConfig(config);
+ }
+ };
+
public void init(final ZenModeController controller) {
- controller.addCallback(new ZenModeController.Callback() {
- @Override
- public void onZenChanged(int zen) {
- setZen(zen);
- }
- @Override
- public void onConfigChanged(ZenModeConfig config) {
- setConfig(config);
- }
- });
+ controller.addCallback(mZenModeCallback);
mEndNowButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
@@ -142,4 +144,8 @@ public class ZenFooter extends LinearLayout {
mSpTexts.update();
}
+ public void cleanup() {
+ mController.removeCallback(mZenModeCallback);
+ }
+
}