Skip to content

Commit 8355a2a

Browse files
committed
fix(core): fix aandroid crash with ripple on < 22
1 parent 918d4e6 commit 8355a2a

File tree

1 file changed

+7
-2
lines changed
  • packages/core/platforms/android/java/com/nativescript/material/core

1 file changed

+7
-2
lines changed

packages/core/platforms/android/java/com/nativescript/material/core/Utils.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,12 +67,17 @@ public static ShapeDrawable createForegroundShape(float radius) {
6767
}
6868

6969
public static Drawable createRippleDrawable(int rippleColor, float radius) {
70-
ShapeDrawable rippleShape = radius != 0 ? createForegroundShape(radius) : null;
7170
if (Build.VERSION.SDK_INT >= 22) {
71+
ShapeDrawable rippleShape = radius != 0 ? createForegroundShape(radius) : null;
7272
return new RippleDrawable(ColorStateList.valueOf(rippleColor), null, rippleShape);
7373
} else {
74+
ShapeDrawable rippleShape = createForegroundShape(radius);
7475
StateListDrawable rippleDrawable = new StateListDrawable();
75-
rippleShape.getPaint().setColor(rippleColor);
76+
if (rippleShape != null) {
77+
rippleShape.getPaint().setColor(rippleColor);
78+
} else {
79+
80+
}
7681
rippleDrawable.addState(new int[] { statePressed }, rippleShape);
7782
return rippleShape;
7883
}

0 commit comments

Comments
 (0)