diff options
-rw-r--r-- | src/com/android/launcher2/AllAppsTabbed.java | 16 | ||||
-rw-r--r-- | src/com/android/launcher2/Launcher.java | 76 | ||||
-rw-r--r-- | src/com/android/launcher2/Workspace.java | 34 |
3 files changed, 63 insertions, 63 deletions
diff --git a/src/com/android/launcher2/AllAppsTabbed.java b/src/com/android/launcher2/AllAppsTabbed.java index 5df580cdf..368306f50 100644 --- a/src/com/android/launcher2/AllAppsTabbed.java +++ b/src/com/android/launcher2/AllAppsTabbed.java @@ -18,10 +18,10 @@ package com.android.launcher2; import java.util.ArrayList; -import android.animation.Animatable; -import android.animation.AnimatableListenerAdapter; import android.animation.Animator; -import android.animation.PropertyAnimator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ValueAnimator; +import android.animation.ObjectAnimator; import android.content.Context; import android.content.res.Resources; import android.graphics.Color; @@ -103,9 +103,9 @@ public class AllAppsTabbed extends TabHost implements AllAppsView { // animate the changing of the tab content by fading pages in and out final int duration = 150; final float alpha = mAllApps.getAlpha(); - Animator alphaAnim = new PropertyAnimator(duration, mAllApps, "alpha", alpha, 0.0f); - alphaAnim.addListener(new AnimatableListenerAdapter() { - public void onAnimationEnd(Animatable animation) { + ValueAnimator alphaAnim = new ObjectAnimator(duration, mAllApps, "alpha", alpha, 0.0f); + alphaAnim.addListener(new AnimatorListenerAdapter() { + public void onAnimationEnd(Animator animation) { String tag = getCurrentTabTag(); if (tag == TAG_ALL) { mAllApps.setAppFilter(AllAppsPagedView.ALL_APPS_FLAG); @@ -118,8 +118,8 @@ public class AllAppsTabbed extends TabHost implements AllAppsView { } final float alpha = mAllApps.getAlpha(); - Animator alphaAnim = - new PropertyAnimator(duration, mAllApps, "alpha", alpha, 1.0f); + ValueAnimator alphaAnim = + new ObjectAnimator(duration, mAllApps, "alpha", alpha, 1.0f); alphaAnim.start(); } }); diff --git a/src/com/android/launcher2/Launcher.java b/src/com/android/launcher2/Launcher.java index b0c6b7042..53661fabc 100644 --- a/src/com/android/launcher2/Launcher.java +++ b/src/com/android/launcher2/Launcher.java @@ -17,15 +17,15 @@ package com.android.launcher2; +import android.animation.Animator; +import android.animation.AnimatorListenerAdapter; +import android.animation.ValueAnimator; import com.android.common.Search; import com.android.launcher.R; -import android.animation.Animatable; -import android.animation.AnimatableListenerAdapter; -import android.animation.Animator; -import android.animation.PropertyAnimator; +import android.animation.ObjectAnimator; import android.animation.PropertyValuesHolder; -import android.animation.Sequencer; +import android.animation.AnimatorSet; import android.app.Activity; import android.app.AlertDialog; import android.app.Dialog; @@ -316,10 +316,10 @@ public final class Launcher extends Activity // animate the changing of the tab content by fading pages in and out final int duration = 150; final float alpha = mCustomizePagedView.getAlpha(); - Animator alphaAnim = new PropertyAnimator(duration, mCustomizePagedView, + ValueAnimator alphaAnim = new ObjectAnimator(duration, mCustomizePagedView, "alpha", alpha, 0.0f); - alphaAnim.addListener(new AnimatableListenerAdapter() { - public void onAnimationEnd(Animatable animation) { + alphaAnim.addListener(new AnimatorListenerAdapter() { + public void onAnimationEnd(Animator animation) { String tag = mHomeCustomizationDrawer.getCurrentTabTag(); if (tag == WIDGETS_TAG) { mCustomizePagedView.setCustomizationFilter( @@ -336,7 +336,7 @@ public final class Launcher extends Activity } final float alpha = mCustomizePagedView.getAlpha(); - Animator alphaAnim = new PropertyAnimator(duration, mCustomizePagedView, + ValueAnimator alphaAnim = new ObjectAnimator(duration, mCustomizePagedView, "alpha", alpha, 1.0f); alphaAnim.start(); } @@ -2242,10 +2242,10 @@ public final class Launcher extends Activity * * @param show If true, create an animation to the show the item. Otherwise, hide it. * @param view The toolbar button to be animated - * @param seq A Sequencer that will be used to animate the transition. If null, the + * @param seq A AnimatorSet that will be used to animate the transition. If null, the * transition will not be animated. */ - private void hideOrShowToolbarButton(boolean show, final View view, Sequencer seq) { + private void hideOrShowToolbarButton(boolean show, final View view, AnimatorSet seq) { final boolean showing = show; final boolean hiding = !show; @@ -2254,12 +2254,12 @@ public final class Launcher extends Activity getResources().getInteger(R.integer.config_toolbarButtonFadeOutTime); if (seq != null) { - Animatable anim = new PropertyAnimator<Float>(duration, view, "alpha", show ? 1.0f : 0.0f); - anim.addListener(new AnimatableListenerAdapter() { - public void onAnimationStart(Animatable animation) { + Animator anim = new ObjectAnimator<Float>(duration, view, "alpha", show ? 1.0f : 0.0f); + anim.addListener(new AnimatorListenerAdapter() { + public void onAnimationStart(Animator animation) { if (showing) showToolbarButton(view); } - public void onAnimationEnd(Animatable animation) { + public void onAnimationEnd(Animator animation) { if (hiding) hideToolbarButton(view); } }); @@ -2278,10 +2278,10 @@ public final class Launcher extends Activity * If showSeq or hideSeq is null, the transition will be done immediately (not animated). * * @param newState The state that is being switched to - * @param showSeq Sequencer in which to put "show" animations, or null. - * @param hideSeq Sequencer in which to put "hide" animations, or null. + * @param showSeq AnimatorSet in which to put "show" animations, or null. + * @param hideSeq AnimatorSet in which to put "hide" animations, or null. */ - private void hideAndShowToolbarButtons(State newState, Sequencer showSeq, Sequencer hideSeq) { + private void hideAndShowToolbarButtons(State newState, AnimatorSet showSeq, AnimatorSet hideSeq) { final View searchButton = findViewById(R.id.search_button); final View allAppsButton = findViewById(R.id.all_apps_button); final View marketButton = findViewById(R.id.market_button); @@ -2353,12 +2353,12 @@ public final class Launcher extends Activity } if (animated) { - Animator scaleAnim = new PropertyAnimator(duration, toView, + ValueAnimator scaleAnim = new ObjectAnimator(duration, toView, new PropertyValuesHolder<Float>("scaleX", scale, 1.0f), new PropertyValuesHolder<Float>("scaleY", scale, 1.0f)); scaleAnim.setInterpolator(new DecelerateInterpolator()); - scaleAnim.addListener(new AnimatableListenerAdapter() { - public void onAnimationStart(Animatable animation) { + scaleAnim.addListener(new AnimatorListenerAdapter() { + public void onAnimationStart(Animator animation) { // Prepare the position toView.setTranslationX(0.0f); toView.setTranslationY(0.0f); @@ -2366,14 +2366,14 @@ public final class Launcher extends Activity } }); - Sequencer toolbarHideAnim = new Sequencer(); - Sequencer toolbarShowAnim = new Sequencer(); + AnimatorSet toolbarHideAnim = new AnimatorSet(); + AnimatorSet toolbarShowAnim = new AnimatorSet(); hideAndShowToolbarButtons(toState, toolbarShowAnim, toolbarHideAnim); // toView should appear right at the end of the workspace shrink animation final int startDelay = res.getInteger(R.integer.config_workspaceShrinkTime) - duration; - Sequencer s = new Sequencer(); + AnimatorSet s = new AnimatorSet(); s.playTogether(scaleAnim, toolbarHideAnim); s.play(scaleAnim).after(startDelay); @@ -2409,21 +2409,21 @@ public final class Launcher extends Activity mWorkspace.unshrink(animated); if (animated) { - Sequencer s = new Sequencer(); - Animator scaleAnim = new PropertyAnimator(duration, fromView, + AnimatorSet s = new AnimatorSet(); + ValueAnimator scaleAnim = new ObjectAnimator(duration, fromView, new PropertyValuesHolder<Float>("scaleX", scaleFactor), new PropertyValuesHolder<Float>("scaleY", scaleFactor)); scaleAnim.setInterpolator(new AccelerateInterpolator()); - s.addListener(new AnimatableListenerAdapter() { - public void onAnimationEnd(Animatable animation) { + s.addListener(new AnimatorListenerAdapter() { + public void onAnimationEnd(Animator animation) { fromView.setVisibility(View.GONE); fromView.setScaleX(1.0f); fromView.setScaleY(1.0f); } }); - Sequencer toolbarHideAnim = new Sequencer(); - Sequencer toolbarShowAnim = new Sequencer(); + AnimatorSet toolbarHideAnim = new AnimatorSet(); + AnimatorSet toolbarShowAnim = new AnimatorSet(); hideAndShowToolbarButtons(State.WORKSPACE, toolbarShowAnim, toolbarHideAnim); s.playTogether(scaleAnim, toolbarHideAnim); @@ -2468,25 +2468,25 @@ public final class Launcher extends Activity } if (animated) { - Sequencer s = new Sequencer(); - s.addListener(new AnimatableListenerAdapter() { - public void onAnimationStart(Animatable animation) { + AnimatorSet s = new AnimatorSet(); + s.addListener(new AnimatorListenerAdapter() { + public void onAnimationStart(Animator animation) { toView.setVisibility(View.VISIBLE); toView.setY(toViewStartY); } - public void onAnimationEnd(Animatable animation) { + public void onAnimationEnd(Animator animation) { fromView.setVisibility(View.GONE); } }); - Sequencer toolbarHideAnim = new Sequencer(); - Sequencer toolbarShowAnim = new Sequencer(); + AnimatorSet toolbarHideAnim = new AnimatorSet(); + AnimatorSet toolbarShowAnim = new AnimatorSet(); hideAndShowToolbarButtons(toState, toolbarShowAnim, toolbarHideAnim); s.playTogether( toolbarHideAnim, - new PropertyAnimator(duration, fromView, "y", fromViewStartY, fromViewEndY), - new PropertyAnimator(duration, toView, "y", toViewStartY, toViewEndY)); + new ObjectAnimator(duration, fromView, "y", fromViewStartY, fromViewEndY), + new ObjectAnimator(duration, toView, "y", toViewStartY, toViewEndY)); // Show the new toolbar buttons just as the main animation is ending final int fadeInTime = res.getInteger(R.integer.config_toolbarButtonFadeInTime); diff --git a/src/com/android/launcher2/Workspace.java b/src/com/android/launcher2/Workspace.java index 755169950..bb63c0877 100644 --- a/src/com/android/launcher2/Workspace.java +++ b/src/com/android/launcher2/Workspace.java @@ -16,13 +16,13 @@ package com.android.launcher2; +import android.animation.Animator; +import android.animation.ObjectAnimator; import com.android.launcher.R; -import android.animation.Animatable; -import android.animation.PropertyAnimator; import android.animation.PropertyValuesHolder; -import android.animation.Sequencer; -import android.animation.Animatable.AnimatableListener; +import android.animation.AnimatorSet; +import android.animation.Animator.AnimatorListener; import android.app.WallpaperManager; import android.appwidget.AppWidgetManager; import android.appwidget.AppWidgetProviderInfo; @@ -106,7 +106,7 @@ public class Workspace extends SmoothPagedView // State variable that indicated whether the pages are small (ie when you're // in all apps or customize mode) private boolean mIsSmall; - private AnimatableListener mUnshrinkAnimationListener; + private AnimatorListener mUnshrinkAnimationListener; /** @@ -156,13 +156,13 @@ public class Workspace extends SmoothPagedView LauncherApplication app = (LauncherApplication)context.getApplicationContext(); mIconCache = app.getIconCache(); - mUnshrinkAnimationListener = new AnimatableListener() { - public void onAnimationStart(Animatable animation) {} - public void onAnimationEnd(Animatable animation) { + mUnshrinkAnimationListener = new AnimatorListener() { + public void onAnimationStart(Animator animation) {} + public void onAnimationEnd(Animator animation) { mIsSmall = false; } - public void onAnimationCancel(Animatable animation) {} - public void onAnimationRepeat(Animatable animation) {} + public void onAnimationCancel(Animator animation) {} + public void onAnimationRepeat(Animator animation) {} }; mSnapVelocity = 600; @@ -609,7 +609,7 @@ public class Workspace extends SmoothPagedView cl.setPivotY(0.0f); if (animated) { final int duration = res.getInteger(R.integer.config_workspaceShrinkTime); - new PropertyAnimator(duration, cl, + new ObjectAnimator(duration, cl, new PropertyValuesHolder("x", newX), new PropertyValuesHolder("y", newY), new PropertyValuesHolder("scaleX", SHRINK_FACTOR), @@ -663,7 +663,7 @@ public class Workspace extends SmoothPagedView void unshrink(boolean animated) { if (mIsSmall) { - Sequencer s = new Sequencer(); + AnimatorSet s = new AnimatorSet(); final int screenCount = getChildCount(); final int duration = getResources().getInteger(R.integer.config_workspaceUnshrinkTime); @@ -673,11 +673,11 @@ public class Workspace extends SmoothPagedView cl.setPivotY(0.0f); if (animated) { s.playTogether( - new PropertyAnimator<Float>(duration, cl, "translationX", 0.0f), - new PropertyAnimator<Float>(duration, cl, "translationY", 0.0f), - new PropertyAnimator<Float>(duration, cl, "scaleX", 1.0f), - new PropertyAnimator<Float>(duration, cl, "scaleY", 1.0f), - new PropertyAnimator<Float>(duration, cl, "dimmedBitmapAlpha", 0.0f)); + new ObjectAnimator<Float>(duration, cl, "translationX", 0.0f), + new ObjectAnimator<Float>(duration, cl, "translationY", 0.0f), + new ObjectAnimator<Float>(duration, cl, "scaleX", 1.0f), + new ObjectAnimator<Float>(duration, cl, "scaleY", 1.0f), + new ObjectAnimator<Float>(duration, cl, "dimmedBitmapAlpha", 0.0f)); } else { cl.setTranslationX(0.0f); cl.setTranslationY(0.0f); |