android.view.ViewOutlineProvider Java Examples
The following examples show how to use
android.view.ViewOutlineProvider.
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: ImageView.java From Carbon with Apache License 2.0 | 6 votes |
private void updateCorners() { if (Carbon.IS_LOLLIPOP_OR_HIGHER) { 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); }
Example #2
Source File: HeaderElevationController.java From LaunchEnr with GNU General Public License v3.0 | 6 votes |
HeaderElevationController(View header) { mHeader = header; final Resources res = mHeader.getContext().getResources(); mMaxElevation = res.getDimension(R.dimen.all_apps_header_max_elevation); mScrollToElevation = res.getDimension(R.dimen.all_apps_header_scroll_to_elevation); // We need to provide a custom outline so the shadow only appears on the bottom edge. // The top, left and right edges are all extended out, and the shadow is clipped // by the parent. final ViewOutlineProvider vop = new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { final View parent = (View) mHeader.getParent(); final int left = parent.getLeft(); // Use the parent to account for offsets final int top = view.getTop(); final int right = left + view.getWidth(); final int bottom = view.getBottom(); final int offset = Utilities.pxFromDp(mMaxElevation, res.getDisplayMetrics()); outline.setRect(left - offset, top - offset, right + offset, bottom); } }; mHeader.setOutlineProvider(vop); }
Example #3
Source File: JellyLayout.java From JellyRefreshLayout with MIT License | 6 votes |
private void init() { setWillNotDraw(false); mPaint = new Paint(Paint.ANTI_ALIAS_FLAG); mPaint.setStyle(Paint.Style.FILL); mPath = new Path(); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { mViewOutlineProvider = new ViewOutlineProvider() { @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @Override public void getOutline(View view, Outline outline) { if (mPath.isConvex()) outline.setConvexPath(mPath); } }; } }
Example #4
Source File: ShapeOfView.java From ShapeOfView with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public ViewOutlineProvider getOutlineProvider() { return new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { if (clipManager != null && !isInEditMode()) { final Path shadowConvexPath = clipManager.getShadowConvexPath(); if (shadowConvexPath != null) { try { outline.setConvexPath(shadowConvexPath); } catch (Exception e) { e.printStackTrace(); } } } } }; }
Example #5
Source File: TabBar.java From AndroidNavigation with MIT License | 6 votes |
private void init(Context context) { selectedItemColor = AppUtils.fetchContextColor(context, R.attr.colorAccent); unselectedItemColor = Color.LTGRAY; barBackgroundColor = Color.WHITE; badgeColor = Color.parseColor("#FF3B30"); setLayoutParams(new ViewGroup.LayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT))); LayoutInflater inflater = LayoutInflater.from(getContext()); View parentView = inflater.inflate(R.layout.nav_tab_bar_container, this, true); container = parentView.findViewById(R.id.nav_tab_bar_container); tabContainer = parentView.findViewById(R.id.nav_tab_bar_item_container); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { this.setOutlineProvider(ViewOutlineProvider.BOUNDS); } ViewCompat.setElevation(this, 0); setClipToPadding(false); }
Example #6
Source File: MotionLayout.java From Carbon with Apache License 2.0 | 6 votes |
private void updateCorners() { if (Carbon.IS_LOLLIPOP_OR_HIGHER) { 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); }
Example #7
Source File: AppBarLayout.java From Carbon with Apache License 2.0 | 6 votes |
private void updateCorners() { if (Carbon.IS_LOLLIPOP_OR_HIGHER) { 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); }
Example #8
Source File: LinearLayout.java From Carbon with Apache License 2.0 | 6 votes |
private void updateCorners() { if (Carbon.IS_LOLLIPOP_OR_HIGHER) { 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); }
Example #9
Source File: PlayPauseView.java From DMAudioStreamer with Apache License 2.0 | 6 votes |
@Override protected void onSizeChanged(final int w, final int h, int oldw, int oldh) { super.onSizeChanged(w, h, oldw, oldh); mDrawable.setBounds(0, 0, w, h); mWidth = w; mHeight = h; if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setOutlineProvider(new ViewOutlineProvider() { @TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public void getOutline(View view, Outline outline) { outline.setOval(0, 0, view.getWidth(), view.getHeight()); } }); setClipToOutline(true); } }
Example #10
Source File: BottomNavigationBar.java From JD-Test with Apache License 2.0 | 6 votes |
/** * This method initiates the bottomNavigationBar and handles layout related values */ private void init() { // MarginLayoutParams marginParams = new ViewGroup.MarginLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) getContext().getResources().getDimension(R.dimen.bottom_navigation_padded_height))); // marginParams.setMargins(0, (int) getContext().getResources().getDimension(R.dimen.bottom_navigation_top_margin_correction), 0, 0); setLayoutParams(new ViewGroup.LayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT))); LayoutInflater inflater = LayoutInflater.from(getContext()); View parentView = inflater.inflate(R.layout.bottom_navigation_bar_container, this, true); mBackgroundOverlay = (FrameLayout) parentView.findViewById(R.id.bottom_navigation_bar_overLay); mContainer = (FrameLayout) parentView.findViewById(R.id.bottom_navigation_bar_container); mTabContainer = (LinearLayout) parentView.findViewById(R.id.bottom_navigation_bar_item_container); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { this.setOutlineProvider(ViewOutlineProvider.BOUNDS); } else { //to do } ViewCompat.setElevation(this, mElevation); setClipToPadding(false); }
Example #11
Source File: CollapsingToolbarLayout.java From Carbon with Apache License 2.0 | 6 votes |
private void updateCorners() { if (Carbon.IS_LOLLIPOP_OR_HIGHER) { 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); }
Example #12
Source File: ObliqueView.java From Oblique with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public ViewOutlineProvider getOutlineProvider() { shadowpath = new Path(); if (config.getRadius() == 0) { shadowpath = path; } else { rect = new Rect(0, 0, (int) width, (int) height); RectF r = new RectF(rect); shadowpath.addRoundRect(r, config.getRadius(), config.getRadius(), Path.Direction.CCW); shadowpath.op(path, shadowpath, Path.Op.INTERSECT); } return new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { if (path.isConvex()) { outline.setConvexPath(shadowpath); } } }; }
Example #13
Source File: FloatingActionButton.java From FluxyAndroidTodo with MIT License | 6 votes |
public FloatingActionButton(Context context, AttributeSet attrs, int defStyleAttr, int defStyleRes) { super(context, attrs, defStyleAttr); setClickable(true); // Set the outline provider for this view. The provider is given the outline which it can // then modify as needed. In this case we set the outline to be an oval fitting the height // and width. setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { outline.setOval(0, 0, getWidth(), getHeight()); } }); // Finally, enable clipping to the outline, using the provider we set above setClipToOutline(true); }
Example #14
Source File: Label.java From ShareBox with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private Drawable createFillDrawable() { StateListDrawable drawable = new StateListDrawable(); drawable.addState(new int[]{android.R.attr.state_pressed}, createRectDrawable(mColorPressed)); drawable.addState(new int[]{}, createRectDrawable(mColorNormal)); if (Util.hasLollipop()) { RippleDrawable ripple = new RippleDrawable(new ColorStateList(new int[][]{{}}, new int[]{mColorRipple}), drawable, null); setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { outline.setOval(0, 0, view.getWidth(), view.getHeight()); } }); setClipToOutline(true); mBackgroundDrawable = ripple; return ripple; } mBackgroundDrawable = drawable; return drawable; }
Example #15
Source File: Button.java From Carbon with Apache License 2.0 | 6 votes |
private void updateCorners() { if (Carbon.IS_LOLLIPOP_OR_HIGHER) { 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); }
Example #16
Source File: FloatingActionButton.java From ShareBox with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private Drawable createFillDrawable() { StateListDrawable drawable = new StateListDrawable(); drawable.addState(new int[]{-android.R.attr.state_enabled}, createCircleDrawable(mColorDisabled)); drawable.addState(new int[]{android.R.attr.state_pressed}, createCircleDrawable(mColorPressed)); drawable.addState(new int[]{}, createCircleDrawable(mColorNormal)); if (Util.hasLollipop()) { RippleDrawable ripple = new RippleDrawable(new ColorStateList(new int[][]{{}}, new int[]{mColorRipple}), drawable, null); setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { outline.setOval(0, 0, view.getWidth(), view.getHeight()); } }); setClipToOutline(true); mBackgroundDrawable = ripple; return ripple; } mBackgroundDrawable = drawable; return drawable; }
Example #17
Source File: TagView.java From GeometricWeather with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); outline.set(0, 0, getMeasuredWidth(), getMeasuredHeight()); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setClipToOutline(true); setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline viewOutline) { viewOutline.setRoundRect( (int) outline.left, (int) outline.top, (int) outline.right, (int) outline.bottom, outline.height() / 2 ); } }); } }
Example #18
Source File: PrecipitationBar.java From GeometricWeather with GNU Lesser General Public License v3.0 | 6 votes |
@Override protected void onMeasure(int widthMeasureSpec, int heightMeasureSpec) { super.onMeasure(widthMeasureSpec, heightMeasureSpec); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setClipToOutline(true); setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { outline.setRoundRect( 0, 0, view.getMeasuredWidth(), view.getMeasuredHeight(), view.getMeasuredHeight() / 2f ); } }); } }
Example #19
Source File: TextView.java From Carbon with Apache License 2.0 | 6 votes |
private void updateCorners() { if (Carbon.IS_LOLLIPOP_OR_HIGHER) { 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); }
Example #20
Source File: Chip.java From material-components-android with Apache License 2.0 | 6 votes |
private void initOutlineProvider() { if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { setOutlineProvider( new ViewOutlineProvider() { @Override @TargetApi(Build.VERSION_CODES.LOLLIPOP) public void getOutline(View view, @NonNull Outline outline) { if (chipDrawable != null) { chipDrawable.getOutline(outline); } else { outline.setAlpha(0.0f); } } }); } }
Example #21
Source File: FlowLayout.java From Carbon with Apache License 2.0 | 6 votes |
private void updateCorners() { if (Carbon.IS_LOLLIPOP_OR_HIGHER) { 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); }
Example #22
Source File: CircularImageView.java From Mysplash with GNU Lesser General Public License v3.0 | 6 votes |
private void initialize() { if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { setOutlineProvider(new ViewOutlineProvider() { @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) @Override public void getOutline(View view, Outline outline) { outline.setOval( view.getPaddingLeft(), view.getPaddingTop(), view.getWidth() - view.getPaddingRight(), view.getHeight() - view.getPaddingBottom() ); } }); setClipToOutline(true); } }
Example #23
Source File: GridLayout.java From Carbon with Apache License 2.0 | 6 votes |
private void updateCorners() { if (Carbon.IS_LOLLIPOP_OR_HIGHER) { 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); }
Example #24
Source File: FrameLayout.java From Carbon with Apache License 2.0 | 6 votes |
private void updateCorners() { if (Carbon.IS_LOLLIPOP_OR_HIGHER) { 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); }
Example #25
Source File: BottomNavigationBar.java From BottomNavigation with Apache License 2.0 | 6 votes |
/** * This method initiates the bottomNavigationBar and handles layout related values */ private void init() { // MarginLayoutParams marginParams = new ViewGroup.MarginLayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, (int) getContext().getResources().getDimension(R.dimen.bottom_navigation_padded_height))); // marginParams.setMargins(0, (int) getContext().getResources().getDimension(R.dimen.bottom_navigation_top_margin_correction), 0, 0); setLayoutParams(new ViewGroup.LayoutParams(new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT))); LayoutInflater inflater = LayoutInflater.from(getContext()); View parentView = inflater.inflate(R.layout.bottom_navigation_bar_container, this, true); mBackgroundOverlay = parentView.findViewById(R.id.bottom_navigation_bar_overLay); mContainer = parentView.findViewById(R.id.bottom_navigation_bar_container); mTabContainer = parentView.findViewById(R.id.bottom_navigation_bar_item_container); if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) { this.setOutlineProvider(ViewOutlineProvider.BOUNDS); } else { //to do } ViewCompat.setElevation(this, mElevation); setClipToPadding(false); }
Example #26
Source File: RelativeLayout.java From Carbon with Apache License 2.0 | 6 votes |
private void updateCorners() { if (Carbon.IS_LOLLIPOP_OR_HIGHER) { 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); }
Example #27
Source File: ShapeOfView.java From ArcLayout with Apache License 2.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) @Override public ViewOutlineProvider getOutlineProvider() { return new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { if (clipManager != null) { final Path shadowConvexPath = clipManager.getShadowConvexPath(); if (shadowConvexPath != null) { try { outline.setConvexPath(shadowConvexPath); } catch (Exception e) { e.printStackTrace(); } } } } }; }
Example #28
Source File: FloatingActionButton.java From clear-todolist with GNU General Public License v3.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private Drawable createFillDrawable() { StateListDrawable drawable = new StateListDrawable(); drawable.addState(new int[]{-android.R.attr.state_enabled}, createCircleDrawable(mColorDisabled)); drawable.addState(new int[]{android.R.attr.state_pressed}, createCircleDrawable(mColorPressed)); drawable.addState(new int[]{}, createCircleDrawable(mColorNormal)); if (Util.hasLollipop()) { RippleDrawable ripple = new RippleDrawable(new ColorStateList(new int[][]{{}}, new int[]{mColorRipple}), drawable, null); setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { outline.setOval(0, 0, view.getWidth(), view.getHeight()); } }); setClipToOutline(true); mBackgroundDrawable = ripple; return ripple; } mBackgroundDrawable = drawable; return drawable; }
Example #29
Source File: Label.java From clear-todolist with GNU General Public License v3.0 | 6 votes |
@TargetApi(Build.VERSION_CODES.LOLLIPOP) private Drawable createFillDrawable() { StateListDrawable drawable = new StateListDrawable(); drawable.addState(new int[]{android.R.attr.state_pressed}, createRectDrawable(mColorPressed)); drawable.addState(new int[]{}, createRectDrawable(mColorNormal)); if (Util.hasLollipop()) { RippleDrawable ripple = new RippleDrawable(new ColorStateList(new int[][]{{}}, new int[]{mColorRipple}), drawable, null); setOutlineProvider(new ViewOutlineProvider() { @Override public void getOutline(View view, Outline outline) { outline.setOval(0, 0, view.getWidth(), view.getHeight()); } }); setClipToOutline(true); mBackgroundDrawable = ripple; return ripple; } mBackgroundDrawable = drawable; return drawable; }
Example #30
Source File: RecyclerView.java From Carbon with Apache License 2.0 | 6 votes |
private void updateCorners() { if (Carbon.IS_LOLLIPOP_OR_HIGHER) { 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); }