Update zen introduction text

And add alarm text to QS & volume dialog.

Fixes: 31533768
Fixes: 33815404
Test: manual
Change-Id: I82f119a8bdbfbc62b0ace752dca0fbc0d5bf8a35
This commit is contained in:
Julia Reynolds
2017-02-16 15:01:36 -05:00
parent 59b9a851a7
commit c12676b449
6 changed files with 124 additions and 27 deletions

View File

@@ -29,6 +29,52 @@
android:layout_marginTop="8dp"
android:background="@color/qs_tile_divider" />
<RelativeLayout
android:id="@+id/zen_introduction"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginStart="16dp"
android:layout_marginEnd="16dp"
android:paddingTop="8dp"
android:paddingBottom="8dp"
android:background="@drawable/zen_introduction_message_background"
android:theme="@*android:style/ThemeOverlay.DeviceDefault.Accent.Light">
<ImageView
android:id="@+id/zen_introduction_confirm"
android:layout_width="48dp"
android:layout_height="48dp"
android:layout_marginEnd="8dp"
android:layout_alignParentEnd="true"
android:background="@drawable/btn_borderless_rect"
android:clickable="true"
android:contentDescription="@string/accessibility_desc_close"
android:scaleType="center"
android:src="@drawable/ic_close"
android:tint="@android:color/white" />
<TextView
android:id="@+id/zen_introduction_message"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:layout_marginStart="24dp"
android:textDirection="locale"
android:lineSpacingMultiplier="1.20029"
android:layout_toStartOf="@id/zen_introduction_confirm"
android:text="@string/zen_alarms_introduction"
android:textAppearance="@style/TextAppearance.QS.Introduction" />
<View
android:layout_width="0dp"
android:layout_height="16dp"
android:layout_below="@id/zen_introduction_message"
android:layout_alignParentEnd="true" />
</RelativeLayout>
<LinearLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"

View File

@@ -838,7 +838,10 @@
<string name="description_direction_left">"Slide left for <xliff:g id="target_description" example="Unlock">%s</xliff:g>.</string>
<!-- Zen mode: Priority only introduction message on first use -->
<string name="zen_priority_introduction">You wont be disturbed by sounds and vibrations, except from alarms, reminders, events, and callers you specify.</string>
<string name="zen_priority_introduction">You wont be disturbed by sounds and vibrations, except from alarms, reminders, events, and callers you specify. You'll still hear anything you choose to play including music, videos, and games.</string>
<!-- Zen mode: Alarms only introduction message on first use -->
<string name="zen_alarms_introduction">You wont be disturbed by sounds and vibrations, except from alarms. You'll still hear anything you choose to play including music, videos, and games.</string>
<!-- Zen mode: Priority only customization button label -->
<string name="zen_priority_customize_button">Customize</string>
@@ -1211,7 +1214,7 @@
<string name="zen_mode_and_condition"><xliff:g id="zen_mode" example="Priority interruptions only">%1$s</xliff:g>. <xliff:g id="exit_condition" example="For one hour">%2$s</xliff:g></string>
<!-- Button label for ending zen mode in the volume dialog -->
<string name="volume_zen_end_now">End now</string>
<string name="volume_zen_end_now">Turn off now</string>
<!-- Content description for accessibility (not shown on the screen): volume dialog expand button. [CHAR LIMIT=NONE] -->
<string name="accessibility_volume_expand">Expand</string>

View File

