Example usage for android.view View setRotationX

List of usage examples for android.view View setRotationX

Introduction

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

Prototype

public void setRotationX(float rotationX) 

Source Link

Document

Sets the degrees that the view is rotated around the horizontal axis through the pivot point.

Usage

From source file:edward.com.recyclerview.BaseItemAnimator.java

void reset(View v) {
    v.setAlpha(1);/*w w w  .  j a  va2 s.  com*/
    v.setScaleY(1);
    v.setScaleX(1);
    v.setTranslationY(0);
    v.setTranslationX(0);
    v.setRotation(0);
    v.setRotationY(0);
    v.setRotationX(0);
    v.setPivotX(v.getMeasuredWidth() / 2);
    v.setPivotY(v.getMeasuredHeight() / 2);
    v.animate().setInterpolator(null);
}

From source file:com.example.lulu.recyclerviewdemo.MyItemAnimator.java

void animateMoveImpl(final ViewHolder holder, int fromX, int fromY, int toX, int toY) {
    final View view = holder.itemView;
    final int deltaX = toX - fromX;
    final int deltaY = toY - fromY;
    if (deltaX != 0) {
        ViewCompat.animate(view).translationX(0);
    }//from w  w  w . jav  a  2 s  .c o  m
    if (deltaY != 0) {
        ViewCompat.animate(view).translationY(0);
    }
    // TODO: make EndActions end listeners instead, since end actions aren't called when
    // vpas are canceled (and can't end them. why?)
    // need listener functionality in VPACompat for this. Ick.
    final ViewPropertyAnimatorCompat animation = ViewCompat.animate(view);
    //X
    animation.rotationX(360);
    mMoveAnimations.add(holder);
    animation.setDuration(getMoveDuration()).setListener(new VpaListenerAdapter() {
        @Override
        public void onAnimationStart(View view) {
            dispatchMoveStarting(holder);
        }

        @Override
        public void onAnimationCancel(View view) {
            if (deltaX != 0) {
                ViewCompat.setTranslationX(view, 0);
            }
            if (deltaY != 0) {
                ViewCompat.setTranslationY(view, 0);
            }
        }

        @Override
        public void onAnimationEnd(View view) {
            animation.setListener(null);
            dispatchMoveFinished(holder);
            mMoveAnimations.remove(holder);
            dispatchFinishedWhenDone();
            view.setRotationX(0);
        }
    }).start();
}

From source file:us.shandian.launcher.Page.java

public void setTransitionEffect(TransitionEffect effect) {
    mTransitionEffect = effect;/*  w w w . j av  a 2s.c om*/

    // Reset
    if (mScrollTransformsSet) {
        for (int i = 0; i < getChildCount(); i++) {
            View v = getPageAt(i);

            if (v != null) {
                v.setPivotX(v.getMeasuredWidth() * 0.5f);
                v.setPivotY(v.getMeasuredHeight() * 0.5f);
                v.setRotation(0);
                v.setRotationX(0);
                v.setRotationY(0);
                v.setScaleX(1f);
                v.setScaleY(1f);
                v.setTranslationX(0f);
                v.setTranslationY(0f);
                v.setVisibility(VISIBLE);
                setChildAlpha(v, 1f);
            }
        }
    }

    mScrollTransformsSet = false;
}

From source file:us.shandian.launcher.Page.java

protected void screenScrolled(int screenCenter) {
    boolean isInOverscroll = mOverScrollX < 0 || mOverScrollX > mMaxScrollX;

    if (mFadeInAdjacentScreens || mTransitionEffect != null || mScrollTransformsSet) {
        for (int i = 0; i < getChildCount(); i++) {
            View v = getPageAt(i);
            if (v != null) {
                float scrollProgress = getScrollProgress(screenCenter, v, i);

                if (Math.abs(scrollProgress) >= 1f) {
                    v.setCameraDistance(0);
                }/*from   ww  w.j a  v a 2 s.c om*/

                if (mTransitionEffect != null && !isInOverscroll) {
                    mTransitionEffect.screenScrolled(v, i, scrollProgress);
                } else if (mScrollTransformsSet) {
                    v.setPivotX(v.getMeasuredWidth() * 0.5f);
                    v.setPivotY(v.getMeasuredHeight() * 0.5f);
                    v.setRotation(0);
                    v.setRotationX(0);
                    v.setRotationY(0);
                    v.setScaleX(1f);
                    v.setScaleY(1f);
                    v.setTranslationX(0f);
                    v.setTranslationY(0f);
                    v.setVisibility(VISIBLE);
                    setChildAlpha(v, 1f);
                }
            }
        }
        mScrollTransformsSet = mTransitionEffect != null && !isInOverscroll;
    }
}