Java Code Examples for android.support.v4.view.ViewCompat#setRotationX()

The following examples show how to use android.support.v4.view.ViewCompat#setRotationX() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: BGABannerUtil.java    From KUtils with Apache License 2.0 6 votes vote down vote up
public static void resetPageTransformer(List<? extends View> views) {
    if (views == null) {
        return;
    }

    for (View view : views) {
        view.setVisibility(View.VISIBLE);
        ViewCompat.setAlpha(view, 1);
        ViewCompat.setPivotX(view, view.getMeasuredWidth() * 0.5f);
        ViewCompat.setPivotY(view, view.getMeasuredHeight() * 0.5f);
        ViewCompat.setTranslationX(view, 0);
        ViewCompat.setTranslationY(view, 0);
        ViewCompat.setScaleX(view, 1);
        ViewCompat.setScaleY(view, 1);
        ViewCompat.setRotationX(view, 0);
        ViewCompat.setRotationY(view, 0);
        ViewCompat.setRotation(view, 0);
    }
}
 
Example 2
Source File: BaseItemAnimator.java    From MultiView with Apache License 2.0 6 votes vote down vote up
protected void resetView(View view) {
    Log.v("resetView: " + view);
    ViewCompat.setAlpha(view, 1);
    ViewCompat.setTranslationX(view, 0);
    ViewCompat.setTranslationY(view, 0);
    ViewCompat.setTranslationZ(view, 0);
    ViewCompat.setRotation(view, 0);
    ViewCompat.setRotationX(view, 0);
    ViewCompat.setRotationY(view, 0);
    ViewCompat.setScaleX(view, 1);
    ViewCompat.setScaleY(view, 1);
    ViewCompat.setPivotY(view, view.getMeasuredHeight() / 2);
    ViewCompat.setPivotX(view, view.getMeasuredWidth() / 2);
    ViewCompat.animate(view).setInterpolator(null);

    //do we need it at all ?
    // view.invalidate();
}
 
Example 3
Source File: BGABannerUtil.java    From KUtils-master with Apache License 2.0 6 votes vote down vote up
public static void resetPageTransformer(List<? extends View> views) {
    if (views == null) {
        return;
    }

    for (View view : views) {
        view.setVisibility(View.VISIBLE);
        ViewCompat.setAlpha(view, 1);
        ViewCompat.setPivotX(view, view.getMeasuredWidth() * 0.5f);
        ViewCompat.setPivotY(view, view.getMeasuredHeight() * 0.5f);
        ViewCompat.setTranslationX(view, 0);
        ViewCompat.setTranslationY(view, 0);
        ViewCompat.setScaleX(view, 1);
        ViewCompat.setScaleY(view, 1);
        ViewCompat.setRotationX(view, 0);
        ViewCompat.setRotationY(view, 0);
        ViewCompat.setRotation(view, 0);
    }
}
 
Example 4
Source File: CubeOutTransformer.java    From PageRecyclerView with Apache License 2.0 5 votes vote down vote up
@Override
protected void onTransform(View view, float position, boolean forwardDirection, int mOrientation) {
	if (mOrientation == OnPageDataListener.HORIZONTAL) {
		ViewCompat.setPivotX(view, position < 0f ? view.getWidth() : 0f);
		ViewCompat.setPivotY(view, view.getHeight() * 0.5f);
		ViewCompat.setRotationY(view, 90f * position);
	} else {
		ViewCompat.setPivotY(view, position < 0f ? view.getHeight() : 0f);
		ViewCompat.setPivotX(view, view.getWidth() * 0.5f);
		ViewCompat.setRotationX(view, -90f * position);
	}
}
 
Example 5
Source File: FlipVerticalTransformer.java    From LoyalNativeSlider with MIT License 5 votes vote down vote up
@Override
protected void onTransform(View view, float position) {
    final float rotation = -180f * position;
    ViewCompat.setAlpha(view, rotation > 90f || rotation < -90f ? 0f : 1f);
    ViewCompat.setPivotX(view, view.getWidth() * 0.5f);
    ViewCompat.setPivotY(view, view.getHeight() * 0.5f);
    ViewCompat.setRotationX(view, rotation);

}
 
