Search in sources :

Example 51 with ViewOutlineProvider

use of android.view.ViewOutlineProvider in project Carbon by ZieIony.

the class Button method updateCorners.

private void updateCorners() {
    if (Carbon.IS_LOLLIPOP_OR_HIGHER) {
        if (!Carbon.isShapeRect(shapeModel, boundsRect))
            setClipToOutline(true);
        setOutlineProvider(new ViewOutlineProvider() {

            @Override
            public void getOutline(View view, Outline outline) {
                if (Carbon.isShapeRect(shapeModel, boundsRect)) {
                    outline.setRect(0, 0, getWidth(), getHeight());
                } else {
                    shadowDrawable.setBounds(0, 0, getWidth(), getHeight());
                    shadowDrawable.setShadowCompatibilityMode(MaterialShapeDrawable.SHADOW_COMPAT_MODE_NEVER);
                    shadowDrawable.getOutline(outline);
                }
            }
        });
    }
    boundsRect.set(shadowDrawable.getBounds());
    shadowDrawable.getPathForSize(getWidth(), getHeight(), cornersMask);
}
Also used : Outline(android.graphics.Outline) ViewOutlineProvider(android.view.ViewOutlineProvider) TintedView(carbon.view.TintedView) ShadowView(carbon.view.ShadowView) StrokeView(carbon.view.StrokeView) View(android.view.View) RippleView(carbon.drawable.ripple.RippleView) RevealView(carbon.view.RevealView) TransformationView(carbon.view.TransformationView) AutoSizeTextView(carbon.view.AutoSizeTextView) AnimatedView(carbon.animation.AnimatedView) MarginView(carbon.view.MarginView) ShapeModelView(carbon.view.ShapeModelView) MaxSizeView(carbon.view.MaxSizeView) TouchMarginView(carbon.view.TouchMarginView) VisibleView(carbon.view.VisibleView) TextAppearanceView(carbon.view.TextAppearanceView) StateAnimatorView(carbon.view.StateAnimatorView)

Example 52 with ViewOutlineProvider

use of android.view.ViewOutlineProvider in project Carbon by ZieIony.

the class CoordinatorLayout method updateCorners.

private void updateCorners() {
    if (Carbon.IS_LOLLIPOP_OR_HIGHER) {
        if (!Carbon.isShapeRect(shapeModel, boundsRect))
            setClipToOutline(true);
        setOutlineProvider(new ViewOutlineProvider() {

            @Override
            public void getOutline(View view, Outline outline) {
                if (Carbon.isShapeRect(shapeModel, boundsRect)) {
                    outline.setRect(0, 0, getWidth(), getHeight());
                } else {
                    shadowDrawable.setBounds(0, 0, getWidth(), getHeight());
                    shadowDrawable.setShadowCompatibilityMode(MaterialShapeDrawable.SHADOW_COMPAT_MODE_NEVER);
                    shadowDrawable.getOutline(outline);
                }
            }
        });
    }
    boundsRect.set(shadowDrawable.getBounds());
    shadowDrawable.getPathForSize(getWidth(), getHeight(), cornersMask);
}
Also used : Outline(android.graphics.Outline) ViewOutlineProvider(android.view.ViewOutlineProvider) ShadowView(carbon.view.ShadowView) ComponentView(carbon.component.ComponentView) StrokeView(carbon.view.StrokeView) View(android.view.View) RippleView(carbon.drawable.ripple.RippleView) RevealView(carbon.view.RevealView) TransformationView(carbon.view.TransformationView) InsetView(carbon.view.InsetView) AnimatedView(carbon.animation.AnimatedView) MarginView(carbon.view.MarginView) ShapeModelView(carbon.view.ShapeModelView) BehaviorView(carbon.view.BehaviorView) MaxSizeView(carbon.view.MaxSizeView) TouchMarginView(carbon.view.TouchMarginView) VisibleView(carbon.view.VisibleView) StateAnimatorView(carbon.view.StateAnimatorView)

Example 53 with ViewOutlineProvider

use of android.view.ViewOutlineProvider in project Carbon by ZieIony.

the class View method updateCorners.

