@@ -168,18 +168,20 @@ export class LottieView extends LottieViewBase {
168168 }
169169 }
170170
171- public setColorValueDelegateForKeyPath ( value : Color , keyPath : string [ ] ) : void {
172- if ( this . nativeViewProtected && value && keyPath && keyPath . length ) {
171+ public setColor ( value : Color , keyPath : string [ ] ) : void {
172+ const nativeView = this . nativeViewProtected ;
173+ if ( nativeView && value && keyPath && keyPath . length ) {
173174 if ( keyPath [ keyPath . length - 1 ] . toLowerCase ( ) === 'color' ) {
175+ keyPath = [ ...keyPath ] ;
174176 keyPath . pop ( ) ; // android specifies the property as an enum parameter.
175177 if ( keyPath . length === 0 ) {
176178 return ;
177179 }
178180 }
179- const nativeKeyPath : java . lang . String [ ] = Array . create ( java . lang . String , keyPath . length ) ;
180- keyPath . forEach ( ( key , index ) => {
181- nativeKeyPath [ index ] = new java . lang . String ( key ) ;
182- } ) ;
181+ const nativeKeyPath : any [ ] = Array . create ( java . lang . String , keyPath . length ) ;
182+ for ( let index = 0 ; index < keyPath . length ; index ++ ) {
183+ nativeKeyPath [ index ] = keyPath [ index ] ;
184+ }
183185 if ( ! LottieProperty ) {
184186 LottieProperty = com . airbnb . lottie . LottieProperty ;
185187 }
@@ -191,16 +193,27 @@ export class LottieView extends LottieViewBase {
191193 LottieKeyPath = com . airbnb . lottie . model . KeyPath ;
192194 }
193195 // by using color filter we change all colors (STROKE_COLOR and COLOR)
196+ // const colorFilter = new android.graphics.PorterDuffColorFilter(value.android, android.graphics.PorterDuff.Mode.SRC_ATOP) ;
194197 const colorFilter = new com . airbnb . lottie . SimpleColorFilter ( value . android ) ;
195- this . nativeViewProtected . addValueCallback (
198+ nativeView . addValueCallback (
196199 new LottieKeyPath ( nativeKeyPath as any ) ,
197200 LottieProperty . COLOR_FILTER ,
198201 new LottieValueCallback ( colorFilter )
199202 ) ;
203+ // nativeView.addValueCallback(
204+ // new LottieKeyPath(nativeKeyPath as any),
205+ // LottieProperty.COLOR,
206+ // new LottieValueCallback(java.lang.Integer.valueOf(value.android))
207+ // );
208+ nativeView . addValueCallback (
209+ new LottieKeyPath ( nativeKeyPath as any ) ,
210+ LottieProperty . COLOR ,
211+ new LottieValueCallback ( java . lang . Integer . valueOf ( value . android ) )
212+ ) ;
200213 }
201214 }
202215
203- public setOpacityValueDelegateForKeyPath ( value : number , keyPath : string [ ] ) : void {
216+ public setOpacity ( value : number , keyPath : string [ ] ) : void {
204217 if ( this . nativeViewProtected && value && keyPath && keyPath . length ) {
205218 if ( keyPath [ keyPath . length - 1 ] . toLowerCase ( ) === 'opacity' ) {
206219 keyPath . pop ( ) ;
0 commit comments