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

Commit 8dbcda1b authored by John Spurlock's avatar John Spurlock Committed by Android (Google) Code Review
Browse files

Merge "Volume: Simple dialog footer, DND in quick settings." into mnc-dev

parents 1c4a44e5 d9c75dba
Loading
Loading
Loading
Loading
+17 −5
Original line number Diff line number Diff line
@@ -62,7 +62,7 @@ public class ZenModeConfig implements Parcelable {
            Calendar.WEDNESDAY, Calendar.THURSDAY };
    public static final int[] WEEKEND_DAYS = { Calendar.FRIDAY, Calendar.SATURDAY };

    public static final int[] MINUTE_BUCKETS = new int[] { 15, 30, 45, 60, 120, 180, 240, 480 };
    public static final int[] MINUTE_BUCKETS = generateMinuteBuckets();
    private static final int SECONDS_MS = 1000;
    private static final int MINUTES_MS = 60 * SECONDS_MS;
    private static final int ZERO_VALUE_MS = 10 * SECONDS_MS;
@@ -201,6 +201,18 @@ public class ZenModeConfig implements Parcelable {
        }
    }

    private static int[] generateMinuteBuckets() {
        final int maxHrs = 12;
        final int[] buckets = new int[maxHrs + 3];
        buckets[0] = 15;
        buckets[1] = 30;
        buckets[2] = 45;
        for (int i = 1; i <= maxHrs; i++) {
            buckets[2 + i] = 60 * i;
        }
        return buckets;
    }

    public static String sourceToString(int source) {
        switch (source) {
            case SOURCE_ANYONE:
@@ -298,10 +310,10 @@ public class ZenModeConfig implements Parcelable {
                        throw new IndexOutOfBoundsException("bad source in config:" + rt.allowFrom);
                    }
                } else if (MANUAL_TAG.equals(tag)) {
                    rt.manualRule = readRuleXml(parser);
                    rt.manualRule = readRuleXml(parser, false /*conditionRequired*/);
                } else if (AUTOMATIC_TAG.equals(tag)) {
                    final String id = parser.getAttributeValue(null, RULE_ATT_ID);
                    final ZenRule automaticRule = readRuleXml(parser);
                    final ZenRule automaticRule = readRuleXml(parser, true /*conditionRequired*/);
                    if (id != null && automaticRule != null) {
                        rt.automaticRules.put(id, automaticRule);
                    }
@@ -341,7 +353,7 @@ public class ZenModeConfig implements Parcelable {
        out.endTag(null, ZEN_TAG);
    }

    public static ZenRule readRuleXml(XmlPullParser parser) {
    public static ZenRule readRuleXml(XmlPullParser parser, boolean conditionRequired) {
        final ZenRule rt = new ZenRule();
        rt.enabled = safeBoolean(parser, RULE_ATT_ENABLED, true);
        rt.snoozing = safeBoolean(parser, RULE_ATT_SNOOZING, false);
@@ -355,7 +367,7 @@ public class ZenModeConfig implements Parcelable {
        rt.conditionId = safeUri(parser, RULE_ATT_CONDITION_ID);
        rt.component = safeComponentName(parser, RULE_ATT_COMPONENT);
        rt.condition = readConditionXml(parser);
        return rt.condition != null ? rt : null;
        return rt.condition != null || !conditionRequired ? rt : null;
    }

    public static void writeRuleXml(ZenRule rule, XmlSerializer out) throws IOException {
+2 −0
Original line number Diff line number Diff line
@@ -51,5 +51,7 @@ public abstract class AudioManagerInternal {
        /** Called when internal ringer mode is evaluated, returns the new external ringer mode */
        int onSetRingerModeInternal(int ringerModeOld, int ringerModeNew, String caller,
                int ringerModeExternal, VolumePolicy policy);

        boolean canVolumeDownEnterSilent();
    }
}
+2 −2
Original line number Diff line number Diff line
@@ -18,7 +18,7 @@
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:background="@drawable/qs_detail_background"
        android:paddingBottom="16dp"
        android:paddingBottom="8dp"
        android:orientation="vertical">

    <FrameLayout
@@ -30,7 +30,7 @@
    <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:paddingEnd="16dp"
            android:paddingEnd="8dp"
            android:gravity="end">

        <TextView
+4 −4
Original line number Diff line number Diff line
@@ -19,10 +19,10 @@
    android:layout_height="wrap_content"
    android:layout_marginStart="@dimen/segmented_button_spacing"
    android:layout_weight="1"
    android:paddingStart="8dp"
    android:gravity="start|center_vertical"
    android:gravity="center"
    android:maxLines="2"
    android:lineSpacingMultiplier="1.05026"
    android:textColor="@color/segmented_button_text_selector"
    android:background="@drawable/btn_borderless_rect"
    android:textAppearance="@style/TextAppearance.Volume.ZenSwitchSummary"
    android:minHeight="48dp" />
    android:textAppearance="@style/TextAppearance.QS.SegmentedButton"
    android:minHeight="64dp" />
+6 −15
Original line number Diff line number Diff line
@@ -21,40 +21,31 @@
    android:layout_marginBottom="4dp"
    android:layout_marginLeft="@dimen/notification_side_padding"
    android:layout_marginRight="@dimen/notification_side_padding"
    android:layout_marginTop="4dp"
    android:background="@drawable/volume_dialog_background"
    android:translationZ="4dp" >

    <com.android.keyguard.AlphaOptimizedImageButton
        android:id="@+id/volume_expand_button"
        style="@style/VolumeButtons"
        android:layout_alignParentLeft="true"
        android:layout_width="@dimen/volume_button_size"
        android:layout_height="@dimen/volume_button_size"
        android:layout_alignParentLeft="true"
        android:clickable="true"
        android:soundEffectsEnabled="false"
        android:src="@drawable/ic_volume_collapse_animation" />
        android:src="@drawable/ic_volume_collapse_animation"
        tools:ignore="RtlHardcoded" />

    <LinearLayout
        android:id="@+id/volume_dialog_content"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:orientation="vertical"
        android:paddingBottom="4dp"
        android:paddingTop="6dp" >
        android:paddingBottom="8dp"
        android:paddingTop="8dp" >

        <!-- volume rows added and removed here! :-) -->

        <FrameLayout
            android:id="@+id/volume_footer"
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            tools:ignore="UselessParent" >

            <include layout="@layout/volume_text_footer" />

        <include layout="@layout/volume_zen_footer" />
        </FrameLayout>
    </LinearLayout>

</RelativeLayout>
 No newline at end of file
Loading