summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorJohn Spurlock <jspurlock@google.com>2014-08-02 14:58:41 +0000
committerAndroid (Google) Code Review <android-gerrit@google.com>2014-08-01 18:14:18 +0000
commitbc53cb41f44adf8440761796a0ef4a4aea6ef7ff (patch)
tree0d8e33ae3dadeace93c85566e5a437ddb715bad8
parent494c590f949c50d55eb74ea8cf71f2546a20fec2 (diff)
parent8af525dd7d1640175fda344301a8712725557caa (diff)
downloadframeworks_base-bc53cb41f44adf8440761796a0ef4a4aea6ef7ff.zip
frameworks_base-bc53cb41f44adf8440761796a0ef4a4aea6ef7ff.tar.gz
frameworks_base-bc53cb41f44adf8440761796a0ef4a4aea6ef7ff.tar.bz2
Merge "QS: Fix detail flashing during transition." into lmp-dev
-rw-r--r--packages/SystemUI/res/drawable/qs_detail_background.xml19
-rw-r--r--packages/SystemUI/res/layout/qs_detail.xml2
-rw-r--r--packages/SystemUI/res/values/colors.xml1
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSDetailClipper.java (renamed from packages/SystemUI/src/com/android/systemui/qs/CircularClipper.java)33
-rw-r--r--packages/SystemUI/src/com/android/systemui/qs/QSPanel.java4
5 files changed, 44 insertions, 15 deletions
diff --git a/packages/SystemUI/res/drawable/qs_detail_background.xml b/packages/SystemUI/res/drawable/qs_detail_background.xml
new file mode 100644
index 0000000..692cd44
--- /dev/null
+++ b/packages/SystemUI/res/drawable/qs_detail_background.xml
@@ -0,0 +1,19 @@
+<!--
+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
diff --git a/packages/SystemUI/res/layout/qs_detail.xml b/packages/SystemUI/res/layout/qs_detail.xml
index ca46437..c6a7368 100644
--- a/packages/SystemUI/res/layout/qs_detail.xml
+++ b/packages/SystemUI/res/layout/qs_detail.xml
@@ -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
diff --git a/packages/SystemUI/res/values/colors.xml b/packages/SystemUI/res/values/colors.xml
index a718f4f..a3bfe5a 100644
--- a/packages/SystemUI/res/values/colors.xml
+++ b/packages/SystemUI/res/values/colors.xml
@@ -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>
diff --git a/packages/SystemUI/src/com/android/systemui/qs/CircularClipper.java b/packages/SystemUI/src/com/android/systemui/qs/QSDetailClipper.java
index 90275c1..c0daf72 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/CircularClipper.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSDetailClipper.java
@@ -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;
};
};
}
diff --git a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
index d216069..1173053 100644
--- a/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
+++ b/packages/SystemUI/src/com/android/systemui/qs/QSPanel.java
@@ -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(),