Example 6
Source File: ViewHelper.java    From RecyclerviewAnimators with Apache License 2.0 5 votes vote down vote up
public static void clear(View v) {
        ViewCompat.setAlpha(v, 1);
        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);
    }
 
Example 7
Source File: ViewHelper.java    From Nimingban with Apache License 2.0 5 votes vote down vote up
public static void clear(View v) {
  ViewCompat.setAlpha(v, 1);
  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);
}
 
Example 8
Source File: AnimateViewUtils.java    From PowerfulRecyclerView with Apache License 2.0 5 votes vote down vote up
public static void clear(View v) {
    ViewCompat.setAlpha(v, 1);
    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);
}
 
Example 9
Source File: ViewHelper.java    From MemoryCleaner with Apache License 2.0 5 votes vote down vote up
public static void clear(View v) {
    ViewCompat.setAlpha(v, 1);
    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);
}
 
Example 10
Source File: ViewHelper.java    From SimpleNews with Apache License 2.0 5 votes vote down vote up
public static void clear(View v) {
  ViewCompat.setAlpha(v, 1);
  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);
  ViewCompat.setPivotY(v, v.getMeasuredHeight() / 2);
  ViewCompat.setPivotX(v, v.getMeasuredWidth() / 2);
  ViewCompat.animate(v).setInterpolator(null).setStartDelay(0);
}
 
Example 11
Source File: UIUtils.java    From FlyRefresh with MIT License 5 votes vote down vote up
public static void clearAnimator(View v) {
    ViewCompat.setAlpha(v, 1);
    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);
}
 
Example 12
Source File: BaseTransformer.java    From PageRecyclerView with Apache License 2.0 5 votes vote down vote up
protected void onPreTransform(View view, float position, @OnPageDataListener.LayoutOrientation int mOrientation) {
	ViewCompat.setAlpha(view, 1);
	ViewCompat.setPivotX(view, 0);
	ViewCompat.setPivotY(view, 0);
	ViewCompat.setRotationY(view, 0);
	ViewCompat.setRotationX(view, 0);
	ViewCompat.setScaleX(view, 1);
	ViewCompat.setScaleY(view, 1);
	ViewCompat.setTranslationX(view, 0);
	ViewCompat.setTranslationY(view, 0);
}
 
Example 13
Source File: FlipTransformer.java    From PageRecyclerView with Apache License 2.0 5 votes vote down vote up
@Override
protected void onTransform(View view, float position, boolean forwardDirection, int mOrientation) {
	final float rotation = 180f * (position);
	if (mOrientation == OnPageDataListener.HORIZONTAL) {
		ViewCompat.setAlpha(view, rotation > 90f || rotation < -90f ? 0 : 1);
		ViewCompat.setPivotX(view, view.getWidth() * 0.5f);
		ViewCompat.setPivotY(view, view.getHeight() * 0.5f);
		ViewCompat.setRotationY(view, rotation);
	} else {
		ViewCompat.setAlpha(view, rotation > 90f || rotation < -90f ? 0 : 1);
		ViewCompat.setPivotX(view, view.getWidth() * 0.5f);
		ViewCompat.setPivotY(view, view.getHeight() * 0.5f);
		ViewCompat.setRotationX(view, -rotation);
	}
}
 
Example 14
Source File: BaseViewAnimator.java    From FimiX8-RE with MIT License 5 votes vote down vote up
public void reset(View target) {
    ViewCompat.setAlpha(target, 1.0f);
    ViewCompat.setScaleX(target, 1.0f);
    ViewCompat.setScaleY(target, 1.0f);
    ViewCompat.setTranslationX(target, 0.0f);
    ViewCompat.setTranslationY(target, 0.0f);
    ViewCompat.setRotation(target, 0.0f);
    ViewCompat.setRotationY(target, 0.0f);
    ViewCompat.setRotationX(target, 0.0f);
}
 
