Example usage for android.view View getRotationY

List of usage examples for android.view View getRotationY

Introduction

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

Prototype

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

Source Link

Document

The degrees that the view is rotated around the vertical axis through the pivot point.

Usage

From source file:com.rukiasoft.androidapps.cocinaconroll.ui.RecipeListRecyclerViewAdapter.java

@Override
public void onClick(final View v) {

    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.ICE_CREAM_SANDWICH) {
        setFrontAndBack(v);/*w  ww. j  av a 2s .  com*/
        if (v.getRotationY() != 0) {
            return;
        }
    }

    // Give some time to the ripple to finish the effect
    if (onCardClickListener != null) {
        new Handler().postDelayed(new Runnable() {
            @Override
            public void run() {
                onCardClickListener.onCardClick(v, (RecipeItem) v.getTag());
            }
        }, 200);
    }
}

From source file:com.rukiasoft.androidapps.cocinaconroll.ui.RecipeListRecyclerViewAdapter.java

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void flipCard(final View card) {
    final View front = frontCard;
    final View back = backCard;
    final AnimatorSet flipCard = (card.getRotationY() == 0)
            ? (AnimatorSet) AnimatorInflater.loadAnimator(mContext, R.animator.card_flip_rotate_half)
            : (AnimatorSet) AnimatorInflater.loadAnimator(mContext, R.animator.card_flip_rotate_full);
    final AnimatorSet disappear = (AnimatorSet) AnimatorInflater.loadAnimator(mContext,
            R.animator.view_disappear);/*from   ww w . java2s.  c  o  m*/
    //final AnimatorSet flipPositive = (AnimatorSet) AnimatorInflater.loadAnimator(mContext, R.animator.card_flip_rotate_full);
    final AnimatorSet appear = (AnimatorSet) AnimatorInflater.loadAnimator(mContext, R.animator.view_appear);
    flipCard.setTarget(card);
    disappear.setTarget(front);
    //flipPositive.setTarget(card);
    appear.setTarget(back);
    //setLeftIn.setTarget(backView);
    flipCard.addListener(new Animator.AnimatorListener() {
        @Override
        public void onAnimationStart(Animator animation) {
            disappear.start();
            appear.start();
            back.setVisibility(View.VISIBLE);
            back.setAlpha(0);
        }

        @Override
        public void onAnimationEnd(Animator animation) {
            front.setVisibility(View.INVISIBLE);
        }

        @Override
        public void onAnimationCancel(Animator animation) {

        }

        @Override
        public void onAnimationRepeat(Animator animation) {

        }
    });

    flipCard.start();
}

From source file:com.rukiasoft.androidapps.cocinaconroll.ui.RecipeListRecyclerViewAdapter.java

@TargetApi(Build.VERSION_CODES.ICE_CREAM_SANDWICH)
private void setFrontAndBack(View v) {
    View faceA = null;/* w  ww.ja v  a 2s. co  m*/
    View faceB = null;
    for (int i = 0; i < ((ViewGroup) v).getChildCount(); ++i) {
        View nextChild = ((ViewGroup) v).getChildAt(i);
        int id = nextChild.getId();
        if (id == R.id.back_cardview_recipe_item) {
            faceB = nextChild;
        } else if (id == R.id.front_cardview_recipe_item) {
            faceA = nextChild;
        }
    }
    if (v.getRotationY() != 0) {
        frontCard = faceB;
        backCard = faceA;
    } else {
        frontCard = faceA;
        backCard = faceB;
    }
}