Java tutorial
//package com.java2s; import android.R.interpolator; import android.content.Context; import android.graphics.Point; import android.view.WindowManager; import android.view.animation.AnimationUtils; import android.view.animation.Interpolator; public class Main { private static Interpolator sDecelerateQuintInterpolator; private static final int ANIMATION_LONG_SCREEN_SIZE = 1600; private static final int ANIMATION_MED_SCREEN_SIZE = 1200; private static final int ANIMATION_SHORT_DURATION = 400; private static final int ANIMATION_MED_DURATION = 450; private static final int ANIMATION_LONG_DURATION = 500; /** * Duration of an individual animation when the children of the grid are laid out again. * This is measured in milliseconds. */ private static int sAnimationDuration = ANIMATION_MED_DURATION; public static void initialize(Context context) { sDecelerateQuintInterpolator = AnimationUtils.loadInterpolator(context, interpolator.decelerate_quint); final Point size = new Point(); ((WindowManager) context.getSystemService(Context.WINDOW_SERVICE)).getDefaultDisplay().getSize(size); final int screenHeight = size.y; if (screenHeight >= ANIMATION_LONG_SCREEN_SIZE) { sAnimationDuration = ANIMATION_LONG_DURATION; } else if (screenHeight >= ANIMATION_MED_SCREEN_SIZE) { sAnimationDuration = ANIMATION_MED_DURATION; } else { sAnimationDuration = ANIMATION_SHORT_DURATION; } } }