diff options
author | John Spurlock <jspurlock@google.com> | 2015-04-28 11:19:13 -0400 |
---|---|---|
committer | John Spurlock <jspurlock@google.com> | 2015-04-29 09:58:38 -0400 |
commit | d9c75dba75ad4742dbaadc34db99d2b76cebca91 (patch) | |
tree | af6a1b4b78602174ec8442b5d019abe1f18f0903 /packages/SystemUI/src/com/android/systemui/volume | |
parent | fa1c1f97df601df50b3998f7ae98a2d3bfb03466 (diff) | |
download | frameworks_base-d9c75dba75ad4742dbaadc34db99d2b76cebca91.zip frameworks_base-d9c75dba75ad4742dbaadc34db99d2b76cebca91.tar.gz frameworks_base-d9c75dba75ad4742dbaadc34db99d2b76cebca91.tar.bz2 |
Volume: Simple dialog footer, DND in quick settings.
- Show DND tile by default, this is now the only
place to manage DND modes / end conditions.
- Remove super footer from volume dialog, replace with
a simplified version that displays the current mode
and allows ending DND.
- Remove obsolete text-only footer from codebase.
- Migrate remaining volume items into main resource files.
- Rename "No interruptions" to "Total silence".
- Add new user information banner for "Total silence"
- Crude media filtering for Total Silence.
(deeper muting changes will be done as a followup)
- Disable volume dialog sliders completely if muted due
to zen.
- Cleanup ZenModePanel: assume embedded mode, remove
expandable subhead
- Remember "favorite" DND mode inside the DND config panel.
- AudioService: consult ringer-mode-delegate before voluming
down into silent.
- Add new hour options to time-based exit conditions.
- Volume dialog visual updates to move closer to final visuals.
- Unify ringer=silent with DND.
Bug: 19260237
Change-Id: I05d7e001eca3b5125418ec3bc4087d0cb8866717
Diffstat (limited to 'packages/SystemUI/src/com/android/systemui/volume')
9 files changed, 132 insertions, 442 deletions
diff --git a/packages/SystemUI/src/com/android/systemui/volume/SegmentedButtons.java b/packages/SystemUI/src/com/android/systemui/volume/SegmentedButtons.java index 4f20ac7..f7cb9fe 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/SegmentedButtons.java +++ b/packages/SystemUI/src/com/android/systemui/volume/SegmentedButtons.java @@ -17,6 +17,7 @@ package com.android.systemui.volume; import android.content.Context; +import android.graphics.Typeface; import android.util.AttributeSet; import android.view.LayoutInflater; import android.view.View; @@ -30,6 +31,8 @@ import java.util.Objects; public class SegmentedButtons extends LinearLayout { private static final int LABEL_RES_KEY = R.id.label; + private static final Typeface REGULAR = Typeface.create("sans-serif", Typeface.NORMAL); + private static final Typeface MEDIUM = Typeface.create("sans-serif-medium", Typeface.NORMAL); private final Context mContext; private final LayoutInflater mInflater; @@ -60,6 +63,7 @@ public class SegmentedButtons extends LinearLayout { final Object tag = c.getTag(); final boolean selected = Objects.equals(mSelectedValue, tag); c.setSelected(selected); + c.setTypeface(selected ? MEDIUM : REGULAR); } fireOnSelected(); } diff --git a/packages/SystemUI/src/com/android/systemui/volume/Util.java b/packages/SystemUI/src/com/android/systemui/volume/Util.java index 216a4da..4214091 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/Util.java +++ b/packages/SystemUI/src/com/android/systemui/volume/Util.java @@ -144,9 +144,14 @@ class Util { return HMMAA.format(new Date(millis)); } - public static void setText(TextView tv, CharSequence text) { - if (Objects.equals(tv.getText(), text)) return; + private static CharSequence emptyToNull(CharSequence str) { + return str == null || str.length() == 0 ? null : str; + } + + public static boolean setText(TextView tv, CharSequence text) { + if (Objects.equals(emptyToNull(tv.getText()), emptyToNull(text))) return false; tv.setText(text); + return true; } public static final void setVisOrGone(View v, boolean vis) { diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java index bb4aa61..9434036 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialog.java @@ -37,7 +37,6 @@ import android.os.Looper; import android.os.Message; import android.os.SystemClock; import android.provider.Settings.Global; -import android.service.notification.ZenModeConfig; import android.util.DisplayMetrics; import android.util.Log; import android.util.SparseBooleanArray; @@ -52,7 +51,6 @@ import android.view.ViewGroup.MarginLayoutParams; import android.view.Window; import android.view.WindowManager; import android.view.animation.DecelerateInterpolator; -import android.widget.Button; import android.widget.ImageButton; import android.widget.LinearLayout; import android.widget.SeekBar; @@ -90,16 +88,12 @@ public class VolumeDialog { private final ViewGroup mDialogView; private final ViewGroup mDialogContentView; private final ImageButton mExpandButton; - private final TextView mFootlineText; - private final Button mFootlineAction; private final View mSettingsButton; - private final View mFooter; private final List<VolumeRow> mRows = new ArrayList<VolumeRow>(); private final SpTexts mSpTexts; private final SparseBooleanArray mDynamic = new SparseBooleanArray(); private final KeyguardManager mKeyguard; private final int mExpandButtonAnimationDuration; - private final View mTextFooter; private final ZenFooter mZenFooter; private final LayoutTransition mLayoutTransition; private final Object mSafetyWarningLock = new Object(); @@ -108,8 +102,6 @@ public class VolumeDialog { private boolean mExpanded; private int mActiveStream; private boolean mShowHeaders = VolumePrefs.DEFAULT_SHOW_HEADERS; - private boolean mShowFooter = VolumePrefs.DEFAULT_SHOW_FOOTER; - private boolean mShowZenFooter = VolumePrefs.DEFAULT_ZEN_FOOTER; private boolean mAutomute = VolumePrefs.DEFAULT_ENABLE_AUTOMUTE; private boolean mSilentMode = VolumePrefs.DEFAULT_ENABLE_SILENT_MODE; private State mState; @@ -118,7 +110,7 @@ public class VolumeDialog { private SafetyWarningDialog mSafetyWarning; private Callback mCallback; - public VolumeDialog(Context context, VolumeDialogController controller, + public VolumeDialog(Context context, int windowType, VolumeDialogController controller, ZenModeController zenModeController, Callback callback) { mContext = context; mController = controller; @@ -141,7 +133,7 @@ public class VolumeDialog { mDialog.setCanceledOnTouchOutside(true); final Resources res = mContext.getResources(); final WindowManager.LayoutParams lp = window.getAttributes(); - lp.type = WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY; + lp.type = windowType; lp.format = PixelFormat.TRANSLUCENT; lp.setTitle(VolumeDialog.class.getSimpleName()); lp.gravity = Gravity.TOP | Gravity.CENTER_HORIZONTAL; @@ -176,17 +168,11 @@ public class VolumeDialog { addRow(AudioManager.STREAM_SYSTEM, R.drawable.ic_volume_system, R.drawable.ic_volume_system_mute, false); - mTextFooter = mDialog.findViewById(R.id.volume_text_footer); - mFootlineText = (TextView) mDialog.findViewById(R.id.volume_footline_text); - mSpTexts.add(mFootlineText); - mFootlineAction = (Button) mDialog.findViewById(R.id.volume_footline_action_button); - mSpTexts.add(mFootlineAction); - mFooter = mDialog.findViewById(R.id.volume_footer); mSettingsButton = mDialog.findViewById(R.id.volume_settings_button); mSettingsButton.setOnClickListener(mClickSettings); mExpandButtonAnimationDuration = res.getInteger(R.integer.volume_expand_animation_duration); mZenFooter = (ZenFooter) mDialog.findViewById(R.id.volume_zen_footer); - mZenFooter.init(zenModeController, mZenFooterCallback); + mZenFooter.init(zenModeController); controller.addCallback(mControllerCallbackH, mHandler); controller.getState(); @@ -217,18 +203,6 @@ public class VolumeDialog { mHandler.sendEmptyMessage(H.RECHECK_ALL); } - public void setShowFooter(boolean show) { - if (mShowFooter == show) return; - mShowFooter = show; - mHandler.sendEmptyMessage(H.RECHECK_ALL); - } - - public void setZenFooter(boolean zen) { - if (mShowZenFooter == zen) return; - mShowZenFooter = zen; - mHandler.sendEmptyMessage(H.RECHECK_ALL); - } - public void setAutomute(boolean automute) { if (mAutomute == automute) return; mAutomute = automute; @@ -315,7 +289,6 @@ public class VolumeDialog { writer.print(" mActiveStream: "); writer.println(mActiveStream); writer.print(" mDynamic: "); writer.println(mDynamic); writer.print(" mShowHeaders: "); writer.println(mShowHeaders); - writer.print(" mShowFooter: "); writer.println(mShowFooter); writer.print(" mAutomute: "); writer.println(mAutomute); writer.print(" mSilentMode: "); writer.println(mSilentMode); } @@ -444,7 +417,6 @@ public class VolumeDialog { } private int computeTimeoutH() { - if (mZenFooter != null && mZenFooter.isFooterExpanded()) return 10000; if (mSafetyWarning != null) return 5000; if (mExpanded || mExpanding) return 5000; if (mActiveStream == AudioManager.STREAM_MUSIC) return 1500; @@ -515,18 +487,9 @@ public class VolumeDialog { final VolumeRow activeRow = getActiveRow(); updateFooterH(); updateExpandButtonH(); - final boolean footerVisible = mFooter.getVisibility() == View.VISIBLE; if (!mShowing) { trimObsoleteH(); } - // first, find the last visible row - VolumeRow lastVisible = null; - for (VolumeRow row : mRows) { - final boolean isActive = row == activeRow; - if (isVisibleH(row, isActive)) { - lastVisible = row; - } - } // apply changes to all rows for (VolumeRow row : mRows) { final boolean isActive = row == activeRow; @@ -542,8 +505,7 @@ public class VolumeDialog { row.settingsButton.setImageResource(expandButtonRes); } } - Util.setVisOrInvis(row.settingsButton, - mExpanded && (!footerVisible && row == lastVisible)); + Util.setVisOrInvis(row.settingsButton, false); row.header.setAlpha(mExpanded && isActive ? 1 : 0.5f); } } @@ -585,51 +547,9 @@ public class VolumeDialog { updateFooterH(); } - private void updateTextFooterH() { - final boolean zen = mState.zenMode != Global.ZEN_MODE_OFF; - final boolean wasVisible = mFooter.getVisibility() == View.VISIBLE; - Util.setVisOrGone(mTextFooter, mExpanded && mShowFooter && (zen || mShowing && wasVisible)); - if (mTextFooter.getVisibility() == View.VISIBLE) { - String text = null; - String action = null; - if (mState.exitCondition != null) { - final long countdown = ZenModeConfig.tryParseCountdownConditionId(mState - .exitCondition.id); - if (countdown != 0) { - text = mContext.getString(R.string.volume_dnd_ends_at, - Util.getShortTime(countdown)); - action = mContext.getString(R.string.volume_end_now); - } - } - if (text == null) { - text = mContext.getString(R.string.volume_dnd_is_on); - } - if (action == null) { - action = mContext.getString(R.string.volume_turn_off); - } - Util.setText(mFootlineText, text); - Util.setText(mFootlineAction, action); - mFootlineAction.setOnClickListener(mTurnOffDnd); - } - Util.setVisOrGone(mFootlineText, zen); - Util.setVisOrGone(mFootlineAction, zen); - } - private void updateFooterH() { - if (!mShowFooter) { - Util.setVisOrGone(mFooter, false); - return; - } - if (mShowZenFooter) { - Util.setVisOrGone(mTextFooter, false); - final boolean ringActive = mActiveStream == AudioManager.STREAM_RING; - Util.setVisOrGone(mZenFooter, mZenFooter.isZen() && ringActive - || mShowing && (mExpanded || mZenFooter.getVisibility() == View.VISIBLE)); - mZenFooter.update(); - } else { - Util.setVisOrGone(mZenFooter, false); - updateTextFooterH(); - } + Util.setVisOrGone(mZenFooter, mState.zenMode != Global.ZEN_MODE_OFF); + mZenFooter.update(); } private void updateVolumeRowH(VolumeRow row) { @@ -642,12 +562,20 @@ public class VolumeDialog { } final boolean isRingStream = row.stream == AudioManager.STREAM_RING; final boolean isSystemStream = row.stream == AudioManager.STREAM_SYSTEM; + final boolean isAlarmStream = row.stream == AudioManager.STREAM_ALARM; + final boolean isMusicStream = row.stream == AudioManager.STREAM_MUSIC; final boolean isRingVibrate = isRingStream && mState.ringerModeInternal == AudioManager.RINGER_MODE_VIBRATE; - final boolean isNoned = (isRingStream || isSystemStream) - && mState.zenMode == Global.ZEN_MODE_NO_INTERRUPTIONS; - final boolean isLimited = isRingStream - && mState.zenMode == Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS; + final boolean isRingSilent = isRingStream + && mState.ringerModeInternal == AudioManager.RINGER_MODE_SILENT; + final boolean isZenAlarms = mState.zenMode == Global.ZEN_MODE_ALARMS; + final boolean isZenNone = mState.zenMode == Global.ZEN_MODE_NO_INTERRUPTIONS; + final boolean isZenPriority = mState.zenMode == Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS; + final boolean isRingZenNone = (isRingStream || isSystemStream) && isZenNone; + final boolean isRingLimited = isRingStream && isZenPriority; + final boolean zenMuted = isZenAlarms ? (isRingStream || isSystemStream) + : isZenNone ? (isRingStream || isSystemStream || isAlarmStream || isMusicStream) + : false; // update slider max final int max = ss.levelMax * 100; @@ -663,15 +591,15 @@ public class VolumeDialog { // update header text final String text; - if (isNoned) { + if (isRingZenNone) { text = mContext.getString(R.string.volume_stream_muted_dnd, ss.name); - } else if (isRingVibrate && isLimited) { + } else if (isRingVibrate && isRingLimited) { text = mContext.getString(R.string.volume_stream_vibrate_dnd, ss.name); } else if (isRingVibrate) { text = mContext.getString(R.string.volume_stream_vibrate, ss.name); } else if (ss.muted || mAutomute && ss.level == 0) { text = mContext.getString(R.string.volume_stream_muted, ss.name); - } else if (isLimited) { + } else if (isRingLimited) { text = mContext.getString(R.string.volume_stream_limited_dnd, ss.name); } else { text = ss.name; @@ -679,11 +607,12 @@ public class VolumeDialog { Util.setText(row.header, text); // update icon - final boolean iconEnabled = mAutomute || ss.muteSupported; + final boolean iconEnabled = (mAutomute || ss.muteSupported) && !zenMuted; row.icon.setEnabled(iconEnabled); row.icon.setAlpha(iconEnabled ? 1 : 0.5f); final int iconRes = isRingVibrate ? R.drawable.ic_volume_ringer_vibrate + : isRingSilent || zenMuted ? row.cachedIconRes : ss.routedToBluetooth ? (ss.muted ? R.drawable.ic_volume_media_bt_mute : R.drawable.ic_volume_media_bt) @@ -705,10 +634,11 @@ public class VolumeDialog { : Events.ICON_STATE_UNKNOWN; // update slider - updateVolumeRowSliderH(row); + updateVolumeRowSliderH(row, zenMuted); } - private void updateVolumeRowSliderH(VolumeRow row) { + private void updateVolumeRowSliderH(VolumeRow row, boolean zenMuted) { + row.slider.setEnabled(!zenMuted); if (row.tracking) { return; // don't update if user is sliding } @@ -887,46 +817,6 @@ public class VolumeDialog { } }; - private final View.OnClickListener mTurnOffDnd = new View.OnClickListener() { - @Override - public void onClick(View v) { - mSettingsButton.postDelayed(new Runnable() { - @Override - public void run() { - mController.setZenMode(Global.ZEN_MODE_OFF); - } - }, WAIT_FOR_RIPPLE); - } - }; - - private final ZenFooter.Callback mZenFooterCallback = new ZenFooter.Callback() { - @Override - public void onFooterExpanded() { - mHandler.sendEmptyMessage(H.RESCHEDULE_TIMEOUT); - } - - @Override - public void onSettingsClicked() { - dismiss(Events.DISMISS_REASON_SETTINGS_CLICKED); - if (mCallback != null) { - mCallback.onZenSettingsClicked(); - } - } - - @Override - public void onDoneClicked() { - dismiss(Events.DISMISS_REASON_DONE_CLICKED); - } - - @Override - public void onPrioritySettingsClicked() { - dismiss(Events.DISMISS_REASON_SETTINGS_CLICKED); - if (mCallback != null) { - mCallback.onZenPrioritySettingsClicked(); - } - } - }; - private final class H extends Handler { private static final int SHOW = 1; private static final int DISMISS = 2; diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java index 86abfcc..1083f40 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogComponent.java @@ -24,6 +24,7 @@ import android.media.VolumePolicy; import android.os.Bundle; import android.os.Handler; import android.provider.Settings; +import android.view.WindowManager; import com.android.systemui.SystemUI; import com.android.systemui.keyguard.KeyguardViewMediator; @@ -61,7 +62,8 @@ public class VolumeDialogComponent implements VolumeComponent { } }; mZenModeController = zen; - mDialog = new VolumeDialog(context, mController, zen, mVolumeDialogCallback); + mDialog = new VolumeDialog(context, WindowManager.LayoutParams.TYPE_VOLUME_OVERLAY, + mController, zen, mVolumeDialogCallback); applyConfiguration(); } @@ -76,12 +78,10 @@ public class VolumeDialogComponent implements VolumeComponent { mDialog.setStreamImportant(AudioManager.STREAM_ALARM, true); mDialog.setStreamImportant(AudioManager.STREAM_SYSTEM, false); mDialog.setShowHeaders(false); - mDialog.setShowFooter(true); - mDialog.setZenFooter(true); mDialog.setAutomute(true); mDialog.setSilentMode(false); mController.setVolumePolicy(mVolumePolicy); - mController.showDndTile(false); + mController.showDndTile(true); } @Override diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogController.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogController.java index 012eb41..3a8081f 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogController.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeDialogController.java @@ -100,7 +100,7 @@ public class VolumeDialogController { private boolean mEnabled; private boolean mDestroyed; private VolumePolicy mVolumePolicy; - private boolean mShowDndTile = false; + private boolean mShowDndTile = true; public VolumeDialogController(Context context, ComponentName component) { mContext = context.getApplicationContext(); @@ -125,6 +125,10 @@ public class VolumeDialogController { return mAudio; } + public ZenModeConfig getZenModeConfig() { + return mNoMan.getZenModeConfig(); + } + public void dismiss() { mCallbacks.onDismissRequested(Events.DISMISS_REASON_VOLUME_CONTROLLER); } @@ -342,7 +346,7 @@ public class VolumeDialogController { updateRingerModeExternalW(mAudio.getRingerMode()); updateZenModeW(); updateEffectsSuppressorW(mNoMan.getEffectsSuppressor()); - updateExitConditionW(); + updateZenModeConfigW(); mCallbacks.onStateChanged(mState); } @@ -395,17 +399,10 @@ public class VolumeDialogController { return stream == AudioManager.STREAM_RING || stream == AudioManager.STREAM_NOTIFICATION; } - private Condition getExitCondition() { - final ZenModeConfig config = mNoMan.getZenModeConfig(); - return config == null ? null - : config.manualRule == null ? null - : config.manualRule.condition; - } - - private boolean updateExitConditionW() { - final Condition exitCondition = getExitCondition(); - if (Objects.equals(mState.exitCondition, exitCondition)) return false; - mState.exitCondition = exitCondition; + private boolean updateZenModeConfigW() { + final ZenModeConfig zenModeConfig = getZenModeConfig(); + if (Objects.equals(mState.zenModeConfig, zenModeConfig)) return false; + mState.zenModeConfig = zenModeConfig; return true; } @@ -750,7 +747,7 @@ public class VolumeDialogController { changed = updateZenModeW(); } if (ZEN_MODE_CONFIG_URI.equals(uri)) { - changed = updateExitConditionW(); + changed = updateZenModeConfigW(); } if (changed) { mCallbacks.onStateChanged(mState); @@ -943,7 +940,7 @@ public class VolumeDialogController { public int zenMode; public ComponentName effectsSuppressor; public String effectsSuppressorName; - public Condition exitCondition; + public ZenModeConfig zenModeConfig; public int activeStream = NO_ACTIVE_STREAM; public State copy() { @@ -956,7 +953,7 @@ public class VolumeDialogController { rt.zenMode = zenMode; if (effectsSuppressor != null) rt.effectsSuppressor = effectsSuppressor.clone(); rt.effectsSuppressorName = effectsSuppressorName; - if (exitCondition != null) rt.exitCondition = exitCondition.copy(); + if (zenModeConfig != null) rt.zenModeConfig = zenModeConfig.copy(); rt.activeStream = activeStream; return rt; } @@ -977,10 +974,15 @@ public class VolumeDialogController { sb.append(",zenMode:").append(zenMode); sb.append(",effectsSuppressor:").append(effectsSuppressor); sb.append(",effectsSuppressorName:").append(effectsSuppressorName); - sb.append(",exitCondition:").append(exitCondition); + sb.append(",zenModeConfig:").append(zenModeConfig); sb.append(",activeStream:").append(activeStream); return sb.append('}').toString(); } + + public Condition getManualExitCondition() { + return zenModeConfig != null && zenModeConfig.manualRule != null + ? zenModeConfig.manualRule.condition : null; + } } public interface Callbacks { diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumePrefs.java b/packages/SystemUI/src/com/android/systemui/volume/VolumePrefs.java index 915e998..04339eb 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumePrefs.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumePrefs.java @@ -32,8 +32,6 @@ public class VolumePrefs { public static final String PREF_SHOW_HEADERS = "pref_show_headers"; public static final String PREF_SHOW_FAKE_REMOTE_1 = "pref_show_fake_remote_1"; public static final String PREF_SHOW_FAKE_REMOTE_2 = "pref_show_fake_remote_2"; - public static final String PREF_SHOW_FOOTER = "pref_show_footer"; - public static final String PREF_ZEN_FOOTER = "pref_zen_footer"; public static final String PREF_ENABLE_AUTOMUTE = "pref_enable_automute"; public static final String PREF_ENABLE_SILENT_MODE = "pref_enable_silent_mode"; public static final String PREF_DEBUG_LOGGING = "pref_debug_logging"; @@ -46,10 +44,8 @@ public class VolumePrefs { public static final String PREF_ADJUST_NOTIFICATION = "pref_adjust_notification"; public static final boolean DEFAULT_SHOW_HEADERS = true; - public static final boolean DEFAULT_SHOW_FOOTER = true; public static final boolean DEFAULT_ENABLE_AUTOMUTE = true; public static final boolean DEFAULT_ENABLE_SILENT_MODE = true; - public static final boolean DEFAULT_ZEN_FOOTER = true; public static void unregisterCallbacks(Context c, OnSharedPreferenceChangeListener listener) { prefs(c).unregisterOnSharedPreferenceChangeListener(listener); diff --git a/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java b/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java index 5f04aaf..2688813 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java +++ b/packages/SystemUI/src/com/android/systemui/volume/VolumeUI.java @@ -103,7 +103,7 @@ public class VolumeUI extends SystemUI { private void setDefaultVolumeController(boolean register) { if (register) { - DndTile.setVisible(mContext, false); + DndTile.setVisible(mContext, true); if (LOGD) Log.d(TAG, "Registering default volume controller"); getVolumeComponent().register(); } else { diff --git a/packages/SystemUI/src/com/android/systemui/volume/ZenFooter.java b/packages/SystemUI/src/com/android/systemui/volume/ZenFooter.java index 775c87d..8aded45 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/ZenFooter.java +++ b/packages/SystemUI/src/com/android/systemui/volume/ZenFooter.java @@ -16,20 +16,12 @@ package com.android.systemui.volume; import android.animation.LayoutTransition; -import android.animation.ValueAnimator; -import android.app.ActivityManager; import android.content.Context; -import android.content.res.Resources; import android.provider.Settings.Global; import android.service.notification.ZenModeConfig; import android.util.AttributeSet; -import android.util.Log; -import android.util.TypedValue; import android.view.View; -import android.widget.CompoundButton; -import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.LinearLayout; -import android.widget.Switch; import android.widget.TextView; import com.android.systemui.R; @@ -38,70 +30,36 @@ import com.android.systemui.statusbar.policy.ZenModeController; import java.util.Objects; /** - * Switch bar + zen mode panel (conditions) attached to the bottom of the volume dialog. + * Zen mode information (and end button) attached to the bottom of the volume dialog. */ public class ZenFooter extends LinearLayout { private static final String TAG = Util.logTag(ZenFooter.class); private final Context mContext; - private final float mSecondaryAlpha; - private final LayoutTransition mLayoutTransition; - private ZenModeController mController; - private Switch mSwitch; - private ZenModePanel mZenModePanel; - private View mZenModePanelButtons; - private View mZenModePanelMoreButton; - private View mZenModePanelDoneButton; - private View mSwitchBar; - private View mSwitchBarIcon; - private View mSummary; private TextView mSummaryLine1; private TextView mSummaryLine2; - private boolean mFooterExpanded; + private View mEndNowButton; private int mZen = -1; private ZenModeConfig mConfig; - private Callback mCallback; + private ZenModeController mController; public ZenFooter(Context context, AttributeSet attrs) { super(context, attrs); mContext = context; - mSecondaryAlpha = getFloat(context.getResources(), R.dimen.volume_secondary_alpha); - mLayoutTransition = new LayoutTransition(); - mLayoutTransition.setDuration(new ValueAnimator().getDuration() / 2); - mLayoutTransition.disableTransitionType(LayoutTransition.DISAPPEARING); - mLayoutTransition.disableTransitionType(LayoutTransition.CHANGE_DISAPPEARING); - } - - private static float getFloat(Resources r, int resId) { - final TypedValue tv = new TypedValue(); - r.getValue(resId, tv, true); - return tv.getFloat(); + setLayoutTransition(new LayoutTransition()); } @Override protected void onFinishInflate() { super.onFinishInflate(); - mSwitchBar = findViewById(R.id.volume_zen_switch_bar); - mSwitchBarIcon = findViewById(R.id.volume_zen_switch_bar_icon); - mSwitch = (Switch) findViewById(R.id.volume_zen_switch); - mZenModePanel = (ZenModePanel) findViewById(R.id.zen_mode_panel); - mZenModePanelButtons = findViewById(R.id.volume_zen_mode_panel_buttons); - mZenModePanelMoreButton = findViewById(R.id.volume_zen_mode_panel_more); - mZenModePanelDoneButton = findViewById(R.id.volume_zen_mode_panel_done); - mSummary = findViewById(R.id.volume_zen_panel_summary); - mSummaryLine1 = (TextView) findViewById(R.id.volume_zen_panel_summary_line_1); - mSummaryLine2 = (TextView) findViewById(R.id.volume_zen_panel_summary_line_2); + mSummaryLine1 = (TextView) findViewById(R.id.volume_zen_summary_line_1); + mSummaryLine2 = (TextView) findViewById(R.id.volume_zen_summary_line_2); + mEndNowButton = findViewById(R.id.volume_zen_end_now); } - public void init(ZenModeController controller, Callback callback) { - mCallback = callback; - mController = controller; - mZenModePanel.init(controller); - mZenModePanel.setEmbedded(true); - mZenModePanel.setCallback(mZenModePanelCallback); - mSwitch.setOnCheckedChangeListener(mCheckedListener); - mController.addCallback(new ZenModeController.Callback() { + public void init(final ZenModeController controller) { + controller.addCallback(new ZenModeController.Callback() { @Override public void onZenChanged(int zen) { setZen(zen); @@ -111,30 +69,15 @@ public class ZenFooter extends LinearLayout { setConfig(config); } }); - mSwitchBar.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - mSwitch.setChecked(!mSwitch.isChecked()); - } - }); - mZenModePanelMoreButton.setOnClickListener(new OnClickListener() { + mEndNowButton.setOnClickListener(new OnClickListener() { @Override public void onClick(View v) { - if (mCallback != null) { - mCallback.onSettingsClicked(); - } + controller.setZen(Global.ZEN_MODE_OFF, null, TAG); } }); - mZenModePanelDoneButton.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - if (mCallback != null) { - mCallback.onDoneClicked(); - } - } - }); - mZen = mController.getZen(); - mConfig = mController.getConfig(); + mZen = controller.getZen(); + mConfig = controller.getConfig(); + mController = controller; update(); } @@ -166,96 +109,17 @@ public class ZenFooter extends LinearLayout { return mZen == Global.ZEN_MODE_NO_INTERRUPTIONS; } - @Override - protected void onDetachedFromWindow() { - super.onDetachedFromWindow(); - setLayoutTransition(null); - setFooterExpanded(false); - } - - @Override - protected void onAttachedToWindow() { - super.onAttachedToWindow(); - setLayoutTransition(mLayoutTransition); - } - - private boolean setFooterExpanded(boolean expanded) { - if (mFooterExpanded == expanded) return false; - mFooterExpanded = expanded; - update(); - if (mCallback != null) { - mCallback.onFooterExpanded(); - } - return true; - } - - public boolean isFooterExpanded() { - return mFooterExpanded; - } - public void update() { - final boolean isZen = isZen(); - mSwitch.setOnCheckedChangeListener(null); - mSwitch.setChecked(isZen); - mSwitch.setOnCheckedChangeListener(mCheckedListener); - Util.setVisOrGone(mZenModePanel, isZen && mFooterExpanded); - Util.setVisOrGone(mZenModePanelButtons, isZen && mFooterExpanded); - Util.setVisOrGone(mSummary, isZen && !mFooterExpanded); - mSwitchBarIcon.setAlpha(isZen ? 1 : mSecondaryAlpha); final String line1 = isZenPriority() ? mContext.getString(R.string.interruption_level_priority) : isZenAlarms() ? mContext.getString(R.string.interruption_level_alarms) : isZenNone() ? mContext.getString(R.string.interruption_level_none) : null; Util.setText(mSummaryLine1, line1); + final String line2 = ZenModeConfig.getConditionSummary(mContext, mConfig, - ActivityManager.getCurrentUser()); + mController.getCurrentUser()); Util.setText(mSummaryLine2, line2); } - private final ZenModePanel.Callback mZenModePanelCallback = new ZenModePanel.Callback() { - @Override - public void onMoreSettings() { - if (mCallback != null) { - mCallback.onSettingsClicked(); - } - } - - @Override - public void onPrioritySettings() { - if (mCallback != null) { - mCallback.onPrioritySettingsClicked(); - } - } - - @Override - public void onInteraction() { - // noop - } - - @Override - public void onExpanded(boolean expanded) { - // noop - } - }; - - private final OnCheckedChangeListener mCheckedListener = new OnCheckedChangeListener() { - @Override - public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) { - if (D.BUG) Log.d(TAG, "onCheckedChanged " + isChecked); - if (isChecked != isZen()) { - final int newZen = isChecked ? Global.ZEN_MODE_ALARMS : Global.ZEN_MODE_OFF; - mZen = newZen; // this one's optimistic - setFooterExpanded(isChecked); - mController.setZen(newZen, null, TAG); - } - } - }; - - public interface Callback { - void onFooterExpanded(); - void onSettingsClicked(); - void onDoneClicked(); - void onPrioritySettingsClicked(); - } } diff --git a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java index 1b563dc..9f9c9ac 100644 --- a/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java +++ b/packages/SystemUI/src/com/android/systemui/volume/ZenModePanel.java @@ -41,8 +41,6 @@ import android.util.MathUtils; import android.view.LayoutInflater; import android.view.View; import android.view.ViewGroup; -import android.view.animation.AnimationUtils; -import android.view.animation.Interpolator; import android.widget.CompoundButton; import android.widget.CompoundButton.OnCheckedChangeListener; import android.widget.ImageView; @@ -85,22 +83,14 @@ public class ZenModePanel extends LinearLayout { private final H mHandler = new H(); private final ZenPrefs mPrefs; private final IconPulser mIconPulser; - private final int mSubheadWarningColor; - private final int mSubheadColor; - private final Interpolator mInterpolator; private final TransitionHelper mTransitionHelper = new TransitionHelper(); private final Uri mForeverId; 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 View mZenIntroduction; + private TextView mZenIntroductionMessage; private View mZenIntroductionConfirm; private View mZenIntroductionCustomize; private LinearLayout mZenConditions; @@ -113,7 +103,6 @@ public class ZenModePanel extends LinearLayout { private int mFirstConditionIndex; private boolean mRequestingConditions; private Condition mExitCondition; - private String mExitConditionText; private int mBucketIndex = -1; private boolean mExpanded; private boolean mHidden; @@ -123,7 +112,6 @@ 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); @@ -131,10 +119,6 @@ public class ZenModePanel extends LinearLayout { mPrefs = new ZenPrefs(); mInflater = LayoutInflater.from(mContext.getApplicationContext()); mIconPulser = new IconPulser(mContext); - mSubheadWarningColor = context.getColor(R.color.system_warning_color); - mSubheadColor = context.getColor(R.color.qs_subhead); - mInterpolator = AnimationUtils.loadInterpolator(mContext, - com.android.internal.R.interpolator.fast_out_slow_in); mForeverId = Condition.newId(mContext).appendPath("forever").build(); if (DEBUG) Log.d(mTag, "new ZenModePanel"); } @@ -149,25 +133,13 @@ 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); + pw.print(" mConfirmedPriorityIntroduction="); + pw.println(mPrefs.mConfirmedPriorityIntroduction); + pw.print(" mConfirmedSilenceIntroduction="); + pw.println(mPrefs.mConfirmedSilenceIntroduction); mTransitionHelper.dump(fd, pw, args); } - public void setEmbedded(boolean embedded) { - if (mEmbedded == embedded) return; - mEmbedded = embedded; - mZenButtonsContainer.setLayoutTransition(mEmbedded ? null : newLayoutTransition(null)); - setLayoutTransition(mEmbedded ? null : newLayoutTransition(null)); - if (mEmbedded) { - mZenButtonsContainer.setBackground(null); - } else { - mZenButtonsContainer.setBackgroundResource(R.drawable.qs_background_secondary); - } - mZenButtons.getChildAt(3).setVisibility(mEmbedded ? GONE : VISIBLE); - mZenEmbeddedDivider.setVisibility(mEmbedded ? VISIBLE : GONE); - updateWidgets(); - } - @Override protected void onFinishInflate() { super.onFinishInflate(); @@ -179,37 +151,10 @@ public class ZenModePanel extends LinearLayout { Global.ZEN_MODE_ALARMS); mZenButtons.addButton(R.string.interruption_level_priority_twoline, Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS); - mZenButtons.addButton(R.string.interruption_level_all, Global.ZEN_MODE_OFF); mZenButtons.setCallback(mZenButtonsCallback); - 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() { - @Override - public void onClick(View v) { - setExpanded(true); - } - }); - Interaction.register(mZenSubheadCollapsed, mInteractionCallback); - - mZenSubheadExpanded = (TextView) findViewById(R.id.zen_subhead_expanded); - Interaction.register(mZenSubheadExpanded, mInteractionCallback); - - mMoreSettings = findViewById(R.id.zen_more_settings); - mMoreSettings.setOnClickListener(new View.OnClickListener() { - @Override - public void onClick(View v) { - fireMoreSettings(); - } - }); - Interaction.register(mMoreSettings, mInteractionCallback); - mZenIntroduction = findViewById(R.id.zen_introduction); + mZenIntroductionMessage = (TextView) findViewById(R.id.zen_introduction_message); mZenIntroductionConfirm = findViewById(R.id.zen_introduction_confirm); mZenIntroductionConfirm.setOnClickListener(new OnClickListener() { @Override @@ -230,25 +175,25 @@ public class ZenModePanel extends LinearLayout { mZenConditions = (LinearLayout) findViewById(R.id.zen_conditions); - setLayoutTransition(newLayoutTransition(mTransitionHelper)); } private void confirmZenIntroduction() { - if (DEBUG) Log.d(TAG, "confirmZenIntroduction"); - Prefs.putBoolean(mContext, Prefs.Key.DND_CONFIRMED_PRIORITY_INTRODUCTION, true); + final String prefKey = prefKeyForConfirmation(getSelectedZen(Global.ZEN_MODE_OFF)); + if (prefKey == null) return; + if (DEBUG) Log.d(TAG, "confirmZenIntroduction " + prefKey); + Prefs.putBoolean(mContext, prefKey, true); mHandler.sendEmptyMessage(H.UPDATE_WIDGETS); } - private LayoutTransition newLayoutTransition(TransitionListener listener) { - final LayoutTransition transition = new LayoutTransition(); - transition.disableTransitionType(LayoutTransition.DISAPPEARING); - transition.disableTransitionType(LayoutTransition.CHANGE_DISAPPEARING); - transition.disableTransitionType(LayoutTransition.APPEARING); - transition.setInterpolator(LayoutTransition.CHANGE_APPEARING, mInterpolator); - if (listener != null) { - transition.addTransitionListener(listener); + private static String prefKeyForConfirmation(int zen) { + switch (zen) { + case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS: + return Prefs.Key.DND_CONFIRMED_PRIORITY_INTRODUCTION; + case Global.ZEN_MODE_NO_INTERRUPTIONS: + return Prefs.Key.DND_CONFIRMED_SILENCE_INTRODUCTION; + default: + return null; } - return transition; } @Override @@ -260,7 +205,6 @@ public class ZenModePanel extends LinearLayout { mSessionZen = mAttachedZen; mTransitionHelper.clear(); setSessionExitCondition(copy(mExitCondition)); - refreshExitConditionText(); updateWidgets(); setRequestingConditions(!mHidden); } @@ -274,9 +218,6 @@ public class ZenModePanel extends LinearLayout { mAttachedZen = -1; mSessionZen = -1; setSessionExitCondition(null); - if (!mEmbedded) { - setExpanded(false); - } setRequestingConditions(false); mTransitionHelper.clear(); } @@ -359,7 +300,6 @@ public class ZenModePanel extends LinearLayout { for (int i = 0; i < mMaxConditions; i++) { mZenConditions.addView(mInflater.inflate(R.layout.zen_mode_condition, this, false)); } - refreshExitConditionText(); mSessionZen = getSelectedZen(-1); handleUpdateManualRule(mController.getManualRule()); if (DEBUG) Log.d(mTag, "init mExitCondition=" + mExitCondition); @@ -375,7 +315,6 @@ public class ZenModePanel extends LinearLayout { if (Objects.equals(mExitCondition, exitCondition)) return; mExitCondition = exitCondition; if (DEBUG) Log.d(mTag, "mExitCondition=" + getConditionId(mExitCondition)); - refreshExitConditionText(); updateWidgets(); } @@ -395,10 +334,6 @@ public class ZenModePanel extends LinearLayout { return condition == null ? null : condition.copy(); } - private void refreshExitConditionText() { - mExitConditionText = getExitConditionText(mContext, mExitCondition); - } - public static String getExitConditionText(Context context, Condition exitCondition) { if (exitCondition == null) { return foreverSummary(context); @@ -430,7 +365,7 @@ public class ZenModePanel extends LinearLayout { private void handleUpdateZen(int zen) { if (mSessionZen != -1 && mSessionZen != zen) { - setExpanded(mEmbedded && isShown() || !mEmbedded && zen != Global.ZEN_MODE_OFF); + setExpanded(isShown()); mSessionZen = zen; } mZenButtons.setSelectedValue(zen); @@ -480,30 +415,18 @@ public class ZenModePanel extends LinearLayout { return; } final int zen = getSelectedZen(Global.ZEN_MODE_OFF); - final boolean zenOff = zen == Global.ZEN_MODE_OFF; final boolean zenImportant = zen == Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS; final boolean zenNone = zen == Global.ZEN_MODE_NO_INTERRUPTIONS; - final boolean expanded = !mHidden && mExpanded; - final boolean conditions = mEmbedded || !zenOff && expanded; - final boolean introduction = conditions && zenImportant && !mPrefs.mConfirmedIntroduction; + final boolean introduction = (zenImportant && !mPrefs.mConfirmedPriorityIntroduction + || zenNone && !mPrefs.mConfirmedSilenceIntroduction); mZenButtons.setVisibility(mHidden ? GONE : VISIBLE); - mZenSubhead.setVisibility(!mHidden && !zenOff && !mEmbedded ? VISIBLE : GONE); - mZenSubheadExpanded.setVisibility(expanded ? VISIBLE : GONE); - mZenSubheadCollapsed.setVisibility(!expanded ? VISIBLE : GONE); - mMoreSettings.setVisibility(zenImportant && expanded ? VISIBLE : GONE); - mZenConditions.setVisibility(conditions ? VISIBLE : GONE); - - if (zenNone) { - mZenSubheadExpanded.setText(R.string.zen_no_interruptions_with_warning); - mZenSubheadCollapsed.setText(mExitConditionText); - } else if (zenImportant) { - mZenSubheadExpanded.setText(R.string.zen_important_interruptions); - mZenSubheadCollapsed.setText(mExitConditionText); - } - mZenSubheadExpanded.setTextColor(zenNone && mPrefs.isNoneDangerous() - ? mSubheadWarningColor : mSubheadColor); mZenIntroduction.setVisibility(introduction ? VISIBLE : GONE); + if (introduction) { + mZenIntroductionMessage.setText(zenImportant ? R.string.zen_priority_introduction + : R.string.zen_silence_introduction); + mZenIntroductionCustomize.setVisibility(zenImportant ? VISIBLE : GONE); + } } private static Condition parseExistingTimeCondition(Context context, Condition condition) { @@ -761,13 +684,13 @@ public class ZenModePanel extends LinearLayout { String modeText; switch(zen) { case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS: - modeText = mContext.getString(R.string.zen_important_interruptions); + modeText = mContext.getString(R.string.interruption_level_priority); break; case Global.ZEN_MODE_NO_INTERRUPTIONS: - modeText = mContext.getString(R.string.zen_no_interruptions); + modeText = mContext.getString(R.string.interruption_level_none); break; case Global.ZEN_MODE_ALARMS: - modeText = mContext.getString(R.string.zen_alarms); + modeText = mContext.getString(R.string.interruption_level_alarms); break; default: return; @@ -837,12 +760,6 @@ public class ZenModePanel extends LinearLayout { setSessionExitCondition(copy(condition)); } - private void fireMoreSettings() { - if (mCallback != null) { - mCallback.onMoreSettings(); - } - } - private void fireInteraction() { if (mCallback != null) { mCallback.onInteraction(); @@ -887,7 +804,6 @@ public class ZenModePanel extends LinearLayout { } public interface Callback { - void onMoreSettings(); void onPrioritySettings(); void onInteraction(); void onExpanded(boolean expanded); @@ -907,7 +823,8 @@ public class ZenModePanel extends LinearLayout { private int mMinuteIndex; private int mNoneSelected; - private boolean mConfirmedIntroduction; + private boolean mConfirmedPriorityIntroduction; + private boolean mConfirmedSilenceIntroduction; private ZenPrefs() { mNoneDangerousThreshold = mContext.getResources() @@ -915,11 +832,8 @@ public class ZenModePanel extends LinearLayout { Prefs.registerListener(mContext, this); updateMinuteIndex(); updateNoneSelected(); - updateConfirmedIntroduction(); - } - - public boolean isNoneDangerous() { - return mNoneSelected < mNoneDangerousThreshold; + updateConfirmedPriorityIntroduction(); + updateConfirmedSilenceIntroduction(); } public void trackNoneSelected() { @@ -945,7 +859,8 @@ public class ZenModePanel extends LinearLayout { public void onSharedPreferenceChanged(SharedPreferences prefs, String key) { updateMinuteIndex(); updateNoneSelected(); - updateConfirmedIntroduction(); + updateConfirmedPriorityIntroduction(); + updateConfirmedSilenceIntroduction(); } private void updateMinuteIndex() { @@ -968,12 +883,22 @@ public class ZenModePanel extends LinearLayout { return MathUtils.constrain(noneSelected, 0, Integer.MAX_VALUE); } - private void updateConfirmedIntroduction() { + private void updateConfirmedPriorityIntroduction() { final boolean confirmed = Prefs.getBoolean(mContext, Prefs.Key.DND_CONFIRMED_PRIORITY_INTRODUCTION, false); - if (confirmed == mConfirmedIntroduction) return; - mConfirmedIntroduction = confirmed; - if (DEBUG) Log.d(mTag, "Confirmed introduction: " + mConfirmedIntroduction); + if (confirmed == mConfirmedPriorityIntroduction) return; + mConfirmedPriorityIntroduction = confirmed; + if (DEBUG) Log.d(mTag, "Confirmed priority introduction: " + + mConfirmedPriorityIntroduction); + } + + private void updateConfirmedSilenceIntroduction() { + final boolean confirmed = Prefs.getBoolean(mContext, + Prefs.Key.DND_CONFIRMED_SILENCE_INTRODUCTION, false); + if (confirmed == mConfirmedSilenceIntroduction) return; + mConfirmedSilenceIntroduction = confirmed; + if (DEBUG) Log.d(mTag, "Confirmed silence introduction: " + + mConfirmedSilenceIntroduction); } } @@ -981,12 +906,16 @@ public class ZenModePanel extends LinearLayout { @Override public void onSelected(final Object value) { if (value != null && mZenButtons.isShown() && isAttachedToWindow()) { - if (DEBUG) Log.d(mTag, "mZenButtonsCallback selected=" + value); + final int zen = (Integer) value; + if (DEBUG) Log.d(mTag, "mZenButtonsCallback selected=" + zen); final Uri realConditionId = getRealConditionId(mSessionExitCondition); AsyncTask.execute(new Runnable() { @Override public void run() { - mController.setZen((Integer) value, realConditionId, TAG + ".selectZen"); + mController.setZen(zen, realConditionId, TAG + ".selectZen"); + if (zen != Global.ZEN_MODE_OFF) { + Prefs.putInt(mContext, Prefs.Key.DND_FAVORITE_ZEN, zen); + } } }); } |