@nativescript-community/ui-image 4.0.34 → 4.1.3
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 +41 -0
- package/image-common.d.ts +3 -0
- package/image-common.js +2 -0
- package/image.android.js +4 -0
- package/image.d.ts +5 -0
- package/image.ios.d.ts +2 -2
- package/image.ios.js +5 -35
- package/package.json +2 -2
- package/platforms/android/.gradle/6.4/fileChanges/last-build.bin +0 -0
- package/platforms/android/.gradle/6.4/fileHashes/fileHashes.lock +0 -0
- package/platforms/android/.gradle/6.4/gc.properties +0 -0
- package/platforms/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/platforms/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/platforms/android/.gradle/checksums/checksums.lock +0 -0
- package/platforms/android/.gradle/vcs-1/gc.properties +0 -0
- package/platforms/android/include.gradle +3 -3
- package/platforms/android/java/com/nativescript/image/DraweeView.java +0 -4
- package/platforms/android/native-api-usage.json +28 -1
- package/platforms/ios/src/NImage.h +1 -0
- package/platforms/ios/src/NSImageRoundAsCircleTransformer.h +8 -0
- package/platforms/ios/src/NSImageRoundAsCircleTransformer.m +40 -0
- package/flipper/index.d.ts +0 -4
- package/flipper/index.js +0 -9
package/CHANGELOG.md
CHANGED
@@ -3,6 +3,47 @@
|
|
3
3
|
All notable changes to this project will be documented in this file.
|
4
4
|
See [Conventional Commits](https://conventionalcommits.org) for commit guidelines.
|
5
5
|
|
6
|
+
## [4.1.3](https://github.com/nativescript-community/ui-image/compare/v4.1.2...v4.1.3) (2022-01-14)
|
7
|
+
|
8
|
+
|
9
|
+
### Bug Fixes
|
10
|
+
|
11
|
+
* **ios:** fixed transforms not being applied. New `animatedImageView` property to be set when using animated images ([5fb20f1](https://github.com/nativescript-community/ui-image/commit/5fb20f1d13cc48fe57000dc2fa6bb15c8b568ff0))
|
12
|
+
|
13
|
+
|
14
|
+
|
15
|
+
|
16
|
+
|
17
|
+
## [4.1.2](https://github.com/nativescript-community/ui-image/compare/v4.1.1...v4.1.2) (2021-12-29)
|
18
|
+
|
19
|
+
**Note:** Version bump only for package @nativescript-community/ui-image
|
20
|
+
|
21
|
+
|
22
|
+
|
23
|
+
|
24
|
+
|
25
|
+
## [4.1.1](https://github.com/nativescript-community/ui-image/compare/v4.1.0...v4.1.1) (2021-12-23)
|
26
|
+
|
27
|
+
|
28
|
+
### Bug Fixes
|
29
|
+
|
30
|
+
* android remove dep on annotationx ([c9fdfbe](https://github.com/nativescript-community/ui-image/commit/c9fdfbe8f7c7f876abb53b1d8b9b7c68d65ae21f))
|
31
|
+
|
32
|
+
|
33
|
+
|
34
|
+
|
35
|
+
|
36
|
+
# [4.1.0](https://github.com/nativescript-community/ui-image/compare/v4.0.34...v4.1.0) (2021-10-21)
|
37
|
+
|
38
|
+
|
39
|
+
### Features
|
40
|
+
|
41
|
+
* **android:** native-api-usage ([0ec235c](https://github.com/nativescript-community/ui-image/commit/0ec235c2df1d5c4f6f30615766ea17ba74576dc7))
|
42
|
+
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
|
6
47
|
## [4.0.34](https://github.com/nativescript-community/ui-image/compare/v4.0.33...v4.0.34) (2021-10-15)
|
7
48
|
|
8
49
|
**Note:** Version bump only for package @nativescript-community/ui-image
|
package/image-common.d.ts
CHANGED
@@ -41,6 +41,7 @@ export interface ImageError {
|
|
41
41
|
}
|
42
42
|
export interface ImagePipelineConfigSetting {
|
43
43
|
isDownsampleEnabled?: boolean;
|
44
|
+
leakTracker?: any;
|
44
45
|
}
|
45
46
|
export declare class EventData implements IEventData {
|
46
47
|
private _eventName;
|
@@ -81,6 +82,7 @@ export declare class ImageBase extends View {
|
|
81
82
|
aspectRatio: number;
|
82
83
|
decodeWidth: number;
|
83
84
|
decodeHeight: number;
|
85
|
+
animatedImageView: boolean;
|
84
86
|
alwaysFade: boolean;
|
85
87
|
noCache: boolean;
|
86
88
|
tintColor: Color;
|
@@ -112,6 +114,7 @@ export declare class ImageBase extends View {
|
|
112
114
|
static roundBottomLeftRadiusProperty: Property<ImageBase, CoreTypes.LengthType>;
|
113
115
|
static roundBottomRightRadiusProperty: Property<ImageBase, CoreTypes.LengthType>;
|
114
116
|
static clipToBoundsProperty: Property<ImageBase, boolean>;
|
117
|
+
static animatedImageViewProperty: Property<ImageBase, boolean>;
|
115
118
|
protected handleImageProgress(value: number, totalSize?: number): void;
|
116
119
|
private static needsSizeAdjustment;
|
117
120
|
computeScaleFactor(measureWidth: number, measureHeight: number, widthIsFinite: boolean, heightIsFinite: boolean, nativeWidth: number, nativeHeight: number, aspectRatio: number): {
|
package/image-common.js
CHANGED
@@ -147,6 +147,7 @@ ImageBase.roundTopRightRadiusProperty = new Property({ name: 'roundTopRightRadiu
|
|
147
147
|
ImageBase.roundBottomLeftRadiusProperty = new Property({ name: 'roundBottomLeftRadius', defaultValue: 0, valueConverter: (v) => Length.toDevicePixels(Length.parse(v)) });
|
148
148
|
ImageBase.roundBottomRightRadiusProperty = new Property({ name: 'roundBottomRightRadius', defaultValue: 0, valueConverter: (v) => Length.toDevicePixels(Length.parse(v)) });
|
149
149
|
ImageBase.clipToBoundsProperty = new Property({ name: 'clipToBounds', defaultValue: true, valueConverter: booleanConverter });
|
150
|
+
ImageBase.animatedImageViewProperty = new Property({ name: 'animatedImageView', defaultValue: false, valueConverter: booleanConverter });
|
150
151
|
ImageBase.srcProperty.register(ImageBase);
|
151
152
|
ImageBase.lowerResSrcProperty.register(ImageBase);
|
152
153
|
ImageBase.placeholderImageUriProperty.register(ImageBase);
|
@@ -173,4 +174,5 @@ ImageBase.decodeHeightProperty.register(ImageBase);
|
|
173
174
|
ImageBase.alwaysFadeProperty.register(ImageBase);
|
174
175
|
ImageBase.noCacheProperty.register(ImageBase);
|
175
176
|
ImageBase.clipToBoundsProperty.register(ImageBase);
|
177
|
+
ImageBase.animatedImageViewProperty.register(ImageBase);
|
176
178
|
//# sourceMappingURL=image-common.js.map
|
package/image.android.js
CHANGED
@@ -18,9 +18,13 @@ export function initialize(config) {
|
|
18
18
|
if (config && config.isDownsampleEnabled) {
|
19
19
|
builder.setDownsampleEnabled(true);
|
20
20
|
}
|
21
|
+
if (config && config.leakTracker) {
|
22
|
+
builder.setCloseableReferenceLeakTracker(config.leakTracker);
|
23
|
+
}
|
21
24
|
const imagePipelineConfig = builder.build();
|
22
25
|
com.facebook.drawee.backends.pipeline.Fresco.initialize(context, imagePipelineConfig);
|
23
26
|
initialized = true;
|
27
|
+
initializeConfig = null;
|
24
28
|
}
|
25
29
|
}
|
26
30
|
export function getImagePipeline() {
|
package/image.d.ts
CHANGED
@@ -194,6 +194,11 @@ export class Img extends View {
|
|
194
194
|
* Number value used as the resized image height
|
195
195
|
*/
|
196
196
|
decodeHeight: number;
|
197
|
+
|
198
|
+
/**
|
199
|
+
* IOS: if you want to show animated images you need to set this to true
|
200
|
+
*/
|
201
|
+
animatedImageView: boolean;
|
197
202
|
}
|
198
203
|
|
199
204
|
/**
|
package/image.ios.d.ts
CHANGED
@@ -31,10 +31,10 @@ export declare class ImagePipeline {
|
|
31
31
|
}
|
32
32
|
export declare function getImagePipeline(): ImagePipeline;
|
33
33
|
export declare class Img extends ImageBase {
|
34
|
-
nativeViewProtected: SDAnimatedImageView;
|
34
|
+
nativeViewProtected: SDAnimatedImageView | UIImageView;
|
35
35
|
isLoading: boolean;
|
36
36
|
private _imageSourceAffectsLayout;
|
37
|
-
createNativeView():
|
37
|
+
createNativeView(): UIImageView;
|
38
38
|
_setNativeClipToBounds(): void;
|
39
39
|
onMeasure(widthMeasureSpec: number, heightMeasureSpec: number): void;
|
40
40
|
updateImageUri(): void;
|
package/image.ios.js
CHANGED
@@ -3,39 +3,6 @@ import { ImageAsset, ImageSource, Screen, Trace, knownFolders, path } from '@nat
|
|
3
3
|
import { isString } from '@nativescript/core/utils/types';
|
4
4
|
import { RESOURCE_PREFIX, isFileOrResourcePath, isFontIconURI, layout } from '@nativescript/core/utils/utils';
|
5
5
|
import { CLog, CLogTypes, ImageBase, ScaleType } from './image-common';
|
6
|
-
var SDImageRoundAsCircleTransformer = /** @class */ (function (_super) {
|
7
|
-
__extends(SDImageRoundAsCircleTransformer, _super);
|
8
|
-
function SDImageRoundAsCircleTransformer() {
|
9
|
-
return _super !== null && _super.apply(this, arguments) || this;
|
10
|
-
}
|
11
|
-
SDImageRoundAsCircleTransformer.transformer = function () {
|
12
|
-
var transformer = SDImageRoundAsCircleTransformer.alloc().init();
|
13
|
-
return transformer;
|
14
|
-
};
|
15
|
-
Object.defineProperty(SDImageRoundAsCircleTransformer.prototype, "transformerKey", {
|
16
|
-
get: function () {
|
17
|
-
return 'SDImageRoundAsCircleTransformer';
|
18
|
-
},
|
19
|
-
enumerable: true,
|
20
|
-
configurable: true
|
21
|
-
});
|
22
|
-
SDImageRoundAsCircleTransformer.prototype.transformedImageWithImageForKey = function (image, key) {
|
23
|
-
if (!image) {
|
24
|
-
return null;
|
25
|
-
}
|
26
|
-
var width = image.size.width;
|
27
|
-
var height = image.size.height;
|
28
|
-
var minwidth = Math.min(width, height);
|
29
|
-
var cornerRadius = minwidth / 2;
|
30
|
-
var result = image
|
31
|
-
.sd_resizedImageWithSizeScaleMode(CGSizeMake(minwidth, minwidth), SDImageScaleMode.AspectFill)
|
32
|
-
.sd_roundedCornerImageWithRadiusCornersBorderWidthBorderColor(cornerRadius, UIRectCorner.BottomLeft | UIRectCorner.BottomRight | UIRectCorner.TopLeft | UIRectCorner.TopRight, 0, null)
|
33
|
-
.sd_resizedImageWithSizeScaleMode(CGSizeMake(width, height), SDImageScaleMode.AspectFit);
|
34
|
-
return result;
|
35
|
-
};
|
36
|
-
SDImageRoundAsCircleTransformer.ObjCProtocols = [SDImageTransformer];
|
37
|
-
return SDImageRoundAsCircleTransformer;
|
38
|
-
}(NSObject));
|
39
6
|
export class ImageInfo {
|
40
7
|
constructor(width, height) {
|
41
8
|
this.width = width;
|
@@ -236,7 +203,7 @@ export class Img extends ImageBase {
|
|
236
203
|
};
|
237
204
|
}
|
238
205
|
createNativeView() {
|
239
|
-
const result = SDAnimatedImageView.new();
|
206
|
+
const result = this.animatedImageView ? SDAnimatedImageView.new() : UIImageView.new();
|
240
207
|
result.contentMode = 1;
|
241
208
|
result.clipsToBounds = true;
|
242
209
|
result.userInteractionEnabled = true;
|
@@ -379,12 +346,15 @@ export class Img extends ImageBase {
|
|
379
346
|
transformers.push(SDImageBlurTransformer.transformerWithRadius(this.blurRadius));
|
380
347
|
}
|
381
348
|
if (this.roundAsCircle === true) {
|
382
|
-
transformers.push(
|
349
|
+
transformers.push(NSImageRoundAsCircleTransformer.transformer());
|
383
350
|
}
|
384
351
|
if (this.roundBottomLeftRadius || this.roundBottomRightRadius || this.roundTopLeftRadius || this.roundTopRightRadius) {
|
385
352
|
transformers.push(NSImageRoundCornerTransformer.transformerWithTopLefRadiusTopRightRadiusBottomRightRadiusBottomLeftRadius(layout.toDeviceIndependentPixels(this.roundTopLeftRadius), layout.toDeviceIndependentPixels(this.roundTopRightRadius), layout.toDeviceIndependentPixels(this.roundBottomRightRadius), layout.toDeviceIndependentPixels(this.roundBottomLeftRadius)));
|
386
353
|
}
|
387
354
|
if (transformers.length > 0) {
|
355
|
+
if (this.animatedImageView) {
|
356
|
+
options |= 512;
|
357
|
+
}
|
388
358
|
context.setValueForKey(SDImagePipelineTransformer.transformerWithTransformers(transformers), SDWebImageContextImageTransformer);
|
389
359
|
}
|
390
360
|
this.nativeViewProtected.sd_setImageWithURLPlaceholderImageOptionsContextProgressCompleted(uri, this.placeholderImage, options, context, this.onLoadProgress, this.handleImageLoaded);
|
package/package.json
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
{
|
2
2
|
"name": "@nativescript-community/ui-image",
|
3
|
-
"version": "4.
|
3
|
+
"version": "4.1.3",
|
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": "./image",
|
6
6
|
"sideEffects": false,
|
@@ -36,5 +36,5 @@
|
|
36
36
|
},
|
37
37
|
"license": "Apache-2.0",
|
38
38
|
"readmeFilename": "README.md",
|
39
|
-
"gitHead": "
|
39
|
+
"gitHead": "7234bbcc3e78bc8ea469bf75657ef2e3be3453d2"
|
40
40
|
}
|
Binary file
|
Binary file
|
File without changes
|
Binary file
|
File without changes
|
@@ -14,8 +14,8 @@ dependencies {
|
|
14
14
|
implementation("com.facebook.fresco:imagepipeline-okhttp3:$frescoVersion") {
|
15
15
|
exclude group: 'com.facebook.soloader', module: 'soloader'
|
16
16
|
}
|
17
|
-
implementation ("com.facebook.fresco:animated-gif:$frescoVersion") {
|
18
|
-
|
19
|
-
}
|
17
|
+
// implementation ("com.facebook.fresco:animated-gif:$frescoVersion") {
|
18
|
+
// exclude group: 'com.facebook.soloader', module: 'soloader'
|
19
|
+
// }
|
20
20
|
implementation(name:'widgets-release', ext:'aar')
|
21
21
|
}
|
@@ -24,8 +24,6 @@ import org.nativescript.widgets.BorderDrawable;
|
|
24
24
|
|
25
25
|
import java.util.Arrays;
|
26
26
|
|
27
|
-
import androidx.annotation.RequiresApi;
|
28
|
-
|
29
27
|
public class DraweeView extends SimpleDraweeView {
|
30
28
|
public int imageWidth = 0;
|
31
29
|
public int imageHeight = 0;
|
@@ -108,7 +106,6 @@ public class DraweeView extends SimpleDraweeView {
|
|
108
106
|
Path innerBorderPath;
|
109
107
|
Path innerBorderTempPath;
|
110
108
|
|
111
|
-
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
|
112
109
|
private Path generateInnerBorderPath(BorderDrawable borderDrawable) {
|
113
110
|
|
114
111
|
float borderTopLeftRadius = borderDrawable.getBorderTopLeftRadius();
|
@@ -154,7 +151,6 @@ public class DraweeView extends SimpleDraweeView {
|
|
154
151
|
return innerBorderPath;
|
155
152
|
}
|
156
153
|
|
157
|
-
@RequiresApi(api = Build.VERSION_CODES.KITKAT)
|
158
154
|
@Override
|
159
155
|
protected void onDraw(Canvas canvas) {
|
160
156
|
Drawable drawable = getBackground();
|
@@ -1,5 +1,32 @@
|
|
1
1
|
{
|
2
2
|
"uses": [
|
3
|
-
"com.facebook.drawee.drawable:ScalingUtils*",
|
3
|
+
"com.facebook.drawee.drawable:ScalingUtils*",
|
4
|
+
"com.facebook.drawee.drawable.ScalingUtils:ScaleType*",
|
5
|
+
"com.facebook.drawee.generic:RoundingParams*",
|
6
|
+
"com.facebook.drawee.drawable:ProgressBarDrawable*",
|
7
|
+
"com.facebook.drawee.view:DraweeView*",
|
8
|
+
"com.facebook.drawee.interfaces:DraweeHierarchy*",
|
9
|
+
"com.facebook.drawee.interfaces:SettableDraweeHierarchy*",
|
10
|
+
"com.facebook.drawee.interfaces:SimpleDraweeControllerBuilder*",
|
11
|
+
"com.facebook.drawee.interfaces:DraweeController*",
|
12
|
+
"com.facebook.drawee.generic:GenericDraweeHierarchyBuilder*",
|
13
|
+
"com.facebook.drawee.generic:GenericDraweeHierarchy*",
|
14
|
+
"com.facebook.imagepipeline.request:ImageRequestBuilder*",
|
15
|
+
"com.facebook.imagepipeline.request:ImageRequest*",
|
16
|
+
"com.facebook.imagepipeline.core:ImagePipelineConfig*",
|
17
|
+
"com.facebook.imagepipeline.common:RotationOptions*",
|
18
|
+
"com.facebook.imagepipeline.common:ResizeOptions*",
|
19
|
+
"com.facebook.drawee.backends.pipeline:Fresco*",
|
20
|
+
"com.facebook.drawee.backends.pipeline:PipelineDraweeControllerBuilder*",
|
21
|
+
"com.facebook.drawee.backends.pipeline:PipelineDraweeController*",
|
22
|
+
"com.facebook.drawee.controller:AbstractDraweeControllerBuilder*",
|
23
|
+
"com.facebook.drawee.controller:AbstractDraweeController*",
|
24
|
+
"com.facebook.drawee.backends.pipeline.info:ImagePerfDataListener*",
|
25
|
+
"com.facebook.drawee.backends.pipeline.info:ImagePerfData*",
|
26
|
+
"com.facebook.drawee.controller:ControllerListener*",
|
27
|
+
"com.nativescript.image:DraweeView*",
|
28
|
+
"com.nativescript.image:ScalingBlurPostprocessor*",
|
29
|
+
"android.graphics.drawable:Animatable",
|
30
|
+
"com.facebook.imagepipeline.image:ImageInfo*"
|
4
31
|
]
|
5
32
|
}
|
@@ -0,0 +1,40 @@
|
|
1
|
+
#import "NSImageRoundAsCircleTransformer.h"
|
2
|
+
#import <SDWebImage/SDGraphicsImageRenderer.h>
|
3
|
+
|
4
|
+
@interface NSImageRoundAsCircleTransformer ()
|
5
|
+
|
6
|
+
@end
|
7
|
+
|
8
|
+
@implementation NSImageRoundAsCircleTransformer
|
9
|
+
+ (instancetype)transformer {
|
10
|
+
|
11
|
+
NSImageRoundAsCircleTransformer *transformer = [NSImageRoundAsCircleTransformer new];
|
12
|
+
return transformer;
|
13
|
+
}
|
14
|
+
|
15
|
+
- (NSString *)transformerKey {
|
16
|
+
return [NSString stringWithFormat:@"NSImageRoundAsCircleTransformer"];
|
17
|
+
}
|
18
|
+
|
19
|
+
- (UIImage *)transformedImageWithImage:(UIImage *)image forKey:(NSString *)key {
|
20
|
+
if (!image) {
|
21
|
+
return nil;
|
22
|
+
}
|
23
|
+
|
24
|
+
CGFloat width = (CGFloat)image.size.width;
|
25
|
+
CGFloat height = (CGFloat)image.size.height;
|
26
|
+
CGFloat minwidth = MIN(width, height);
|
27
|
+
CGFloat cornerRadius = minwidth / 2;
|
28
|
+
|
29
|
+
UIImage * resultImage = [image sd_resizedImageWithSize:CGSizeMake(minwidth, minwidth) scaleMode:SDImageScaleModeAspectFill];
|
30
|
+
resultImage = [resultImage sd_roundedCornerImageWithRadius:cornerRadius corners:UIRectCornerAllCorners borderWidth:0 borderColor:nil];
|
31
|
+
return resultImage;
|
32
|
+
// const result = (image as any)
|
33
|
+
// .sd_resizedImageWithSizeScaleMode(CGSizeMake(minwidth, minwidth), SDImageScaleMode.AspectFill)
|
34
|
+
// .sd_roundedCornerImageWithRadiusCornersBorderWidthBorderColor(cornerRadius, UIRectCorner.BottomLeft | UIRectCorner.BottomRight | UIRectCorner.TopLeft | UIRectCorner.TopRight, 0, null)
|
35
|
+
// .sd_resizedImageWithSizeScaleMode(CGSizeMake(width, height), SDImageScaleMode.AspectFit);
|
36
|
+
// return result;
|
37
|
+
// return resultImage;
|
38
|
+
}
|
39
|
+
|
40
|
+
@end
|
package/flipper/index.d.ts
DELETED
package/flipper/index.js
DELETED