@@ -65,7 +65,7 @@ public MaskableFrameLayout(
6565 @ Override
6666 protected void onSizeChanged (int w , int h , int oldw , int oldh ) {
6767 super .onSizeChanged (w , h , oldw , oldh );
68- onMaskChanged ();
68+ updateMaskRect ();
6969 }
7070
7171 @ Override
@@ -123,13 +123,17 @@ public void setMaskXPercentage(float percentage) {
123123 percentage = MathUtils .clamp (percentage , 0F , 1F );
124124 if (maskXPercentage != percentage ) {
125125 this .maskXPercentage = percentage ;
126- // Translate the percentage into an actual pixel value of how much of this view should be
127- // masked away.
128- float maskWidth = AnimationUtils .lerp (0f , getWidth () / 2F , 0f , 1f , maskXPercentage );
129- setMaskRectF (new RectF (maskWidth , 0F , (getWidth () - maskWidth ), getHeight ()));
126+ updateMaskRect ();
130127 }
131128 }
132129
130+ private void updateMaskRect () {
131+ // Translate the percentage into an actual pixel value of how much of this view should be
132+ // masked away.
133+ float maskWidth = AnimationUtils .lerp (0f , getWidth () / 2F , 0f , 1f , maskXPercentage );
134+ setMaskRectF (new RectF (maskWidth , 0F , (getWidth () - maskWidth ), getHeight ()));
135+ }
136+
133137 /**
134138 * Sets the {@link RectF} that this {@link View} will be masked by.
135139 *
0 commit comments