summaryrefslogtreecommitdiffstats
path: root/packages/SystemUI
diff options
context:
space:
mode:
authorSelim Cinek <cinek@google.com>2014-05-24 18:02:16 +0200
committerSelim Cinek <cinek@google.com>2014-06-04 17:30:07 +0200
commit9c80964d3fa869111eb82aae70903d2fb85089cc (patch)
treee42de6022a1139fcc198c00134fe9cac7807249a /packages/SystemUI
parent5158d82340b6e222da1b9254c5b9667c600e002e (diff)
downloadframeworks_base-9c80964d3fa869111eb82aae70903d2fb85089cc.zip
frameworks_base-9c80964d3fa869111eb82aae70903d2fb85089cc.tar.gz
frameworks_base-9c80964d3fa869111eb82aae70903d2fb85089cc.tar.bz2
In the speedbump view, use hasOverlappingRenderings instead of layers
Bug: 15181880 Change-Id: I49b0dbe1cd0ff9f7804dc68502b73fcfd87c7389
Diffstat (limited to 'packages/SystemUI')
-rw-r--r--packages/SystemUI/res/layout/status_bar_notification_speed_bump.xml4
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/AlphaOptimizedView.java50
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotView.java5
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotsState.java25
-rw-r--r--packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java13
5 files changed, 69 insertions, 28 deletions
diff --git a/packages/SystemUI/res/layout/status_bar_notification_speed_bump.xml b/packages/SystemUI/res/layout/status_bar_notification_speed_bump.xml
index ff8800c..84d64b9 100644
--- a/packages/SystemUI/res/layout/status_bar_notification_speed_bump.xml
+++ b/packages/SystemUI/res/layout/status_bar_notification_speed_bump.xml
@@ -28,7 +28,7 @@
android:layout_height="@dimen/speed_bump_height_collapsed"
android:layout_gravity="top"
android:orientation="horizontal">
- <View
+ <com.android.systemui.statusbar.AlphaOptimizedView
android:id="@+id/speedbump_line_left"
android:layout_width="0dp"
android:layout_height="1dp"
@@ -42,7 +42,7 @@
android:layout_marginEnd="8dp"
android:layout_height="match_parent"
android:layout_weight="0"/>
- <View
+ <com.android.systemui.statusbar.AlphaOptimizedView
android:id="@+id/speedbump_line_right"
android:layout_width="0dp"
android:layout_height="1dp"
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/AlphaOptimizedView.java b/packages/SystemUI/src/com/android/systemui/statusbar/AlphaOptimizedView.java
new file mode 100644
index 0000000..d2fe858
--- /dev/null
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/AlphaOptimizedView.java
@@ -0,0 +1,50 @@
+/*
+ * 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
+ */
+
+package com.android.systemui.statusbar;
+
+import android.content.Context;
+import android.util.AttributeSet;
+import android.view.View;
+
+/**
+ * A View which does not have overlapping renderings commands and therefore does not need a
+ * layer when alpha is changed.
+ */
+public class AlphaOptimizedView extends View
+{
+ public AlphaOptimizedView(Context context) {
+ super(context);
+ }
+
+ public AlphaOptimizedView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ }
+
+ public AlphaOptimizedView(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ }
+
+ public AlphaOptimizedView(Context context, AttributeSet attrs, int defStyleAttr,
+ int defStyleRes) {
+ super(context, attrs, defStyleAttr, defStyleRes);
+ }
+
+ @Override
+ public boolean hasOverlappingRendering() {
+ return false;
+ }
+}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotView.java
index 3ca021a..1503072 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotView.java
@@ -41,6 +41,11 @@ public class SpeedBumpDotView extends View {
canvas.drawCircle(radius, radius, radius, mPaint);
}
+ @Override
+ public boolean hasOverlappingRendering() {
+ return false;
+ }
+
public void setColor(int color) {
mPaint.setColor(color);
}
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotsState.java b/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotsState.java
index 06a7f95..4febab1 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotsState.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotsState.java
@@ -70,23 +70,12 @@ public class SpeedBumpDotsState {
for (int i = 0; i < childCount; i++) {
View child = mHostView.getChildAt(i);
ViewState viewState = mStateMap.get(child);
- float translationX = child.getTranslationX();
- float translationY = child.getTranslationY();
- float scale = child.getScaleX();
- float alpha = child.getAlpha();
- if (translationX != viewState.xTranslation) {
- child.setTranslationX(viewState.xTranslation);
- }
- if (translationY != viewState.yTranslation) {
- child.setTranslationY(viewState.yTranslation);
- }
- if (scale != viewState.scale) {
- child.setScaleX(viewState.scale);
- child.setScaleY(viewState.scale);
- }
- if (alpha != viewState.alpha) {
- child.setAlpha(viewState.alpha);
- }
+
+ child.setTranslationX(viewState.xTranslation);
+ child.setTranslationY(viewState.yTranslation);
+ child.setScaleX(viewState.scale);
+ child.setScaleY(viewState.scale);
+ child.setAlpha(viewState.alpha);
}
}
@@ -115,7 +104,7 @@ public class SpeedBumpDotsState {
ViewState viewState = mStateMap.get(child);
child.animate().setInterpolator(mFastOutSlowInInterpolator)
.setStartDelay(startDelay)
- .alpha(viewState.alpha).withLayer()
+ .alpha(viewState.alpha)
.translationX(viewState.xTranslation)
.translationY(viewState.yTranslation)
.scaleX(viewState.scale).scaleY(viewState.scale);
diff --git a/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java b/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java
index a84daef..689d0e9 100644
--- a/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java
+++ b/packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java
@@ -37,8 +37,8 @@ public class SpeedBumpView extends ExpandableView implements View.OnClickListene
private final int mDotsHeight;
private final int mTextPaddingInset;
private SpeedBumpDotsLayout mDots;
- private View mLineLeft;
- private View mLineRight;
+ private AlphaOptimizedView mLineLeft;
+ private AlphaOptimizedView mLineRight;
private boolean mIsExpanded;
private boolean mDividerVisible = true;
private ValueAnimator mCurrentAnimator;
@@ -89,8 +89,8 @@ public class SpeedBumpView extends ExpandableView implements View.OnClickListene
protected void onFinishInflate() {
super.onFinishInflate();
mDots = (SpeedBumpDotsLayout) findViewById(R.id.speed_bump_dots_layout);
- mLineLeft = findViewById(R.id.speedbump_line_left);
- mLineRight = findViewById(R.id.speedbump_line_right);
+ mLineLeft = (AlphaOptimizedView) findViewById(R.id.speedbump_line_left);
+ mLineRight = (AlphaOptimizedView) findViewById(R.id.speedbump_line_right);
mExplanationText = (TextView) findViewById(R.id.speed_bump_text);
resetExplanationText();
@@ -176,8 +176,7 @@ public class SpeedBumpView extends ExpandableView implements View.OnClickListene
.scaleX(scale)
.scaleY(scale)
.translationY(translationY)
- .setListener(needsHideListener ? mHideExplanationListener : null)
- .withLayer();
+ .setListener(needsHideListener ? mHideExplanationListener : null);
mExplanationTextVisible = visible;
}
}
@@ -211,7 +210,6 @@ public class SpeedBumpView extends ExpandableView implements View.OnClickListene
float endTranslationXRight = nowVisible ? 0.0f : mCenterX - mLineRight.getLeft();
mLineLeft.animate()
.alpha(endValue)
- .withLayer()
.scaleX(endValue)
.scaleY(endValue)
.translationX(endTranslationXLeft)
@@ -219,7 +217,6 @@ public class SpeedBumpView extends ExpandableView implements View.OnClickListene
.withEndAction(onFinishedRunnable);
mLineRight.animate()
.alpha(endValue)
- .withLayer()
.scaleX(endValue)
.scaleY(endValue)
.translationX(endTranslationXRight)