Example usage for android.view.animation BounceInterpolator BounceInterpolator

List of usage examples for android.view.animation BounceInterpolator BounceInterpolator

Introduction

In this page you can find the example usage for android.view.animation BounceInterpolator BounceInterpolator.

Prototype

@SuppressWarnings({ "UnusedDeclaration" })
    public BounceInterpolator(Context context, AttributeSet attrs) 

Source Link

Usage

From source file:Main.java

private static Interpolator createInterpolatorFromXml(Context c, XmlPullParser parser)
        throws XmlPullParserException, IOException {

    Interpolator interpolator = null;/*www  .j  av  a  2  s  .  c om*/

    // Make sure we are on a start tag.
    int type;
    int depth = parser.getDepth();

    while (((type = parser.next()) != XmlPullParser.END_TAG || parser.getDepth() > depth)
            && type != XmlPullParser.END_DOCUMENT) {

        if (type != XmlPullParser.START_TAG) {
            continue;
        }

        AttributeSet attrs = Xml.asAttributeSet(parser);

        String name = parser.getName();
        switch (name) {
        case "linearInterpolator":
            interpolator = new LinearInterpolator(c, attrs);
            break;
        case "accelerateInterpolator":
            interpolator = new AccelerateInterpolator(c, attrs);
            break;
        case "decelerateInterpolator":
            interpolator = new DecelerateInterpolator(c, attrs);
            break;
        case "accelerateDecelerateInterpolator":
            interpolator = new AccelerateDecelerateInterpolator(c, attrs);
            break;
        case "cycleInterpolator":
            interpolator = new CycleInterpolator(c, attrs);
            break;
        case "anticipateInterpolator":
            interpolator = new AnticipateInterpolator(c, attrs);
            break;
        case "overshootInterpolator":
            interpolator = new OvershootInterpolator(c, attrs);
            break;
        case "anticipateOvershootInterpolator":
            interpolator = new AnticipateOvershootInterpolator(c, attrs);
            break;
        case "bounceInterpolator":
            interpolator = new BounceInterpolator(c, attrs);
            break;
        default:
            throw new RuntimeException("Unknown interpolator name: " + parser.getName());
        }

    }

    return interpolator;

}