Skip to content

Commit 0f0921d

Browse files
ymarianldjcmu
authored andcommitted
Fix ripple in Fab Minis
PiperOrigin-RevId: 246370664
1 parent c71b6cc commit 0f0921d

File tree

3 files changed

+6
-5
lines changed

3 files changed

+6
-5
lines changed

lib/java/com/google/android/material/floatingactionbutton/FloatingActionButton.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -249,7 +249,8 @@ public FloatingActionButton(Context context, @Nullable AttributeSet attrs, int d
249249
expandableWidgetHelper = new ExpandableWidgetHelper(this);
250250

251251
getImpl().setShapeAppearance(shapeAppearance, usingDefaultCorner);
252-
getImpl().setBackgroundDrawable(backgroundTint, backgroundTintMode, rippleColor, borderWidth);
252+
getImpl()
253+
.initializeBackgroundDrawable(backgroundTint, backgroundTintMode, rippleColor, borderWidth);
253254
getImpl().setMinTouchTargetSize(minTouchTargetSize);
254255
getImpl().setElevation(elevation);
255256
getImpl().setHoveredFocusedTranslationZ(hoveredFocusedTranslationZ);

lib/java/com/google/android/material/floatingactionbutton/FloatingActionButtonImpl.java

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@
5151
import com.google.android.material.shape.MaterialShapeDrawable;
5252
import com.google.android.material.shape.ShapeAppearanceModel;
5353
import androidx.core.graphics.drawable.DrawableCompat;
54+
import androidx.core.util.Preconditions;
5455
import androidx.core.view.ViewCompat;
5556
import android.view.View;
5657
import android.view.ViewTreeObserver;
@@ -175,7 +176,7 @@ interface InternalVisibilityChangedListener {
175176
rotation = this.view.getRotation();
176177
}
177178

178-
void setBackgroundDrawable(
179+
void initializeBackgroundDrawable(
179180
ColorStateList backgroundTint,
180181
PorterDuff.Mode backgroundTintMode,
181182
ColorStateList rippleColor,
@@ -200,7 +201,6 @@ void setBackgroundDrawable(
200201
checkNotNull(shapeDrawable),
201202
touchFeedbackShape};
202203
contentBackground = new LayerDrawable(layers);
203-
shadowViewDelegate.setBackgroundDrawable(contentBackground);
204204
}
205205

206206
void setBackgroundTintList(@Nullable ColorStateList tint) {
@@ -662,6 +662,7 @@ void getPadding(Rect rect) {
662662
}
663663

664664
void onPaddingUpdated(Rect padding) {
665+
Preconditions.checkNotNull(contentBackground, "Didn't initialize content background");
665666
if (shouldAddPadding()) {
666667
InsetDrawable insetDrawable = new InsetDrawable(
667668
contentBackground, padding.left, padding.top, padding.right, padding.bottom);

lib/java/com/google/android/material/floatingactionbutton/FloatingActionButtonImplLollipop.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ class FloatingActionButtonImplLollipop extends FloatingActionButtonImpl {
5454
}
5555

5656
@Override
57-
void setBackgroundDrawable(
57+
void initializeBackgroundDrawable(
5858
ColorStateList backgroundTint,
5959
PorterDuff.Mode backgroundTintMode,
6060
ColorStateList rippleColor,
@@ -82,7 +82,6 @@ void setBackgroundDrawable(
8282
RippleUtils.convertToRippleDrawableColor(rippleColor), rippleContent, null);
8383

8484
contentBackground = rippleDrawable;
85-
shadowViewDelegate.setBackgroundDrawable(contentBackground);
8685
}
8786

8887
@Override

0 commit comments

Comments
 (0)