@@ -58,6 +58,7 @@ public final class Prefs {
String DND_TILE_COMBINED_ICON = "DndTileCombinedIcon";
String DND_CONFIRMED_PRIORITY_INTRODUCTION = "DndConfirmedPriorityIntroduction";
String DND_CONFIRMED_SILENCE_INTRODUCTION = "DndConfirmedSilenceIntroduction";
String DND_CONFIRMED_ALARM_INTRODUCTION = "DndConfirmedAlarmIntroduction";
String DND_FAVORITE_BUCKET_INDEX = "DndCountdownMinuteIndex";
String DND_NONE_SELECTED = "DndNoneSelected";
String DND_FAVORITE_ZEN = "DndFavoriteZen";

View File

@@ -642,7 +642,6 @@ public class VolumeDialogImpl implements VolumeDialog, TunerService.Tunable {
updateVolumeRowSliderTintH(row, isActive);
}
}
}
private void trimObsoleteH() {
@@ -695,28 +694,25 @@ public class VolumeDialogImpl implements VolumeDialog, TunerService.Tunable {
final boolean visible = mState.zenMode != Global.ZEN_MODE_OFF
&& (mAudioManager.isStreamAffectedByRingerMode(mActiveStream) || mExpanded)
&& !mZenPanel.isEditing();
TransitionManager.beginDelayedTransition(mDialogView, getTransistion());
if (wasVisible != visible && !visible) {
prepareForCollapse();
if (wasVisible != visible) {
mZenFooter.update();
Util.setVisOrGone(mZenFooter, visible);
}
Util.setVisOrGone(mZenFooter, visible);
mZenFooter.update();
final boolean fullWasVisible = mZenPanel.getVisibility() == View.VISIBLE;
final boolean fullVisible = mShowFullZen && !visible;
if (fullWasVisible != fullVisible && !fullVisible) {
prepareForCollapse();
}
Util.setVisOrGone(mZenPanel, fullVisible);
if (fullVisible) {
mZenPanel.setZenState(mState.zenMode);
mZenPanel.setDoneListener(new OnClickListener() {
@Override
public void onClick(View v) {
prepareForCollapse();
mHandler.sendEmptyMessage(H.UPDATE_FOOTER);
}
});
if (fullWasVisible != fullVisible) {
Util.setVisOrGone(mZenPanel, fullVisible);
if (fullVisible) {
mZenPanel.setZenState(mState.zenMode);
mZenPanel.setDoneListener(new OnClickListener() {
@Override
public void onClick(View v) {
mHandler.sendEmptyMessage(H.UPDATE_FOOTER);
}
});
}
}
}

View File

@@ -20,12 +20,16 @@ import android.animation.ValueAnimator;
import android.content.Context;
import android.provider.Settings.Global;
import android.service.notification.ZenModeConfig;
import android.transition.AutoTransition;
import android.transition.TransitionManager;
import android.util.AttributeSet;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.LinearLayout;
import android.widget.TextView;
import com.android.systemui.Prefs;
import com.android.systemui.R;
import com.android.systemui.statusbar.policy.ZenModeController;
@@ -44,6 +48,9 @@ public class ZenFooter extends LinearLayout {
private TextView mSummaryLine1;
private TextView mSummaryLine2;
private TextView mEndNowButton;
private View mZenIntroduction;
private View mZenIntroductionConfirm;
private TextView mZenIntroductionMessage;
private int mZen = -1;
private ZenModeConfig mConfig;
private ZenModeController mController;
@@ -64,6 +71,17 @@ public class ZenFooter extends LinearLayout {
mSummaryLine1 = findViewById(R.id.volume_zen_summary_line_1);
mSummaryLine2 = findViewById(R.id.volume_zen_summary_line_2);
mEndNowButton = findViewById(R.id.volume_zen_end_now);
mZenIntroduction = findViewById(R.id.zen_introduction);
mZenIntroductionMessage = findViewById(R.id.zen_introduction_message);
mConfigurableTexts.add(mZenIntroductionMessage, R.string.zen_alarms_introduction);
mZenIntroductionConfirm = findViewById(R.id.zen_introduction_confirm);
mZenIntroductionConfirm.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
confirmZenIntroduction();
}
});
Util.setVisOrGone(mZenIntroduction, shouldShowIntroduction());
mConfigurableTexts.add(mSummaryLine1);
mConfigurableTexts.add(mSummaryLine2);
mConfigurableTexts.add(mEndNowButton, R.string.volume_zen_end_now);
@@ -73,6 +91,7 @@ public class ZenFooter extends LinearLayout {
mEndNowButton.setOnClickListener(new OnClickListener() {
@Override
public void onClick(View v) {
setZen(Global.ZEN_MODE_OFF);
controller.setZen(Global.ZEN_MODE_OFF, null, TAG);
}
});
@@ -81,6 +100,7 @@ public class ZenFooter extends LinearLayout {
mController = controller;
mController.addCallback(mZenCallback);
update();
updateIntroduction();
}
public void cleanup() {
@@ -91,6 +111,7 @@ public class ZenFooter extends LinearLayout {
if (mZen == zen) return;
mZen = zen;
update();
updateIntroduction();
}
private void setConfig(ZenModeConfig config) {
@@ -99,8 +120,9 @@ public class ZenFooter extends LinearLayout {
update();
}
public boolean isZen() {
return isZenPriority() || isZenAlarms() || isZenNone();
private void confirmZenIntroduction() {
Prefs.putBoolean(mContext, Prefs.Key.DND_CONFIRMED_ALARM_INTRODUCTION, true);
updateIntroduction();
}
private boolean isZenPriority() {
@@ -128,6 +150,15 @@ public class ZenFooter extends LinearLayout {
mController.getCurrentUser(), true /*shortVersion*/);
Util.setText(mSummaryLine2, line2);
}
public boolean shouldShowIntroduction() {
final boolean confirmed = Prefs.getBoolean(mContext,
Prefs.Key.DND_CONFIRMED_ALARM_INTRODUCTION, false);
return !confirmed && isZenAlarms();
}
public void updateIntroduction() {
Util.setVisOrGone(mZenIntroduction, shouldShowIntroduction());
}
public void onConfigurationChanged() {
mConfigurableTexts.update();

View File

@@ -284,6 +284,8 @@ public class ZenModePanel extends FrameLayout {
return Prefs.Key.DND_CONFIRMED_PRIORITY_INTRODUCTION;
case Global.ZEN_MODE_NO_INTERRUPTIONS:
return Prefs.Key.DND_CONFIRMED_SILENCE_INTRODUCTION;
case Global.ZEN_MODE_ALARMS:
return Prefs.Key.DND_CONFIRMED_ALARM_INTRODUCTION;
default:
return null;
}
@@ -523,16 +525,22 @@ public class ZenModePanel extends FrameLayout {
final int zen = getSelectedZen(Global.ZEN_MODE_OFF);
final boolean zenImportant = zen == Global.ZEN_MODE_IMPORTANT_INTERRUPTIONS;
final boolean zenNone = zen == Global.ZEN_MODE_NO_INTERRUPTIONS;
final boolean zenAlarm = zen == Global.ZEN_MODE_ALARMS;
final boolean introduction = (zenImportant && !mPrefs.mConfirmedPriorityIntroduction
|| zenNone && !mPrefs.mConfirmedSilenceIntroduction);
|| zenNone && !mPrefs.mConfirmedSilenceIntroduction
|| zenAlarm && !mPrefs.mConfirmedAlarmIntroduction);
mZenButtons.setVisibility(mHidden ? GONE : VISIBLE);
mZenIntroduction.setVisibility(introduction ? VISIBLE : GONE);
if (introduction) {
mConfigurableTexts.add(mZenIntroductionMessage, zenImportant
int message = zenImportant
? R.string.zen_priority_introduction
: mVoiceCapable ? R.string.zen_silence_introduction_voice
: R.string.zen_silence_introduction);
: zenAlarm
? R.string.zen_alarms_introduction
: mVoiceCapable
? R.string.zen_silence_introduction_voice
: R.string.zen_silence_introduction;
mConfigurableTexts.add(mZenIntroductionMessage, message);
mConfigurableTexts.update();
mZenIntroductionCustomize.setVisibility(zenImportant ? VISIBLE : GONE);
}
@@ -963,6 +971,7 @@ public class ZenModePanel extends FrameLayout {
private int mNoneSelected;
private boolean mConfirmedPriorityIntroduction;
private boolean mConfirmedSilenceIntroduction;
private boolean mConfirmedAlarmIntroduction;
private ZenPrefs() {
mNoneDangerousThreshold = mContext.getResources()
@@ -972,6 +981,7 @@ public class ZenModePanel extends FrameLayout {
updateNoneSelected();
updateConfirmedPriorityIntroduction();
updateConfirmedSilenceIntroduction();
updateConfirmedAlarmIntroduction();
}
public void trackNoneSelected() {
@@ -999,6 +1009,7 @@ public class ZenModePanel extends FrameLayout {
updateNoneSelected();
updateConfirmedPriorityIntroduction();
updateConfirmedSilenceIntroduction();
updateConfirmedAlarmIntroduction();
}
private void updateMinuteIndex() {
@@ -1038,6 +1049,15 @@ public class ZenModePanel extends FrameLayout {
if (DEBUG) Log.d(mTag, "Confirmed silence introduction: "
+ mConfirmedSilenceIntroduction);
}
private void updateConfirmedAlarmIntroduction() {
final boolean confirmed = Prefs.getBoolean(mContext,
Prefs.Key.DND_CONFIRMED_ALARM_INTRODUCTION, false);
if (confirmed == mConfirmedAlarmIntroduction) return;
mConfirmedAlarmIntroduction = confirmed;
if (DEBUG) Log.d(mTag, "Confirmed alarm introduction: "
+ mConfirmedAlarmIntroduction);
}
}
protected final SegmentedButtons.Callback mZenButtonsCallback = new SegmentedButtons.Callback() {