@nativescript-community/ui-image 4.3.10 → 4.3.12
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +11 -333
- package/index-common.d.ts +30 -30
- package/index-common.js +159 -78
- package/index.android.d.ts +2 -0
- package/index.android.js +204 -227
- package/index.ios.js +6 -6
- package/package.json +2 -2
- package/platforms/android/include.gradle +1 -0
- package/platforms/android/java/com/nativescript/image/DraweeView.java +96 -4
- package/platforms/android/ui_image.aar +0 -0
- package/typings/android.d.ts +1 -0
package/index.android.js
CHANGED
@@ -1,10 +1,8 @@
|
|
1
1
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j, _k, _l, _m, _o, _p, _q, _r, _s, _t;
|
2
2
|
export * from './index-common';
|
3
|
-
import {
|
4
|
-
import { android as androidApp } from '@nativescript/core/application';
|
3
|
+
import { Application, Background, Color, ImageAsset, ImageSource, Trace, Utils, backgroundInternalProperty, knownFolders, path } from '@nativescript/core';
|
5
4
|
import { isString } from '@nativescript/core/utils/types';
|
6
|
-
import { CLog, CLogTypes, EventData, ImageBase, ScaleType } from './index-common';
|
7
|
-
import { layout } from '@nativescript/core/utils/layout-helper';
|
5
|
+
import { CLog, CLogTypes, EventData, ImageBase, ScaleType, aspectRatioProperty, backgroundUriProperty, blurDownSamplingProperty, blurRadiusProperty, fadeDurationProperty, failureImageUriProperty, imageRotationProperty, lowerResSrcProperty, placeholderImageUriProperty, progressBarColorProperty, roundAsCircleProperty, roundBottomLeftRadiusProperty, roundBottomRightRadiusProperty, roundTopLeftRadiusProperty, roundTopRightRadiusProperty, showProgressBarProperty, srcProperty, stretchProperty, tintColorProperty } from './index-common';
|
8
6
|
let initialized = false;
|
9
7
|
let initializeConfig;
|
10
8
|
export function initialize(config) {
|
@@ -42,14 +40,16 @@ export function initialize(config) {
|
|
42
40
|
initializeConfig = null;
|
43
41
|
}
|
44
42
|
}
|
43
|
+
let imagePineLine;
|
45
44
|
export function getImagePipeline() {
|
46
|
-
if (
|
47
|
-
|
48
|
-
|
49
|
-
|
50
|
-
|
45
|
+
if (!imagePineLine) {
|
46
|
+
if (Application.android.nativeApp) {
|
47
|
+
const nativePipe = com.facebook.drawee.backends.pipeline.Fresco.getImagePipeline();
|
48
|
+
imagePineLine = new ImagePipeline();
|
49
|
+
imagePineLine.android = nativePipe;
|
50
|
+
}
|
51
51
|
}
|
52
|
-
return
|
52
|
+
return imagePineLine;
|
53
53
|
}
|
54
54
|
export function shutDown() {
|
55
55
|
if (!initialized) {
|
@@ -59,7 +59,7 @@ export function shutDown() {
|
|
59
59
|
com.facebook.drawee.view.SimpleDraweeView.shutDown();
|
60
60
|
com.facebook.drawee.backends.pipeline.Fresco.shutDown();
|
61
61
|
}
|
62
|
-
function getUri(src) {
|
62
|
+
function getUri(src, asNative = true) {
|
63
63
|
let uri;
|
64
64
|
let imagePath;
|
65
65
|
if (src instanceof ImageAsset) {
|
@@ -73,20 +73,24 @@ function getUri(src) {
|
|
73
73
|
const resName = imagePath.substring(Utils.RESOURCE_PREFIX.length);
|
74
74
|
const identifier = Utils.ad.resources.getDrawableId(resName);
|
75
75
|
if (0 < identifier) {
|
76
|
-
|
76
|
+
const netUri = new android.net.Uri.Builder().scheme(com.facebook.common.util.UriUtil.LOCAL_RESOURCE_SCHEME).path(java.lang.String.valueOf(identifier)).build();
|
77
|
+
if (asNative) {
|
78
|
+
return netUri;
|
79
|
+
}
|
80
|
+
uri = netUri.toString();
|
77
81
|
}
|
78
82
|
}
|
79
83
|
else if (imagePath.indexOf('~/') === 0) {
|
80
|
-
uri =
|
84
|
+
uri = `file:${path.join(knownFolders.currentApp().path, imagePath.replace('~/', ''))}`;
|
81
85
|
}
|
82
86
|
else if (imagePath.indexOf('/') === 0) {
|
83
|
-
uri =
|
87
|
+
uri = `file:${imagePath}`;
|
84
88
|
}
|
85
89
|
}
|
86
90
|
else {
|
87
|
-
uri =
|
91
|
+
uri = imagePath;
|
88
92
|
}
|
89
|
-
return uri;
|
93
|
+
return asNative ? android.net.Uri.parse(uri) : uri;
|
90
94
|
}
|
91
95
|
export class ImagePipeline {
|
92
96
|
toUri(value) {
|
@@ -263,7 +267,7 @@ export const needRequestImage = function (target, propertyKey, descriptor) {
|
|
263
267
|
this._needRequestImage = true;
|
264
268
|
// we need to ensure a hierarchy is set or the default aspect ratio wont be set
|
265
269
|
// because aspectFit is the default (wanted) but then we wont go into stretchProperty.setNative
|
266
|
-
this._needUpdateHierarchy = true;
|
270
|
+
// this._needUpdateHierarchy = true;
|
267
271
|
return;
|
268
272
|
}
|
269
273
|
return originalMethod.apply(this, args);
|
@@ -285,7 +289,7 @@ export class Img extends ImageBase {
|
|
285
289
|
this.isLoading = false;
|
286
290
|
this._canRequestImage = true;
|
287
291
|
this._canUpdateHierarchy = true;
|
288
|
-
this._needUpdateHierarchy =
|
292
|
+
this._needUpdateHierarchy = false;
|
289
293
|
this._needRequestImage = false;
|
290
294
|
}
|
291
295
|
onResumeNativeUpdates() {
|
@@ -336,9 +340,10 @@ export class Img extends ImageBase {
|
|
336
340
|
// this.initDrawee();
|
337
341
|
// this.updateHierarchy();
|
338
342
|
// }
|
339
|
-
|
340
|
-
|
341
|
-
|
343
|
+
disposeNativeView() {
|
344
|
+
this.controllerListener = null;
|
345
|
+
// this.nativeImageViewProtected.setImageURI(null, null);
|
346
|
+
}
|
342
347
|
updateImageUri() {
|
343
348
|
const imagePipeLine = getImagePipeline();
|
344
349
|
const src = this.src;
|
@@ -352,81 +357,72 @@ export class Img extends ImageBase {
|
|
352
357
|
this.src = null;
|
353
358
|
this.src = src;
|
354
359
|
}
|
355
|
-
[_a =
|
360
|
+
[_a = placeholderImageUriProperty.setNative]() {
|
356
361
|
this.updateHierarchy();
|
357
362
|
}
|
358
|
-
[_b =
|
363
|
+
[_b = failureImageUriProperty.setNative]() {
|
359
364
|
this.updateHierarchy();
|
360
365
|
}
|
361
|
-
[_c =
|
366
|
+
[_c = stretchProperty.setNative]() {
|
362
367
|
this.updateHierarchy();
|
363
368
|
}
|
364
|
-
[_d =
|
369
|
+
[_d = fadeDurationProperty.setNative]() {
|
365
370
|
this.updateHierarchy();
|
366
371
|
}
|
367
|
-
[_e =
|
372
|
+
[_e = backgroundUriProperty.setNative]() {
|
368
373
|
this.updateHierarchy();
|
369
374
|
}
|
370
|
-
[_f =
|
375
|
+
[_f = showProgressBarProperty.setNative]() {
|
371
376
|
this.updateHierarchy();
|
372
377
|
}
|
373
|
-
[_g =
|
378
|
+
[_g = progressBarColorProperty.setNative]() {
|
374
379
|
this.updateHierarchy();
|
375
380
|
}
|
376
|
-
[_h =
|
381
|
+
[_h = roundAsCircleProperty.setNative]() {
|
377
382
|
this.updateHierarchy();
|
378
383
|
}
|
379
|
-
[_j =
|
384
|
+
[_j = roundTopLeftRadiusProperty.setNative]() {
|
380
385
|
this.updateHierarchy();
|
381
386
|
}
|
382
|
-
[
|
387
|
+
[imageRotationProperty.setNative](value) {
|
383
388
|
const scaleType = this.nativeImageViewProtected.getHierarchy().getActualImageScaleType();
|
384
389
|
scaleType['setImageRotation']?.(value);
|
385
390
|
this.nativeImageViewProtected.invalidate();
|
386
391
|
}
|
387
|
-
[_k =
|
392
|
+
[_k = roundTopRightRadiusProperty.setNative]() {
|
388
393
|
this.updateHierarchy();
|
389
394
|
}
|
390
|
-
[_l =
|
395
|
+
[_l = roundBottomLeftRadiusProperty.setNative]() {
|
391
396
|
this.updateHierarchy();
|
392
397
|
}
|
393
|
-
[_m =
|
398
|
+
[_m = roundBottomRightRadiusProperty.setNative]() {
|
394
399
|
this.updateHierarchy();
|
395
400
|
}
|
396
|
-
[_o =
|
401
|
+
[_o = tintColorProperty.setNative](value) {
|
397
402
|
this.updateHierarchy();
|
398
403
|
}
|
399
|
-
[_p =
|
404
|
+
[_p = blurRadiusProperty.setNative]() {
|
400
405
|
this.initImage();
|
401
406
|
}
|
402
|
-
[_q =
|
407
|
+
[_q = srcProperty.setNative]() {
|
403
408
|
this.initImage();
|
404
409
|
}
|
405
|
-
[_r =
|
410
|
+
[_r = lowerResSrcProperty.setNative]() {
|
406
411
|
this.initImage();
|
407
412
|
}
|
408
|
-
[_s =
|
413
|
+
[_s = blurDownSamplingProperty.setNative]() {
|
409
414
|
this.initImage();
|
410
415
|
}
|
411
|
-
[_t =
|
416
|
+
[_t = aspectRatioProperty.setNative]() {
|
412
417
|
this.initImage();
|
413
418
|
}
|
414
|
-
|
415
|
-
|
416
|
-
|
417
|
-
|
418
|
-
// (this.nativeImageViewProtected as any).setXfermode(android.graphics.PorterDuff.Mode.MULTIPLY);
|
419
|
-
// break;
|
420
|
-
// case 'lighten':
|
421
|
-
// (this.nativeImageViewProtected as any).setXfermode(android.graphics.PorterDuff.Mode.LIGHTEN);
|
422
|
-
// break;
|
423
|
-
// }
|
424
|
-
// }
|
425
|
-
// private initDrawee() {
|
426
|
-
// this.initImage();
|
427
|
-
// }
|
419
|
+
[backgroundInternalProperty.setNative](value) {
|
420
|
+
super[backgroundInternalProperty.setNative](value);
|
421
|
+
this.nativeViewProtected.setClipToOutline(value?.hasBorderRadius());
|
422
|
+
}
|
428
423
|
async initImage() {
|
429
|
-
|
424
|
+
const view = this.nativeViewProtected;
|
425
|
+
if (view) {
|
430
426
|
// this.nativeImageViewProtected.setImageURI(null);
|
431
427
|
const src = this.src;
|
432
428
|
if (src instanceof Promise) {
|
@@ -455,174 +451,161 @@ export class Img extends ImageBase {
|
|
455
451
|
}
|
456
452
|
const uri = getUri(src);
|
457
453
|
if (!uri) {
|
458
|
-
console.
|
454
|
+
console.error(`Error: 'src' not valid: ${src}`);
|
459
455
|
return;
|
460
456
|
}
|
461
457
|
if (this.noCache) {
|
462
|
-
|
463
|
-
const
|
464
|
-
|
465
|
-
|
466
|
-
|
458
|
+
// testing if is in cache is slow so lets remove without testing
|
459
|
+
// const imagePipeLine = getImagePipeline();
|
460
|
+
// const isInCache = imagePipeLine.isInBitmapMemoryCache(uri) || imagePipeLine.isInDiskCache(uri);
|
461
|
+
// if (isInCache) {
|
462
|
+
getImagePipeline().evictFromCache(uri);
|
463
|
+
// }
|
467
464
|
}
|
468
465
|
this.isLoading = true;
|
469
|
-
|
470
|
-
|
471
|
-
|
472
|
-
|
473
|
-
|
474
|
-
|
475
|
-
|
476
|
-
|
477
|
-
|
478
|
-
|
479
|
-
|
480
|
-
|
481
|
-
|
482
|
-
|
483
|
-
|
484
|
-
|
485
|
-
|
486
|
-
|
487
|
-
|
488
|
-
|
489
|
-
|
490
|
-
}
|
491
|
-
|
492
|
-
|
493
|
-
|
494
|
-
|
495
|
-
const
|
496
|
-
|
497
|
-
|
498
|
-
|
499
|
-
|
500
|
-
|
501
|
-
|
502
|
-
|
503
|
-
|
504
|
-
|
505
|
-
|
506
|
-
|
507
|
-
|
508
|
-
|
509
|
-
|
510
|
-
|
511
|
-
|
512
|
-
|
513
|
-
|
514
|
-
|
515
|
-
|
516
|
-
|
517
|
-
|
518
|
-
|
519
|
-
|
520
|
-
|
521
|
-
|
522
|
-
|
523
|
-
|
524
|
-
|
525
|
-
|
526
|
-
|
527
|
-
|
528
|
-
|
529
|
-
|
530
|
-
|
531
|
-
|
532
|
-
|
533
|
-
|
534
|
-
|
535
|
-
|
536
|
-
|
537
|
-
|
538
|
-
|
539
|
-
|
540
|
-
|
541
|
-
}
|
542
|
-
|
543
|
-
|
544
|
-
|
545
|
-
|
546
|
-
|
547
|
-
|
548
|
-
|
549
|
-
|
550
|
-
|
551
|
-
|
552
|
-
|
553
|
-
|
554
|
-
|
555
|
-
|
556
|
-
|
557
|
-
|
558
|
-
|
559
|
-
|
560
|
-
|
561
|
-
|
562
|
-
|
563
|
-
|
564
|
-
|
565
|
-
|
566
|
-
|
567
|
-
CLog(CLogTypes.info, 'onRelease', id);
|
568
|
-
}
|
569
|
-
const nativeView = that && that.get();
|
570
|
-
if (nativeView) {
|
571
|
-
const args = {
|
572
|
-
eventName: ImageBase.releaseEvent,
|
573
|
-
object: nativeView
|
574
|
-
};
|
575
|
-
that.get().notify(args);
|
576
|
-
}
|
577
|
-
else {
|
578
|
-
console.log("Warning: WeakRef<Image> was GC and no '" + ImageBase.releaseEvent + "' callback will be raised.");
|
579
|
-
}
|
580
|
-
},
|
581
|
-
onSubmit(id, callerContext) {
|
582
|
-
if (Trace.isEnabled()) {
|
583
|
-
CLog(CLogTypes.info, 'onSubmit', id, callerContext);
|
584
|
-
}
|
585
|
-
const nativeView = that && that.get();
|
586
|
-
if (nativeView) {
|
587
|
-
const args = {
|
588
|
-
eventName: ImageBase.submitEvent,
|
589
|
-
object: nativeView
|
590
|
-
};
|
591
|
-
that.get().notify(args);
|
592
|
-
}
|
593
|
-
else {
|
594
|
-
console.log("Warning: WeakRef<Image> was GC and no 'submitEvent' callback will be raised.");
|
466
|
+
if (!this.controllerListener) {
|
467
|
+
const that = new WeakRef(this);
|
468
|
+
this.controllerListener = new com.facebook.drawee.controller.ControllerListener({
|
469
|
+
onFinalImageSet(id, imageInfo, animatable) {
|
470
|
+
if (Trace.isEnabled()) {
|
471
|
+
CLog(CLogTypes.info, 'onFinalImageSet', id, imageInfo, animatable);
|
472
|
+
}
|
473
|
+
const nativeView = that?.get();
|
474
|
+
if (nativeView) {
|
475
|
+
nativeView.updateViewSize(imageInfo);
|
476
|
+
nativeView.isLoading = false;
|
477
|
+
const eventName = ImageBase.finalImageSetEvent;
|
478
|
+
if (nativeView.hasListeners(eventName)) {
|
479
|
+
const info = new ImageInfo(imageInfo);
|
480
|
+
nativeView.notify({
|
481
|
+
eventName,
|
482
|
+
imageInfo: info,
|
483
|
+
animatable: animatable
|
484
|
+
});
|
485
|
+
}
|
486
|
+
}
|
487
|
+
},
|
488
|
+
onFailure(id, throwable) {
|
489
|
+
if (Trace.isEnabled()) {
|
490
|
+
CLog(CLogTypes.info, 'onFailure', id, throwable.getLocalizedMessage());
|
491
|
+
}
|
492
|
+
const nativeView = that?.get();
|
493
|
+
if (nativeView) {
|
494
|
+
// const nView = nativeView.nativeViewProtected;
|
495
|
+
nativeView.isLoading = false;
|
496
|
+
const eventName = ImageBase.failureEvent;
|
497
|
+
if (nativeView.hasListeners(eventName)) {
|
498
|
+
const imageError = new ImageError(throwable);
|
499
|
+
nativeView.notify({
|
500
|
+
eventName,
|
501
|
+
error: imageError
|
502
|
+
});
|
503
|
+
}
|
504
|
+
}
|
505
|
+
},
|
506
|
+
onIntermediateImageFailed(id, throwable) {
|
507
|
+
if (Trace.isEnabled()) {
|
508
|
+
CLog(CLogTypes.info, 'onIntermediateImageFailed', id, throwable);
|
509
|
+
}
|
510
|
+
const nativeView = that?.get();
|
511
|
+
if (nativeView) {
|
512
|
+
const eventName = ImageBase.intermediateImageFailedEvent;
|
513
|
+
if (nativeView.hasListeners(eventName)) {
|
514
|
+
const imageError = new ImageError(throwable);
|
515
|
+
nativeView.notify({
|
516
|
+
eventName,
|
517
|
+
error: imageError
|
518
|
+
});
|
519
|
+
}
|
520
|
+
}
|
521
|
+
},
|
522
|
+
onIntermediateImageSet(id, imageInfo) {
|
523
|
+
if (Trace.isEnabled()) {
|
524
|
+
CLog(CLogTypes.info, 'onIntermediateImageSet', id, imageInfo);
|
525
|
+
}
|
526
|
+
const nativeView = that?.get();
|
527
|
+
if (nativeView) {
|
528
|
+
nativeView.updateViewSize(imageInfo);
|
529
|
+
const eventName = ImageBase.intermediateImageSetEvent;
|
530
|
+
if (nativeView.hasListeners(eventName)) {
|
531
|
+
const info = new ImageInfo(imageInfo);
|
532
|
+
nativeView.notify({
|
533
|
+
eventName,
|
534
|
+
imageInfo: info
|
535
|
+
});
|
536
|
+
}
|
537
|
+
}
|
538
|
+
},
|
539
|
+
onRelease(id) {
|
540
|
+
if (Trace.isEnabled()) {
|
541
|
+
CLog(CLogTypes.info, 'onRelease', id);
|
542
|
+
}
|
543
|
+
const nativeView = that?.get();
|
544
|
+
if (nativeView) {
|
545
|
+
const eventName = ImageBase.releaseEvent;
|
546
|
+
if (nativeView.hasListeners(eventName)) {
|
547
|
+
nativeView.notify({
|
548
|
+
eventName
|
549
|
+
});
|
550
|
+
}
|
551
|
+
}
|
552
|
+
},
|
553
|
+
onSubmit(id, callerContext) {
|
554
|
+
if (Trace.isEnabled()) {
|
555
|
+
CLog(CLogTypes.info, 'onSubmit', id, callerContext);
|
556
|
+
}
|
557
|
+
const nativeView = that?.get();
|
558
|
+
const eventName = ImageBase.submitEvent;
|
559
|
+
if (nativeView?.hasListeners(eventName)) {
|
560
|
+
nativeView.notify({
|
561
|
+
eventName
|
562
|
+
});
|
563
|
+
}
|
595
564
|
}
|
596
|
-
}
|
565
|
+
});
|
566
|
+
}
|
567
|
+
const options = JSON.stringify({
|
568
|
+
progressiveRenderingEnabled: this.blurRadius,
|
569
|
+
localThumbnailPreviewsEnabled: this.blurRadius,
|
570
|
+
decodeWidth: this.decodeWidth,
|
571
|
+
decodeHeight: this.decodeHeight,
|
572
|
+
blurRadius: this.blurRadius,
|
573
|
+
lowerResSrc: this.lowerResSrc ? getUri(this.lowerResSrc, false) : undefined,
|
574
|
+
blurDownSampling: this.blurDownSampling,
|
575
|
+
autoPlayAnimations: this.autoPlayAnimations,
|
576
|
+
tapToRetryEnabled: this.tapToRetryEnabled
|
597
577
|
});
|
578
|
+
view.setUri(uri, options, this.controllerListener);
|
598
579
|
// const async = this.loadMode === 'async';
|
599
580
|
// if (async) {
|
600
|
-
const builder = com.facebook.drawee.backends.pipeline.Fresco.newDraweeControllerBuilder();
|
601
|
-
builder.setImageRequest(request);
|
602
|
-
builder.setCallerContext(src);
|
603
|
-
builder.setControllerListener(listener);
|
604
|
-
builder.setOldController(this.nativeImageViewProtected.getController());
|
605
|
-
if (Trace.isEnabled()) {
|
606
|
-
|
607
|
-
|
608
|
-
|
609
|
-
|
610
|
-
|
611
|
-
|
612
|
-
|
613
|
-
|
614
|
-
}
|
615
|
-
|
616
|
-
|
617
|
-
|
618
|
-
|
619
|
-
|
620
|
-
|
621
|
-
|
622
|
-
|
623
|
-
|
624
|
-
|
625
|
-
|
581
|
+
// const builder = com.facebook.drawee.backends.pipeline.Fresco.newDraweeControllerBuilder();
|
582
|
+
// builder.setImageRequest(request);
|
583
|
+
// builder.setCallerContext(src);
|
584
|
+
// builder.setControllerListener(listener);
|
585
|
+
// builder.setOldController(this.nativeImageViewProtected.getController());
|
586
|
+
// if (Trace.isEnabled()) {
|
587
|
+
// builder.setPerfDataListener(
|
588
|
+
// new com.facebook.drawee.backends.pipeline.info.ImagePerfDataListener({
|
589
|
+
// onImageLoadStatusUpdated(param0: com.facebook.drawee.backends.pipeline.info.ImagePerfData, param1: number) {
|
590
|
+
// CLog(CLogTypes.info, 'onImageLoadStatusUpdated', param0, param1);
|
591
|
+
// },
|
592
|
+
// onImageVisibilityUpdated(param0: com.facebook.drawee.backends.pipeline.info.ImagePerfData, param1: number) {
|
593
|
+
// CLog(CLogTypes.info, 'onImageVisibilityUpdated', param0, param1);
|
594
|
+
// }
|
595
|
+
// })
|
596
|
+
// );
|
597
|
+
// }
|
598
|
+
// if (this.lowerResSrc) {
|
599
|
+
// builder.setLowResImageRequest(com.facebook.imagepipeline.request.ImageRequest.fromUri(getUri(this.lowerResSrc)));
|
600
|
+
// }
|
601
|
+
// if (this.autoPlayAnimations) {
|
602
|
+
// builder.setAutoPlayAnimations(this.autoPlayAnimations);
|
603
|
+
// }
|
604
|
+
// if (this.tapToRetryEnabled) {
|
605
|
+
// builder.setTapToRetryEnabled(this.tapToRetryEnabled);
|
606
|
+
// }
|
607
|
+
// const controller = builder.build();
|
608
|
+
// this.nativeImageViewProtected.setController(controller);
|
626
609
|
// } else {
|
627
610
|
// const dataSource = com.facebook.drawee.backends.pipeline.Fresco.getImagePipeline().fetchDecodedImage(request, src);
|
628
611
|
// const result = com.facebook.datasource.DataSources.waitForFinalResult(dataSource);
|
@@ -668,12 +651,7 @@ export class Img extends ImageBase {
|
|
668
651
|
if (this.stretch) {
|
669
652
|
builder.setActualImageScaleType(this.stretch, this.imageRotation);
|
670
653
|
}
|
671
|
-
|
672
|
-
builder.setFadeDuration(this.fadeDuration);
|
673
|
-
}
|
674
|
-
else {
|
675
|
-
builder.setFadeDuration(0);
|
676
|
-
}
|
654
|
+
builder.setFadeDuration(this.fadeDuration || 0);
|
677
655
|
if (this.backgroundUri && backgroundDrawable) {
|
678
656
|
builder.setBackground(backgroundDrawable);
|
679
657
|
}
|
@@ -683,15 +661,14 @@ export class Img extends ImageBase {
|
|
683
661
|
if (this.roundAsCircle) {
|
684
662
|
builder.setRoundingParamsAsCircle();
|
685
663
|
}
|
686
|
-
|
687
|
-
|
688
|
-
|
689
|
-
|
690
|
-
|
664
|
+
const topLeftRadius = this.roundTopLeftRadius || 0;
|
665
|
+
const topRightRadius = this.roundTopRightRadius || 0;
|
666
|
+
const bottomRightRadius = this.roundBottomRightRadius || 0;
|
667
|
+
const bottomLeftRadius = this.roundBottomLeftRadius || 0;
|
668
|
+
if (topLeftRadius || topRightRadius || bottomRightRadius || bottomLeftRadius) {
|
691
669
|
builder.setCornersRadii(topLeftRadius, topRightRadius, bottomRightRadius, bottomLeftRadius);
|
692
670
|
}
|
693
|
-
|
694
|
-
this.nativeImageViewProtected.setHierarchy(hierarchy);
|
671
|
+
this.nativeImageViewProtected.setHierarchy(builder.build());
|
695
672
|
}
|
696
673
|
}
|
697
674
|
getDrawable(path) {
|
package/index.ios.js
CHANGED
@@ -1,8 +1,8 @@
|
|
1
1
|
export * from './index-common';
|
2
2
|
import { ImageAsset, ImageSource, Screen, Trace, Utils, knownFolders, path } from '@nativescript/core';
|
3
|
-
import { isString } from '@nativescript/core/utils/types';
|
4
|
-
import { CLog, CLogTypes, EventData, ImageBase, ScaleType } from './index-common';
|
5
3
|
import { layout } from '@nativescript/core/utils/layout-helper';
|
4
|
+
import { isString } from '@nativescript/core/utils/types';
|
5
|
+
import { CLog, CLogTypes, EventData, ImageBase, ScaleType, failureImageUriProperty, placeholderImageUriProperty, srcProperty, stretchProperty } from './index-common';
|
6
6
|
export class ImageInfo {
|
7
7
|
constructor(width, height) {
|
8
8
|
this.width = width;
|
@@ -401,17 +401,17 @@ export class Img extends ImageBase {
|
|
401
401
|
}
|
402
402
|
}
|
403
403
|
}
|
404
|
-
[
|
404
|
+
[srcProperty.setNative](value) {
|
405
405
|
this.initImage();
|
406
406
|
}
|
407
|
-
[
|
407
|
+
[placeholderImageUriProperty.setNative]() {
|
408
408
|
this.placeholderImage = this.getUIImage(this.placeholderImageUri);
|
409
409
|
this.initImage();
|
410
410
|
}
|
411
|
-
[
|
411
|
+
[failureImageUriProperty.setNative]() {
|
412
412
|
// this.updateHierarchy();
|
413
413
|
}
|
414
|
-
[
|
414
|
+
[stretchProperty.setNative](value) {
|
415
415
|
if (!this.nativeView) {
|
416
416
|
return;
|
417
417
|
}
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nativescript-community/ui-image",
|
3
|
-
"version": "4.3.
|
3
|
+
"version": "4.3.12",
|
4
4
|
"description": "Advanced and efficient image display plugin which uses Fresco (Android) and SDWebImage (iOS) to implement caching, placeholders, image effects, and much more.",
|
5
5
|
"main": "./index",
|
6
6
|
"sideEffects": false,
|
@@ -44,5 +44,5 @@
|
|
44
44
|
},
|
45
45
|
"license": "Apache-2.0",
|
46
46
|
"readmeFilename": "README.md",
|
47
|
-
"gitHead": "
|
47
|
+
"gitHead": "9ea31cb0967917f14880e3928043f74497f59b88"
|
48
48
|
}
|
@@ -9,6 +9,7 @@ dependencies {
|
|
9
9
|
implementation("com.facebook.fresco:imagepipeline-okhttp3:$frescoVersion") {
|
10
10
|
exclude group: 'com.facebook.soloader', module: 'soloader'
|
11
11
|
}
|
12
|
+
implementation("com.facebook.fresco:nativeimagetranscoder:$frescoVersion")
|
12
13
|
implementation 'com.facebook.infer.annotation:infer-annotation:0.18.0'
|
13
14
|
// implementation ("com.facebook.fresco:animated-gif:$frescoVersion") {
|
14
15
|
// exclude group: 'com.facebook.soloader', module: 'soloader'
|