mobile/android/base/animation/HeightChangeAnimation.java

changeset 0
6474c204b198
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/mobile/android/base/animation/HeightChangeAnimation.java	Wed Dec 31 06:09:35 2014 +0100
     1.3 @@ -0,0 +1,27 @@
     1.4 +/* This Source Code Form is subject to the terms of the Mozilla Public
     1.5 + * License, v. 2.0. If a copy of the MPL was not distributed with this file,
     1.6 + * You can obtain one at http://mozilla.org/MPL/2.0/. */
     1.7 +
     1.8 +package org.mozilla.gecko.animation;
     1.9 +
    1.10 +import android.view.View;
    1.11 +import android.view.animation.Animation;
    1.12 +import android.view.animation.Transformation;
    1.13 +
    1.14 +public class HeightChangeAnimation extends Animation {
    1.15 +    int mFromHeight;
    1.16 +    int mToHeight;
    1.17 +    View mView;
    1.18 +
    1.19 +    public HeightChangeAnimation(View view, int fromHeight, int toHeight) {
    1.20 +        mView = view;
    1.21 +        mFromHeight = fromHeight;
    1.22 +        mToHeight = toHeight;
    1.23 +    }
    1.24 +
    1.25 +    @Override
    1.26 +    protected void applyTransformation(float interpolatedTime, Transformation t) {
    1.27 +        mView.getLayoutParams().height = Math.round((mFromHeight * (1 - interpolatedTime)) + (mToHeight * interpolatedTime));
    1.28 +        mView.requestLayout();
    1.29 +    }
    1.30 +}

mercurial