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

Commit 7c62c310 authored by Julia Reynolds's avatar Julia Reynolds
Browse files

Show volume dialog vertically in all rotations

The volume dialog will be volume_dialog_base_margin dp away from
the nearest thing on its right, be that nav bar, cutout, or the
side of the device.

Additionally made the dialog a bit shorter and skinnier to fit.

Test: manual, used dialog in all rotations in rtl and ltr
Change-Id: Ia2642ede7670989dcc2b7612cc8c3bf2ba94fbc7
Fixes: 72711737
parent 34b58512
Loading
Loading
Loading
Loading
+7 −6
Original line number Diff line number Diff line
@@ -20,14 +20,15 @@
    android:background="@android:color/transparent"
    android:theme="@style/qs_theme"
    android:clipChildren="false" >
    <!-- right-aligned to be physically near volume button -->
    <LinearLayout
        android:id="@+id/volume_dialog"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical|end"
        android:layout_gravity="center_vertical|right"
        android:minWidth="@dimen/volume_dialog_panel_width"
        android:background="@android:color/transparent"
        android:layout_margin="12dp"
        android:layout_margin="@dimen/volume_dialog_base_margin"
        android:translationZ="8dp"
        android:orientation="vertical"
        android:clipChildren="false" >
@@ -38,8 +39,8 @@
            android:layout_height="wrap_content"
            android:clipChildren="false"
            android:clipToPadding="false"
            android:paddingTop="12dp"
            android:paddingBottom="12dp"
            android:paddingTop="10dp"
            android:paddingBottom="10dp"
            android:background="@drawable/rounded_bg_full"
            android:translationZ="8dp"
            android:orientation="horizontal" >
@@ -71,7 +72,7 @@
                android:maxLines="1"
                android:layout_centerVertical="true"
                android:textColor="?android:attr/colorControlNormal"
                android:textAppearance="?android:attr/textAppearanceSmall" />
                android:textAppearance="@style/TextAppearance.Volume.Header" />

            <com.android.keyguard.AlphaOptimizedImageButton
                android:id="@+id/ringer_icon"
@@ -89,7 +90,7 @@
                android:ellipsize="end"
                android:maxLines="1"
                android:textColor="?android:attr/colorControlNormal"
                android:textAppearance="?android:attr/textAppearanceSmall" />
                android:textAppearance="@style/TextAppearance.Volume.Header.Secondary" />

        </LinearLayout>
    </LinearLayout>
+7 −5
Original line number Diff line number Diff line
@@ -29,15 +29,16 @@
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:gravity="center"
        android:padding="10dp">
        android:padding="5dp">
        <TextView
            android:id="@+id/volume_row_header"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:ellipsize="end"
            android:maxLength="10"
            android:maxLines="1"
            android:textColor="?android:attr/colorControlNormal"
            android:textAppearance="?android:attr/textAppearanceSmall" />
            android:textAppearance="@style/TextAppearance.Volume.Header" />
        <LinearLayout
            android:id="@+id/output_chooser"
            android:orientation="vertical"
@@ -53,9 +54,10 @@
                android:visibility="gone"
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                android:maxLength="10"
                android:ellipsize="end"
                android:maxLines="1"
                android:textAppearance="@style/TextAppearance.QS.DetailItemSecondary" />
                android:textAppearance="@style/TextAppearance.Volume.Header.Secondary" />
            <com.android.keyguard.AlphaOptimizedImageButton
                android:id="@+id/output_chooser_button"
                android:layout_width="24dp"
@@ -74,13 +76,13 @@
        android:padding="0dp"
        android:layout_width="@dimen/volume_dialog_panel_width"
        android:layoutDirection="rtl"
        android:layout_height="150dp">
        android:layout_height="@dimen/volume_dialog_panel_width">
        <SeekBar
            android:id="@+id/volume_row_slider"
            android:clickable="true"
            android:padding="0dp"
            android:layout_margin="0dp"
            android:layout_width="150dp"
            android:layout_width="@dimen/volume_dialog_panel_width"
            android:layout_height="@dimen/volume_dialog_panel_width"
            android:layoutDirection="rtl"
            android:layout_gravity="center"
