1
- import {
2
- Application ,
3
- Background ,
4
- Button ,
5
- Color ,
6
- Length ,
7
- PercentLength ,
8
- Utils ,
9
- View ,
10
- androidDynamicElevationOffsetProperty ,
11
- androidElevationProperty ,
12
- backgroundInternalProperty
13
- } from '@nativescript/core' ;
14
- import { createRippleDrawable , createStateListAnimator , getAttrColor , getColorStateList , handleClearFocus , isPostLollipop , isPostLollipopMR1 , isPostMarshmallow } from './android/utils' ;
15
- import { CornerFamily , applyMixins } from './index.common' ;
16
- import { cssProperty , dynamicElevationOffsetProperty , elevationProperty , rippleColorProperty } from './cssproperties' ;
1
+ import { Background , Button , Color , Length , PercentLength , Utils , View , androidDynamicElevationOffsetProperty , androidElevationProperty , backgroundInternalProperty } from '@nativescript/core' ;
17
2
import { ad } from '@nativescript/core/utils' ;
18
3
import { ShapeProperties } from '.' ;
4
+ import { createRippleDrawable , createStateListAnimator , getAttrColor , getColorStateList , handleClearFocus , isPostLollipop , isPostMarshmallow } from './android/utils' ;
5
+ import { cssProperty , dynamicElevationOffsetProperty , elevationProperty , rippleColorProperty } from './cssproperties' ;
6
+ import { CornerFamily , applyMixins } from './index.common' ;
19
7
export * from './cssproperties' ;
20
8
export { applyMixins } ;
21
9
@@ -232,9 +220,9 @@ export function overrideViewBase() {
232
220
return getRippleColor ( themer . getAccentColor ( ) ) ;
233
221
}
234
222
235
- setRippleDrawable ( view : android . view . View , radius = 0 ) {
223
+ setRippleDrawable ( view : android . view . View , topLeftRadius = 0 , topRightRadius = 0 , bottomRightRadius = 0 , bottomLeftRadius = 0 ) {
236
224
if ( ! this . rippleDrawable ) {
237
- this . rippleDrawable = createRippleDrawable ( this . getRippleColor ( ) , radius ) ;
225
+ this . rippleDrawable = createRippleDrawable ( this . getRippleColor ( ) , topLeftRadius , topRightRadius , bottomRightRadius , bottomLeftRadius ) ;
238
226
if ( isPostMarshmallow ) {
239
227
view . setForeground ( this . rippleDrawable ) ;
240
228
}
@@ -259,7 +247,13 @@ export function overrideViewBase() {
259
247
nativeViewProtected . setClickable ( this . isUserInteractionEnabled ) ;
260
248
const rippleDrawable = this . rippleDrawable ;
261
249
if ( ! rippleDrawable ) {
262
- this . setRippleDrawable ( nativeViewProtected , Length . toDevicePixels ( this . style . borderTopLeftRadius ) ) ;
250
+ this . setRippleDrawable (
251
+ nativeViewProtected ,
252
+ Length . toDevicePixels ( this . style . borderTopLeftRadius ) ,
253
+ Length . toDevicePixels ( this . style . borderTopRightRadius ) ,
254
+ Length . toDevicePixels ( this . style . borderBottomRightRadius ) ,
255
+ Length . toDevicePixels ( this . style . borderBottomLeftRadius )
256
+ ) ;
263
257
} else {
264
258
if ( isPostLollipop ) {
265
259
( rippleDrawable as android . graphics . drawable . RippleDrawable ) . setColor ( getColorStateList ( rippleColor ) ) ;
@@ -277,7 +271,13 @@ export function overrideViewBase() {
277
271
// native button have on the background. Setting color will remove the ripple!
278
272
if ( this . rippleDrawable || ( value . color && this instanceof Button && this . rippleColor ) ) {
279
273
this . rippleDrawable = null ;
280
- this . setRippleDrawable ( this . nativeViewProtected , value . borderTopLeftRadius ) ;
274
+ this . setRippleDrawable (
275
+ this . nativeViewProtected ,
276
+ Length . toDevicePixels ( this . style . borderTopLeftRadius ) ,
277
+ Length . toDevicePixels ( this . style . borderTopRightRadius ) ,
278
+ Length . toDevicePixels ( this . style . borderBottomRightRadius ) ,
279
+ Length . toDevicePixels ( this . style . borderBottomLeftRadius )
280
+ ) ;
281
281
}
282
282
}
283
283
}
0 commit comments