Skip to content

Commit

Permalink
[Carousel] Deprecate set/get mask x percentages in Maskable as they a…
Browse files Browse the repository at this point in the history
…re no longer used anywhere, and is a misleading method due to these methods not actually having any effect on the Carousel as CarouselLayoutManager overrides the values.

PiperOrigin-RevId: 542347361
  • Loading branch information
imhappi authored and raajkumars committed Jun 26, 2023
1 parent bdef355 commit 29d8742
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 0 deletions.
4 changes: 4 additions & 0 deletions lib/java/com/google/android/material/carousel/Maskable.java
Expand Up @@ -32,15 +32,19 @@ interface Maskable {
* implementing view to calculate the correct rect given the mask percentage.
*
* @param percentage 0 when this view is fully unmasked. 1 when this view is fully masked.
* @deprecated {@link CarouselLayoutManager} calculates its own mask percentages.
*/
@Deprecated
void setMaskXPercentage(@FloatRange(from = 0F, to = 1F) float percentage);

/**
* Gets the percentage by which this {@link View} should mask itself along the x axis.
*
* @return a float between 0 and 1 where 0 is fully unmasked and 1 is fully masked.
* @deprecated {@link CarouselLayoutManager} calculates its own mask percentages.
*/
@FloatRange(from = 0F, to = 1F)
@Deprecated
float getMaskXPercentage();

/**
Expand Down
Expand Up @@ -114,8 +114,11 @@ public ShapeAppearanceModel getShapeAppearanceModel() {
* Sets the percentage by which this {@link View} masks by along the x axis.
*
* @param percentage 0 when this view is fully unmasked. 1 when this view is fully masked.
* @deprecated This is no longer used as {@link CarouselLayoutManager} calculates its own mask
* percentages.
*/
@Override
@Deprecated
public void setMaskXPercentage(float percentage) {
percentage = MathUtils.clamp(percentage, 0F, 1F);
if (maskXPercentage != percentage) {
Expand All @@ -142,8 +145,11 @@ public void setMaskRectF(@NonNull RectF maskRect) {
* Gets the percentage by which this {@link View} is masked by along the x axis.
*
* @return a float between 0 and 1 where 0 is fully unmasked and 1 is fully masked.
* @deprecated This is no longer used as {@link CarouselLayoutManager} calculates its own mask
* percentages.
*/
@Override
@Deprecated
public float getMaskXPercentage() {
return maskXPercentage;
}
Expand Down

0 comments on commit 29d8742

Please sign in to comment.