+5 −1
Original line number Diff line number Diff line
@@ -262,7 +262,11 @@
    <!-- The width of the panel that holds the quick settings. -->
    <dimen name="qs_panel_width">@dimen/notification_panel_width</dimen>

    <dimen name="volume_dialog_panel_width">120dp</dimen>
    <!-- the amount the volume panel should be offset at the end from the view next to it (or
    the scren edge, in portrait-->
    <dimen name="volume_dialog_base_margin">12dp</dimen>

    <dimen name="volume_dialog_panel_width">100dp</dimen>

    <dimen name="output_chooser_panel_width">320dp</dimen>

+3 −8
Original line number Diff line number Diff line
@@ -410,16 +410,11 @@
        <item name="android:textColor">?android:attr/textColorSecondary</item>
    </style>

    <style name="TextAppearance.Volume.ZenSummary">
        <item name="android:textSize">14sp</item>
        <item name="android:fontFamily">sans-serif-medium</item>
    <style name="TextAppearance.Volume.Header.Secondary">
        <item name="android:textSize">12sp</item>
        <item name="android:textColor">?android:attr/textColorTertiary</item>
    </style>

    <style name="TextAppearance.Volume.ZenDetail">
        <item name="android:textSize">14sp</item>
        <item name="android:fontFamily">sans-serif</item>
        <item name="android:textColor">?android:attr/textColorSecondary</item>
    </style>

    <style name="VolumeButtons" parent="@android:style/Widget.Material.Button.Borderless">
        <item name="android:background">@drawable/btn_borderless_rect</item>
+8 −3
Original line number Diff line number Diff line
@@ -18,6 +18,7 @@ package com.android.systemui.volume;

import static android.accessibilityservice.AccessibilityServiceInfo.FEEDBACK_ALL_MASK;
import static android.accessibilityservice.AccessibilityServiceInfo.FEEDBACK_GENERIC;
import static android.media.AudioManager.STREAM_ACCESSIBILITY;

import static com.android.systemui.volume.Events.DISMISS_REASON_OUTPUT_CHOOSER;
import static com.android.systemui.volume.Events.DISMISS_REASON_SETTINGS_CLICKED;
@@ -47,6 +48,7 @@ import android.os.SystemClock;
import android.provider.Settings;
import android.provider.Settings.Global;
import android.support.v7.media.MediaRouter;
import android.text.InputFilter;
import android.text.TextUtils;
import android.util.Log;
import android.util.Slog;
@@ -219,7 +221,7 @@ public class VolumeDialogImpl implements VolumeDialog {
                        R.drawable.ic_volume_bt_sco, R.drawable.ic_volume_bt_sco, false, false);
                addRow(AudioManager.STREAM_SYSTEM, R.drawable.ic_volume_system,
                        R.drawable.ic_volume_system_mute, false, false);
                addRow(AudioManager.STREAM_ACCESSIBILITY, R.drawable.ic_volume_accessibility,
                addRow(STREAM_ACCESSIBILITY, R.drawable.ic_volume_accessibility,
                        R.drawable.ic_volume_accessibility, true, false);
            }
        } else {
@@ -334,6 +336,9 @@ public class VolumeDialogImpl implements VolumeDialog {
        row.view.setTag(row);
        row.header = row.view.findViewById(R.id.volume_row_header);
        row.header.setId(20 * row.stream);
        if (stream == STREAM_ACCESSIBILITY) {
            row.header.setFilters(new InputFilter[] {new InputFilter.LengthFilter(13)});
        }
        row.slider =  row.view.findViewById(R.id.volume_row_slider);
        row.slider.setOnSeekBarChangeListener(new VolumeSeekBarChangeListener(row));
        row.anim = null;
@@ -643,7 +648,7 @@ public class VolumeDialogImpl implements VolumeDialog {
        if (ss.level == row.requestedLevel) {
            row.requestedLevel = -1;
        }
        final boolean isA11yStream = row.stream == AudioManager.STREAM_ACCESSIBILITY;
        final boolean isA11yStream = row.stream == STREAM_ACCESSIBILITY;
        final boolean isRingStream = row.stream == AudioManager.STREAM_RING;
        final boolean isSystemStream = row.stream == AudioManager.STREAM_SYSTEM;
        final boolean isAlarmStream = row.stream == AudioManager.STREAM_ALARM;
@@ -949,7 +954,7 @@ public class VolumeDialogImpl implements VolumeDialog {
        public void onAccessibilityModeChanged(Boolean showA11yStream) {
            mShowA11yStream = showA11yStream == null ? false : showA11yStream;
            VolumeRow activeRow = getActiveRow();
            if (!mShowA11yStream && AudioManager.STREAM_ACCESSIBILITY == activeRow.stream) {
            if (!mShowA11yStream && STREAM_ACCESSIBILITY == activeRow.stream) {
                dismissH(Events.DISMISS_STREAM_GONE);
            } else {
                updateRowsH(activeRow);
Loading