Skip to content

Commit 1222a0f

Browse files
committed
fix(core): some lollipop carsh fixes
1 parent ca30bee commit 1222a0f

File tree

2 files changed

+5
-7
lines changed

2 files changed

+5
-7
lines changed

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

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static ColorStateList getEnabledColorStateList(int color, int disabledCol
5252
}
5353

5454
public static ColorStateList getFullColorStateList(int activeColor, int inactiveColor, int disabledColor) {
55-
int[][] states = new int[][] { new int[] { android.R.attr.state_focused, }, // focused
55+
int[][] states = new int[][] { new int[] { android.R.attr.state_focused, }, // focused
5656
android.util.StateSet.WILD_CARD, // other
5757
new int[] { -android.R.attr.state_enabled } // disabled
5858
};
@@ -67,19 +67,17 @@ public static ShapeDrawable createForegroundShape(float radius) {
6767
}
6868

6969
public static Drawable createRippleDrawable(int rippleColor, float radius) {
70-
if (Build.VERSION.SDK_INT >= 22) {
70+
if (Build.VERSION.SDK_INT >= 21) {
7171
ShapeDrawable rippleShape = radius != 0 ? createForegroundShape(radius) : null;
7272
return new RippleDrawable(ColorStateList.valueOf(rippleColor), null, rippleShape);
7373
} else {
7474
ShapeDrawable rippleShape = createForegroundShape(radius);
7575
StateListDrawable rippleDrawable = new StateListDrawable();
7676
if (rippleShape != null) {
7777
rippleShape.getPaint().setColor(rippleColor);
78-
} else {
79-
8078
}
8179
rippleDrawable.addState(new int[] { statePressed }, rippleShape);
82-
return rippleShape;
80+
return rippleDrawable;
8381
}
8482
}
8583

src/core/index.android.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -216,9 +216,9 @@ class ViewWithElevationAndRipple extends View {
216216
if (!rippleDrawable) {
217217
this.setRippleDrawable(nativeViewProtected, Length.toDevicePixels(this.style.borderTopLeftRadius));
218218
} else {
219-
if (isPostLollipopMR1()) {
219+
if (isPostLollipop()) {
220220
(rippleDrawable as android.graphics.drawable.RippleDrawable).setColor(getColorStateList(rippleColor));
221-
} else {
221+
} else if ((rippleDrawable as any).rippleShape) {
222222
(rippleDrawable as any).rippleShape.getPaint().setColor(rippleColor);
223223
}
224224
}

0 commit comments

Comments
 (0)