Example usage for android.view View setPivotY

List of usage examples for android.view View setPivotY

Introduction

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

Prototype

public void setPivotY(float pivotY) 

Source Link

Document

Sets the y location of the point around which the view is #setRotation(float) rotated and #setScaleY(float) scaled .

Usage

From source file:Main.java

/**
 * Animator to animate X scale of the view. Y scale is constant
 *
 * @param view View to be animated/*ww  w .ja v a2 s .  c  o m*/
 * @param pivotX x coordinate of the pivot
 * @param pivotY y coordinate of the pivot
 * @param fromScale initial scale
 * @param toScale final scale
 * @param duration animation duration in milliseconds
 * @return Animator Object
 */
@NonNull
public static Animator scaleX(@NonNull View view, int pivotX, int pivotY, float fromScale, float toScale,
        int duration) {
    view.setPivotX(pivotX);
    view.setPivotY(pivotY);
    Animator animator = ObjectAnimator.ofFloat(view, "scaleX", fromScale, toScale);
    animator.setDuration(duration);
    return animator;
}

From source file:Main.java

/**
 * Animator to animate Y scale of the view. X scale is constant
 *
 * @param view View to be animated//from  www  .  j  av a2 s.  c  o m
 * @param pivotX x coordinate of the pivot
 * @param pivotY y coordinate of the pivot
 * @param fromScale initial scale
 * @param toScale final scale
 * @param duration animation duration in milliseconds
 * @return Animator Object
 */
@NonNull
public static Animator scaleY(@NonNull View view, int pivotX, int pivotY, float fromScale, float toScale,
        int duration) {
    view.setPivotX(pivotX);
    view.setPivotY(pivotY);
    Animator animator = ObjectAnimator.ofFloat(view, "scaleY", fromScale, toScale);
    animator.setDuration(duration);
    return animator;
}

From source file:com.kogitune.activitytransition.core.TransitionAnimation.java

private static void runEnterAnimation(MoveData moveData, TimeInterpolator interpolator) {
    final View toView = moveData.toView;
    toView.setPivotX(0);//from  w w w  . jav  a2  s  .c o  m
    toView.setPivotY(0);
    toView.setScaleX(moveData.widthScale);
    toView.setScaleY(moveData.heightScale);
    toView.setTranslationX(moveData.leftDelta);
    toView.setTranslationY(moveData.topDelta);

    toView.animate().setDuration(moveData.duration).scaleX(1).scaleY(1).translationX(0).translationY(0)
            .setInterpolator(interpolator);
}

From source file:com.dgsd.android.ShiftTracker.Util.PageTransformerUtils.java

public static ViewPager.PageTransformer getTwistTransformer() {
    if (mTwistTransformer == null) {
        mTwistTransformer = new ViewPager.PageTransformer() {
            @Override//from   w  ww .  ja v a  2s .  co  m
            public void transformPage(View view, float position) {
                if (!Api.isMin(Api.HONEYCOMB))
                    return;

                view.setPivotX(0);
                view.setPivotY(0);

                final float distFromZero = Math.abs(position);
                view.animate().alpha(1.0f - distFromZero).rotation(90 * position).setDuration(0).start();
            }
        };
    }

    return mTwistTransformer;
}

From source file:Main.java

public static void clear(View v) {
    ViewCompat.setAlpha(v, 1);//from  w  ww.  ja  va 2 s.  c o m
    ViewCompat.setScaleY(v, 1);
    ViewCompat.setScaleX(v, 1);
    ViewCompat.setTranslationY(v, 0);
    ViewCompat.setTranslationX(v, 0);
    ViewCompat.setRotation(v, 0);
    ViewCompat.setRotationY(v, 0);
    ViewCompat.setRotationX(v, 0);
    v.setPivotY(v.getMeasuredHeight() / 2);
    ViewCompat.setPivotX(v, v.getMeasuredWidth() / 2);
    ViewCompat.animate(v).setInterpolator(null);
}

From source file:Main.java

public static void clearAnimator(View v) {
    ViewCompat.setAlpha(v, 1);/*from   w  w  w  . j  ava  2s  .c  o m*/
    ViewCompat.setScaleY(v, 1);
    ViewCompat.setScaleX(v, 1);
    ViewCompat.setTranslationY(v, 0);
    ViewCompat.setTranslationX(v, 0);
    ViewCompat.setRotation(v, 0);
    ViewCompat.setRotationY(v, 0);
    ViewCompat.setRotationX(v, 0);
    // @TODO https://code.google.com/p/android/issues/detail?id=80863
    // ViewCompat.setPivotY(v, v.getMeasuredHeight() / 2);
    v.setPivotY(v.getMeasuredHeight() / 2);
    ViewCompat.setPivotX(v, v.getMeasuredWidth() / 2);
    ViewCompat.animate(v).setInterpolator(null);
}

