summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
author Muyuan Li <muyuanli@google.com> 2016-03-23 20:08:26 -0700
committer Muyuan Li <muyuanli@google.com> 2016-03-29 20:09:46 +0000
commit8303bd2b17eb33dcecf2ef63d1aee87f7427f812 (patch)
tree237383ce47bb630f41453068b50569b4183962e2
parenta5c45459d3f114f125da3357c36b5a3f659d2229 (diff)
sysui: refactor for extension
Refactored ZenModePanel: 1. Button creation is split from onFinishInflate. 2. Added a method to query current Zen condition 3. Made mZenButtonsCallback protected. Change-Id: I959fa2f7770ba1888af01eababe7c4512981332d (cherry picked from commit 79df200108c5240c0d2a041d7d841f8d9d143ec0)
-rw-r--r--packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java14
1 files changed, 8 insertions, 6 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java
index 6976c0b1d312..9df09fc2940a 100644
--- a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java
+++ b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java
@@ -95,7 +95,7 @@ public class ZenModePanel extends LinearLayout {
private String mTag = TAG + "/" + Integer.toHexString(System.identityHashCode(this));
- private SegmentedButtons mZenButtons;
+ protected SegmentedButtons mZenButtons;
private View mZenIntroduction;
private TextView mZenIntroductionMessage;
private View mZenIntroductionConfirm;
@@ -148,10 +148,7 @@ public class ZenModePanel extends LinearLayout {
mTransitionHelper.dump(fd, pw, args);
}
- @Override
- protected void onFinishInflate() {
- super.onFinishInflate();
-
+ protected void createZenButtons() {
mZenButtons = (SegmentedButtons) findViewById(R.id.zen_buttons);
mZenButtons.addButton(R.string.interruption_level_none_twoline,
R.string.interruption_level_none_with_warning,
@@ -163,7 +160,12 @@ public class ZenModePanel extends LinearLayout {
R.string.interruption_level_priority,
Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS);
mZenButtons.setCallback(mZenButtonsCallback);
+ }
+ @Override
+ protected void onFinishInflate() {
+ super.onFinishInflate();
+ createZenButtons();
mZenIntroduction = findViewById(R.id.zen_introduction);
mZenIntroductionMessage = (TextView) findViewById(R.id.zen_introduction_message);
mSpTexts.add(mZenIntroductionMessage);
@@ -917,7 +919,7 @@ public class ZenModePanel extends LinearLayout {
}
}
- private final SegmentedButtons.Callback mZenButtonsCallback = new SegmentedButtons.Callback() {
+ protected final SegmentedButtons.Callback mZenButtonsCallback = new SegmentedButtons.Callback() {
@Override
public void onSelected(final Object value, boolean fromClick) {
if (value != null && mZenButtons.isShown() && isAttachedToWindow()) {