diff options
author | John Spurlock <jspurlock@google.com> | 2015-02-24 12:12:25 -0500 |
---|---|---|
committer | John Spurlock <jspurlock@google.com> | 2015-02-25 12:46:13 -0500 |
commit | 3c4076a2465a89cf21ffd2e94cabd15be1d31689 (patch) | |
tree | 1215a8ee879a2fb8006e8eaa2e0c8cea6e6219f6 /packages/SystemUI/src/com/android/systemui/volume | |
parent | cff41ae3635170b93acca5bfd2813b719e060e0f (diff) | |
download | frameworks_base-3c4076a2465a89cf21ffd2e94cabd15be1d31689.zip frameworks_base-3c4076a2465a89cf21ffd2e94cabd15be1d31689.tar.gz frameworks_base-3c4076a2465a89cf21ffd2e94cabd15be1d31689.tar.bz2 |
DND: Add a hidden DND tile to quick settings.
Invisible by default, not activatable when the platform
volume controller is active.
However, when the platform volume controller is not active,
it can be enabled via a broadcast intent.
When enabled, the status bar icon also changes to a single
dnd icon.
Very little more than embedding the existing zen mode panel
into the detail pane of a new QS tile.
Change-Id: I1e0ff6fbb99b00f67b53bceda8cbf121f3ef6b52
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/volume')
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java | 2 | ||||
-rw-r--r-- | packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java | 32 |
2 files changed, 29 insertions, 5 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java index 8048a48..5e3ec3f 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java @@ -44,6 +44,7 @@ import android.util.Log; import com.android.systemui.R; import com.android.systemui.SystemUI; import com.android.systemui.keyguard.KeyguardViewMediator; +import com.android.systemui.qs.tiles.DndTile; import com.android.systemui.statusbar.ServiceMonitor; import com.android.systemui.statusbar.phone.PhoneStatusBar; import com.android.systemui.statusbar.phone.SystemUIDialog; @@ -114,6 +115,7 @@ public class VolumeUI extends SystemUI { if (LOGD) Log.d(TAG, "Registering volume controller"); mAudioManager.setVolumeController(mVolumeController); mMediaSessionManager.setRemoteVolumeController(mRemoteVolumeController); + DndTile.setVisible(mContext, false); } else { if (LOGD) Log.d(TAG, "Unregistering volume controller"); mAudioManager.setVolumeController(null); diff --git a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java index 5726fa7..6cecc8f 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java +++ b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java @@ -90,9 +90,11 @@ public class ZenModePanel extends LinearLayout { private String mTag = TAG + "/" + Integer.toHexString(System.identityHashCode(this)); private SegmentedButtons mZenButtons; + private ViewGroup mZenButtonsContainer; private View mZenSubhead; private TextView mZenSubheadCollapsed; private TextView mZenSubheadExpanded; + private View mZenEmbeddedDivider; private View mMoreSettings; private LinearLayout mZenConditions; @@ -114,6 +116,7 @@ public class ZenModePanel extends LinearLayout { private Condition mSessionExitCondition; private Condition[] mConditions; private Condition mTimeCondition; + private boolean mEmbedded; public ZenModePanel(Context context, AttributeSet attrs) { super(context, attrs); @@ -140,9 +143,25 @@ public class ZenModePanel extends LinearLayout { pw.print(" mExpanded="); pw.println(mExpanded); pw.print(" mSessionZen="); pw.println(mSessionZen); pw.print(" mAttachedZen="); pw.println(mAttachedZen); + pw.print(" mEmbedded="); pw.println(mEmbedded); mTransitionHelper.dump(fd, pw, args); } + public void setEmbedded(boolean embedded) { + if (mEmbedded == embedded) return; + mEmbedded = embedded; + mZenButtonsContainer.setLayoutTransition(mEmbedded ? null : newLayoutTransition(null)); + if (mEmbedded) { + mZenButtonsContainer.setBackground(null); + } else { + mZenButtonsContainer.setBackgroundResource(R.drawable.qs_background_secondary); + } + mZenButtons.getChildAt(2).setVisibility(mEmbedded ? GONE : VISIBLE); + mZenEmbeddedDivider.setVisibility(mEmbedded ? VISIBLE : GONE); + setExpanded(mEmbedded); + updateWidgets(); + } + @Override protected void onFinishInflate() { super.onFinishInflate(); @@ -156,10 +175,11 @@ public class ZenModePanel extends LinearLayout { Global.ZEN_MODE_OFF); mZenButtons.setCallback(mZenButtonsCallback); - final ViewGroup zenButtonsContainer = (ViewGroup) findViewById(R.id.zen_buttons_container); - zenButtonsContainer.setLayoutTransition(newLayoutTransition(null)); + mZenButtonsContainer = (ViewGroup) findViewById(R.id.zen_buttons_container); + mZenButtonsContainer.setLayoutTransition(newLayoutTransition(null)); mZenSubhead = findViewById(R.id.zen_subhead); + mZenEmbeddedDivider = findViewById(R.id.zen_embedded_divider); mZenSubheadCollapsed = (TextView) findViewById(R.id.zen_subhead_collapsed); mZenSubheadCollapsed.setOnClickListener(new View.OnClickListener() { @@ -222,7 +242,9 @@ public class ZenModePanel extends LinearLayout { mAttachedZen = -1; mSessionZen = -1; setSessionExitCondition(null); - setExpanded(false); + if (!mEmbedded) { + setExpanded(false); + } setRequestingConditions(false); mTransitionHelper.clear(); } @@ -361,7 +383,7 @@ public class ZenModePanel extends LinearLayout { private void handleUpdateZen(int zen) { if (mSessionZen != -1 && mSessionZen != zen) { - setExpanded(zen != Global.ZEN_MODE_OFF); + setExpanded(mEmbedded || zen != Global.ZEN_MODE_OFF); mSessionZen = zen; } mZenButtons.setSelectedValue(zen); @@ -403,7 +425,7 @@ public class ZenModePanel extends LinearLayout { final boolean expanded = !mHidden && mExpanded; mZenButtons.setVisibility(mHidden ? GONE : VISIBLE); - mZenSubhead.setVisibility(!mHidden && !zenOff ? VISIBLE : GONE); + mZenSubhead.setVisibility(!mHidden && !zenOff && !mEmbedded ? VISIBLE : GONE); mZenSubheadExpanded.setVisibility(expanded ? VISIBLE : GONE); mZenSubheadCollapsed.setVisibility(!expanded ? VISIBLE : GONE); mMoreSettings.setVisibility(zenImportant && expanded ? VISIBLE : GONE); |