From source file:com.kzaemrio.justforfun.animadapter.ViewHelper.java

public static void clear(View v) {
    ViewCompat.setAlpha(v, 1);/*  w  w w  .  j a v  a 2  s .co  m*/
    ViewCompat.setScaleY(v, 1);
    ViewCompat.setScaleX(v, 1);
    ViewCompat.setTranslationY(v, 0);
    ViewCompat.setTranslationX(v, 0);
    ViewCompat.setRotation(v, 0);
    ViewCompat.setRotationY(v, 0);
    ViewCompat.setRotationX(v, 0);

    // TODO https://code.google.com/p/android/issues/detail?id=80863
    // ViewCompat.setPivotY(v, v.getMeasuredHeight() / 2);

    v.setPivotY(v.getMeasuredHeight() / 2);
    ViewCompat.setPivotX(v, v.getMeasuredWidth() / 2);
    ViewCompat.animate(v).setInterpolator(null);
}

From source file:cc.easyandroid.easyrecyclerview.animation.ViewHelper.java

public static void clear(View v) {
    ViewCompat.setAlpha(v, 1);// www. j av  a2s. com
    ViewCompat.setScaleY(v, 1);
    ViewCompat.setScaleX(v, 1);
    ViewCompat.setTranslationY(v, 0);
    ViewCompat.setTranslationX(v, 0);
    ViewCompat.setRotation(v, 0);
    ViewCompat.setRotationY(v, 0);
    ViewCompat.setRotationX(v, 0);
    // @TODO https://code.google.com/p/android/issues/detail?id=80863
    //        ViewCompat.setPivotY(v, v.getMeasuredHeight() / 2);
    v.setPivotY(v.getMeasuredHeight() / 2);
    ViewCompat.setPivotX(v, v.getMeasuredWidth() / 2);
    ViewCompat.animate(v).setInterpolator(null);
}

From source file:com.marshalchen.ultimaterecyclerview.animators.internal.ViewHelper.java

@TargetApi(Build.VERSION_CODES.HONEYCOMB)
public static void clear(View v) {
    ViewCompat.setAlpha(v, 1);//www  .  j a va 2 s . c  o m
    ViewCompat.setScaleY(v, 1);
    ViewCompat.setScaleX(v, 1);
    ViewCompat.setTranslationY(v, 0);
    ViewCompat.setTranslationX(v, 0);
    ViewCompat.setRotation(v, 0);
    ViewCompat.setRotationY(v, 0);
    ViewCompat.setRotationX(v, 0);
    // @TODO https://code.google.com/p/android/issues/detail?id=80863
    //        ViewCompat.setPivotY(v, v.getMeasuredHeight() / 2);
    v.setPivotY(v.getMeasuredHeight() / 2);
    ViewCompat.setPivotX(v, v.getMeasuredWidth() / 2);
    ViewCompat.animate(v).setInterpolator(null);
}

From source file:com.fastbootmobile.encore.utils.Utils.java

public static void animateScale(View v, boolean animate, boolean visible) {
    v.setPivotX(v.getMeasuredWidth() / 2);
    v.setPivotY(v.getMeasuredHeight() / 2);

    if (visible) {
        if (animate) {
            v.animate().scaleX(1.0f).scaleY(1.0f).alpha(1.0f).translationY(0.0f).setDuration(400)
                    .setInterpolator(new DecelerateInterpolator()).start();
        } else {//from   ww w  .ja  v a 2  s . co  m
            v.setScaleX(1.0f);
            v.setScaleY(1.0f);
            v.setAlpha(1.0f);
            v.setTranslationY(0.0f);
        }
    } else {
        if (animate) {
            v.animate().scaleX(0.0f).scaleY(0.0f).alpha(0.0f).translationY(v.getHeight() / 4).setDuration(400)
                    .setInterpolator(new DecelerateInterpolator()).start();
        } else {
            v.setScaleX(0.0f);
            v.setScaleY(0.0f);
            v.setAlpha(0.0f);
            v.setTranslationY(v.getHeight() / 4);
        }
    }
}