Skip to content

Commit

Permalink
[Carousel] Renamed Maskable.getMaskRect to Maskable.getMaskRectF
Browse files Browse the repository at this point in the history
PiperOrigin-RevId: 508626230
  • Loading branch information
hunterstich authored and dsn5ft committed Feb 10, 2023
1 parent fc0f53a commit 4b1a890
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ interface Maskable {

/** Gets a {@link RectF} that this {@link View} is masking itself by. */
@NonNull
RectF getMaskRect();
RectF getMaskRectF();

/** Adds an {@link OnMaskChangedListener}. */
void addOnMaskChangedListener(@NonNull OnMaskChangedListener listener);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ public float getMaskXPercentage() {
/** Gets a {@link RectF} that this {@link View} is masking itself by. */
@NonNull
@Override
public RectF getMaskRect() {
public RectF getMaskRectF() {
return maskRect;
}

Expand Down Expand Up @@ -178,7 +178,7 @@ private static void initMaskOutlineProvider(MaskableFrameLayout maskableFrameLay
new ViewOutlineProvider() {
@Override
public void getOutline(View view, Outline outline) {
RectF maskRect = ((MaskableFrameLayout) view).getMaskRect();
RectF maskRect = ((MaskableFrameLayout) view).getMaskRectF();
float cornerSize = ((MaskableFrameLayout) view).getCornerRadiusFromShapeAppearance();
if (!maskRect.isEmpty()) {
outline.setRoundRect(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ protected KeylineState onFirstChildMeasuredWithMargins(
setAdapterItems(recyclerView, layoutManager, adapter, createDataSetWithSize(1));

MaskableFrameLayout child = (MaskableFrameLayout) recyclerView.getChildAt(0);
assertThat(child.getMaskRect().width()).isEqualTo(450F * .2F);
assertThat(child.getMaskRectF().width()).isEqualTo(450F * .2F);
}

@Test
Expand All @@ -134,10 +134,10 @@ protected KeylineState onFirstChildMeasuredWithMargins(
setAdapterItems(recyclerView, layoutManager, adapter, createDataSetWithSize(10));

MaskableFrameLayout firstChild = (MaskableFrameLayout) recyclerView.getChildAt(0);
int maskLeft = (int) firstChild.getMaskRect().left;
int maskLeft = (int) firstChild.getMaskRectF().left;
MaskableFrameLayout lastChild =
(MaskableFrameLayout) recyclerView.getChildAt(recyclerView.getChildCount() - 1);
int maskRight = (int) (lastChild.getWidth() - lastChild.getMaskRect().right);
int maskRight = (int) (lastChild.getWidth() - lastChild.getMaskRectF().right);

assertThat(firstChild.getLeft() + maskLeft).isEqualTo(0);
assertThat(lastChild.getRight() - maskRight).isEqualTo(DEFAULT_RECYCLER_VIEW_WIDTH);
Expand Down

0 comments on commit 4b1a890

Please sign in to comment.