Skip to content

Commit 88fc4f7

Browse files
committed
[Internal] Fix drawable compositing on API < 23
1 parent c2051db commit 88fc4f7

1 file changed

Lines changed: 5 additions & 8 deletions

File tree

lib/java/com/google/android/material/drawable/DrawableUtils.java

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -239,9 +239,9 @@ public static Drawable compositeTwoLayeredDrawable(
239239
* @param bottomLayerDrawable the drawable to be on the bottom layer
240240
* @param topLayerDrawable the drawable to be on the top layer
241241
* @param topLayerDesiredWidth top layer desired width in pixels, or {@link #INTRINSIC_SIZE} to
242-
* use the intrinsic width.
242+
* use the intrinsic width as the desired one.
243243
* @param topLayerDesiredHeight top layer desired height in pixels, or {@link #INTRINSIC_SIZE} to
244-
* use the intrinsic height.
244+
* use the intrinsic height as the desired one.
245245
*/
246246
@Nullable
247247
public static Drawable compositeTwoLayeredDrawable(
@@ -256,8 +256,6 @@ public static Drawable compositeTwoLayeredDrawable(
256256
return bottomLayerDrawable;
257257
}
258258

259-
boolean shouldScaleTopLayer =
260-
topLayerDesiredWidth != INTRINSIC_SIZE && topLayerDesiredHeight != INTRINSIC_SIZE;
261259
if (topLayerDesiredWidth == INTRINSIC_SIZE) {
262260
topLayerDesiredWidth = getTopLayerIntrinsicWidth(bottomLayerDrawable, topLayerDrawable);
263261
}
@@ -298,10 +296,9 @@ public static Drawable compositeTwoLayeredDrawable(
298296
drawable.setLayerSize(1, topLayerNewWidth, topLayerNewHeight);
299297
drawable.setLayerGravity(1, Gravity.CENTER);
300298
} else {
301-
if (shouldScaleTopLayer) {
302-
topLayerDrawable =
303-
new ScaledDrawableWrapper(topLayerDrawable, topLayerNewWidth, topLayerNewHeight);
304-
}
299+
topLayerDrawable =
300+
new ScaledDrawableWrapper(topLayerDrawable, topLayerNewWidth, topLayerNewHeight);
301+
305302
drawable = new LayerDrawable(new Drawable[] {bottomLayerDrawable, topLayerDrawable});
306303

307304
final int horizontalInset =

0 commit comments

Comments
 (0)