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

The following examples show how to use android.view.View#setClipBounds() . These examples are extracted from open source projects. 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 want to check out the right sidebar which shows the related API usage.
Example 1
Source Project: ParallaxScroll   File: ParallaxedView.java    License: 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 Project: scene   File: ViewOtherAnimationBuilder.java    License: 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 Project: letv   File: ViewCompatJellybeanMr2.java    License: Apache License 2.0 4 votes vote down vote up
public static void setClipBounds(View view, Rect clipBounds) {
    view.setClipBounds(clipBounds);
}
 
Example 4
@Override
public void setClipBounds(@NonNull View v, @Nullable Rect clipBounds) {
    v.setClipBounds(clipBounds);
}