Loading packages/SystemUI/res/layout/status_bar_notification_speed_bump.xml +2 −2 Original line number Diff line number Diff line Loading @@ -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" Loading @@ -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" Loading packages/SystemUI/src/com/android/systemui/statusbar/AlphaOptimizedView.java 0 → 100644 +50 −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 */ 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; } } packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotView.java +5 −0 Original line number Diff line number Diff line Loading @@ -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); } Loading packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotsState.java +7 −18 Original line number Diff line number Diff line Loading @@ -70,25 +70,14 @@ 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); } } } public void animateToState() { int childCount = mHostView.getChildCount(); Loading @@ -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); Loading packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java +5 −8 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); Loading Loading @@ -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; } } Loading Loading @@ -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) Loading @@ -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) Loading Loading
packages/SystemUI/res/layout/status_bar_notification_speed_bump.xml +2 −2 Original line number Diff line number Diff line Loading @@ -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" Loading @@ -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" Loading
packages/SystemUI/src/com/android/systemui/statusbar/AlphaOptimizedView.java 0 → 100644 +50 −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 */ 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; } }
packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotView.java +5 −0 Original line number Diff line number Diff line Loading @@ -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); } Loading
packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpDotsState.java +7 −18 Original line number Diff line number Diff line Loading @@ -70,25 +70,14 @@ 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); } } } public void animateToState() { int childCount = mHostView.getChildCount(); Loading @@ -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); Loading
packages/SystemUI/src/com/android/systemui/statusbar/SpeedBumpView.java +5 −8 Original line number Diff line number Diff line Loading @@ -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; Loading Loading @@ -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(); Loading Loading @@ -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; } } Loading Loading @@ -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) Loading @@ -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) Loading