private void updateCorners() {
    if (Carbon.IS_LOLLIPOP_OR_HIGHER) {
        if (!Carbon.isShapeRect(shapeModel, boundsRect))
            setClipToOutline(true);
        setOutlineProvider(new ViewOutlineProvider() {

            @Override
            public void getOutline(android.view.View view, Outline outline) {
                if (Carbon.isShapeRect(shapeModel, boundsRect)) {
                    outline.setRect(0, 0, getWidth(), getHeight());
                } else {
                    shadowDrawable.setBounds(0, 0, getWidth(), getHeight());
                    shadowDrawable.setShadowCompatibilityMode(MaterialShapeDrawable.SHADOW_COMPAT_MODE_NEVER);
                    shadowDrawable.getOutline(outline);
                }
            }
        });
    }
    boundsRect.set(shadowDrawable.getBounds());
    shadowDrawable.getPathForSize(getWidth(), getHeight(), cornersMask);
}
Also used : Outline(android.graphics.Outline) ViewOutlineProvider(android.view.ViewOutlineProvider)

Example 54 with ViewOutlineProvider

use of android.view.ViewOutlineProvider in project Carbon by ZieIony.

the class AppBarLayout method updateCorners.

private void updateCorners() {
    if (Carbon.IS_LOLLIPOP_OR_HIGHER) {
        if (!Carbon.isShapeRect(shapeModel, boundsRect))
            setClipToOutline(true);
        setOutlineProvider(new ViewOutlineProvider() {

            @Override
            public void getOutline(View view, Outline outline) {
                if (Carbon.isShapeRect(shapeModel, boundsRect)) {
                    outline.setRect(0, 0, getWidth(), getHeight());
                } else {
                    shadowDrawable.setBounds(0, 0, getWidth(), getHeight());
                    shadowDrawable.setShadowCompatibilityMode(MaterialShapeDrawable.SHADOW_COMPAT_MODE_NEVER);
                    shadowDrawable.getOutline(outline);
                }
            }
        });
    }
    boundsRect.set(shadowDrawable.getBounds());
    shadowDrawable.getPathForSize(getWidth(), getHeight(), cornersMask);
}
Also used : Outline(android.graphics.Outline) ViewOutlineProvider(android.view.ViewOutlineProvider) ShadowView(carbon.view.ShadowView) ComponentView(carbon.component.ComponentView) StrokeView(carbon.view.StrokeView) View(android.view.View) RippleView(carbon.drawable.ripple.RippleView) RevealView(carbon.view.RevealView) InsetView(carbon.view.InsetView) AnimatedView(carbon.animation.AnimatedView) MarginView(carbon.view.MarginView) ShapeModelView(carbon.view.ShapeModelView) MaxSizeView(carbon.view.MaxSizeView) TouchMarginView(carbon.view.TouchMarginView) VisibleView(carbon.view.VisibleView) StateAnimatorView(carbon.view.StateAnimatorView)

Example 55 with ViewOutlineProvider

use of android.view.ViewOutlineProvider in project cardslib by gabrielemariotti.

the class LPreviewUtilsBase method setupCircleButton.

// ----------------------------------------------------------------------------
// Circle Button
// ----------------------------------------------------------------------------
public void setupCircleButton(ImageButton sourceButton) {
    if (hasL()) {
        if (sourceButton != null) {
            final int size = mActivity.getResources().getDimensionPixelSize(R.dimen.hd_fab_size);
            sourceButton.setOutlineProvider(new ViewOutlineProvider() {

                @Override
                public void getOutline(View view, Outline outline) {
                    outline.setOval(0, 0, size, size);
                }
            });
            sourceButton.setClipToOutline(true);
        }
    }
}
Also used : Outline(android.graphics.Outline) ViewOutlineProvider(android.view.ViewOutlineProvider) View(android.view.View)

Aggregations

ViewOutlineProvider (android.view.ViewOutlineProvider)55 Outline (android.graphics.Outline)54 View (android.view.View)54 TextView (android.widget.TextView)24 AnimatedView (carbon.animation.AnimatedView)17 RippleView (carbon.drawable.ripple.RippleView)17 MarginView (carbon.view.MarginView)17 MaxSizeView (carbon.view.MaxSizeView)17 RevealView (carbon.view.RevealView)17 ShadowView (carbon.view.ShadowView)16 ShapeModelView (carbon.view.ShapeModelView)16 StateAnimatorView (carbon.view.StateAnimatorView)16 StrokeView (carbon.view.StrokeView)16 TouchMarginView (carbon.view.TouchMarginView)16 VisibleView (carbon.view.VisibleView)16 TargetApi (android.annotation.TargetApi)12 ComponentView (carbon.component.ComponentView)12 InsetView (carbon.view.InsetView)12 TransformationView (carbon.view.TransformationView)12 BehaviorView (carbon.view.BehaviorView)10