|
1 | 1 | import { getRippleColor, rippleColorProperty, themer } from '@nativescript-community/ui-material-core'; |
2 | | -import { Background, Color, backgroundInternalProperty } from '@nativescript/core'; |
3 | | -import { createRippleDrawable, getAttrColor, getColorStateList, isPostLollipopMR1, isPostMarshmallow } from '@nativescript-community/ui-material-core/android/utils'; |
| 2 | +import { createRippleDrawable, getColorStateList, isPostLollipopMR1, isPostMarshmallow } from '@nativescript-community/ui-material-core/android/utils'; |
| 3 | +import { Background, Color, Length, backgroundInternalProperty } from '@nativescript/core'; |
4 | 4 | import { RippleBase } from './ripple-common'; |
5 | 5 |
|
6 | 6 | let MDStackLayout: typeof org.nativescript.widgets.StackLayout; |
7 | 7 |
|
8 | 8 | const DEFAULT_STROKE_VALUE = -1; |
9 | 9 | function initMDStackLayout() { |
10 | 10 | if (!MDStackLayout) { |
11 | | - if (isPostLollipopMR1()) { |
| 11 | + if (isPostLollipopMR1) { |
12 | 12 | MDStackLayout = org.nativescript.widgets.StackLayout; |
13 | 13 | } else { |
14 | 14 | initializePreLollipopStackLayout(); |
@@ -213,19 +213,25 @@ export class Ripple extends RippleBase { |
213 | 213 | } |
214 | 214 | return getRippleColor(themer.getAccentColor()); |
215 | 215 | } |
216 | | - setRippleDrawable(view: android.view.View, radius = 0) { |
| 216 | + setRippleDrawable(view: android.view.View, topLeftRadius = 0, topRightRadius = 0, bottomRightRadius = 0, bottomLeftRadius = 0) { |
217 | 217 | if (!this.rippleDrawable) { |
218 | | - this.rippleDrawable = createRippleDrawable(this.getRippleColor(), radius); |
219 | | - if (isPostMarshmallow()) { |
| 218 | + this.rippleDrawable = createRippleDrawable(this.getRippleColor(), topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius); |
| 219 | + if (isPostMarshmallow) { |
220 | 220 | view.setForeground(this.rippleDrawable); |
221 | 221 | } |
222 | 222 | } |
223 | 223 | } |
224 | 224 | [rippleColorProperty.setNative](color: Color) { |
225 | 225 | if (!this.rippleDrawable) { |
226 | | - this.setRippleDrawable(this.nativeViewProtected); |
| 226 | + this.setRippleDrawable( |
| 227 | + this.nativeViewProtected, |
| 228 | + Length.toDevicePixels(this.style.borderTopLeftRadius), |
| 229 | + Length.toDevicePixels(this.style.borderTopRightRadius), |
| 230 | + Length.toDevicePixels(this.style.borderBottomRightRadius), |
| 231 | + Length.toDevicePixels(this.style.borderBottomLeftRadius) |
| 232 | + ); |
227 | 233 | } else { |
228 | | - if (isPostLollipopMR1()) { |
| 234 | + if (isPostLollipopMR1) { |
229 | 235 | (this.rippleDrawable as android.graphics.drawable.RippleDrawable).setColor(getColorStateList(color.android)); |
230 | 236 | } else { |
231 | 237 | (this.rippleDrawable as any).rippleShape.getPaint().setColor(getRippleColor(color)); |
|
0 commit comments