Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.view.View;
import android.view.animation.Animation;

import android.view.animation.Transformation;

public class Main {
    private static Animation collapseAnimation(final View drawer) {
        final int initialHeight = drawer.getMeasuredHeight();

        return new Animation() {
            @Override
            protected void applyTransformation(float interpolatedTime, Transformation t) {
                if (interpolatedTime == 1) {
                    drawer.setVisibility(View.GONE);
                } else {
                    drawer.getLayoutParams().height = initialHeight - (int) (initialHeight * interpolatedTime);
                    drawer.requestLayout();
                }
            }

            @Override
            public boolean willChangeBounds() {
                return true;
            }
        };
    }
}