com.google.android.material.shape.ShapeAppearanceModel Java Examples
The following examples show how to use
com.google.android.material.shape.ShapeAppearanceModel.
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: BottomAppBarMainDemoFragment.java From material-components-android with Apache License 2.0 | 6 votes |
private void setUpBottomAppBarShapeAppearance() { ShapeAppearanceModel fabShapeAppearanceModel = fab.getShapeAppearanceModel(); boolean cutCornersFab = fabShapeAppearanceModel.getBottomLeftCorner() instanceof CutCornerTreatment && fabShapeAppearanceModel.getBottomRightCorner() instanceof CutCornerTreatment; BottomAppBarTopEdgeTreatment topEdge = cutCornersFab ? new BottomAppBarCutCornersTopEdge( bar.getFabCradleMargin(), bar.getFabCradleRoundedCornerRadius(), bar.getCradleVerticalOffset()) : new BottomAppBarTopEdgeTreatment( bar.getFabCradleMargin(), bar.getFabCradleRoundedCornerRadius(), bar.getCradleVerticalOffset()); MaterialShapeDrawable babBackground = (MaterialShapeDrawable) bar.getBackground(); babBackground.setShapeAppearanceModel( babBackground.getShapeAppearanceModel().toBuilder().setTopEdge(topEdge).build()); }
Example #2
Source File: MaterialContainerTransform.java From material-components-android with Apache License 2.0 | 6 votes |
private static ShapeAppearanceModel getShapeAppearance( @NonNull View view, @Nullable ShapeAppearanceModel shapeAppearanceModelOverride) { if (shapeAppearanceModelOverride != null) { return shapeAppearanceModelOverride; } if (view.getTag(R.id.mtrl_motion_snapshot_view) instanceof ShapeAppearanceModel) { return (ShapeAppearanceModel) view.getTag(R.id.mtrl_motion_snapshot_view); } Context context = view.getContext(); int transitionShapeAppearanceResId = getTransitionShapeAppearanceResId(context); if (transitionShapeAppearanceResId != -1) { return ShapeAppearanceModel.builder(context, transitionShapeAppearanceResId, 0).build(); } if (view instanceof Shapeable) { return ((Shapeable) view).getShapeAppearanceModel(); } return ShapeAppearanceModel.builder().build(); }
Example #3
Source File: BottomSheetBehavior.java From Mysplash with GNU Lesser General Public License v3.0 | 6 votes |
private void createMaterialShapeDrawable( @NonNull Context context, AttributeSet attrs, boolean hasBackgroundTint, @Nullable ColorStateList bottomSheetColor) { if (this.shapeThemingEnabled) { this.shapeAppearanceModelDefault = ShapeAppearanceModel.builder(context, attrs, R.attr.bottomSheetStyle, DEF_STYLE_RES) .build(); this.materialShapeDrawable = new MaterialShapeDrawable(shapeAppearanceModelDefault); this.materialShapeDrawable.initializeElevationOverlay(context); if (hasBackgroundTint && bottomSheetColor != null) { materialShapeDrawable.setFillColor(bottomSheetColor); } else { // If the tint isn't set, use the theme default background color. TypedValue defaultColor = new TypedValue(); context.getTheme().resolveAttribute(android.R.attr.colorBackground, defaultColor, true); materialShapeDrawable.setTint(defaultColor.data); } } }
Example #4
Source File: NavigationView.java From material-components-android with Apache License 2.0 | 6 votes |
/** * Creates a {@link MaterialShapeDrawable} to use as the {@code itemBackground} and wraps it in an * {@link InsetDrawable} for margins. * * @param a The TintTypedArray containing the resolved NavigationView style attributes. */ @NonNull private final Drawable createDefaultItemBackground(@NonNull TintTypedArray a) { int shapeAppearanceResId = a.getResourceId(R.styleable.NavigationView_itemShapeAppearance, 0); int shapeAppearanceOverlayResId = a.getResourceId(R.styleable.NavigationView_itemShapeAppearanceOverlay, 0); MaterialShapeDrawable materialShapeDrawable = new MaterialShapeDrawable( ShapeAppearanceModel.builder( getContext(), shapeAppearanceResId, shapeAppearanceOverlayResId) .build()); materialShapeDrawable.setFillColor( MaterialResources.getColorStateList( getContext(), a, R.styleable.NavigationView_itemShapeFillColor)); int insetLeft = a.getDimensionPixelSize(R.styleable.NavigationView_itemShapeInsetStart, 0); int insetTop = a.getDimensionPixelSize(R.styleable.NavigationView_itemShapeInsetTop, 0); int insetRight = a.getDimensionPixelSize(R.styleable.NavigationView_itemShapeInsetEnd, 0); int insetBottom = a.getDimensionPixelSize(R.styleable.NavigationView_itemShapeInsetBottom, 0); return new InsetDrawable(materialShapeDrawable, insetLeft, insetTop, insetRight, insetBottom); }
Example #5
Source File: MaterialCardViewHelper.java From material-components-android with Apache License 2.0 | 6 votes |
void setShapeAppearanceModel(@NonNull ShapeAppearanceModel shapeAppearanceModel) { this.shapeAppearanceModel = shapeAppearanceModel; bgDrawable.setShapeAppearanceModel(shapeAppearanceModel); bgDrawable.setShadowBitmapDrawingEnable(!bgDrawable.isRoundRect()); if (foregroundContentDrawable != null) { foregroundContentDrawable.setShapeAppearanceModel(shapeAppearanceModel); } if (foregroundShapeDrawable != null) { foregroundShapeDrawable.setShapeAppearanceModel(shapeAppearanceModel); } if (compatRippleDrawable != null) { compatRippleDrawable.setShapeAppearanceModel(shapeAppearanceModel); } }
Example #6
Source File: BottomSheetBehavior.java From material-components-android with Apache License 2.0 | 6 votes |
private void createMaterialShapeDrawable( @NonNull Context context, AttributeSet attrs, boolean hasBackgroundTint, @Nullable ColorStateList bottomSheetColor) { if (this.shapeThemingEnabled) { this.shapeAppearanceModelDefault = ShapeAppearanceModel.builder(context, attrs, R.attr.bottomSheetStyle, DEF_STYLE_RES) .build(); this.materialShapeDrawable = new MaterialShapeDrawable(shapeAppearanceModelDefault); this.materialShapeDrawable.initializeElevationOverlay(context); if (hasBackgroundTint && bottomSheetColor != null) { materialShapeDrawable.setFillColor(bottomSheetColor); } else { // If the tint isn't set, use the theme default background color. TypedValue defaultColor = new TypedValue(); context.getTheme().resolveAttribute(android.R.attr.colorBackground, defaultColor, true); materialShapeDrawable.setTint(defaultColor.data); } } }
Example #7
Source File: BottomSheetBehavior.java From bottomsheetrecycler with Apache License 2.0 | 6 votes |
private void createMaterialShapeDrawable( Context context, AttributeSet attrs, boolean hasBackgroundTint, @Nullable ColorStateList bottomSheetColor) { if (this.shapeThemingEnabled) { this.shapeAppearanceModelDefault = new ShapeAppearanceModel(context, attrs, R.attr.bottomSheetStyle, DEF_STYLE_RES); this.materialShapeDrawable = new MaterialShapeDrawable(shapeAppearanceModelDefault); this.materialShapeDrawable.initializeElevationOverlay(context); if (hasBackgroundTint && bottomSheetColor != null) { materialShapeDrawable.setFillColor(bottomSheetColor); } else { // If the tint isn't set, use the theme default background color. TypedValue defaultColor = new TypedValue(); context.getTheme().resolveAttribute(android.R.attr.colorBackground, defaultColor, true); materialShapeDrawable.setTint(defaultColor.data); } } }
Example #8
Source File: View.java From Carbon with Apache License 2.0 | 5 votes |
@Override public void setShapeModel(@NotNull ShapeAppearanceModel model) { this.shapeModel = model; shadowDrawable = new MaterialShapeDrawable(shapeModel); if (getWidth() > 0 && getHeight() > 0) updateCorners(); if (!Carbon.IS_LOLLIPOP_OR_HIGHER) postInvalidate(); }
Example #9
Source File: MaterialButtonHelper.java From material-components-android with Apache License 2.0 | 5 votes |
private void updateButtonShape(@NonNull ShapeAppearanceModel shapeAppearanceModel) { if (getMaterialShapeDrawable() != null) { getMaterialShapeDrawable().setShapeAppearanceModel(shapeAppearanceModel); } if (getSurfaceColorStrokeDrawable() != null) { getSurfaceColorStrokeDrawable().setShapeAppearanceModel(shapeAppearanceModel); } if (getMaskDrawable() != null) { getMaskDrawable().setShapeAppearanceModel(shapeAppearanceModel); } }
Example #10
Source File: MaterialButtonToggleGroupTest.java From material-components-android with Apache License 2.0 | 5 votes |
private static void assertShapeAppearance( ShapeAppearanceModel shapeAppearanceModel, float... corners) { RectF ignore = new RectF(); assertThat( new float[]{ shapeAppearanceModel.getTopLeftCornerSize().getCornerSize(ignore), shapeAppearanceModel.getBottomLeftCornerSize().getCornerSize(ignore), shapeAppearanceModel.getTopRightCornerSize().getCornerSize(ignore), shapeAppearanceModel.getBottomRightCornerSize().getCornerSize(ignore) }) .isEqualTo(corners); }
Example #11
Source File: ImageView.java From Carbon with Apache License 2.0 | 5 votes |
@Override public void setShapeModel(@NotNull ShapeAppearanceModel model) { this.shapeModel = model; shadowDrawable = new MaterialShapeDrawable(shapeModel); if (getWidth() > 0 && getHeight() > 0) updateCorners(); if (!Carbon.IS_LOLLIPOP_OR_HIGHER) postInvalidate(); }
Example #12
Source File: ShapeableImageView.java From material-components-android with Apache License 2.0 | 5 votes |
public ShapeableImageView(Context context, @Nullable AttributeSet attrs, int defStyle) { super(wrap(context, attrs, defStyle, DEF_STYLE_RES), attrs, defStyle); // Ensure we are using the correctly themed context rather than the context that was passed in. context = getContext(); clearPaint = new Paint(); clearPaint.setAntiAlias(true); clearPaint.setColor(Color.WHITE); clearPaint.setXfermode(new PorterDuffXfermode(Mode.DST_OUT)); destination = new RectF(); maskRect = new RectF(); maskPath = new Path(); TypedArray attributes = context.obtainStyledAttributes( attrs, R.styleable.ShapeableImageView, defStyle, DEF_STYLE_RES); strokeColor = MaterialResources.getColorStateList( context, attributes, R.styleable.ShapeableImageView_strokeColor); strokeWidth = attributes.getDimensionPixelSize(R.styleable.ShapeableImageView_strokeWidth, 0); borderPaint = new Paint(); borderPaint.setStyle(Style.STROKE); borderPaint.setAntiAlias(true); shapeAppearanceModel = ShapeAppearanceModel.builder(context, attrs, defStyle, DEF_STYLE_RES).build(); if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) { setOutlineProvider(new OutlineProvider()); } }
Example #13
Source File: MaterialButtonToggleGroup.java From material-components-android with Apache License 2.0 | 5 votes |
private static void updateBuilderWithCornerData( ShapeAppearanceModel.Builder shapeAppearanceModelBuilder, @Nullable CornerData cornerData) { if (cornerData == null) { shapeAppearanceModelBuilder.setAllCornerSizes(0); return; } shapeAppearanceModelBuilder .setTopLeftCornerSize(cornerData.topLeft) .setBottomLeftCornerSize(cornerData.bottomLeft) .setTopRightCornerSize(cornerData.topRight) .setBottomRightCornerSize(cornerData.bottomRight); }
Example #14
Source File: MaskEvaluator.java From material-components-android with Apache License 2.0 | 5 votes |
/** Update the mask used by this evaluator based on a given progress. */ void evaluate( float progress, ShapeAppearanceModel startShapeAppearanceModel, ShapeAppearanceModel endShapeAppearanceModel, RectF currentStartBounds, RectF currentStartBoundsMasked, RectF currentEndBoundsMasked, ProgressThresholds shapeMaskThresholds) { // Animate shape appearance corner changes over range of `progress` & use this when // drawing the container background & images float shapeStartFraction = shapeMaskThresholds.getStart(); float shapeEndFraction = shapeMaskThresholds.getEnd(); currentShapeAppearanceModel = lerp( startShapeAppearanceModel, endShapeAppearanceModel, currentStartBounds, currentEndBoundsMasked, shapeStartFraction, shapeEndFraction, progress); pathProvider.calculatePath(currentShapeAppearanceModel, 1, currentStartBoundsMasked, startPath); pathProvider.calculatePath(currentShapeAppearanceModel, 1, currentEndBoundsMasked, endPath); // Union the two paths on API 23 and above. API 21 and 22 have problems with this // call and instead use the start and end paths to clip. if (VERSION.SDK_INT >= VERSION_CODES.M) { path.op(startPath, endPath, Op.UNION); } }
Example #15
Source File: RelativeLayout.java From Carbon with Apache License 2.0 | 5 votes |
@Override public void setShapeModel(@NotNull ShapeAppearanceModel model) { this.shapeModel = model; shadowDrawable = new MaterialShapeDrawable(shapeModel); if (getWidth() > 0 && getHeight() > 0) updateCorners(); if (!Carbon.IS_LOLLIPOP_OR_HIGHER) postInvalidate(); }
Example #16
Source File: DrawerLayout.java From Carbon with Apache License 2.0 | 5 votes |
@Override public void setShapeModel(@NotNull ShapeAppearanceModel model) { this.shapeModel = model; shadowDrawable = new MaterialShapeDrawable(shapeModel); if (getWidth() > 0 && getHeight() > 0) updateCorners(); if (!Carbon.IS_LOLLIPOP_OR_HIGHER) postInvalidate(); }
Example #17
Source File: MaterialContainerTransform.java From material-components-android with Apache License 2.0 | 5 votes |
private static ShapeAppearanceModel captureShapeAppearance( @NonNull View view, @NonNull RectF bounds, @Nullable ShapeAppearanceModel shapeAppearanceModelOverride) { ShapeAppearanceModel shapeAppearanceModel = getShapeAppearance(view, shapeAppearanceModelOverride); return convertToRelativeCornerSizes(shapeAppearanceModel, bounds); }
Example #18
Source File: AppBarLayout.java From Carbon with Apache License 2.0 | 5 votes |
@Override public void setShapeModel(@NotNull ShapeAppearanceModel model) { this.shapeModel = model; shadowDrawable = new MaterialShapeDrawable(shapeModel); if (getWidth() > 0 && getHeight() > 0) updateCorners(); if (!Carbon.IS_LOLLIPOP_OR_HIGHER) postInvalidate(); }
Example #19
Source File: MaterialContainerTransform.java From material-components-android with Apache License 2.0 | 5 votes |
private void drawElevationShadowWithPaintShadowLayer(Canvas canvas) { ShapeAppearanceModel currentShapeAppearanceModel = maskEvaluator.getCurrentShapeAppearanceModel(); if (currentShapeAppearanceModel.isRoundRect(currentMaskBounds)) { // Optimize for the common round rect case, should also account for regular rect float radius = currentShapeAppearanceModel.getTopLeftCornerSize().getCornerSize(currentMaskBounds); canvas.drawRoundRect(currentMaskBounds, radius, radius, shadowPaint); } else { // This will be less performant but should be a minority of cases canvas.drawPath(maskEvaluator.getPath(), shadowPaint); } }
Example #20
Source File: Carbon.java From Carbon with Apache License 2.0 | 5 votes |
public static void initCornerCutRadius(ShapeModelView shapeModelView, TypedArray a, int[] ids) { int carbon_cornerRadiusTopStart = ids[0]; int carbon_cornerRadiusTopEnd = ids[1]; int carbon_cornerRadiusBottomStart = ids[2]; int carbon_cornerRadiusBottomEnd = ids[3]; int carbon_cornerRadius = ids[4]; int carbon_cornerCutTopStart = ids[5]; int carbon_cornerCutTopEnd = ids[6]; int carbon_cornerCutBottomStart = ids[7]; int carbon_cornerCutBottomEnd = ids[8]; int carbon_cornerCut = ids[9]; float cornerRadius = Math.max(a.getDimension(carbon_cornerRadius, 0), 0.1f); float cornerRadiusTopStart = a.getDimension(carbon_cornerRadiusTopStart, cornerRadius); float cornerRadiusTopEnd = a.getDimension(carbon_cornerRadiusTopEnd, cornerRadius); float cornerRadiusBottomStart = a.getDimension(carbon_cornerRadiusBottomStart, cornerRadius); float cornerRadiusBottomEnd = a.getDimension(carbon_cornerRadiusBottomEnd, cornerRadius); float cornerCut = a.getDimension(carbon_cornerCut, 0); float cornerCutTopStart = a.getDimension(carbon_cornerCutTopStart, cornerCut); float cornerCutTopEnd = a.getDimension(carbon_cornerCutTopEnd, cornerCut); float cornerCutBottomStart = a.getDimension(carbon_cornerCutBottomStart, cornerCut); float cornerCutBottomEnd = a.getDimension(carbon_cornerCutBottomEnd, cornerCut); ShapeAppearanceModel model = ShapeAppearanceModel.builder() .setTopLeftCorner(cornerCutTopStart >= cornerRadiusTopStart ? new CutCornerTreatment(cornerCutTopStart) : new RoundedCornerTreatment(cornerRadiusTopStart)) .setTopRightCorner(cornerCutTopEnd >= cornerRadiusTopEnd ? new CutCornerTreatment(cornerCutTopEnd) : new RoundedCornerTreatment(cornerRadiusTopEnd)) .setBottomLeftCorner(cornerCutBottomStart >= cornerRadiusBottomStart ? new CutCornerTreatment(cornerCutBottomStart) : new RoundedCornerTreatment(cornerRadiusBottomStart)) .setBottomRightCorner(cornerCutBottomEnd >= cornerRadiusBottomEnd ? new CutCornerTreatment(cornerCutBottomEnd) : new RoundedCornerTreatment(cornerRadiusBottomEnd)) .build(); shapeModelView.setShapeModel(model); }
Example #21
Source File: LinearLayout.java From Carbon with Apache License 2.0 | 5 votes |
@Override public void setShapeModel(@NotNull ShapeAppearanceModel model) { this.shapeModel = model; shadowDrawable = new MaterialShapeDrawable(shapeModel); if (getWidth() > 0 && getHeight() > 0) updateCorners(); if (!Carbon.IS_LOLLIPOP_OR_HIGHER) postInvalidate(); }
Example #22
Source File: MaterialContainerTransform.java From material-components-android with Apache License 2.0 | 5 votes |
private static ShapeAppearanceModel captureShapeAppearance( @NonNull View view, @NonNull RectF bounds, @Nullable ShapeAppearanceModel shapeAppearanceModelOverride) { ShapeAppearanceModel shapeAppearanceModel = getShapeAppearance(view, shapeAppearanceModelOverride); return convertToRelativeCornerSizes(shapeAppearanceModel, bounds); }
Example #23
Source File: TransitionUtils.java From material-components-android with Apache License 2.0 | 5 votes |
static ShapeAppearanceModel lerp( ShapeAppearanceModel startValue, ShapeAppearanceModel endValue, final RectF startBounds, final RectF endBounds, final @FloatRange(from = 0.0, to = 1.0) float startFraction, final @FloatRange(from = 0.0, to = 1.0) float endFraction, final @FloatRange(from = 0.0, to = 1.0) float fraction) { if (fraction < startFraction) { return startValue; } if (fraction > endFraction) { return endValue; } return transformCornerSizes( startValue, endValue, startBounds, new CornerSizeBinaryOperator() { @NonNull @Override public CornerSize apply( @NonNull CornerSize cornerSize1, @NonNull CornerSize cornerSize2) { float startCornerSize = cornerSize1.getCornerSize(startBounds); float endCornerSize = cornerSize2.getCornerSize(endBounds); float cornerSize = lerp(startCornerSize, endCornerSize, startFraction, endFraction, fraction); return new AbsoluteCornerSize(cornerSize); } }); }
Example #24
Source File: CollapsingToolbarLayout.java From Carbon with Apache License 2.0 | 5 votes |
@Override public void setShapeModel(@NotNull ShapeAppearanceModel model) { this.shapeModel = model; shadowDrawable = new MaterialShapeDrawable(shapeModel); if (getWidth() > 0 && getHeight() > 0) updateCorners(); if (!Carbon.IS_LOLLIPOP_OR_HIGHER) postInvalidate(); }
Example #25
Source File: TransitionUtils.java From material-components-android with Apache License 2.0 | 5 votes |
private static boolean isShapeAppearanceSignificant( ShapeAppearanceModel shapeAppearanceModel, RectF bounds) { return shapeAppearanceModel.getTopLeftCornerSize().getCornerSize(bounds) != 0 || shapeAppearanceModel.getTopRightCornerSize().getCornerSize(bounds) != 0 || shapeAppearanceModel.getBottomRightCornerSize().getCornerSize(bounds) != 0 || shapeAppearanceModel.getBottomLeftCornerSize().getCornerSize(bounds) != 0; }
Example #26
Source File: RecyclerView.java From Carbon with Apache License 2.0 | 5 votes |
@Override public void setShapeModel(@NotNull ShapeAppearanceModel model) { this.shapeModel = model; shadowDrawable = new MaterialShapeDrawable(shapeModel); if (getWidth() > 0 && getHeight() > 0) updateCorners(); if (!Carbon.IS_LOLLIPOP_OR_HIGHER) postInvalidate(); }
Example #27
Source File: TransitionUtils.java From material-components-android with Apache License 2.0 | 5 votes |
static ShapeAppearanceModel convertToRelativeCornerSizes( ShapeAppearanceModel shapeAppearanceModel, final RectF bounds) { return shapeAppearanceModel.withTransformedCornerSizes( new CornerSizeUnaryOperator() { @NonNull @Override public CornerSize apply(@NonNull CornerSize cornerSize) { return cornerSize instanceof RelativeCornerSize ? cornerSize : new RelativeCornerSize(cornerSize.getCornerSize(bounds) / bounds.height()); } }); }
Example #28
Source File: TransitionUtils.java From material-components-android with Apache License 2.0 | 5 votes |
static ShapeAppearanceModel transformCornerSizes( ShapeAppearanceModel shapeAppearanceModel1, ShapeAppearanceModel shapeAppearanceModel2, RectF shapeAppearanceModel1Bounds, CornerSizeBinaryOperator op) { // If all of shapeAppearanceModel's corner sizes are 0, consider the shape appearance // insignificant compared to shapeAppearanceModel2 and use shapeAppearanceModel2's // corner family instead. ShapeAppearanceModel shapeAppearanceModel = isShapeAppearanceSignificant(shapeAppearanceModel1, shapeAppearanceModel1Bounds) ? shapeAppearanceModel1 : shapeAppearanceModel2; return shapeAppearanceModel.toBuilder() .setTopLeftCornerSize( op.apply( shapeAppearanceModel1.getTopLeftCornerSize(), shapeAppearanceModel2.getTopLeftCornerSize())) .setTopRightCornerSize( op.apply( shapeAppearanceModel1.getTopRightCornerSize(), shapeAppearanceModel2.getTopRightCornerSize())) .setBottomLeftCornerSize( op.apply( shapeAppearanceModel1.getBottomLeftCornerSize(), shapeAppearanceModel2.getBottomLeftCornerSize())) .setBottomRightCornerSize( op.apply( shapeAppearanceModel1.getBottomRightCornerSize(), shapeAppearanceModel2.getBottomRightCornerSize())) .build(); }
Example #29
Source File: TransitionUtils.java From material-components-android with Apache License 2.0 | 5 votes |
private static boolean isShapeAppearanceSignificant( ShapeAppearanceModel shapeAppearanceModel, RectF bounds) { return shapeAppearanceModel.getTopLeftCornerSize().getCornerSize(bounds) != 0 || shapeAppearanceModel.getTopRightCornerSize().getCornerSize(bounds) != 0 || shapeAppearanceModel.getBottomRightCornerSize().getCornerSize(bounds) != 0 || shapeAppearanceModel.getBottomLeftCornerSize().getCornerSize(bounds) != 0; }
Example #30
Source File: TransitionUtils.java From material-components-android with Apache License 2.0 | 5 votes |
static ShapeAppearanceModel lerp( ShapeAppearanceModel startValue, ShapeAppearanceModel endValue, final RectF startBounds, final RectF endBounds, final @FloatRange(from = 0.0, to = 1.0) float startFraction, final @FloatRange(from = 0.0, to = 1.0) float endFraction, final @FloatRange(from = 0.0, to = 1.0) float fraction) { if (fraction < startFraction) { return startValue; } if (fraction > endFraction) { return endValue; } return transformCornerSizes( startValue, endValue, startBounds, new CornerSizeBinaryOperator() { @NonNull @Override public CornerSize apply( @NonNull CornerSize cornerSize1, @NonNull CornerSize cornerSize2) { float startCornerSize = cornerSize1.getCornerSize(startBounds); float endCornerSize = cornerSize2.getCornerSize(endBounds); float cornerSize = lerp(startCornerSize, endCornerSize, startFraction, endFraction, fraction); return new AbsoluteCornerSize(cornerSize); } }); }