Search in sources :

Example 56 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)56 Outline (android.graphics.Outline)55 View (android.view.View)55 TextView (android.widget.TextView)25 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)16 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