Loading packages/SystemUI/res/layout/keyguard_bottom_area.xml +6 −10 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ android:layout_height="match_parent" android:layout_width="match_parent" > <com.android.systemui.statusbar.phone.SwipeAffordanceView <com.android.systemui.statusbar.AlphaImageView android:id="@+id/camera_button" android:layout_height="64dp" android:layout_width="64dp" Loading @@ -30,10 +30,9 @@ android:tint="#ffffffff" android:src="@drawable/ic_camera_alt_24dp" android:scaleType="center" android:contentDescription="@string/accessibility_camera_button" systemui:swipeDirection="start"/> android:contentDescription="@string/accessibility_camera_button" /> <com.android.systemui.statusbar.phone.SwipeAffordanceView <com.android.systemui.statusbar.AlphaImageView android:id="@+id/phone_button" android:layout_height="64dp" android:layout_width="64dp" Loading @@ -41,8 +40,7 @@ android:tint="#ffffffff" android:src="@drawable/ic_phone_24dp" android:scaleType="center" android:contentDescription="@string/accessibility_phone_button" systemui:swipeDirection="end"/> android:contentDescription="@string/accessibility_phone_button" /> <com.android.systemui.statusbar.phone.KeyguardIndicationTextView android:id="@+id/keyguard_indication_text" Loading @@ -54,15 +52,13 @@ android:textColor="#ffffff" android:textAppearance="?android:attr/textAppearanceSmall"/> <ImageView <com.android.systemui.statusbar.AlphaImageView android:id="@+id/lock_icon" android:layout_width="64dp" android:layout_height="64dp" android:layout_gravity="bottom|center_horizontal" android:src="@drawable/ic_lock_24dp" android:scaleType="center" android:alpha="0.7" android:layerType="hardware" android:tint="#ffffffff" /> </com.android.systemui.statusbar.phone.KeyguardBottomAreaView> packages/SystemUI/res/values/attrs.xml +0 −6 Original line number Diff line number Diff line Loading @@ -43,12 +43,6 @@ <declare-styleable name="BatteryMeterView"> <attr name="frameColor" format="color" /> </declare-styleable> <declare-styleable name="SwipeAffordanceView"> <attr name="swipeDirection" format="enum"> <enum name="start" value="0" /> <enum name="end" value="1" /> </attr> </declare-styleable> <declare-styleable name="Clock"> <attr name="amPmStyle" format="enum"> <enum name="normal" value="0" /> Loading packages/SystemUI/res/values/dimens.xml +3 −0 Original line number Diff line number Diff line Loading @@ -294,6 +294,9 @@ <dimen name="keyguard_clock_notifications_margin_min">22dp</dimen> <dimen name="keyguard_clock_notifications_margin_max">36dp</dimen> <!-- The minimum amount the user needs to swipe to go to the camera / phone. --> <dimen name="keyguard_min_swipe_amount">75dp</dimen> <!-- Volume panel dialog y offset --> <dimen name="volume_panel_top">16dp</dimen> Loading packages/SystemUI/src/com/android/systemui/statusbar/AlphaImageView.java 0 → 100644 +48 −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.widget.ImageView; /** * An ImageView which does not have overlapping renderings commands and therefore does not need a * layer when alpha is changed. */ public class AlphaImageView extends ImageView { public AlphaImageView(Context context) { super(context); } public AlphaImageView(Context context, AttributeSet attrs) { super(context, attrs); } public AlphaImageView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } public AlphaImageView(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/FlingAnimationUtils.java +88 −8 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar; import android.animation.ValueAnimator; import android.content.Context; import android.view.ViewPropertyAnimator; import android.view.animation.AnimationUtils; import android.view.animation.Interpolator; import android.view.animation.PathInterpolator; Loading Loading @@ -46,6 +47,8 @@ public class FlingAnimationUtils { private float mMaxLengthSeconds; private float mHighVelocityPxPerSecond; private AnimatorProperties mAnimatorProperties = new AnimatorProperties(); public FlingAnimationUtils(Context ctx, float maxLengthSeconds) { mMaxLengthSeconds = maxLengthSeconds; mLinearOutSlowIn = new PathInterpolator(0, 0, LINEAR_OUT_SLOW_IN_X2, 1); Loading @@ -72,6 +75,20 @@ public class FlingAnimationUtils { apply(animator, currValue, endValue, velocity, Math.abs(endValue - currValue)); } /** * Applies the interpolator and length to the animator, such that the fling animation is * consistent with the finger motion. * * @param animator the animator to apply * @param currValue the current value * @param endValue the end value of the animator * @param velocity the current velocity of the motion */ public void apply(ViewPropertyAnimator animator, float currValue, float endValue, float velocity) { apply(animator, currValue, endValue, velocity, Math.abs(endValue - currValue)); } /** * Applies the interpolator and length to the animator, such that the fling animation is * consistent with the finger motion. Loading @@ -85,13 +102,40 @@ public class FlingAnimationUtils { */ public void apply(ValueAnimator animator, float currValue, float endValue, float velocity, float maxDistance) { AnimatorProperties properties = getProperties(currValue, endValue, velocity, maxDistance); animator.setDuration(properties.duration); animator.setInterpolator(properties.interpolator); } /** * Applies the interpolator and length to the animator, such that the fling animation is * consistent with the finger motion. * * @param animator the animator to apply * @param currValue the current value * @param endValue the end value of the animator * @param velocity the current velocity of the motion * @param maxDistance the maximum distance for this interaction; the maximum animation length * gets multiplied by the ratio between the actual distance and this value */ public void apply(ViewPropertyAnimator animator, float currValue, float endValue, float velocity, float maxDistance) { AnimatorProperties properties = getProperties(currValue, endValue, velocity, maxDistance); animator.setDuration(properties.duration); animator.setInterpolator(properties.interpolator); } private AnimatorProperties getProperties(float currValue, float endValue, float velocity, float maxDistance) { float maxLengthSeconds = (float) (mMaxLengthSeconds * Math.sqrt(Math.abs(endValue - currValue) / maxDistance)); float diff = Math.abs(endValue - currValue); float velAbs = Math.abs(velocity); float durationSeconds = LINEAR_OUT_SLOW_IN_START_GRADIENT * diff / velAbs; if (durationSeconds <= maxLengthSeconds) { animator.setInterpolator(mLinearOutSlowIn); mAnimatorProperties.interpolator = mLinearOutSlowIn; } else if (velAbs >= mMinVelocityPxPerSecond) { // Cross fade between fast-out-slow-in and linear interpolator with current velocity. Loading @@ -100,14 +144,15 @@ public class FlingAnimationUtils { = new VelocityInterpolator(durationSeconds, velAbs, diff); InterpolatorInterpolator superInterpolator = new InterpolatorInterpolator( velocityInterpolator, mLinearOutSlowIn, mLinearOutSlowIn); animator.setInterpolator(superInterpolator); mAnimatorProperties.interpolator = superInterpolator; } else { // Just use a normal interpolator which doesn't take the velocity into account. durationSeconds = maxLengthSeconds; animator.setInterpolator(mFastOutSlowIn); mAnimatorProperties.interpolator = mFastOutSlowIn; } animator.setDuration((long) (durationSeconds * 1000)); mAnimatorProperties.duration = (long) (durationSeconds * 1000); return mAnimatorProperties; } /** Loading @@ -124,6 +169,34 @@ public class FlingAnimationUtils { */ public void applyDismissing(ValueAnimator animator, float currValue, float endValue, float velocity, float maxDistance) { AnimatorProperties properties = getDismissingProperties(currValue, endValue, velocity, maxDistance); animator.setDuration(properties.duration); animator.setInterpolator(properties.interpolator); } /** * Applies the interpolator and length to the animator, such that the fling animation is * consistent with the finger motion for the case when the animation is making something * disappear. * * @param animator the animator to apply * @param currValue the current value * @param endValue the end value of the animator * @param velocity the current velocity of the motion * @param maxDistance the maximum distance for this interaction; the maximum animation length * gets multiplied by the ratio between the actual distance and this value */ public void applyDismissing(ViewPropertyAnimator animator, float currValue, float endValue, float velocity, float maxDistance) { AnimatorProperties properties = getDismissingProperties(currValue, endValue, velocity, maxDistance); animator.setDuration(properties.duration); animator.setInterpolator(properties.interpolator); } private AnimatorProperties getDismissingProperties(float currValue, float endValue, float velocity, float maxDistance) { float maxLengthSeconds = (float) (mMaxLengthSeconds * Math.pow(Math.abs(endValue - currValue) / maxDistance, 0.5f)); float diff = Math.abs(endValue - currValue); Loading @@ -135,7 +208,7 @@ public class FlingAnimationUtils { Interpolator mLinearOutFasterIn = new PathInterpolator(0, 0, 1, y2); float durationSeconds = startGradient * diff / velAbs; if (durationSeconds <= maxLengthSeconds) { animator.setInterpolator(mLinearOutFasterIn); mAnimatorProperties.interpolator = mLinearOutFasterIn; } else if (velAbs >= mMinVelocityPxPerSecond) { // Cross fade between linear-out-faster-in and linear interpolator with current Loading @@ -145,14 +218,15 @@ public class FlingAnimationUtils { = new VelocityInterpolator(durationSeconds, velAbs, diff); InterpolatorInterpolator superInterpolator = new InterpolatorInterpolator( velocityInterpolator, mLinearOutFasterIn, mLinearOutSlowIn); animator.setInterpolator(superInterpolator); mAnimatorProperties.interpolator = superInterpolator; } else { // Just use a normal interpolator which doesn't take the velocity into account. durationSeconds = maxLengthSeconds; animator.setInterpolator(mFastOutLinearIn); mAnimatorProperties.interpolator = mFastOutLinearIn; } animator.setDuration((long) (durationSeconds * 1000)); mAnimatorProperties.duration = (long) (durationSeconds * 1000); return mAnimatorProperties; } /** Loading Loading @@ -221,4 +295,10 @@ public class FlingAnimationUtils { return time * mVelocity / mDiff; } } private static class AnimatorProperties { Interpolator interpolator; long duration; } } Loading
packages/SystemUI/res/layout/keyguard_bottom_area.xml +6 −10 Original line number Diff line number Diff line Loading @@ -22,7 +22,7 @@ android:layout_height="match_parent" android:layout_width="match_parent" > <com.android.systemui.statusbar.phone.SwipeAffordanceView <com.android.systemui.statusbar.AlphaImageView android:id="@+id/camera_button" android:layout_height="64dp" android:layout_width="64dp" Loading @@ -30,10 +30,9 @@ android:tint="#ffffffff" android:src="@drawable/ic_camera_alt_24dp" android:scaleType="center" android:contentDescription="@string/accessibility_camera_button" systemui:swipeDirection="start"/> android:contentDescription="@string/accessibility_camera_button" /> <com.android.systemui.statusbar.phone.SwipeAffordanceView <com.android.systemui.statusbar.AlphaImageView android:id="@+id/phone_button" android:layout_height="64dp" android:layout_width="64dp" Loading @@ -41,8 +40,7 @@ android:tint="#ffffffff" android:src="@drawable/ic_phone_24dp" android:scaleType="center" android:contentDescription="@string/accessibility_phone_button" systemui:swipeDirection="end"/> android:contentDescription="@string/accessibility_phone_button" /> <com.android.systemui.statusbar.phone.KeyguardIndicationTextView android:id="@+id/keyguard_indication_text" Loading @@ -54,15 +52,13 @@ android:textColor="#ffffff" android:textAppearance="?android:attr/textAppearanceSmall"/> <ImageView <com.android.systemui.statusbar.AlphaImageView android:id="@+id/lock_icon" android:layout_width="64dp" android:layout_height="64dp" android:layout_gravity="bottom|center_horizontal" android:src="@drawable/ic_lock_24dp" android:scaleType="center" android:alpha="0.7" android:layerType="hardware" android:tint="#ffffffff" /> </com.android.systemui.statusbar.phone.KeyguardBottomAreaView>
packages/SystemUI/res/values/attrs.xml +0 −6 Original line number Diff line number Diff line Loading @@ -43,12 +43,6 @@ <declare-styleable name="BatteryMeterView"> <attr name="frameColor" format="color" /> </declare-styleable> <declare-styleable name="SwipeAffordanceView"> <attr name="swipeDirection" format="enum"> <enum name="start" value="0" /> <enum name="end" value="1" /> </attr> </declare-styleable> <declare-styleable name="Clock"> <attr name="amPmStyle" format="enum"> <enum name="normal" value="0" /> Loading
packages/SystemUI/res/values/dimens.xml +3 −0 Original line number Diff line number Diff line Loading @@ -294,6 +294,9 @@ <dimen name="keyguard_clock_notifications_margin_min">22dp</dimen> <dimen name="keyguard_clock_notifications_margin_max">36dp</dimen> <!-- The minimum amount the user needs to swipe to go to the camera / phone. --> <dimen name="keyguard_min_swipe_amount">75dp</dimen> <!-- Volume panel dialog y offset --> <dimen name="volume_panel_top">16dp</dimen> Loading
packages/SystemUI/src/com/android/systemui/statusbar/AlphaImageView.java 0 → 100644 +48 −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.widget.ImageView; /** * An ImageView which does not have overlapping renderings commands and therefore does not need a * layer when alpha is changed. */ public class AlphaImageView extends ImageView { public AlphaImageView(Context context) { super(context); } public AlphaImageView(Context context, AttributeSet attrs) { super(context, attrs); } public AlphaImageView(Context context, AttributeSet attrs, int defStyleAttr) { super(context, attrs, defStyleAttr); } public AlphaImageView(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/FlingAnimationUtils.java +88 −8 Original line number Diff line number Diff line Loading @@ -18,6 +18,7 @@ package com.android.systemui.statusbar; import android.animation.ValueAnimator; import android.content.Context; import android.view.ViewPropertyAnimator; import android.view.animation.AnimationUtils; import android.view.animation.Interpolator; import android.view.animation.PathInterpolator; Loading Loading @@ -46,6 +47,8 @@ public class FlingAnimationUtils { private float mMaxLengthSeconds; private float mHighVelocityPxPerSecond; private AnimatorProperties mAnimatorProperties = new AnimatorProperties(); public FlingAnimationUtils(Context ctx, float maxLengthSeconds) { mMaxLengthSeconds = maxLengthSeconds; mLinearOutSlowIn = new PathInterpolator(0, 0, LINEAR_OUT_SLOW_IN_X2, 1); Loading @@ -72,6 +75,20 @@ public class FlingAnimationUtils { apply(animator, currValue, endValue, velocity, Math.abs(endValue - currValue)); } /** * Applies the interpolator and length to the animator, such that the fling animation is * consistent with the finger motion. * * @param animator the animator to apply * @param currValue the current value * @param endValue the end value of the animator * @param velocity the current velocity of the motion */ public void apply(ViewPropertyAnimator animator, float currValue, float endValue, float velocity) { apply(animator, currValue, endValue, velocity, Math.abs(endValue - currValue)); } /** * Applies the interpolator and length to the animator, such that the fling animation is * consistent with the finger motion. Loading @@ -85,13 +102,40 @@ public class FlingAnimationUtils { */ public void apply(ValueAnimator animator, float currValue, float endValue, float velocity, float maxDistance) { AnimatorProperties properties = getProperties(currValue, endValue, velocity, maxDistance); animator.setDuration(properties.duration); animator.setInterpolator(properties.interpolator); } /** * Applies the interpolator and length to the animator, such that the fling animation is * consistent with the finger motion. * * @param animator the animator to apply * @param currValue the current value * @param endValue the end value of the animator * @param velocity the current velocity of the motion * @param maxDistance the maximum distance for this interaction; the maximum animation length * gets multiplied by the ratio between the actual distance and this value */ public void apply(ViewPropertyAnimator animator, float currValue, float endValue, float velocity, float maxDistance) { AnimatorProperties properties = getProperties(currValue, endValue, velocity, maxDistance); animator.setDuration(properties.duration); animator.setInterpolator(properties.interpolator); } private AnimatorProperties getProperties(float currValue, float endValue, float velocity, float maxDistance) { float maxLengthSeconds = (float) (mMaxLengthSeconds * Math.sqrt(Math.abs(endValue - currValue) / maxDistance)); float diff = Math.abs(endValue - currValue); float velAbs = Math.abs(velocity); float durationSeconds = LINEAR_OUT_SLOW_IN_START_GRADIENT * diff / velAbs; if (durationSeconds <= maxLengthSeconds) { animator.setInterpolator(mLinearOutSlowIn); mAnimatorProperties.interpolator = mLinearOutSlowIn; } else if (velAbs >= mMinVelocityPxPerSecond) { // Cross fade between fast-out-slow-in and linear interpolator with current velocity. Loading @@ -100,14 +144,15 @@ public class FlingAnimationUtils { = new VelocityInterpolator(durationSeconds, velAbs, diff); InterpolatorInterpolator superInterpolator = new InterpolatorInterpolator( velocityInterpolator, mLinearOutSlowIn, mLinearOutSlowIn); animator.setInterpolator(superInterpolator); mAnimatorProperties.interpolator = superInterpolator; } else { // Just use a normal interpolator which doesn't take the velocity into account. durationSeconds = maxLengthSeconds; animator.setInterpolator(mFastOutSlowIn); mAnimatorProperties.interpolator = mFastOutSlowIn; } animator.setDuration((long) (durationSeconds * 1000)); mAnimatorProperties.duration = (long) (durationSeconds * 1000); return mAnimatorProperties; } /** Loading @@ -124,6 +169,34 @@ public class FlingAnimationUtils { */ public void applyDismissing(ValueAnimator animator, float currValue, float endValue, float velocity, float maxDistance) { AnimatorProperties properties = getDismissingProperties(currValue, endValue, velocity, maxDistance); animator.setDuration(properties.duration); animator.setInterpolator(properties.interpolator); } /** * Applies the interpolator and length to the animator, such that the fling animation is * consistent with the finger motion for the case when the animation is making something * disappear. * * @param animator the animator to apply * @param currValue the current value * @param endValue the end value of the animator * @param velocity the current velocity of the motion * @param maxDistance the maximum distance for this interaction; the maximum animation length * gets multiplied by the ratio between the actual distance and this value */ public void applyDismissing(ViewPropertyAnimator animator, float currValue, float endValue, float velocity, float maxDistance) { AnimatorProperties properties = getDismissingProperties(currValue, endValue, velocity, maxDistance); animator.setDuration(properties.duration); animator.setInterpolator(properties.interpolator); } private AnimatorProperties getDismissingProperties(float currValue, float endValue, float velocity, float maxDistance) { float maxLengthSeconds = (float) (mMaxLengthSeconds * Math.pow(Math.abs(endValue - currValue) / maxDistance, 0.5f)); float diff = Math.abs(endValue - currValue); Loading @@ -135,7 +208,7 @@ public class FlingAnimationUtils { Interpolator mLinearOutFasterIn = new PathInterpolator(0, 0, 1, y2); float durationSeconds = startGradient * diff / velAbs; if (durationSeconds <= maxLengthSeconds) { animator.setInterpolator(mLinearOutFasterIn); mAnimatorProperties.interpolator = mLinearOutFasterIn; } else if (velAbs >= mMinVelocityPxPerSecond) { // Cross fade between linear-out-faster-in and linear interpolator with current Loading @@ -145,14 +218,15 @@ public class FlingAnimationUtils { = new VelocityInterpolator(durationSeconds, velAbs, diff); InterpolatorInterpolator superInterpolator = new InterpolatorInterpolator( velocityInterpolator, mLinearOutFasterIn, mLinearOutSlowIn); animator.setInterpolator(superInterpolator); mAnimatorProperties.interpolator = superInterpolator; } else { // Just use a normal interpolator which doesn't take the velocity into account. durationSeconds = maxLengthSeconds; animator.setInterpolator(mFastOutLinearIn); mAnimatorProperties.interpolator = mFastOutLinearIn; } animator.setDuration((long) (durationSeconds * 1000)); mAnimatorProperties.duration = (long) (durationSeconds * 1000); return mAnimatorProperties; } /** Loading Loading @@ -221,4 +295,10 @@ public class FlingAnimationUtils { return time * mVelocity / mDiff; } } private static class AnimatorProperties { Interpolator interpolator; long duration; } }