Loading packages/Keyguard/src/com/android/keyguard/KeyguardPINView.java +5 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,9 @@ import android.view.View; import android.view.ViewGroup; import android.view.animation.AnimationUtils; import com.android.settingslib.animation.AppearAnimationUtils; import com.android.settingslib.animation.DisappearAnimationUtils; /** * Displays a PIN pad for unlocking. */ Loading Loading @@ -115,7 +118,7 @@ public class KeyguardPINView extends KeyguardPinBasedInputView { .setDuration(500) .setInterpolator(mAppearAnimationUtils.getInterpolator()) .translationY(0); mAppearAnimationUtils.startAnimation(mViews, mAppearAnimationUtils.startAnimation2d(mViews, new Runnable() { @Override public void run() { Loading @@ -132,7 +135,7 @@ public class KeyguardPINView extends KeyguardPinBasedInputView { .setDuration(280) .setInterpolator(mDisappearAnimationUtils.getInterpolator()) .translationY(mDisappearYTranslation); mDisappearAnimationUtils.startAnimation(mViews, mDisappearAnimationUtils.startAnimation2d(mViews, new Runnable() { @Override public void run() { Loading packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java +5 −2 Original line number Diff line number Diff line Loading @@ -36,6 +36,9 @@ import android.widget.LinearLayout; import com.android.internal.widget.LockPatternChecker; import com.android.internal.widget.LockPatternUtils; import com.android.internal.widget.LockPatternView; import com.android.settingslib.animation.AppearAnimationCreator; import com.android.settingslib.animation.AppearAnimationUtils; import com.android.settingslib.animation.DisappearAnimationUtils; import java.util.List; Loading Loading @@ -325,7 +328,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit .setDuration(500) .setInterpolator(mAppearAnimationUtils.getInterpolator()) .translationY(0); mAppearAnimationUtils.startAnimation( mAppearAnimationUtils.startAnimation2d( mLockPatternView.getCellStates(), new Runnable() { @Override Loading Loading @@ -353,7 +356,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit .setDuration(300) .setInterpolator(mDisappearAnimationUtils.getInterpolator()) .translationY(-mDisappearAnimationUtils.getStartTranslation()); mDisappearAnimationUtils.startAnimation(mLockPatternView.getCellStates(), mDisappearAnimationUtils.startAnimation2d(mLockPatternView.getCellStates(), new Runnable() { @Override public void run() { Loading packages/SettingsLib/res/values/dimens.xml 0 → 100644 +24 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2015 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 --> <resources> <!-- The y translation to apply at the start in appear animations. --> <dimen name="appear_y_translation_start">32dp</dimen> <!-- The translation for disappearing security views after having solved them. --> <dimen name="disappear_y_translation">-32dp</dimen> </resources> No newline at end of file packages/Keyguard/src/com/android/keyguard/AppearAnimationCreator.java→packages/SettingsLib/src/com/android/settingslib/animation/AppearAnimationCreator.java +3 −3 Original line number Diff line number Diff line /* * Copyright (C) 2014 The Android Open Source Project * Copyright (C) 2015 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. Loading @@ -14,13 +14,13 @@ * limitations under the License */ package com.android.keyguard; package com.android.settingslib.animation; import android.view.animation.Interpolator; /** * An interface which can create animations when starting an appear animation with * {@link com.android.keyguard.AppearAnimationUtils} * {@link AppearAnimationUtils} */ public interface AppearAnimationCreator<T> { void createAnimation(T animatedObject, long delay, long duration, Loading packages/Keyguard/src/com/android/keyguard/AppearAnimationUtils.java→packages/SettingsLib/src/com/android/settingslib/animation/AppearAnimationUtils.java +22 −12 Original line number Diff line number Diff line /* * Copyright (C) 2014 The Android Open Source Project * Copyright (C) 2015 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. Loading @@ -14,13 +14,15 @@ * limitations under the License */ package com.android.keyguard; package com.android.settingslib.animation; import android.content.Context; import android.view.View; import android.view.animation.AnimationUtils; import android.view.animation.Interpolator; import com.android.settingslib.R; /** * A class to make nice appear transitions for views in a tabular layout. */ Loading @@ -33,7 +35,7 @@ public class AppearAnimationUtils implements AppearAnimationCreator<View> { private final AppearAnimationProperties mProperties = new AppearAnimationProperties(); protected final float mDelayScale; private final long mDuration; protected boolean mScaleTranslationWithRow; protected RowTranslationScaler mRowTranslationScaler; protected boolean mAppearing; public AppearAnimationUtils(Context ctx) { Loading @@ -49,19 +51,18 @@ public class AppearAnimationUtils implements AppearAnimationCreator<View> { R.dimen.appear_y_translation_start) * translationScaleFactor; mDelayScale = delayScaleFactor; mDuration = duration; mScaleTranslationWithRow = false; mAppearing = true; } public void startAnimation(View[][] objects, final Runnable finishListener) { startAnimation(objects, finishListener, this); public void startAnimation2d(View[][] objects, final Runnable finishListener) { startAnimation2d(objects, finishListener, this); } public void startAnimation(View[] objects, final Runnable finishListener) { startAnimation(objects, finishListener, this); } public <T> void startAnimation(T[][] objects, final Runnable finishListener, public <T> void startAnimation2d(T[][] objects, final Runnable finishListener, AppearAnimationCreator<T> creator) { AppearAnimationProperties properties = getDelays(objects); startAnimations(properties, objects, finishListener, creator); Loading @@ -86,8 +87,13 @@ public class AppearAnimationUtils implements AppearAnimationCreator<View> { if (properties.maxDelayRowIndex == row && properties.maxDelayColIndex == 0) { endRunnable = finishListener; } float translationScale = mRowTranslationScaler != null ? mRowTranslationScaler.getRowTranslationScale(row, properties.delays.length) : 1f; float translation = translationScale * mStartTranslation; creator.createAnimation(objects[row], delay, mDuration, mStartTranslation, true /* appearing */, mInterpolator, endRunnable); mAppearing ? translation : -translation, mAppearing, mInterpolator, endRunnable); } } Loading @@ -99,10 +105,10 @@ public class AppearAnimationUtils implements AppearAnimationCreator<View> { } for (int row = 0; row < properties.delays.length; row++) { long[] columns = properties.delays[row]; float translation = mScaleTranslationWithRow ? (float) (Math.pow((properties.delays.length - row), 2) / properties.delays.length * mStartTranslation) : mStartTranslation; float translationScale = mRowTranslationScaler != null ? mRowTranslationScaler.getRowTranslationScale(row, properties.delays.length) : 1f; float translation = translationScale * mStartTranslation; for (int col = 0; col < columns.length; col++) { long delay = columns[col]; Runnable endRunnable = null; Loading Loading @@ -193,4 +199,8 @@ public class AppearAnimationUtils implements AppearAnimationCreator<View> { public int maxDelayRowIndex; public int maxDelayColIndex; } public interface RowTranslationScaler { float getRowTranslationScale(int row, int numRows); } } Loading
packages/Keyguard/src/com/android/keyguard/KeyguardPINView.java +5 −2 Original line number Diff line number Diff line Loading @@ -22,6 +22,9 @@ import android.view.View; import android.view.ViewGroup; import android.view.animation.AnimationUtils; import com.android.settingslib.animation.AppearAnimationUtils; import com.android.settingslib.animation.DisappearAnimationUtils; /** * Displays a PIN pad for unlocking. */ Loading Loading @@ -115,7 +118,7 @@ public class KeyguardPINView extends KeyguardPinBasedInputView { .setDuration(500) .setInterpolator(mAppearAnimationUtils.getInterpolator()) .translationY(0); mAppearAnimationUtils.startAnimation(mViews, mAppearAnimationUtils.startAnimation2d(mViews, new Runnable() { @Override public void run() { Loading @@ -132,7 +135,7 @@ public class KeyguardPINView extends KeyguardPinBasedInputView { .setDuration(280) .setInterpolator(mDisappearAnimationUtils.getInterpolator()) .translationY(mDisappearYTranslation); mDisappearAnimationUtils.startAnimation(mViews, mDisappearAnimationUtils.startAnimation2d(mViews, new Runnable() { @Override public void run() { Loading
packages/Keyguard/src/com/android/keyguard/KeyguardPatternView.java +5 −2 Original line number Diff line number Diff line Loading @@ -36,6 +36,9 @@ import android.widget.LinearLayout; import com.android.internal.widget.LockPatternChecker; import com.android.internal.widget.LockPatternUtils; import com.android.internal.widget.LockPatternView; import com.android.settingslib.animation.AppearAnimationCreator; import com.android.settingslib.animation.AppearAnimationUtils; import com.android.settingslib.animation.DisappearAnimationUtils; import java.util.List; Loading Loading @@ -325,7 +328,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit .setDuration(500) .setInterpolator(mAppearAnimationUtils.getInterpolator()) .translationY(0); mAppearAnimationUtils.startAnimation( mAppearAnimationUtils.startAnimation2d( mLockPatternView.getCellStates(), new Runnable() { @Override Loading Loading @@ -353,7 +356,7 @@ public class KeyguardPatternView extends LinearLayout implements KeyguardSecurit .setDuration(300) .setInterpolator(mDisappearAnimationUtils.getInterpolator()) .translationY(-mDisappearAnimationUtils.getStartTranslation()); mDisappearAnimationUtils.startAnimation(mLockPatternView.getCellStates(), mDisappearAnimationUtils.startAnimation2d(mLockPatternView.getCellStates(), new Runnable() { @Override public void run() { Loading
packages/SettingsLib/res/values/dimens.xml 0 → 100644 +24 −0 Original line number Diff line number Diff line <?xml version="1.0" encoding="utf-8"?> <!-- ~ Copyright (C) 2015 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 --> <resources> <!-- The y translation to apply at the start in appear animations. --> <dimen name="appear_y_translation_start">32dp</dimen> <!-- The translation for disappearing security views after having solved them. --> <dimen name="disappear_y_translation">-32dp</dimen> </resources> No newline at end of file
packages/Keyguard/src/com/android/keyguard/AppearAnimationCreator.java→packages/SettingsLib/src/com/android/settingslib/animation/AppearAnimationCreator.java +3 −3 Original line number Diff line number Diff line /* * Copyright (C) 2014 The Android Open Source Project * Copyright (C) 2015 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. Loading @@ -14,13 +14,13 @@ * limitations under the License */ package com.android.keyguard; package com.android.settingslib.animation; import android.view.animation.Interpolator; /** * An interface which can create animations when starting an appear animation with * {@link com.android.keyguard.AppearAnimationUtils} * {@link AppearAnimationUtils} */ public interface AppearAnimationCreator<T> { void createAnimation(T animatedObject, long delay, long duration, Loading
packages/Keyguard/src/com/android/keyguard/AppearAnimationUtils.java→packages/SettingsLib/src/com/android/settingslib/animation/AppearAnimationUtils.java +22 −12 Original line number Diff line number Diff line /* * Copyright (C) 2014 The Android Open Source Project * Copyright (C) 2015 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. Loading @@ -14,13 +14,15 @@ * limitations under the License */ package com.android.keyguard; package com.android.settingslib.animation; import android.content.Context; import android.view.View; import android.view.animation.AnimationUtils; import android.view.animation.Interpolator; import com.android.settingslib.R; /** * A class to make nice appear transitions for views in a tabular layout. */ Loading @@ -33,7 +35,7 @@ public class AppearAnimationUtils implements AppearAnimationCreator<View> { private final AppearAnimationProperties mProperties = new AppearAnimationProperties(); protected final float mDelayScale; private final long mDuration; protected boolean mScaleTranslationWithRow; protected RowTranslationScaler mRowTranslationScaler; protected boolean mAppearing; public AppearAnimationUtils(Context ctx) { Loading @@ -49,19 +51,18 @@ public class AppearAnimationUtils implements AppearAnimationCreator<View> { R.dimen.appear_y_translation_start) * translationScaleFactor; mDelayScale = delayScaleFactor; mDuration = duration; mScaleTranslationWithRow = false; mAppearing = true; } public void startAnimation(View[][] objects, final Runnable finishListener) { startAnimation(objects, finishListener, this); public void startAnimation2d(View[][] objects, final Runnable finishListener) { startAnimation2d(objects, finishListener, this); } public void startAnimation(View[] objects, final Runnable finishListener) { startAnimation(objects, finishListener, this); } public <T> void startAnimation(T[][] objects, final Runnable finishListener, public <T> void startAnimation2d(T[][] objects, final Runnable finishListener, AppearAnimationCreator<T> creator) { AppearAnimationProperties properties = getDelays(objects); startAnimations(properties, objects, finishListener, creator); Loading @@ -86,8 +87,13 @@ public class AppearAnimationUtils implements AppearAnimationCreator<View> { if (properties.maxDelayRowIndex == row && properties.maxDelayColIndex == 0) { endRunnable = finishListener; } float translationScale = mRowTranslationScaler != null ? mRowTranslationScaler.getRowTranslationScale(row, properties.delays.length) : 1f; float translation = translationScale * mStartTranslation; creator.createAnimation(objects[row], delay, mDuration, mStartTranslation, true /* appearing */, mInterpolator, endRunnable); mAppearing ? translation : -translation, mAppearing, mInterpolator, endRunnable); } } Loading @@ -99,10 +105,10 @@ public class AppearAnimationUtils implements AppearAnimationCreator<View> { } for (int row = 0; row < properties.delays.length; row++) { long[] columns = properties.delays[row]; float translation = mScaleTranslationWithRow ? (float) (Math.pow((properties.delays.length - row), 2) / properties.delays.length * mStartTranslation) : mStartTranslation; float translationScale = mRowTranslationScaler != null ? mRowTranslationScaler.getRowTranslationScale(row, properties.delays.length) : 1f; float translation = translationScale * mStartTranslation; for (int col = 0; col < columns.length; col++) { long delay = columns[col]; Runnable endRunnable = null; Loading Loading @@ -193,4 +199,8 @@ public class AppearAnimationUtils implements AppearAnimationCreator<View> { public int maxDelayRowIndex; public int maxDelayColIndex; } public interface RowTranslationScaler { float getRowTranslationScale(int row, int numRows); } }