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

The following examples show how to use android.support.v4.view.ViewCompat#setPivotX() . 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-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 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: ZoomFadePageTransformer.java    From KUtils with Apache License 2.0 5 votes vote down vote up
@Override
public void handleLeftPage(View view, float position) {
    ViewCompat.setTranslationX(view, -view.getWidth() * position);

    ViewCompat.setPivotX(view, view.getWidth() * 0.5f);
    ViewCompat.setPivotY(view, view.getHeight() * 0.5f);
    ViewCompat.setScaleX(view, 1 + position);
    ViewCompat.setScaleY(view, 1 + position);

    ViewCompat.setAlpha(view, 1 + position);
}
 
Example 4
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 5
Source File: ZoomStackPageTransformer.java    From JD-Test with Apache License 2.0 5 votes vote down vote up
@Override
public void handleLeftPage(View view, float position) {
    ViewCompat.setTranslationX(view, -view.getWidth() * position);

    ViewCompat.setPivotX(view, view.getWidth() * 0.5f);
    ViewCompat.setPivotY(view, view.getHeight() * 0.5f);
    ViewCompat.setScaleX(view, 1 + position);
    ViewCompat.setScaleY(view, 1 + position);

    if (position < -0.95f) {
        ViewCompat.setAlpha(view, 0);
    } else {
        ViewCompat.setAlpha(view, 1);
    }
}
 
Example 6
Source File: ZoomStackPageTransformer.java    From KUtils-master with Apache License 2.0 5 votes vote down vote up
@Override
public void handleLeftPage(View view, float position) {
    ViewCompat.setTranslationX(view, -view.getWidth() * position);

    ViewCompat.setPivotX(view, view.getWidth() * 0.5f);
    ViewCompat.setPivotY(view, view.getHeight() * 0.5f);
    ViewCompat.setScaleX(view, 1 + position);
    ViewCompat.setScaleY(view, 1 + position);

    if (position < -0.95f) {
        ViewCompat.setAlpha(view, 0);
    } else {
        ViewCompat.setAlpha(view, 1);
    }
}
 
Example 7
Source File: RotatePageTransformer.java    From JD-Test 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 8
Source File: ZoomFadePageTransformer.java    From KUtils-master with Apache License 2.0 5 votes vote down vote up
@Override
public void handleRightPage(View view, float position) {
    ViewCompat.setTranslationX(view, -view.getWidth() * position);

    ViewCompat.setPivotX(view, view.getWidth() * 0.5f);
    ViewCompat.setPivotY(view, view.getHeight() * 0.5f);
    ViewCompat.setScaleX(view, 1 - position);
    ViewCompat.setScaleY(view, 1 - position);
    ViewCompat.setAlpha(view, 1 - position);
}
 
Example 9
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 10
Source File: ZoomFadePageTransformer.java    From JD-Test with Apache License 2.0 5 votes vote down vote up
@Override
public void handleLeftPage(View view, float position) {
    ViewCompat.setTranslationX(view, -view.getWidth() * position);

    ViewCompat.setPivotX(view, view.getWidth() * 0.5f);
    ViewCompat.setPivotY(view, view.getHeight() * 0.5f);
    ViewCompat.setScaleX(view, 1 + position);
    ViewCompat.setScaleY(view, 1 + position);

    ViewCompat.setAlpha(view, 1 + position);
}
 
Example 11
Source File: ZoomInTransformer.java    From LoyalNativeSlider with MIT License 5 votes vote down vote up
@Override
protected void onTransform(View view, float position) {
    final float scale = position < 0 ? position + 1f : Math.abs(1f - position);
    ViewCompat.setScaleX(view, scale);
    ViewCompat.setScaleY(view, scale);
    ViewCompat.setPivotX(view, view.getMeasuredWidth() * 0.5f);
    ViewCompat.setPivotY(view, view.getMeasuredHeight() * 0.5f);
    ViewCompat.setAlpha(view, position < -1f || position > 1f ? 0f : 1f - (scale - 1f));
}
 
Example 12
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 13
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 14
Source File: CubePageTransformer.java    From JD-Test with Apache License 2.0 4 votes vote down vote up
@Override
public void handleInvisiblePage(View view, float position) {
    ViewCompat.setPivotX(view, view.getMeasuredWidth());
    ViewCompat.setPivotY(view, view.getMeasuredHeight() * 0.5f);
    ViewCompat.setRotationY(view, 0);
}
 
Example 15
Source File: ScaleInRightAnimator.java    From RecyclerviewAnimators with Apache License 2.0 4 votes vote down vote up
@Override
protected void preAnimateRemoveImpl(RecyclerView.ViewHolder holder) {
    ViewCompat.setPivotX(holder.itemView, holder.itemView.getWidth());
}
 
Example 16
Source File: ScaleInLeftAnimator.java    From RecyclerviewAnimators with Apache License 2.0 4 votes vote down vote up
@Override
protected void preAnimateRemoveImpl(RecyclerView.ViewHolder holder) {
    ViewCompat.setPivotX(holder.itemView, 0);
}
 
Example 17
Source File: ScaleInRightAnimator.java    From RecyclerviewAnimators with Apache License 2.0 4 votes vote down vote up
@Override
protected void preAnimateAddImpl(RecyclerView.ViewHolder holder) {
    ViewCompat.setPivotX(holder.itemView, holder.itemView.getWidth());
    ViewCompat.setScaleX(holder.itemView, 0);
    ViewCompat.setScaleY(holder.itemView, 0);
}
 
Example 18
Source File: CubePageTransformer.java    From KUtils-master with Apache License 2.0 4 votes vote down vote up
@Override
public void handleLeftPage(View view, float position) {
    ViewCompat.setPivotX(view, view.getMeasuredWidth());
    ViewCompat.setPivotY(view, view.getMeasuredHeight() * 0.5f);
    ViewCompat.setRotationY(view, mMaxRotation * position);
}
 
Example 19
Source File: AccordionPageTransformer.java    From JD-Test with Apache License 2.0 4 votes vote down vote up
@Override
public void handleRightPage(View view, float position) {
    ViewCompat.setPivotX(view, 0);
    ViewCompat.setScaleX(view, 1.0f - position);
    ViewCompat.setAlpha(view, 1);
}
 
Example 20
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);
}