removing workaround for fixed animator bug

Change-Id: I244b1c83f5659cf55e1f172ae33f63adbdcf2ea5
This commit is contained in:
Michael Jurka
2010-12-17 20:44:15 -08:00
parent 800242b5b7
commit 8edd75c8bb
6 changed files with 32 additions and 104 deletions
+5 -4
View File
@@ -16,9 +16,10 @@
package com.android.launcher2;
import java.util.ArrayList;
import com.android.launcher.R;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.ObjectAnimator;
import android.animation.ValueAnimator;
import android.content.Context;
@@ -32,7 +33,7 @@ import android.widget.TabHost;
import android.widget.TabWidget;
import android.widget.TextView;
import com.android.launcher.R;
import java.util.ArrayList;
/**
* Implements a tabbed version of AllApps2D.
@@ -91,9 +92,9 @@ public class AllAppsTabbed extends TabHost implements AllAppsView {
final float alpha = mAllApps.getAlpha();
ValueAnimator alphaAnim = ObjectAnimator.ofFloat(mAllApps, "alpha", alpha, 0.0f).
setDuration(duration);
alphaAnim.addListener(new LauncherAnimatorListenerAdapter() {
alphaAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEndOrCancel(Animator animation) {
public void onAnimationEnd(Animator animation) {
String tag = getCurrentTabTag();
if (tag == TAG_ALL) {
mAllApps.setAppFilter(AllAppsPagedView.ALL_APPS_FLAG);
+2 -2
View File
@@ -304,13 +304,13 @@ public class CellLayout extends ViewGroup implements Dimmable {
AnimatorSet bouncer = new AnimatorSet();
bouncer.play(scaleUp).before(scaleDown);
bouncer.play(scaleUp).with(alphaFadeOut);
bouncer.addListener(new LauncherAnimatorListenerAdapter() {
bouncer.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
setHover(true);
}
@Override
public void onAnimationEndOrCancel(Animator animation) {
public void onAnimationEnd(Animator animation) {
setHover(false);
setHoverScale(1.0f);
setHoverAlpha(1.0f);
@@ -52,9 +52,9 @@ public class InterruptibleInOutAnimator {
mOriginalFromValue = fromValue;
mOriginalToValue = toValue;
mAnimator.addListener(new LauncherAnimatorListenerAdapter() {
mAnimator.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEndOrCancel(Animator animation) {
public void onAnimationEnd(Animator animation) {
mDirection = STOPPED;
}
});
+11 -10
View File
@@ -22,6 +22,7 @@ import com.android.launcher.R;
import com.android.launcher2.Workspace.ShrinkState;
import android.animation.Animator;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
@@ -337,9 +338,9 @@ public final class Launcher extends Activity
ValueAnimator alphaAnim = ObjectAnimator.ofFloat(mCustomizePagedView,
"alpha", alpha, 0.0f);
alphaAnim.setDuration(duration);
alphaAnim.addListener(new LauncherAnimatorListenerAdapter() {
alphaAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEndOrCancel(Animator animation) {
public void onAnimationEnd(Animator animation) {
String tag = mHomeCustomizationDrawer.getCurrentTabTag();
if (tag == WIDGETS_TAG) {
mCustomizePagedView.setCustomizationFilter(
@@ -2541,13 +2542,13 @@ public final class Launcher extends Activity
if (seq != null) {
Animator anim = ObjectAnimator.ofFloat(view, "alpha", show ? 1.0f : 0.0f);
anim.setDuration(duration);
anim.addListener(new LauncherAnimatorListenerAdapter() {
anim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
if (showing) showToolbarButton(view);
}
@Override
public void onAnimationEndOrCancel(Animator animation) {
public void onAnimationEnd(Animator animation) {
if (hiding) hideToolbarButton(view);
}
});
@@ -2648,7 +2649,7 @@ public final class Launcher extends Activity
scaleAnim.setDuration(duration);
scaleAnim.setInterpolator(new Workspace.ZoomOutInterpolator());
scaleAnim.addListener(new LauncherAnimatorListenerAdapter() {
scaleAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
// Prepare the position
@@ -2658,7 +2659,7 @@ public final class Launcher extends Activity
toView.setAlpha(1.0f);
}
@Override
public void onAnimationEndOrCancel(Animator animation) {
public void onAnimationEnd(Animator animation) {
// If we don't set the final scale values here, if this animation is cancelled
// it will have the wrong scale value and subsequent cameraPan animations will
// not fix that
@@ -2731,9 +2732,9 @@ public final class Launcher extends Activity
ValueAnimator alphaAnim = ObjectAnimator.ofPropertyValuesHolder(fromView,
PropertyValuesHolder.ofFloat("alpha", 1.0f, 0.0f));
alphaAnim.setDuration(res.getInteger(R.integer.config_allAppsFadeOutTime));
alphaAnim.addListener(new LauncherAnimatorListenerAdapter() {
alphaAnim.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationEndOrCancel(Animator animation) {
public void onAnimationEnd(Animator animation) {
fromView.setVisibility(View.GONE);
}
});
@@ -2793,7 +2794,7 @@ public final class Launcher extends Activity
if (animated) {
if (mStateAnimation != null) mStateAnimation.cancel();
mStateAnimation = new AnimatorSet();
mStateAnimation.addListener(new LauncherAnimatorListenerAdapter() {
mStateAnimation.addListener(new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
toView.setVisibility(View.VISIBLE);
@@ -2801,7 +2802,7 @@ public final class Launcher extends Activity
toView.setAlpha(1.0f);
}
@Override
public void onAnimationEndOrCancel(Animator animation) {
public void onAnimationEnd(Animator animation) {
fromView.setVisibility(View.GONE);
}
});
@@ -1,70 +0,0 @@
/*
* Copyright (C) 2010 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.launcher2;
import android.animation.Animator;
import java.util.HashSet;
/**
* This adapter class provides empty implementations of the methods from {@link android.animation.Animator.AnimatorListener}.
* Any custom listener that cares only about a subset of the methods of this listener can
* simply subclass this adapter class instead of implementing the interface directly.
*/
public abstract class LauncherAnimatorListenerAdapter implements Animator.AnimatorListener {
HashSet<Animator> cancelled = new HashSet<Animator>();
/**
* {@inheritDoc}
*/
@Override
public final void onAnimationCancel(Animator animation) {
onAnimationEndOrCancel(animation);
cancelled.add(animation);
}
/**
* {@inheritDoc}
*/
@Override
public final void onAnimationEnd(Animator animation) {
if (!cancelled.contains(animation)) onAnimationEndOrCancel(animation);
cancelled.remove(animation);
}
/**
* Like onAnimationEnd, except it's called immediately in the case on onAnimationCancel, and
* it's only called once in that case
*/
public void onAnimationEndOrCancel(Animator animation) {
}
/**
* {@inheritDoc}
*/
@Override
public void onAnimationRepeat(Animator animation) {
}
/**
* {@inheritDoc}
*/
@Override
public void onAnimationStart(Animator animation) {
}
}
+12 -16
View File
@@ -16,17 +16,17 @@
package com.android.launcher2;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
import com.android.launcher.R;
import com.android.launcher2.InstallWidgetReceiver.WidgetMimeTypeHandlerData;
import android.animation.Animator;
import android.animation.Animator.AnimatorListener;
import android.animation.AnimatorListenerAdapter;
import android.animation.AnimatorSet;
import android.animation.ObjectAnimator;
import android.animation.PropertyValuesHolder;
import android.animation.TimeInterpolator;
import android.animation.ValueAnimator;
import android.animation.Animator.AnimatorListener;
import android.animation.ValueAnimator.AnimatorUpdateListener;
import android.app.AlertDialog;
import android.app.WallpaperManager;
@@ -44,7 +44,6 @@ import android.content.res.TypedArray;
import android.graphics.Bitmap;
import android.graphics.Camera;
import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.Matrix;
import android.graphics.Paint;
import android.graphics.Rect;
@@ -62,12 +61,12 @@ import android.view.DragEvent;
import android.view.MotionEvent;
import android.view.View;
import android.view.animation.DecelerateInterpolator;
import android.widget.TabHost;
import android.widget.TextView;
import android.widget.Toast;
import com.android.launcher.R;
import com.android.launcher2.InstallWidgetReceiver.WidgetMimeTypeHandlerData;
import java.util.ArrayList;
import java.util.HashSet;
import java.util.List;
/**
* The workspace is a wide area with a wallpaper and a finite number of pages.
@@ -267,13 +266,13 @@ public class Workspace extends SmoothPagedView
// In this case, we will skip drawing background protection
}
mUnshrinkAnimationListener = new LauncherAnimatorListenerAdapter() {
mUnshrinkAnimationListener = new AnimatorListenerAdapter() {
@Override
public void onAnimationStart(Animator animation) {
mIsInUnshrinkAnimation = true;
}
@Override
public void onAnimationEndOrCancel(Animator animation) {
public void onAnimationEnd(Animator animation) {
mIsInUnshrinkAnimation = false;
if (mShrinkState != ShrinkState.SPRING_LOADED) {
mDrawCustomizeTrayBackground = false;
@@ -1520,22 +1519,19 @@ public class Workspace extends SmoothPagedView
}
if (mDropAnim != null) {
// This should really be end(), but that will not be called synchronously,
// so instead we use LauncherAnimatorListenerAdapter.onAnimationEndOrCancel()
// and call cancel() here.
mDropAnim.cancel();
mDropAnim.end();
}
mDropAnim = new ValueAnimator();
mDropAnim.setInterpolator(mQuintEaseOutInterpolator);
// The view is invisible during the animation; we render it manually.
mDropAnim.addListener(new LauncherAnimatorListenerAdapter() {
mDropAnim.addListener(new AnimatorListenerAdapter() {
public void onAnimationStart(Animator animation) {
// Set this here so that we don't render it until the animation begins
mDropView = view;
}
public void onAnimationEndOrCancel(Animator animation) {
public void onAnimationEnd(Animator animation) {
if (mDropView != null) {
mDropView.setVisibility(View.VISIBLE);
mDropView = null;