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

The following examples show how to use android.support.v4.view.ViewCompat#setRotation() . 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 JD-Test 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: XBannerUtils.java    From XBanner 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 3
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 4
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 5
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 6
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 7
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 8
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 9
Source File: CubeInTransformer.java    From LoyalNativeSlider with MIT License 5 votes vote down vote up
@Override
protected void onTransform(View view, float position) {
	// Rotate the fragment on the left or right edge
       ViewCompat.setPivotX(view,position > 0 ? 0 : view.getWidth());
       ViewCompat.setPivotY(view,0);
       ViewCompat.setRotation(view, -90f * position);
}
 
Example 10
Source File: RotateUpTransformer.java    From LoyalNativeSlider with MIT License 5 votes vote down vote up
@Override
protected void onTransform(View view, float position) {
	final float width = view.getWidth();
	final float rotation = ROT_MOD * position;

	ViewCompat.setPivotX(view, width * 0.5f);
       ViewCompat.setPivotY(view,0f);
       ViewCompat.setTranslationX(view,0f);
       ViewCompat.setRotation(view,rotation);
}
 
Example 11
Source File: RotatePageTransformer.java    From KUtils with Apache License 2.0 5 votes vote down vote up
@Override
public void handleLeftPage(View view, float position) {
    float rotation = (mMaxRotation * position);
    ViewCompat.setPivotX(view, view.getMeasuredWidth() * 0.5f);
    ViewCompat.setPivotY(view, view.getMeasuredHeight());
    ViewCompat.setRotation(view, rotation);
}
 
Example 12
Source File: BaseViewAnimator.java    From KUtils with Apache License 2.0 5 votes vote down vote up
/**
 * reset the view to default status
 *
 * @param target
 */
public void reset(View target) {
    ViewCompat.setAlpha(target, 1);
    ViewCompat.setScaleX(target, 1);
    ViewCompat.setScaleY(target, 1);
    ViewCompat.setTranslationX(target, 0);
    ViewCompat.setTranslationY(target, 0);
    ViewCompat.setRotation(target, 0);
    ViewCompat.setRotationY(target, 0);
    ViewCompat.setRotationX(target, 0);
}
 
Example 13
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 14
Source File: RotateDownTransformer.java    From LoyalNativeSlider with MIT License 5 votes vote down vote up
@Override
protected void onTransform(View view, float position) {
	final float width = view.getWidth();
	final float height = view.getHeight();
	final float rotation = ROT_MOD * position * -1.25f;

	ViewCompat.setPivotX(view, width * 0.5f);
       ViewCompat.setPivotY(view,height);
       ViewCompat.setRotation(view,rotation);
}
 
Example 15
Source File: GearView.java    From GearLoadingProject with Apache License 2.0 4 votes vote down vote up
public void rotateByValue(float rotateOffset, boolean reverse) {
    if (reverse)
        rotateOffset = 360f - rotateOffset;
    ViewCompat.setRotation(this, rotateOffset);
}
 
Example 16
Source File: ShapeLoadingRefreshView.java    From CanRefresh with Apache License 2.0 4 votes vote down vote up
@Override
public void onPositionChange(float currentPercent) {


    float rotation = currentPercent * 360;
    if (rotation >= 360) {

        rotation = 360;
    }

    float distance = currentPercent * MAX_DISTANCE;
    if (distance >= MAX_DISTANCE) {

        distance = MAX_DISTANCE;
    }

    ViewCompat.setRotation(mShapeLoadingView, rotation);
    ViewCompat.setTranslationY(mShapeLoadingView, distance);


}
 
Example 17
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);
                        }
                    }
                }
            }
        }
    }
}
 
Example 18
Source File: RotatePageTransformer.java    From KUtils-master with Apache License 2.0 4 votes vote down vote up
@Override
public void handleInvisiblePage(View view, float position) {
    ViewCompat.setPivotX(view, view.getMeasuredWidth() * 0.5f);
    ViewCompat.setPivotY(view, view.getMeasuredHeight());
    ViewCompat.setRotation(view, 0);
}
 
Example 19
Source File: RotatePageTransformer.java    From KUtils with Apache License 2.0 4 votes vote down vote up
@Override
public void handleInvisiblePage(View view, float position) {
    ViewCompat.setPivotX(view, view.getMeasuredWidth() * 0.5f);
    ViewCompat.setPivotY(view, view.getMeasuredHeight());
    ViewCompat.setRotation(view, 0);
}
 
Example 20
Source File: RotateRefreshView.java    From CanRefresh with Apache License 2.0 3 votes vote down vote up
@Override
public void onPositionChange(float currentPercent) {



    ViewCompat.setRotation(ivRotate,currentPercent*rotateHight);
    
}