private void createCubicPathInterpolator()

in AnimationsInterpolatorPlayground/app/src/main/java/com/example/android/interpolatorplayground/MainActivity.java [272:322]


    private void createCubicPathInterpolator(LinearLayout parent) {
        float cx1 = 0.5f, cy1 = .2f;
        float cx2 = 0.9f, cy2 = .7f;

        LinearLayout inputContainer = new LinearLayout(this);
        inputContainer.setOrientation(LinearLayout.VERTICAL);
        final LayoutParams params = new LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
        params.setMargins(mDefaultMargin, mDefaultMargin, mDefaultMargin, mDefaultMargin);
        inputContainer.setLayoutParams(params);

        final TextView cx1Label = createControlPointLabel("ControlX1", cx1);
        final TextView cy1Label = createControlPointLabel("ControlY1", cy1);
        final TextView cx2Label = createControlPointLabel("ControlX2", cx2);
        final TextView cy2Label = createControlPointLabel("ControlY2", cy2);

        inputContainer.addView(cx1Label);
        inputContainer.addView(cy1Label);
        inputContainer.addView(cx2Label);
        inputContainer.addView(cy2Label);
        parent.addView(inputContainer);

        final ControlPointCallback callback = new ControlPointCallback() {
            @Override
            void onControlPoint1Moved(float cx, float cy) {
                cx1Label.setText("ControlX1: " + String.format("%.2f", cx));
                cy1Label.setText("ControlY1: " + String.format("%.2f", cy));
            }

            @Override
            void onControlPoint2Moved(float cx, float cy) {
                cx2Label.setText("ControlX2: " + String.format("%.2f", cx));
                cy2Label.setText("ControlY2: " + String.format("%.2f", cy));
            }
        };

        // Buttons to set control points from standard Material Design interpolators
        LinearLayout buttonContainer = new LinearLayout(this);
        buttonContainer.setOrientation(LinearLayout.HORIZONTAL);
        buttonContainer.setLayoutParams(new LinearLayout.LayoutParams(
                ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT));
        buttonContainer.addView(createMaterialMotionButton("L out S in",
                0, 0, .2f, 1, .33f, callback));
        buttonContainer.addView(createMaterialMotionButton("F out S in",
                .4f, 0, .2f, 1, .33f, callback));
        buttonContainer.addView(createMaterialMotionButton("F out L in",
                .4f, 0, 1, 1, .33f, callback));
        inputContainer.addView(buttonContainer);

        mVisualizer.setCubicInterpolator(cx1, cy1, cx2, cy2, callback);
    }