Skip to content

Commit 43c5077

Browse files
hunterstichpaulfthomas
authored andcommittedMar 16, 2023
[Carousel] Updated MaskableFrameLayout to use Outline path clipping on 33+ only.
PiperOrigin-RevId: 517128236
1 parent 3f99392 commit 43c5077

File tree

2 files changed

+11
-11
lines changed

2 files changed

+11
-11
lines changed
 

‎lib/java/com/google/android/material/carousel/MaskableFrameLayout.java

+8-8
Original file line numberDiff line numberDiff line change
@@ -71,8 +71,8 @@ public MaskableFrameLayout(
7171
}
7272

7373
private MaskableDelegate createMaskableDelegate() {
74-
if (VERSION.SDK_INT >= VERSION_CODES.R) {
75-
return new MaskableDelegateV30(this);
74+
if (VERSION.SDK_INT >= VERSION_CODES.TIRAMISU) {
75+
return new MaskableDelegateV33(this);
7676
} else if (VERSION.SDK_INT >= VERSION_CODES.LOLLIPOP) {
7777
return new MaskableDelegateV21(this);
7878
} else {
@@ -303,7 +303,7 @@ void invalidateClippingMethod(View view) {
303303
}
304304

305305
/**
306-
* A {@link MaskableDelegate} for API 21-29 that uses {@link ViewOutlineProvider} to clip when the
306+
* A {@link MaskableDelegate} for API 21-32 that uses {@link ViewOutlineProvider} to clip when the
307307
* shape being clipped is a round rect with symmetrical corners and canvas clipping for all other
308308
* shapes.
309309
*
@@ -366,16 +366,16 @@ public void getOutline(View view, Outline outline) {
366366
}
367367

368368
/**
369-
* A {@link MaskableDelegate} for API 30+ that uses {@link ViewOutlineProvider} to clip for
369+
* A {@link MaskableDelegate} for API 33+ that uses {@link ViewOutlineProvider} to clip for
370370
* all shapes.
371371
*
372-
* <p>{@link Outline#setPath(Path)} was added in API 30 and allows using {@link
372+
* <p>{@link Outline#setPath(Path)} was added in API 33 and allows using {@link
373373
* ViewOutlineProvider} to clip for all shapes.
374374
*/
375-
@RequiresApi(VERSION_CODES.R)
376-
private static class MaskableDelegateV30 extends MaskableDelegate {
375+
@RequiresApi(VERSION_CODES.TIRAMISU)
376+
private static class MaskableDelegateV33 extends MaskableDelegate {
377377

378-
MaskableDelegateV30(View view) {
378+
MaskableDelegateV33(View view) {
379379
initMaskOutlineProvider(view);
380380
}
381381

‎lib/javatests/com/google/android/material/carousel/MaskableFrameLayoutTest.java

+3-3
Original file line numberDiff line numberDiff line change
@@ -113,10 +113,10 @@ public void testCutCornersApi21_doesNotUseViewOutlineProvider() {
113113
assertThat(maskableFrameLayout.getClipToOutline()).isFalse();
114114
}
115115

116-
@RequiresApi(api = VERSION_CODES.R)
117-
@Config(sdk = VERSION_CODES.R)
116+
@RequiresApi(api = VERSION_CODES.TIRAMISU)
117+
@Config(sdk = VERSION_CODES.TIRAMISU)
118118
@Test
119-
public void testCutCornersApi30_usesViewOutlineProvider() {
119+
public void testCutCornersApi33_usesViewOutlineProvider() {
120120
MaskableFrameLayout maskableFrameLayout = createMaskableFrameLayoutWithSize(50, 50);
121121
ShapeAppearanceModel model =
122122
new ShapeAppearanceModel.Builder()

0 commit comments

Comments
 (0)