Example usage for android.view View SCALE_X

List of usage examples for android.view View SCALE_X

Introduction

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

Prototype

Property SCALE_X

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

Click Source Link

Document

A Property wrapper around the scaleX functionality handled by the View#setScaleX(float) and View#getScaleX() methods.

Usage

From source file:com.android.tv.menu.MenuLayoutManager.java

private ObjectAnimator createScaleXAnimator(View view, float from, float to) {
    ObjectAnimator animator = ObjectAnimator.ofFloat(view, View.SCALE_X, from, to);
    animator.setDuration(mRowAnimationDuration);
    animator.setInterpolator(mFastOutSlowIn);
    return animator;
}

From source file:com.mishiranu.dashchan.ui.navigator.NavigatorActivity.java

private void showScaleAnimation(boolean post) {
    clearListAnimator();//from  w w  w.  jav  a 2 s.  co m
    if (allowScaleAnimation) {
        if (post) {
            listView.setVisibility(View.INVISIBLE);
            handler.post(showScaleRunnable);
        } else {
            final float fromScale = 0.925f;
            ObjectAnimator alphaAnimator = ObjectAnimator.ofFloat(listView, View.ALPHA, 0f, 1f);
            ObjectAnimator scaleXAnimator = ObjectAnimator.ofFloat(listView, View.SCALE_X, fromScale, 1f);
            ObjectAnimator scaleYAnimator = ObjectAnimator.ofFloat(listView, View.SCALE_Y, fromScale, 1f);
            AnimatorSet animatorSet = new AnimatorSet();
            animatorSet.playTogether(alphaAnimator, scaleXAnimator, scaleYAnimator);
            animatorSet.setDuration(100);
            startListAnimator(animatorSet);
        }
    }
}

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

private void showEditDoneProgress(final boolean animateDoneItem, final boolean show) {
    if (doneItemAnimation != null) {
        doneItemAnimation.cancel();/*w ww . ja v  a 2  s  .  com*/
    }
    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();
    }
}