Example usage for android.view ViewPropertyAnimator scaleX

List of usage examples for android.view ViewPropertyAnimator scaleX

Introduction

In this page you can find the example usage for android.view ViewPropertyAnimator scaleX.

Prototype

public ViewPropertyAnimator scaleX(float value) 

Source Link

Document

This method will cause the View's scaleX property to be animated to the specified value.

Usage

From source file:org.apache.appharness.AppHarnessUI.java

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void setSlaveVisible(boolean value, CallbackContext callbackContext) {
    if (value == slaveVisible) {
        return;/*  w w w  .j av a  2  s .  co m*/
    }
    if (slaveWebView == null) {
        Log.w(LOG_TAG, "setSlaveVisible: slave not created");
    } else {
        slaveVisible = value;
        ViewPropertyAnimator anim = slaveWebView.getView().animate();
        // Note: Pivot is set in onSizeChanged.
        if (value) {
            anim.scaleX(1.0f).scaleY(1.0f);
            webView.getView().setEnabled(false);
            slaveWebView.getView().setEnabled(true);
            slaveWebView.getView().requestFocus();
        } else {
            anim.scaleX(.25f).scaleY(.25f);
            webView.getView().setEnabled(true);
            slaveWebView.getView().setEnabled(false);
            webView.getView().requestFocus();
        }
        slaveWebViewEngine.setStealTapEvents(!value);
        anim.setDuration(300).setInterpolator(new DecelerateInterpolator(2.0f)).start();
    }
    if (callbackContext != null) {
        callbackContext.success();
    }
}

From source file:me.lizheng.deckview.helpers.DeckChildViewTransform.java

/**
 * Applies this transform to a view./*from   w w  w .  j ava 2  s  . c  om*/
 */
public void applyToTaskView(View v, int duration, Interpolator interp, /*boolean allowLayers,*/
        boolean allowShadows/*, ValueAnimator.AnimatorUpdateListener updateCallback*/) {
    // Check to see if any properties have changed, and update the task view
    if (duration > 0) {
        ViewPropertyAnimator anim = v.animate();
        //            boolean requiresLayers = false;

        // Animate to the final state
        if (hasTranslationYChangedFrom(v.getTranslationY())) {
            anim.translationY(translationY);
        }
        //            if (allowShadows && hasTranslationZChangedFrom(v.getTranslationZ())) {
        //                anim.translationZ(translationZ);
        //            }
        if (hasScaleChangedFrom(v.getScaleX())) {
            anim.scaleX(scale).scaleY(scale);
            //                requiresLayers = true;
        }
        if (hasAlphaChangedFrom(v.getAlpha())) {
            // Use layers if we animate alpha
            anim.alpha(alpha);
            //                requiresLayers = true;
        }
        //            if (requiresLayers && allowLayers) {
        //                anim.withLayer();
        //            }
        //            if (updateCallback != null) {
        //                anim.setUpdateListener(updateCallback);
        //            } else {
        //                anim.setUpdateListener(null);
        //            }
        anim.setStartDelay(startDelay).setDuration(duration).setInterpolator(interp).start();
    } else {
        // Set the changed properties
        if (hasTranslationYChangedFrom(v.getTranslationY())) {
            v.setTranslationY(translationY);
        }
        if (allowShadows && hasTranslationZChangedFrom(ViewCompat.getTranslationZ(v))) {
            ViewCompat.setTranslationZ(v, translationZ);
        }
        if (hasScaleChangedFrom(v.getScaleX())) {
            v.setScaleX(scale);
            v.setScaleY(scale);
        }
        if (hasAlphaChangedFrom(v.getAlpha())) {
            v.setAlpha(alpha);
        }
    }
}