Fields Summary |
---|
private static final String | TAG |
private static final boolean | DEBUG |
private static final int | SECONDS_MS |
private static final int | MINUTES_MS |
private static final int[] | MINUTE_BUCKETS |
private static final int | MIN_BUCKET_MINUTES |
private static final int | MAX_BUCKET_MINUTES |
private static final int | DEFAULT_BUCKET_INDEX |
private static final int | FOREVER_CONDITION_INDEX |
private static final int | COUNTDOWN_CONDITION_INDEX |
public static final android.content.Intent | ZEN_SETTINGS |
private final android.content.Context | mContext |
private final android.view.LayoutInflater | mInflater |
private final H | mHandler |
private final Prefs | mPrefs |
private final IconPulser | mIconPulser |
private final int | mSubheadWarningColor |
private final int | mSubheadColor |
private final android.view.animation.Interpolator | mInterpolator |
private final int | mMaxConditions |
private final int | mMaxOptionalConditions |
private final boolean | mCountdownConditionSupported |
private final int | mFirstConditionIndex |
private final TransitionHelper | mTransitionHelper |
private final android.net.Uri | mForeverId |
private String | mTag |
private SegmentedButtons | mZenButtons |
private android.view.View | mZenSubhead |
private android.widget.TextView | mZenSubheadCollapsed |
private android.widget.TextView | mZenSubheadExpanded |
private android.view.View | mMoreSettings |
private android.widget.LinearLayout | mZenConditions |
private Callback | mCallback |
private com.android.systemui.statusbar.policy.ZenModeController | mController |
private boolean | mRequestingConditions |
private android.service.notification.Condition | mExitCondition |
private String | mExitConditionText |
private int | mBucketIndex |
private boolean | mExpanded |
private boolean | mHidden |
private int | mSessionZen |
private int | mAttachedZen |
private boolean | mAttached |
private android.service.notification.Condition | mSessionExitCondition |
private android.service.notification.Condition[] | mConditions |
private android.service.notification.Condition | mTimeCondition |
private final ZenModeController.Callback | mZenCallback |
private final SegmentedButtons.Callback | mZenButtonsCallback |
private final Interaction.Callback | mInteractionCallback |
Methods Summary |
---|
private void | announceConditionSelection(com.android.systemui.volume.ZenModePanel$ConditionTag tag)
final int zen = getSelectedZen(Global.ZEN_MODE_OFF);
String modeText;
switch(zen) {
case Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS:
modeText = mContext.getString(R.string.zen_important_interruptions);
break;
case Global.ZEN_MODE_NO_INTERRUPTIONS:
modeText = mContext.getString(R.string.zen_no_interruptions);
break;
default:
return;
}
announceForAccessibility(mContext.getString(R.string.zen_mode_and_condition, modeText,
tag.line1.getText()));
|
private void | bind(android.service.notification.Condition condition, android.view.View row)
if (condition == null) throw new IllegalArgumentException("condition must not be null");
final boolean enabled = condition.state == Condition.STATE_TRUE;
final ConditionTag tag =
row.getTag() != null ? (ConditionTag) row.getTag() : new ConditionTag();
row.setTag(tag);
final boolean first = tag.rb == null;
if (tag.rb == null) {
tag.rb = (RadioButton) row.findViewById(android.R.id.checkbox);
}
tag.condition = condition;
final Uri conditionId = getConditionId(tag.condition);
if (DEBUG) Log.d(mTag, "bind i=" + mZenConditions.indexOfChild(row) + " first=" + first
+ " condition=" + conditionId);
tag.rb.setEnabled(enabled);
final boolean checked = (mSessionExitCondition != null
|| mAttachedZen != Global.ZEN_MODE_OFF)
&& (sameConditionId(mSessionExitCondition, tag.condition)
|| isCountdown(mSessionExitCondition) && isCountdown(tag.condition));
if (checked != tag.rb.isChecked()) {
if (DEBUG) Log.d(mTag, "bind checked=" + checked + " condition=" + conditionId);
tag.rb.setChecked(checked);
}
tag.rb.setOnCheckedChangeListener(new OnCheckedChangeListener() {
@Override
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
if (mExpanded && isChecked) {
if (DEBUG) Log.d(mTag, "onCheckedChanged " + conditionId);
final int N = getVisibleConditions();
for (int i = 0; i < N; i++) {
final ConditionTag childTag = getConditionTagAt(i);
if (childTag == null || childTag == tag) continue;
childTag.rb.setChecked(false);
}
select(tag.condition);
announceConditionSelection(tag);
}
}
});
if (tag.lines == null) {
tag.lines = row.findViewById(android.R.id.content);
}
if (tag.line1 == null) {
tag.line1 = (TextView) row.findViewById(android.R.id.text1);
}
if (tag.line2 == null) {
tag.line2 = (TextView) row.findViewById(android.R.id.text2);
}
final String line1 = !TextUtils.isEmpty(condition.line1) ? condition.line1
: condition.summary;
final String line2 = condition.line2;
tag.line1.setText(line1);
if (TextUtils.isEmpty(line2)) {
tag.line2.setVisibility(GONE);
} else {
tag.line2.setVisibility(VISIBLE);
tag.line2.setText(line2);
}
tag.lines.setEnabled(enabled);
tag.lines.setAlpha(enabled ? 1 : .4f);
final ImageView button1 = (ImageView) row.findViewById(android.R.id.button1);
button1.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
onClickTimeButton(row, tag, false /*down*/);
}
});
final ImageView button2 = (ImageView) row.findViewById(android.R.id.button2);
button2.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
onClickTimeButton(row, tag, true /*up*/);
}
});
tag.lines.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
tag.rb.setChecked(true);
}
});
final long time = ZenModeConfig.tryParseCountdownConditionId(conditionId);
if (time > 0) {
button1.setVisibility(VISIBLE);
button2.setVisibility(VISIBLE);
if (mBucketIndex > -1) {
button1.setEnabled(mBucketIndex > 0);
button2.setEnabled(mBucketIndex < MINUTE_BUCKETS.length - 1);
} else {
final long span = time - System.currentTimeMillis();
button1.setEnabled(span > MIN_BUCKET_MINUTES * MINUTES_MS);
final Condition maxCondition = ZenModeConfig.toTimeCondition(mContext,
MAX_BUCKET_MINUTES, ActivityManager.getCurrentUser());
button2.setEnabled(!Objects.equals(condition.summary, maxCondition.summary));
}
button1.setAlpha(button1.isEnabled() ? 1f : .5f);
button2.setAlpha(button2.isEnabled() ? 1f : .5f);
} else {
button1.setVisibility(GONE);
button2.setVisibility(GONE);
}
// wire up interaction callbacks for newly-added condition rows
if (first) {
Interaction.register(tag.rb, mInteractionCallback);
Interaction.register(tag.lines, mInteractionCallback);
Interaction.register(button1, mInteractionCallback);
Interaction.register(button2, mInteractionCallback);
}
row.setVisibility(VISIBLE);
|
private void | checkForAttachedZenChange()
final int selectedZen = getSelectedZen(-1);
if (DEBUG) Log.d(mTag, "selectedZen=" + selectedZen);
if (selectedZen != mAttachedZen) {
if (DEBUG) Log.d(mTag, "attachedZen: " + mAttachedZen + " -> " + selectedZen);
if (selectedZen == Global.ZEN_MODE_NO_INTERRUPTIONS) {
mPrefs.trackNoneSelected();
}
}
|
private static android.service.notification.Condition | copy(android.service.notification.Condition condition)
return condition == null ? null : condition.copy();
|
public void | dump(java.io.FileDescriptor fd, java.io.PrintWriter pw, java.lang.String[] args)
pw.println("ZenModePanel state:");
pw.print(" mCountdownConditionSupported="); pw.println(mCountdownConditionSupported);
pw.print(" mMaxConditions="); pw.println(mMaxConditions);
pw.print(" mRequestingConditions="); pw.println(mRequestingConditions);
pw.print(" mAttached="); pw.println(mAttached);
pw.print(" mHidden="); pw.println(mHidden);
pw.print(" mExpanded="); pw.println(mExpanded);
pw.print(" mSessionZen="); pw.println(mSessionZen);
pw.print(" mAttachedZen="); pw.println(mAttachedZen);
mTransitionHelper.dump(fd, pw, args);
|
private void | ensureSelection()
// are we left without anything selected? if so, set a default
final int visibleConditions = getVisibleConditions();
if (visibleConditions == 0) return;
for (int i = 0; i < visibleConditions; i++) {
final ConditionTag tag = getConditionTagAt(i);
if (tag != null && tag.rb.isChecked()) {
if (DEBUG) Log.d(mTag, "Not selecting a default, checked=" + tag.condition);
return;
}
}
final ConditionTag foreverTag = getConditionTagAt(FOREVER_CONDITION_INDEX);
if (foreverTag == null) return;
if (DEBUG) Log.d(mTag, "Selecting a default");
final int favoriteIndex = mPrefs.getMinuteIndex();
if (favoriteIndex == -1 || !mCountdownConditionSupported) {
foreverTag.rb.setChecked(true);
} else {
mTimeCondition = ZenModeConfig.toTimeCondition(mContext,
MINUTE_BUCKETS[favoriteIndex], ActivityManager.getCurrentUser());
mBucketIndex = favoriteIndex;
bind(mTimeCondition, mZenConditions.getChildAt(COUNTDOWN_CONDITION_INDEX));
getConditionTagAt(COUNTDOWN_CONDITION_INDEX).rb.setChecked(true);
}
|
private void | fireExpanded()
if (mCallback != null) {
mCallback.onExpanded(mExpanded);
}
|
private void | fireInteraction()
if (mCallback != null) {
mCallback.onInteraction();
}
|
private void | fireMoreSettings()
if (mCallback != null) {
mCallback.onMoreSettings();
}
|
private android.service.notification.Condition | forever()
return new Condition(mForeverId, foreverSummary(), "", "", 0 /*icon*/, Condition.STATE_TRUE,
0 /*flags*/);
|
private java.lang.String | foreverSummary()
return mContext.getString(com.android.internal.R.string.zen_mode_forever);
|
private static android.net.Uri | getConditionId(android.service.notification.Condition condition)
return condition != null ? condition.id : null;
|
private com.android.systemui.volume.ZenModePanel$ConditionTag | getConditionTagAt(int index)
return (ConditionTag) mZenConditions.getChildAt(index).getTag();
|
private android.service.notification.Condition | getSelectedCondition()
final int N = getVisibleConditions();
for (int i = 0; i < N; i++) {
final ConditionTag tag = getConditionTagAt(i);
if (tag != null && tag.rb.isChecked()) {
return tag.condition;
}
}
return null;
|
private int | getSelectedZen(int defValue)
final Object zen = mZenButtons.getSelectedValue();
return zen != null ? (Integer) zen : defValue;
|
private int | getVisibleConditions()
int rt = 0;
final int N = mZenConditions.getChildCount();
for (int i = 0; i < N; i++) {
rt += mZenConditions.getChildAt(i).getVisibility() == VISIBLE ? 1 : 0;
}
return rt;
|
private void | handleExitConditionChanged(android.service.notification.Condition exitCondition)
setExitCondition(exitCondition);
if (DEBUG) Log.d(mTag, "handleExitConditionChanged " + mExitCondition);
final int N = getVisibleConditions();
for (int i = 0; i < N; i++) {
final ConditionTag tag = getConditionTagAt(i);
if (tag != null) {
if (sameConditionId(tag.condition, mExitCondition)) {
bind(exitCondition, mZenConditions.getChildAt(i));
}
}
}
|
private void | handleUpdateConditions(android.service.notification.Condition[] conditions)
conditions = trimConditions(conditions);
if (Arrays.equals(conditions, mConditions)) {
final int count = mConditions == null ? 0 : mConditions.length;
if (DEBUG) Log.d(mTag, "handleUpdateConditions unchanged conditionCount=" + count);
return;
}
mConditions = conditions;
handleUpdateConditions();
|
private void | handleUpdateConditions()
if (mTransitionHelper.isTransitioning()) {
mTransitionHelper.pendingUpdateConditions();
return;
}
final int conditionCount = mConditions == null ? 0 : mConditions.length;
if (DEBUG) Log.d(mTag, "handleUpdateConditions conditionCount=" + conditionCount);
// forever
bind(forever(), mZenConditions.getChildAt(FOREVER_CONDITION_INDEX));
// countdown
if (mCountdownConditionSupported && mTimeCondition != null) {
bind(mTimeCondition, mZenConditions.getChildAt(COUNTDOWN_CONDITION_INDEX));
}
// provider conditions
for (int i = 0; i < conditionCount; i++) {
bind(mConditions[i], mZenConditions.getChildAt(mFirstConditionIndex + i));
}
// hide the rest
for (int i = mZenConditions.getChildCount() - 1; i > mFirstConditionIndex + conditionCount;
i--) {
mZenConditions.getChildAt(i).setVisibility(GONE);
}
// ensure something is selected
if (mExpanded) {
ensureSelection();
}
|
private void | handleUpdateZen(int zen)
if (mSessionZen != -1 && mSessionZen != zen) {
setExpanded(zen != Global.ZEN_MODE_OFF);
mSessionZen = zen;
}
mZenButtons.setSelectedValue(zen);
updateWidgets();
handleUpdateConditions();
if (mExpanded) {
final Condition selected = getSelectedCondition();
if (!Objects.equals(mExitCondition, selected)) {
select(selected);
}
}
|
private void | hideAllConditions()
final int N = mZenConditions.getChildCount();
for (int i = 0; i < N; i++) {
mZenConditions.getChildAt(i).setVisibility(GONE);
}
|
public void | init(com.android.systemui.statusbar.policy.ZenModeController controller)
mController = controller;
setExitCondition(mController.getExitCondition());
refreshExitConditionText();
mSessionZen = getSelectedZen(-1);
handleUpdateZen(mController.getZen());
if (DEBUG) Log.d(mTag, "init mExitCondition=" + mExitCondition);
hideAllConditions();
mController.addCallback(mZenCallback);
|
private boolean | isCountdown(android.service.notification.Condition c)
return c != null && ZenModeConfig.isValidCountdownConditionId(c.id);
|
private boolean | isForever(android.service.notification.Condition c)
return c != null && mForeverId.equals(c.id);
|
private android.animation.LayoutTransition | newLayoutTransition(android.animation.LayoutTransition.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);
}
return transition;
|
protected void | onAttachedToWindow()
super.onAttachedToWindow();
if (DEBUG) Log.d(mTag, "onAttachedToWindow");
mAttached = true;
mAttachedZen = getSelectedZen(-1);
mSessionZen = mAttachedZen;
mTransitionHelper.clear();
setSessionExitCondition(copy(mExitCondition));
refreshExitConditionText();
updateWidgets();
setRequestingConditions(!mHidden);
|
private void | onClickTimeButton(android.view.View row, com.android.systemui.volume.ZenModePanel$ConditionTag tag, boolean up)
Condition newCondition = null;
final int N = MINUTE_BUCKETS.length;
if (mBucketIndex == -1) {
// not on a known index, search for the next or prev bucket by time
final Uri conditionId = getConditionId(tag.condition);
final long time = ZenModeConfig.tryParseCountdownConditionId(conditionId);
final long now = System.currentTimeMillis();
for (int i = 0; i < N; i++) {
int j = up ? i : N - 1 - i;
final int bucketMinutes = MINUTE_BUCKETS[j];
final long bucketTime = now + bucketMinutes * MINUTES_MS;
if (up && bucketTime > time || !up && bucketTime < time) {
mBucketIndex = j;
newCondition = ZenModeConfig.toTimeCondition(mContext,
bucketTime, bucketMinutes, now, ActivityManager.getCurrentUser());
break;
}
}
if (newCondition == null) {
mBucketIndex = DEFAULT_BUCKET_INDEX;
newCondition = ZenModeConfig.toTimeCondition(mContext,
MINUTE_BUCKETS[mBucketIndex], ActivityManager.getCurrentUser());
}
} else {
// on a known index, simply increment or decrement
mBucketIndex = Math.max(0, Math.min(N - 1, mBucketIndex + (up ? 1 : -1)));
newCondition = ZenModeConfig.toTimeCondition(mContext,
MINUTE_BUCKETS[mBucketIndex], ActivityManager.getCurrentUser());
}
mTimeCondition = newCondition;
bind(mTimeCondition, row);
tag.rb.setChecked(true);
select(mTimeCondition);
announceConditionSelection(tag);
|
protected void | onDetachedFromWindow()
super.onDetachedFromWindow();
if (DEBUG) Log.d(mTag, "onDetachedFromWindow");
checkForAttachedZenChange();
mAttached = false;
mAttachedZen = -1;
mSessionZen = -1;
setSessionExitCondition(null);
setExpanded(false);
setRequestingConditions(false);
mTransitionHelper.clear();
|
protected void | onFinishInflate()
super.onFinishInflate();
mZenButtons = (SegmentedButtons) findViewById(R.id.zen_buttons);
mZenButtons.addButton(R.string.interruption_level_none, R.drawable.ic_zen_none,
Global.ZEN_MODE_NO_INTERRUPTIONS);
mZenButtons.addButton(R.string.interruption_level_priority, R.drawable.ic_zen_important,
Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS);
mZenButtons.addButton(R.string.interruption_level_all, R.drawable.ic_zen_all,
Global.ZEN_MODE_OFF);
mZenButtons.setCallback(mZenButtonsCallback);
final ViewGroup zenButtonsContainer = (ViewGroup) findViewById(R.id.zen_buttons_container);
zenButtonsContainer.setLayoutTransition(newLayoutTransition(null));
mZenSubhead = findViewById(R.id.zen_subhead);
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);
mZenConditions = (LinearLayout) findViewById(R.id.zen_conditions);
for (int i = 0; i < mMaxConditions; i++) {
mZenConditions.addView(mInflater.inflate(R.layout.zen_mode_condition, this, false));
}
setLayoutTransition(newLayoutTransition(mTransitionHelper));
|
private android.service.notification.Condition | parseExistingTimeCondition(android.service.notification.Condition condition)
if (condition == null) return null;
final long time = ZenModeConfig.tryParseCountdownConditionId(condition.id);
if (time == 0) return null;
final long now = System.currentTimeMillis();
final long span = time - now;
if (span <= 0 || span > MAX_BUCKET_MINUTES * MINUTES_MS) return null;
return ZenModeConfig.toTimeCondition(mContext,
time, Math.round(span / (float) MINUTES_MS), now, ActivityManager.getCurrentUser());
|
private void | refreshExitConditionText()
if (mExitCondition == null) {
mExitConditionText = foreverSummary();
} else if (isCountdown(mExitCondition)) {
final Condition condition = parseExistingTimeCondition(mExitCondition);
mExitConditionText = condition != null ? condition.summary : foreverSummary();
} else {
mExitConditionText = mExitCondition.summary;
}
|
private static boolean | sameConditionId(android.service.notification.Condition lhs, android.service.notification.Condition rhs)
return lhs == null ? rhs == null : rhs != null && lhs.id.equals(rhs.id);
|
private void | select(android.service.notification.Condition condition)
if (DEBUG) Log.d(mTag, "select " + condition);
final boolean isForever = isForever(condition);
if (mController != null) {
AsyncTask.execute(new Runnable() {
@Override
public void run() {
mController.setExitCondition(isForever ? null : condition);
}
});
}
setExitCondition(condition);
if (isForever) {
mPrefs.setMinuteIndex(-1);
} else if (isCountdown(condition) && mBucketIndex != -1) {
mPrefs.setMinuteIndex(mBucketIndex);
}
setSessionExitCondition(copy(condition));
|
public void | setCallback(com.android.systemui.volume.ZenModePanel$Callback callback)
mCallback = callback;
|
private void | setExitCondition(android.service.notification.Condition exitCondition)
if (Objects.equals(mExitCondition, exitCondition)) return;
mExitCondition = exitCondition;
if (DEBUG) Log.d(mTag, "mExitCondition=" + getConditionId(mExitCondition));
refreshExitConditionText();
updateWidgets();
|
private void | setExpanded(boolean expanded)
if (expanded == mExpanded) return;
mExpanded = expanded;
if (mExpanded) {
ensureSelection();
}
updateWidgets();
fireExpanded();
|
public void | setHidden(boolean hidden)
if (mHidden == hidden) return;
if (DEBUG) Log.d(mTag, "hidden=" + hidden);
mHidden = hidden;
setRequestingConditions(mAttached && !mHidden);
updateWidgets();
|
private void | setRequestingConditions(boolean requesting)Start or stop requesting relevant zen mode exit conditions
if (mRequestingConditions == requesting) return;
if (DEBUG) Log.d(mTag, "setRequestingConditions " + requesting);
mRequestingConditions = requesting;
if (mController != null) {
AsyncTask.execute(new Runnable() {
@Override
public void run() {
mController.requestConditions(requesting);
}
});
}
if (mRequestingConditions) {
mTimeCondition = parseExistingTimeCondition(mExitCondition);
if (mTimeCondition != null) {
mBucketIndex = -1;
} else {
mBucketIndex = DEFAULT_BUCKET_INDEX;
mTimeCondition = ZenModeConfig.toTimeCondition(mContext,
MINUTE_BUCKETS[mBucketIndex], ActivityManager.getCurrentUser());
}
if (DEBUG) Log.d(mTag, "Initial bucket index: " + mBucketIndex);
mConditions = null; // reset conditions
handleUpdateConditions();
} else {
hideAllConditions();
}
|
private void | setSessionExitCondition(android.service.notification.Condition condition)
if (Objects.equals(condition, mSessionExitCondition)) return;
if (DEBUG) Log.d(mTag, "mSessionExitCondition=" + getConditionId(condition));
mSessionExitCondition = condition;
|
public void | showSilentHint()
if (DEBUG) Log.d(mTag, "showSilentHint");
if (mZenButtons == null || mZenButtons.getChildCount() == 0) return;
final View noneButton = mZenButtons.getChildAt(0);
mIconPulser.start(noneButton);
|
private android.service.notification.Condition[] | trimConditions(android.service.notification.Condition[] conditions)
if (conditions == null || conditions.length <= mMaxOptionalConditions) {
// no need to trim
return conditions;
}
// look for current exit condition, ensure it is included if found
int found = -1;
for (int i = 0; i < conditions.length; i++) {
final Condition c = conditions[i];
if (mSessionExitCondition != null && sameConditionId(mSessionExitCondition, c)) {
found = i;
break;
}
}
final Condition[] rt = Arrays.copyOf(conditions, mMaxOptionalConditions);
if (found >= mMaxOptionalConditions) {
// found after the first N, promote to the end of the first N
rt[mMaxOptionalConditions - 1] = conditions[found];
}
return rt;
|
public void | updateLocale()
mZenButtons.updateLocale();
|
private void | updateWidgets()
if (mTransitionHelper.isTransitioning()) {
mTransitionHelper.pendingUpdateWidgets();
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;
mZenButtons.setVisibility(mHidden ? GONE : VISIBLE);
mZenSubhead.setVisibility(!mHidden && !zenOff ? VISIBLE : GONE);
mZenSubheadExpanded.setVisibility(expanded ? VISIBLE : GONE);
mZenSubheadCollapsed.setVisibility(!expanded ? VISIBLE : GONE);
mMoreSettings.setVisibility(zenImportant && expanded ? VISIBLE : GONE);
mZenConditions.setVisibility(!zenOff && expanded ? 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);
|