@@ -0,0 +1,2725 @@
+/*%0A * Copyright (C) 2022 The Android Open Source Project%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *      http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License.%0A */%0A%0Apackage com.google.android.material.internal;%0A%0Aimport static androidx.annotation.RestrictTo.Scope.LIBRARY_GROUP;%0A%0Aimport android.content.Context;%0Aimport android.graphics.Canvas;%0Aimport android.graphics.Path;%0Aimport android.graphics.Rect;%0Aimport android.graphics.RectF;%0Aimport android.util.AttributeSet;%0Aimport android.widget.FrameLayout;%0Aimport androidx.annotation.NonNull;%0Aimport androidx.annotation.Nullable;%0Aimport androidx.annotation.RestrictTo;%0A%0A/**%0A * Wrapper layout for rendering and animating rounded corners with clip bounds.%0A *%0A * @hide%0A */%0A@RestrictTo(LIBRARY_GROUP)%0Apublic class ClippableRoundedCornerLayout extends FrameLayout %7B%0A%0A  @Nullable private Path path;%0A%0A  public ClippableRoundedCornerLayout(@NonNull Context context) %7B%0A    super(context);%0A  %7D%0A%0A  public ClippableRoundedCornerLayout(@NonNull Context context, @Nullable AttributeSet attrs) %7B%0A    super(context, attrs);%0A  %7D%0A%0A  public ClippableRoundedCornerLayout(%0A      @NonNull Context context, @Nullable AttributeSet attrs, int defStyleAttr) %7B%0A    super(context, attrs, defStyleAttr);%0A  %7D%0A%0A  @Override%0A  protected void dispatchDraw(Canvas canvas) %7B%0A    if (path == null) %7B%0A      super.dispatchDraw(canvas);%0A      return;%0A    %7D%0A    int save = canvas.save();%0A    canvas.clipPath(path);%0A    super.dispatchDraw(canvas);%0A    canvas.restoreToCount(save);%0A  %7D%0A%0A  public void resetClipBoundsAndCornerRadius() %7B%0A    path = null;%0A    invalidate();%0A  %7D%0A%0A  public void updateClipBoundsAndCornerRadius(@NonNull Rect rect, float cornerRadius) %7B%0A    updateClipBoundsAndCornerRadius(rect.left, rect.top, rect.right, rect.bottom, cornerRadius);%0A  %7D%0A%0A  public void updateClipBoundsAndCornerRadius(%0A      float left, float top, float right, float bottom, float cornerRadius) %7B%0A    updateClipBoundsAndCornerRadius(new RectF(left, top, right, bottom), cornerRadius);%0A  %7D%0A%0A  public void updateClipBoundsAndCornerRadius(@NonNull RectF rectF, float cornerRadius) %7B%0A    if (path == null) %7B%0A      path = new Path();%0A    %7D%0A    path.reset();%0A    path.addRoundRect(rectF, cornerRadius, cornerRadius, Path.Direction.CW);%0A    path.close();%0A    invalidate();%0A  %7D%0A%7D%0A

Move ClippableRoundedCornerLayout to Material Android library.