Example usage for android.view View getScaleY

List of usage examples for android.view View getScaleY

Introduction

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

Prototype

@ViewDebug.ExportedProperty(category = "drawing")
public float getScaleY() 

Source Link

Document

The amount that the view is scaled in y around the pivot point, as a proportion of the view's unscaled height.

Usage

From source file:Main.java

public static synchronized void animateScaleUp(View v, float targetScale) {
    float currentScaleX = v.getScaleX();
    float currentScaleY = v.getScaleY();

    PropertyValuesHolder scaleXHolder = PropertyValuesHolder.ofFloat(View.SCALE_X, currentScaleX, targetScale);
    PropertyValuesHolder scaleYHolder = PropertyValuesHolder.ofFloat(View.SCALE_Y, currentScaleY, targetScale);
    ValueAnimator scaleAnimator = ObjectAnimator.ofPropertyValuesHolder(v, scaleXHolder, scaleYHolder);
    scaleAnimator.start();/* ww  w .j a  v a2s  .c o m*/
}

From source file:Main.java

public static synchronized void animateScaleDown(View v, float targetScale) {
    float currentScaleX = v.getScaleX();
    float currentScaleY = v.getScaleY();

    PropertyValuesHolder scaleXHolder = PropertyValuesHolder.ofFloat(View.SCALE_X, currentScaleX, targetScale);
    PropertyValuesHolder scaleYHolder = PropertyValuesHolder.ofFloat(View.SCALE_Y, currentScaleY, targetScale);

    ValueAnimator scaleAnimator = ObjectAnimator.ofPropertyValuesHolder(v, scaleXHolder, scaleYHolder);
    scaleAnimator.start();/*from   w  w w  . j  a va  2  s.c  om*/
}

From source file:Main.java

/**
 * Helps to show views.//from   ww  w.  j  a v  a2  s .co  m
 *
 * @param views             Views to show.
 * @param animationDuration Animation duration.
 * @param animationDelay    Animation delay.
 */
static void orderedShowViews(final List<View> views, long animationDuration, int animationDelay) {
    if (views != null) {
        for (int viewIndex = 0; viewIndex < views.size(); viewIndex++) {
            final View childView = views.get(viewIndex);
            childView.setVisibility(View.VISIBLE);
            final ScaleAnimation scaleAnimation = new ScaleAnimation(0, childView.getScaleX(), 0,
                    childView.getScaleY(), Animation.RELATIVE_TO_SELF, .5f, Animation.RELATIVE_TO_SELF, .5f);
            scaleAnimation.setInterpolator(new DecelerateInterpolator());
            scaleAnimation.setDuration(animationDuration);
            scaleAnimation.setStartOffset(viewIndex * animationDelay);
            childView.startAnimation(scaleAnimation);
        }
    }
}

From source file:Main.java

public static int[] getCenterDeltaInScreenSpace(View v0, View v1, int[] delta) {
    v0.getLocationInWindow(sLoc0);/*from   w ww.j  a v a 2 s . c  o m*/
    v1.getLocationInWindow(sLoc1);

    sLoc0[0] += (v0.getMeasuredWidth() * v0.getScaleX()) / 2;
    sLoc0[1] += (v0.getMeasuredHeight() * v0.getScaleY()) / 2;
    sLoc1[0] += (v1.getMeasuredWidth() * v1.getScaleX()) / 2;
    sLoc1[1] += (v1.getMeasuredHeight() * v1.getScaleY()) / 2;

    if (delta == null) {
        delta = new int[2];
    }

    delta[0] = sLoc1[0] - sLoc0[0];
    delta[1] = sLoc1[1] - sLoc0[1];

    return delta;
}