List of usage examples for android.view.animation OvershootInterpolator OvershootInterpolator
public OvershootInterpolator(Context context, AttributeSet attrs)
From source file:Main.java
private static Interpolator createInterpolatorFromXml(Context c, XmlPullParser parser) throws XmlPullParserException, IOException { Interpolator interpolator = null;/*www . j a v a 2 s. c o m*/ // 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; }
From source file:com.hippo.anani.AnimationUtils.java
private static Interpolator createInterpolatorFromXml(Context context, XmlPullParser parser) throws XmlPullParserException, IOException { Interpolator interpolator = null;// w w w. jav a 2s .c o m // 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(); if (name.equals("linearInterpolator")) { interpolator = new LinearInterpolator(); } else if (name.equals("accelerateInterpolator")) { interpolator = new AccelerateInterpolator(context, attrs); } else if (name.equals("decelerateInterpolator")) { interpolator = new DecelerateInterpolator(context, attrs); } else if (name.equals("accelerateDecelerateInterpolator")) { interpolator = new AccelerateDecelerateInterpolator(); } else if (name.equals("cycleInterpolator")) { interpolator = new CycleInterpolator(context, attrs); } else if (name.equals("anticipateInterpolator")) { interpolator = new AnticipateInterpolator(context, attrs); } else if (name.equals("overshootInterpolator")) { interpolator = new OvershootInterpolator(context, attrs); } else if (name.equals("anticipateOvershootInterpolator")) { interpolator = new AnticipateOvershootInterpolator(context, attrs); } else if (name.equals("bounceInterpolator")) { interpolator = new BounceInterpolator(); } else if (name.equals("pathInterpolator")) { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { interpolator = new android.view.animation.PathInterpolator(context, attrs); } else { interpolator = new PathInterpolator(context, attrs); } } else { throw new RuntimeException("Unknown interpolator name: " + parser.getName()); } } return interpolator; }
From source file:android.support.graphics.drawable.AnimationUtilsCompat.java
private static Interpolator createInterpolatorFromXml(Context context, Resources res, Theme theme, XmlPullParser parser) throws XmlPullParserException, IOException { Interpolator interpolator = null;//from w w w .ja va 2s .c o m // 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(); if (name.equals("linearInterpolator")) { interpolator = new LinearInterpolator(); } else if (name.equals("accelerateInterpolator")) { interpolator = new AccelerateInterpolator(context, attrs); } else if (name.equals("decelerateInterpolator")) { interpolator = new DecelerateInterpolator(context, attrs); } else if (name.equals("accelerateDecelerateInterpolator")) { interpolator = new AccelerateDecelerateInterpolator(); } else if (name.equals("cycleInterpolator")) { interpolator = new CycleInterpolator(context, attrs); } else if (name.equals("anticipateInterpolator")) { interpolator = new AnticipateInterpolator(context, attrs); } else if (name.equals("overshootInterpolator")) { interpolator = new OvershootInterpolator(context, attrs); } else if (name.equals("anticipateOvershootInterpolator")) { interpolator = new AnticipateOvershootInterpolator(context, attrs); } else if (name.equals("bounceInterpolator")) { interpolator = new BounceInterpolator(); } else if (name.equals("pathInterpolator")) { interpolator = new PathInterpolatorCompat(context, attrs, parser); } else { throw new RuntimeException("Unknown interpolator name: " + parser.getName()); } } return interpolator; }