get Interpolator for Animation - Android android.animation

Android examples for android.animation:TimeInterpolator

Description

get Interpolator for Animation

Demo Code


//package com.java2s;
import android.animation.TimeInterpolator;
import android.content.Context;
import android.os.Build;
import android.view.animation.AnimationUtils;

public class Main {
    static int getInterpolator() {
        if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
            return android.R.interpolator.fast_out_linear_in;
        } else {/*from  w  w w.  ja  va 2  s .  c o m*/
            return android.R.interpolator.decelerate_cubic;
        }
    }

    public static TimeInterpolator getInterpolator(Context context) {
        return AnimationUtils.loadInterpolator(context, getInterpolator());
    }
}

Related Tutorials