Java Code Examples for android.view.View#setClipBounds()

The following examples show how to use android.view.View#setClipBounds() . 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: ParallaxedView.java    From ParallaxScroll with MIT License 5 votes vote down vote up
@SuppressLint("NewApi")
public void setOffset(float offset, int originalScrollY) {
    View view = this.view.get();
    if (view != null)
        if (isAPI11) {
            if (!firstRectGet) {
                clippingRect.top = view.getTop();
                clippingRect.left = view.getLeft();
                clippingRect.right = view.getRight();
                clippingRect.bottom = view.getBottom();
                firstRectGet = true;
            }
            if (lastScrollY == 0) {
                lastScrollY = originalScrollY;
            }
            int delta = lastScrollY - originalScrollY;
            clippingRect.bottom += delta;
            view.setTranslationY(Math.round(offset));
            if (isAPI18) view.setClipBounds(clippingRect);
            lastScrollY = originalScrollY;
            if (isAPI18) {
                if (clippingRect.bottom <= clippingRect.top) {
                    view.setVisibility(View.INVISIBLE);
                } else {
                    view.setVisibility(View.VISIBLE);
                }
            }
        } else {
            translatePreICS(view, offset);
        }
}
 
Example 2
Source File: ViewOtherAnimationBuilder.java    From scene with Apache License 2.0 4 votes vote down vote up
@Override
public void set(View object, Rect value) {
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR2) {
        object.setClipBounds(value);
    }
}
 
Example 3
Source File: ViewCompatJellybeanMr2.java    From letv with Apache License 2.0 4 votes vote down vote up
public static void setClipBounds(View view, Rect clipBounds) {
    view.setClipBounds(clipBounds);
}
 
Example 4
Source File: ViewUtils.java    From Transitions-Everywhere with Apache License 2.0 4 votes vote down vote up
@Override
public void setClipBounds(@NonNull View v, @Nullable Rect clipBounds) {
    v.setClipBounds(clipBounds);
}