Bug 767980 - Use faster interpolator for the tabs pane animation (r=mfinkle)

This commit is contained in:
Lucas Rocha 2012-10-12 12:57:06 +01:00
parent 487bbe7578
commit ce30bf201e
2 changed files with 15 additions and 4 deletions

View File

@ -34,6 +34,7 @@ import android.view.MenuInflater;
import android.view.MenuItem;
import android.view.View;
import android.view.ViewGroup;
import android.view.animation.Interpolator;
import android.widget.LinearLayout;
import android.widget.Toast;
@ -73,6 +74,13 @@ abstract public class BrowserApp extends GeckoApp
private PropertyAnimator mMainLayoutAnimator;
private static final Interpolator sTabsInterpolator = new Interpolator() {
public float getInterpolation(float t) {
t -= 1.0f;
return t * t * t * t * t + 1.0f;
}
};
private FindInPageBar mFindInPageBar;
// We'll ask for feedback after the user launches the app this many times.
@ -500,7 +508,7 @@ abstract public class BrowserApp extends GeckoApp
if (mTabsPanel.isShown())
mTabsPanel.setDescendantFocusability(ViewGroup.FOCUS_AFTER_DESCENDANTS);
mMainLayoutAnimator = new PropertyAnimator(150);
mMainLayoutAnimator = new PropertyAnimator(450, sTabsInterpolator);
mMainLayoutAnimator.setPropertyAnimationListener(this);
if (hasTabsSideBar()) {

View File

@ -23,8 +23,6 @@ import java.util.TimerTask;
public class PropertyAnimator implements Runnable {
private static final String LOGTAG = "GeckoPropertyAnimator";
private Interpolator mInterpolator;
public static enum Property {
SHRINK_LEFT,
SHRINK_TOP,
@ -44,6 +42,7 @@ public class PropertyAnimator implements Runnable {
public void onPropertyAnimationEnd();
}
private Interpolator mInterpolator;
private long mStartTime;
private long mDuration;
private float mDurationReciprocal;
@ -52,9 +51,13 @@ public class PropertyAnimator implements Runnable {
private FramePoster mFramePoster;
public PropertyAnimator(int duration) {
this(duration, new DecelerateInterpolator());
}
public PropertyAnimator(int duration, Interpolator interpolator) {
mDuration = duration;
mDurationReciprocal = 1.0f / (float) mDuration;
mInterpolator = new DecelerateInterpolator();
mInterpolator = interpolator;
mElementsList = new ArrayList<ElementHolder>();
mFramePoster = FramePoster.create(this);
}