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

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

Merge changes I0d090d52,I77296f91

* changes:
  Anchor the volume dialog to hardware keys.
  Switch default stream from RING to MUSIC.
parents 29cd580e 4241192a
Loading
Loading
Loading
Loading
+22 −16
Original line number Diff line number Diff line
@@ -13,16 +13,21 @@
     See the License for the specific language governing permissions and
     limitations under the License.
-->
<RelativeLayout
<com.android.systemui.HardwareUiLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/volume_dialog"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_marginBottom="@dimen/volume_dialog_margin_bottom"
    android:background="@drawable/volume_dialog_background"
    android:paddingTop="@dimen/volume_dialog_padding_top"
    android:layout_height="match_parent"
    android:theme="@style/qs_theme"
    android:translationZ="4dp" >
    android:clipChildren="false" >
    <RelativeLayout
        android:id="@+id/volume_dialog"
        android:layout_width="@dimen/volume_dialog_panel_width"
        android:layout_height="wrap_content"
        android:layout_gravity="center_vertical|end"
        android:paddingTop="@dimen/volume_row_padding_bottom"
        android:layout_margin="12dp"
        android:background="?android:attr/actionBarItemBackground"
        android:translationZ="8dp" >

        <LinearLayout
            android:id="@+id/volume_dialog_content"
@@ -40,3 +45,4 @@
        </LinearLayout>

    </RelativeLayout>
</com.android.systemui.HardwareUiLayout>
+9 −3
Original line number Diff line number Diff line
@@ -19,8 +19,8 @@
    android:layout_height="@dimen/volume_row_height"
    android:clipChildren="false"
    android:clipToPadding="false"
    android:orientation="vertical"
    android:paddingBottom="@dimen/volume_row_padding_bottom" >
    android:theme="@style/qs_theme"
    android:orientation="vertical" >

    <TextView
        android:id="@+id/volume_row_header"
@@ -28,7 +28,8 @@
        android:layout_height="wrap_content"
        android:ellipsize="end"
        android:maxLines="1"
        android:textAppearance="@style/TextAppearance.Volume.Header"
        android:textColor="?android:attr/colorControlNormal"
        android:textAppearance="?android:attr/textAppearanceSmall"
        android:paddingStart="@dimen/volume_row_header_padding_start" />

    <LinearLayout
@@ -53,4 +54,9 @@
                android:paddingStart="@dimen/volume_row_slider_padding_start"/>
    </LinearLayout>

    <Space
        android:id="@+id/spacer"
        android:layout_width="match_parent"
        android:layout_height="@dimen/volume_row_padding_bottom"/>

</LinearLayout>
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -240,7 +240,7 @@
    <!-- 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">@dimen/standard_notification_panel_width</dimen>
    <dimen name="volume_dialog_panel_width">315dp</dimen>

    <!-- Gravity for the notification panel -->
    <integer name="notification_panel_layout_gravity">0x31</integer><!-- center_horizontal|top -->
+1 −1
Original line number Diff line number Diff line
@@ -80,7 +80,7 @@ import com.android.systemui.Interpolators;
import com.android.systemui.colorextraction.SysuiColorExtractor;
import com.android.systemui.plugins.GlobalActions.GlobalActionsManager;
import com.android.systemui.statusbar.phone.ScrimController;
import com.android.systemui.volume.VolumeDialogMotion.LogAccelerateInterpolator;
import com.android.systemui.volume.SystemUIInterpolators.LogAccelerateInterpolator;

import java.util.ArrayList;
import java.util.List;
+78 −0
Original line number Diff line number Diff line
/*
 * Copyright (C) 2015 The Android Open Source Project
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.android.systemui.volume;

import android.animation.TimeInterpolator;

public class SystemUIInterpolators {
    public static final class LogDecelerateInterpolator implements TimeInterpolator {
        private final float mBase;
        private final float mDrift;
        private final float mTimeScale;
        private final float mOutputScale;

        public LogDecelerateInterpolator() {
            this(400f, 1.4f, 0);
        }

        private LogDecelerateInterpolator(float base, float timeScale, float drift) {
            mBase = base;
            mDrift = drift;
            mTimeScale = 1f / timeScale;

            mOutputScale = 1f / computeLog(1f);
        }

        private float computeLog(float t) {
            return 1f - (float) Math.pow(mBase, -t * mTimeScale) + (mDrift * t);
        }

        @Override
        public float getInterpolation(float t) {
            return computeLog(t) * mOutputScale;
        }
    }

    public static final class LogAccelerateInterpolator implements TimeInterpolator {
        private final int mBase;
        private final int mDrift;
        private final float mLogScale;

        public LogAccelerateInterpolator() {
            this(100, 0);
        }

        private LogAccelerateInterpolator(int base, int drift) {
            mBase = base;
            mDrift = drift;
            mLogScale = 1f / computeLog(1, mBase, mDrift);
        }

        private static float computeLog(float t, int base, int drift) {
            return (float) -Math.pow(base, -t) + 1 + (drift * t);
        }

        @Override
        public float getInterpolation(float t) {
            return 1 - computeLog(1 - t, mBase, mDrift) * mLogScale;
        }
    }

    public interface Callback {
        void onAnimatingChanged(boolean animating);
    }
}
Loading