in AnimationsInterpolatorPlayground/app/src/main/java/com/example/android/interpolatorplayground/MainActivity.java [125:168]
private void populateParametersUI(String interpolatorName, LinearLayout parent) {
parent.removeAllViews();
try {
switch (interpolatorName) {
case "Quadratic Path":
createQuadraticPathInterpolator(parent);
break;
case "Cubic Path":
createCubicPathInterpolator(parent);
break;
case "AccelerateDecelerate":
mVisualizer.setInterpolator(new AccelerateDecelerateInterpolator());
break;
case "Linear":
mVisualizer.setInterpolator(new LinearInterpolator());
break;
case "Bounce":
mVisualizer.setInterpolator(new BounceInterpolator());
break;
case "Accelerate":
Constructor<AccelerateInterpolator> decelConstructor =
AccelerateInterpolator.class.getConstructor(float.class);
createParamaterizedInterpolator(parent, decelConstructor, "Factor", 1, 5, 1);
break;
case "Decelerate":
Constructor<DecelerateInterpolator> accelConstructor =
DecelerateInterpolator.class.getConstructor(float.class);
createParamaterizedInterpolator(parent, accelConstructor, "Factor", 1, 5, 1);
break;
case "Overshoot":
Constructor<OvershootInterpolator> overshootConstructor =
OvershootInterpolator.class.getConstructor(float.class);
createParamaterizedInterpolator(parent, overshootConstructor, "Tension", 1, 5, 1);
break;
case "Anticipate":
Constructor<AnticipateInterpolator> anticipateConstructor =
AnticipateInterpolator.class.getConstructor(float.class);
createParamaterizedInterpolator(parent, anticipateConstructor, "Tension", 1, 5, 1);
break;
}
} catch (NoSuchMethodException e) {
Log.e("InterpolatorPlayground", "Error constructing interpolator: " + e);
}
}