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);
}
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);
}
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);
}
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);
}
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);
}
}
}
Aggregations