Example usage for android.view View SCALE_Y

List of usage examples for android.view View SCALE_Y

Introduction

In this page you can find the example usage for android.view View SCALE_Y.

Prototype

Property SCALE_Y

To view the source code for android.view View SCALE_Y.

Click Source Link

Document

A Property wrapper around the scaleY functionality handled by the View#setScaleY(float) and View#getScaleY() methods.

Usage

From source file:org.telegram.ui.PassportActivity.java

private void showEditDoneProgress(final boolean animateDoneItem, final boolean show) {
    if (doneItemAnimation != null) {
        doneItemAnimation.cancel();//from  w ww.  j ava 2 s. co  m
    }
    if (animateDoneItem && doneItem != null) {
        doneItemAnimation = new AnimatorSet();
        if (show) {
            progressView.setVisibility(View.VISIBLE);
            doneItem.setEnabled(false);
            doneItemAnimation.playTogether(ObjectAnimator.ofFloat(doneItem.getImageView(), View.SCALE_X, 0.1f),
                    ObjectAnimator.ofFloat(doneItem.getImageView(), View.SCALE_Y, 0.1f),
                    ObjectAnimator.ofFloat(doneItem.getImageView(), View.ALPHA, 0.0f),
                    ObjectAnimator.ofFloat(progressView, View.SCALE_X, 1.0f),
                    ObjectAnimator.ofFloat(progressView, View.SCALE_Y, 1.0f),
                    ObjectAnimator.ofFloat(progressView, View.ALPHA, 1.0f));
        } else {
            doneItem.getImageView().setVisibility(View.VISIBLE);
            doneItem.setEnabled(true);
            doneItemAnimation.playTogether(ObjectAnimator.ofFloat(progressView, View.SCALE_X, 0.1f),
                    ObjectAnimator.ofFloat(progressView, View.SCALE_Y, 0.1f),
                    ObjectAnimator.ofFloat(progressView, View.ALPHA, 0.0f),
                    ObjectAnimator.ofFloat(doneItem.getImageView(), View.SCALE_X, 1.0f),
                    ObjectAnimator.ofFloat(doneItem.getImageView(), View.SCALE_Y, 1.0f),
                    ObjectAnimator.ofFloat(doneItem.getImageView(), View.ALPHA, 1.0f));
        }
        doneItemAnimation.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                if (doneItemAnimation != null && doneItemAnimation.equals(animation)) {
                    if (!show) {
                        progressView.setVisibility(View.INVISIBLE);
                    } else {
                        doneItem.getImageView().setVisibility(View.INVISIBLE);
                    }
                }
            }

            @Override
            public void onAnimationCancel(Animator animation) {
                if (doneItemAnimation != null && doneItemAnimation.equals(animation)) {
                    doneItemAnimation = null;
                }
            }
        });
        doneItemAnimation.setDuration(150);
        doneItemAnimation.start();
    } else if (acceptTextView != null) {
        doneItemAnimation = new AnimatorSet();
        if (show) {
            progressViewButton.setVisibility(View.VISIBLE);
            bottomLayout.setEnabled(false);
            doneItemAnimation.playTogether(ObjectAnimator.ofFloat(acceptTextView, View.SCALE_X, 0.1f),
                    ObjectAnimator.ofFloat(acceptTextView, View.SCALE_Y, 0.1f),
                    ObjectAnimator.ofFloat(acceptTextView, View.ALPHA, 0.0f),
                    ObjectAnimator.ofFloat(progressViewButton, View.SCALE_X, 1.0f),
                    ObjectAnimator.ofFloat(progressViewButton, View.SCALE_Y, 1.0f),
                    ObjectAnimator.ofFloat(progressViewButton, View.ALPHA, 1.0f));
        } else {
            acceptTextView.setVisibility(View.VISIBLE);
            bottomLayout.setEnabled(true);
            doneItemAnimation.playTogether(ObjectAnimator.ofFloat(progressViewButton, View.SCALE_X, 0.1f),
                    ObjectAnimator.ofFloat(progressViewButton, View.SCALE_Y, 0.1f),
                    ObjectAnimator.ofFloat(progressViewButton, View.ALPHA, 0.0f),
                    ObjectAnimator.ofFloat(acceptTextView, View.SCALE_X, 1.0f),
                    ObjectAnimator.ofFloat(acceptTextView, View.SCALE_Y, 1.0f),
                    ObjectAnimator.ofFloat(acceptTextView, View.ALPHA, 1.0f));

        }
        doneItemAnimation.addListener(new AnimatorListenerAdapter() {
            @Override
            public void onAnimationEnd(Animator animation) {
                if (doneItemAnimation != null && doneItemAnimation.equals(animation)) {
                    if (!show) {
                        progressViewButton.setVisibility(View.INVISIBLE);
                    } else {
                        acceptTextView.setVisibility(View.INVISIBLE);
                    }
                }
            }

            @Override
            public void onAnimationCancel(Animator animation) {
                if (doneItemAnimation != null && doneItemAnimation.equals(animation)) {
                    doneItemAnimation = null;
                }
            }
        });
        doneItemAnimation.setDuration(150);
        doneItemAnimation.start();
    }
}