Example 15
Source File: GarageDoorItemAnimator.java    From RecyclerViewLib with Apache License 2.0 4 votes vote down vote up
@Override
protected boolean prepHolderForAnimateAdd(ViewHolder holder) {
    ViewCompat.setRotationX(holder.itemView, 90);
    ViewCompat.setTranslationY(holder.itemView, - (holder.itemView.getMeasuredHeight() / 2));
    return true;
}
 
Example 16
Source File: GarageDoorItemAnimator.java    From RecyclerViewLib with Apache License 2.0 4 votes vote down vote up
@Override
protected void onAddCanceled(ViewHolder holder) {
    ViewCompat.setRotationX(holder.itemView, 0);
    ViewCompat.setTranslationY(holder.itemView, 0);
}
 
Example 17
Source File: GarageDoorItemAnimator.java    From RecyclerViewLib with Apache License 2.0 4 votes vote down vote up
@Override
protected void onRemoveCanceled(ViewHolder holder) {
    ViewCompat.setRotationX(holder.itemView, 0);
    ViewCompat.setTranslationY(holder.itemView, 0);
}
 
Example 18
Source File: FlipInTopXAnimator.java    From RecyclerviewAnimators with Apache License 2.0 4 votes vote down vote up
@Override
protected void preAnimateAddImpl(RecyclerView.ViewHolder holder) {
    ViewCompat.setRotationX(holder.itemView, 90);
}
 
Example 19
Source File: FlipInBottomXAnimator.java    From RecyclerviewAnimators with Apache License 2.0 4 votes vote down vote up
@Override
protected void preAnimateAddImpl(RecyclerView.ViewHolder holder) {
    ViewCompat.setRotationX(holder.itemView, -90);
}
 
Example 20
Source File: BaseTransformer.java    From LoyalNativeSlider with MIT License 4 votes vote down vote up
/**
 * Called each {@link #transformPage(View, float)} before {{@link #onTransform(View, float)} is called.
 *
 * @param view     view
 * @param position position
 */
protected void onPreTransform(View view, float position) {
    final float width = view.getWidth();

    ViewCompat.setRotationX(view, 0);
    ViewCompat.setRotationY(view, 0);
    ViewCompat.setRotation(view, 0);
    ViewCompat.setScaleX(view, 1);
    ViewCompat.setScaleY(view, 1);
    ViewCompat.setPivotX(view, 0);
    ViewCompat.setPivotY(view, 0);
    ViewCompat.setTranslationY(view, 0);
    ViewCompat.setTranslationX(view, isPagingEnabled() ? 0f : -width * position);

    if (hideOffscreenPages()) {
        ViewCompat.setAlpha(view, position <= -1f || position >= 1f ? 0f : 1f);
    } else {
        ViewCompat.setAlpha(view, 1f);
    }
    if (mCustomAnimationInterface != null) {
        if (h.containsKey(view) == false || h.get(view).size() == 1) {
            if (position > -1 && position < 1) {
                if (h.get(view) == null) {
                    h.put(view, new ArrayList<Float>());
                }
                h.get(view).add(position);
                if (h.get(view).size() == 2) {
                    float zero = h.get(view).get(0);
                    float cha = h.get(view).get(1) - h.get(view).get(0);
                    if (zero > 0) {
                        if (cha > -1 && cha < 0) {
                            //in
                            mCustomAnimationInterface.onPrepareNextItemShowInScreen(view);
                        } else {
                            //out
                            mCustomAnimationInterface.onPrepareCurrentItemLeaveScreen(view);
                        }
                    } else {
                        if (cha > -1 && cha < 0) {
                            //out
                            mCustomAnimationInterface.onPrepareCurrentItemLeaveScreen(view);
                        } else {
                            //in
                            mCustomAnimationInterface.onPrepareNextItemShowInScreen(view);
                        }
                    }
                }
            }
        }
    }
}