Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit 6256362a authored by TreeHugger Robot's avatar TreeHugger Robot Committed by Android (Google) Code Review
Browse files

Merge "Update zen introduction text"

parents 48ba685e d7a00aa1
Loading
Loading
Loading
Loading
+46 −0
Original line number Diff line number Diff line
@@ -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"
+5 −2
Original line number Diff line number Diff line
@@ -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 won’t be disturbed by sounds and vibrations, except from alarms, reminders, events, and callers you specify.</string>
    <string name="zen_priority_introduction">You won’t 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 won’t 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>
@@ -1217,7 +1220,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>
+1 −0
Original line number Diff line number Diff line
@@ -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";
+16 −23
Original line number Diff line number Diff line
@@ -645,7 +645,6 @@ public class VolumeDialogImpl implements VolumeDialog, TunerService.Tunable,
                updateVolumeRowSliderTintH(row, isActive);
            }
        }

    }

    private void trimObsoleteH() {
@@ -698,11 +697,9 @@ 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 (visible != wasVisible) {

        if (wasVisible != visible) {
            mZenFooter.update();
            if (visible) {
                HardwareUiLayout.get(mZenFooter).setDivisionView(mZenFooter);
            } else {
@@ -710,28 +707,24 @@ public class VolumeDialogImpl implements VolumeDialog, TunerService.Tunable,
                                HardwareUiLayout.get(mZenFooter).setDivisionView(mZenFooter),
                        mExpandButtonAnimationDuration);
            }

        }
            Util.setVisOrGone(mZenFooter, visible);
        mZenFooter.update();
        }

        final boolean fullWasVisible = mZenPanel.getVisibility() == View.VISIBLE;
        final boolean fullVisible = mShowFullZen && !visible;
        if (fullWasVisible != fullVisible && !fullVisible) {
            prepareForCollapse();
        }
        if (fullWasVisible != fullVisible) {
            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);
                    }
                });
            }
        }
    }

    private void updateVolumeRowH(VolumeRow row) {
        if (D.BUG) Log.d(TAG, "updateVolumeRowH s=" + row.stream);
+33 −2
Original line number Diff line number Diff line
@@ -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();
Loading