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

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

Merge "QS: Fix detail flashing during transition." into lmp-dev

parents 494c590f 8af525dd
Loading
Loading
Loading
Loading
+19 −0
Original line number Diff line number Diff line
<!--
Copyright (C) 2014 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.
-->
<transition xmlns:android="http://schemas.android.com/apk/res/android">
    <item android:drawable="@color/qs_detail_transition" />
    <item android:drawable="@color/system_primary_color" />
</transition>
 No newline at end of file
+1 −1
Original line number Diff line number Diff line
@@ -17,7 +17,7 @@
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@color/system_primary_color"
    android:background="@drawable/qs_detail_background"
    android:padding="16dp" >

    <TextView
+1 −0
Original line number Diff line number Diff line
@@ -44,6 +44,7 @@
    <color name="qs_tile_text">#B3FFFFFF</color><!-- 70% white -->
    <color name="qs_subhead">#99FFFFFF</color><!-- 60% white -->
    <color name="qs_detail_empty">#24B0BEC5</color><!-- 14% blue grey 200-->
    <color name="qs_detail_transition">#99FFFFFF</color>
    <color name="data_usage_secondary">#99FFFFFF</color><!-- 60% white -->
    <color name="data_usage_graph_track">#33FFFFFF</color><!-- 20% white -->
    <color name="data_usage_graph_warning">#FFFFFFFF</color>
+21 −12
Original line number Diff line number Diff line
@@ -19,37 +19,40 @@ package com.android.systemui.qs;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.AnimatorListenerAdapter;
import android.graphics.drawable.TransitionDrawable;
import android.view.View;
import android.view.ViewAnimationUtils;

/** Helper for view-level circular clip animations. **/
public class CircularClipper {
/** Helper for quick settings detail panel clip animations. **/
public class QSDetailClipper {

    private final View mTarget;
    private final View mDetail;
    private final TransitionDrawable mBackground;

    private Animator mAnimator;

    public CircularClipper(View target) {
        mTarget = target;
    public QSDetailClipper(View detail) {
        mDetail = detail;
        mBackground = (TransitionDrawable) detail.getBackground();
    }

    public void animateCircularClip(int x, int y, boolean in, AnimatorListener listener) {
        if (mAnimator != null) {
            mAnimator.cancel();
        }
        final int w = mTarget.getWidth() - x;
        final int h = mTarget.getHeight() - y;
        final int w = mDetail.getWidth() - x;
        final int h = mDetail.getHeight() - y;
        int r = (int) Math.ceil(Math.sqrt(x * x + y * y));
        r = (int) Math.max(r, Math.ceil(Math.sqrt(w * w + y * y)));
        r = (int) Math.max(r, Math.ceil(Math.sqrt(w * w + h * h)));
        r = (int) Math.max(r, Math.ceil(Math.sqrt(x * x + h * h)));

        mAnimator = ViewAnimationUtils.createCircularReveal(mTarget, x, y, 0, r);
        mAnimator.removeAllListeners();
        mAnimator = ViewAnimationUtils.createCircularReveal(mDetail, x, y, 0, r);
        mAnimator.setDuration((long)(mAnimator.getDuration() * 1.5));
        if (listener != null) {
            mAnimator.addListener(listener);
        }
        if (in) {
            mBackground.startTransition((int)(mAnimator.getDuration() * 0.6));
            mAnimator.addListener(mVisibleOnStart);
            mAnimator.start();
        } else {
@@ -61,14 +64,20 @@ public class CircularClipper {
    private final AnimatorListenerAdapter mVisibleOnStart = new AnimatorListenerAdapter() {
        @Override
        public void onAnimationStart(Animator animation) {
            mTarget.setVisibility(View.VISIBLE);
            mDetail.setVisibility(View.VISIBLE);
        }

        public void onAnimationEnd(Animator animation) {
            mAnimator = null;
        }
    };

    private final AnimatorListenerAdapter mGoneOnEnd = new AnimatorListenerAdapter() {
        @Override
        public void onAnimationEnd(Animator animation) {
            mTarget.setVisibility(View.GONE);
            mDetail.setVisibility(View.GONE);
            mBackground.resetTransition();
            mAnimator = null;
        };
    };
}
+2 −2
Original line number Diff line number Diff line
@@ -49,7 +49,7 @@ public class QSPanel extends ViewGroup {
    private final View mDetailSettingsButton;
    private final View mDetailDoneButton;
    private final View mBrightnessView;
    private final CircularClipper mClipper;
    private final QSDetailClipper mClipper;
    private final H mHandler = new H();

    private int mColumns;
@@ -85,7 +85,7 @@ public class QSPanel extends ViewGroup {
                R.layout.quick_settings_brightness_dialog, this, false);
        addView(mDetail);
        addView(mBrightnessView);
        mClipper = new CircularClipper(mDetail);
        mClipper = new QSDetailClipper(mDetail);
        updateResources();

        mBrightnessController = new BrightnessController(getContext(),