@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-common.d.ts
CHANGED
@@ -53,6 +53,36 @@ export declare class EventData implements IEventData {
|
|
53
53
|
set object(value: any);
|
54
54
|
}
|
55
55
|
export declare type Stretch = 'none' | 'fill' | 'aspectFill' | 'aspectFit';
|
56
|
+
export declare const srcProperty: Property<ImageBase, string | ImageSource | ImageAsset>;
|
57
|
+
export declare const lowerResSrcProperty: Property<ImageBase, string>;
|
58
|
+
export declare const placeholderImageUriProperty: Property<ImageBase, string>;
|
59
|
+
export declare const failureImageUriProperty: Property<ImageBase, string>;
|
60
|
+
export declare const stretchProperty: Property<ImageBase, string>;
|
61
|
+
export declare const backgroundUriProperty: Property<ImageBase, string>;
|
62
|
+
export declare const progressiveRenderingEnabledProperty: Property<ImageBase, boolean>;
|
63
|
+
export declare const localThumbnailPreviewsEnabledProperty: Property<ImageBase, boolean>;
|
64
|
+
export declare const showProgressBarProperty: Property<ImageBase, boolean>;
|
65
|
+
export declare const progressBarColorProperty: Property<ImageBase, string>;
|
66
|
+
export declare const roundAsCircleProperty: Property<ImageBase, boolean>;
|
67
|
+
export declare const blurRadiusProperty: Property<ImageBase, number>;
|
68
|
+
export declare const blurDownSamplingProperty: Property<ImageBase, number>;
|
69
|
+
export declare const imageRotationProperty: Property<ImageBase, number>;
|
70
|
+
export declare const autoPlayAnimationsProperty: Property<ImageBase, boolean>;
|
71
|
+
export declare const tapToRetryEnabledProperty: Property<ImageBase, boolean>;
|
72
|
+
export declare const aspectRatioProperty: Property<ImageBase, number>;
|
73
|
+
export declare const decodeWidthProperty: Property<ImageBase, number>;
|
74
|
+
export declare const decodeHeightProperty: Property<ImageBase, number>;
|
75
|
+
export declare const tintColorProperty: Property<ImageBase, Color>;
|
76
|
+
export declare const alwaysFadeProperty: Property<ImageBase, boolean>;
|
77
|
+
export declare const fadeDurationProperty: Property<ImageBase, number>;
|
78
|
+
export declare const noCacheProperty: Property<ImageBase, boolean>;
|
79
|
+
export declare const roundTopLeftRadiusProperty: Property<ImageBase, CoreTypes.LengthType>;
|
80
|
+
export declare const roundTopRightRadiusProperty: Property<ImageBase, CoreTypes.LengthType>;
|
81
|
+
export declare const roundBottomLeftRadiusProperty: Property<ImageBase, CoreTypes.LengthType>;
|
82
|
+
export declare const roundBottomRightRadiusProperty: Property<ImageBase, CoreTypes.LengthType>;
|
83
|
+
export declare const loadModeProperty: Property<ImageBase, "sync" | "async">;
|
84
|
+
export declare const clipToBoundsProperty: Property<ImageBase, boolean>;
|
85
|
+
export declare const animatedImageViewProperty: Property<ImageBase, boolean>;
|
56
86
|
export declare class ImageBase extends View {
|
57
87
|
static finalImageSetEvent: string;
|
58
88
|
static failureEvent: string;
|
@@ -90,36 +120,6 @@ export declare class ImageBase extends View {
|
|
90
120
|
noCache: boolean;
|
91
121
|
tintColor: Color;
|
92
122
|
readonly isLoading: boolean;
|
93
|
-
static srcProperty: Property<ImageBase, string | ImageSource | ImageAsset>;
|
94
|
-
static lowerResSrcProperty: Property<ImageBase, string>;
|
95
|
-
static placeholderImageUriProperty: Property<ImageBase, string>;
|
96
|
-
static failureImageUriProperty: Property<ImageBase, string>;
|
97
|
-
static stretchProperty: Property<ImageBase, string>;
|
98
|
-
static backgroundUriProperty: Property<ImageBase, string>;
|
99
|
-
static progressiveRenderingEnabledProperty: Property<ImageBase, boolean>;
|
100
|
-
static localThumbnailPreviewsEnabledProperty: Property<ImageBase, boolean>;
|
101
|
-
static showProgressBarProperty: Property<ImageBase, boolean>;
|
102
|
-
static progressBarColorProperty: Property<ImageBase, string>;
|
103
|
-
static roundAsCircleProperty: Property<ImageBase, boolean>;
|
104
|
-
static blurRadiusProperty: Property<ImageBase, number>;
|
105
|
-
static blurDownSamplingProperty: Property<ImageBase, number>;
|
106
|
-
static imageRotationProperty: Property<ImageBase, number>;
|
107
|
-
static autoPlayAnimationsProperty: Property<ImageBase, boolean>;
|
108
|
-
static tapToRetryEnabledProperty: Property<ImageBase, boolean>;
|
109
|
-
static aspectRatioProperty: Property<ImageBase, number>;
|
110
|
-
static decodeWidthProperty: Property<ImageBase, number>;
|
111
|
-
static decodeHeightProperty: Property<ImageBase, number>;
|
112
|
-
static tintColorProperty: Property<ImageBase, Color>;
|
113
|
-
static alwaysFadeProperty: Property<ImageBase, boolean>;
|
114
|
-
static fadeDurationProperty: Property<ImageBase, number>;
|
115
|
-
static noCacheProperty: Property<ImageBase, boolean>;
|
116
|
-
static roundTopLeftRadiusProperty: Property<ImageBase, CoreTypes.LengthType>;
|
117
|
-
static roundTopRightRadiusProperty: Property<ImageBase, CoreTypes.LengthType>;
|
118
|
-
static roundBottomLeftRadiusProperty: Property<ImageBase, CoreTypes.LengthType>;
|
119
|
-
static roundBottomRightRadiusProperty: Property<ImageBase, CoreTypes.LengthType>;
|
120
|
-
static loadModeProperty: Property<ImageBase, "sync" | "async">;
|
121
|
-
static clipToBoundsProperty: Property<ImageBase, boolean>;
|
122
|
-
static animatedImageViewProperty: Property<ImageBase, boolean>;
|
123
123
|
get nativeImageViewProtected(): any;
|
124
124
|
protected handleImageProgress(value: number, totalSize?: number): void;
|
125
125
|
private static needsSizeAdjustment;
|
package/index-common.js
CHANGED
@@ -5,6 +5,51 @@ import { isAndroid } from '@nativescript/core/platform';
|
|
5
5
|
function isNonNegativeFiniteNumber(value) {
|
6
6
|
return isFinite(value) && !isNaN(value) && value >= 0;
|
7
7
|
}
|
8
|
+
function parseThickness(value) {
|
9
|
+
if (typeof value === 'string') {
|
10
|
+
const arr = value.split(/[ ,]+/);
|
11
|
+
let top;
|
12
|
+
let right;
|
13
|
+
let bottom;
|
14
|
+
let left;
|
15
|
+
if (arr.length === 1) {
|
16
|
+
top = arr[0];
|
17
|
+
right = arr[0];
|
18
|
+
bottom = arr[0];
|
19
|
+
left = arr[0];
|
20
|
+
}
|
21
|
+
else if (arr.length === 2) {
|
22
|
+
top = arr[0];
|
23
|
+
bottom = arr[0];
|
24
|
+
right = arr[1];
|
25
|
+
left = arr[1];
|
26
|
+
}
|
27
|
+
else if (arr.length === 3) {
|
28
|
+
top = arr[0];
|
29
|
+
right = arr[1];
|
30
|
+
left = arr[1];
|
31
|
+
bottom = arr[2];
|
32
|
+
}
|
33
|
+
else if (arr.length === 4) {
|
34
|
+
top = arr[0];
|
35
|
+
right = arr[1];
|
36
|
+
bottom = arr[2];
|
37
|
+
left = arr[3];
|
38
|
+
}
|
39
|
+
else {
|
40
|
+
throw new Error('Expected 1, 2, 3 or 4 parameters. Actual: ' + value);
|
41
|
+
}
|
42
|
+
return {
|
43
|
+
top,
|
44
|
+
right,
|
45
|
+
bottom,
|
46
|
+
left
|
47
|
+
};
|
48
|
+
}
|
49
|
+
else {
|
50
|
+
return value;
|
51
|
+
}
|
52
|
+
}
|
8
53
|
export var CLogTypes;
|
9
54
|
(function (CLogTypes) {
|
10
55
|
CLogTypes[CLogTypes["log"] = Trace.messageType.log] = "log";
|
@@ -45,6 +90,90 @@ export class EventData {
|
|
45
90
|
this._object = value;
|
46
91
|
}
|
47
92
|
}
|
93
|
+
export const srcProperty = new Property({ name: 'src' });
|
94
|
+
export const lowerResSrcProperty = new Property({ name: 'lowerResSrc' });
|
95
|
+
export const placeholderImageUriProperty = new Property({ name: 'placeholderImageUri' });
|
96
|
+
export const failureImageUriProperty = new Property({ name: 'failureImageUri' });
|
97
|
+
export const stretchProperty = new Property({ name: 'stretch', defaultValue: 'aspectFill' });
|
98
|
+
export const backgroundUriProperty = new Property({ name: 'backgroundUri' });
|
99
|
+
export const progressiveRenderingEnabledProperty = new Property({ name: 'progressiveRenderingEnabled', valueConverter: booleanConverter });
|
100
|
+
export const localThumbnailPreviewsEnabledProperty = new Property({ name: 'localThumbnailPreviewsEnabled', valueConverter: booleanConverter });
|
101
|
+
export const showProgressBarProperty = new Property({ name: 'showProgressBar', valueConverter: booleanConverter });
|
102
|
+
export const progressBarColorProperty = new Property({ name: 'progressBarColor', defaultValue: undefined });
|
103
|
+
export const roundAsCircleProperty = new Property({ name: 'roundAsCircle', valueConverter: booleanConverter, affectsLayout: isAndroid });
|
104
|
+
export const blurRadiusProperty = new Property({ name: 'blurRadius', valueConverter: (v) => parseFloat(v) });
|
105
|
+
export const blurDownSamplingProperty = new Property({ name: 'blurDownSampling', valueConverter: (v) => parseFloat(v) });
|
106
|
+
export const imageRotationProperty = new Property({ name: 'imageRotation', valueConverter: (v) => parseFloat(v) });
|
107
|
+
export const autoPlayAnimationsProperty = new Property({ name: 'autoPlayAnimations', valueConverter: booleanConverter });
|
108
|
+
export const tapToRetryEnabledProperty = new Property({ name: 'tapToRetryEnabled', valueConverter: booleanConverter });
|
109
|
+
export const aspectRatioProperty = new Property({ name: 'aspectRatio', affectsLayout: true, valueConverter: (v) => parseFloat(v) });
|
110
|
+
export const decodeWidthProperty = new Property({ name: 'decodeWidth', valueConverter: (v) => parseFloat(v) });
|
111
|
+
export const decodeHeightProperty = new Property({ name: 'decodeHeight', valueConverter: (v) => parseFloat(v) });
|
112
|
+
export const tintColorProperty = new Property({ name: 'tintColor' });
|
113
|
+
export const alwaysFadeProperty = new Property({ name: 'alwaysFade', valueConverter: booleanConverter, defaultValue: false });
|
114
|
+
export const fadeDurationProperty = new Property({ name: 'fadeDuration', valueConverter: (v) => parseFloat(v) });
|
115
|
+
export const noCacheProperty = new Property({ name: 'noCache', defaultValue: false, valueConverter: booleanConverter });
|
116
|
+
export const roundTopLeftRadiusProperty = new Property({
|
117
|
+
name: 'roundTopLeftRadius',
|
118
|
+
defaultValue: 0,
|
119
|
+
valueConverter: (v) => Length.toDevicePixels(Length.parse(v))
|
120
|
+
});
|
121
|
+
export const roundTopRightRadiusProperty = new Property({
|
122
|
+
name: 'roundTopRightRadius',
|
123
|
+
defaultValue: 0,
|
124
|
+
valueConverter: (v) => Length.toDevicePixels(Length.parse(v))
|
125
|
+
});
|
126
|
+
export const roundBottomLeftRadiusProperty = new Property({
|
127
|
+
name: 'roundBottomLeftRadius',
|
128
|
+
defaultValue: 0,
|
129
|
+
valueConverter: (v) => Length.toDevicePixels(Length.parse(v))
|
130
|
+
});
|
131
|
+
export const roundBottomRightRadiusProperty = new Property({
|
132
|
+
name: 'roundBottomRightRadius',
|
133
|
+
defaultValue: 0,
|
134
|
+
valueConverter: (v) => Length.toDevicePixels(Length.parse(v))
|
135
|
+
});
|
136
|
+
// export const roundRadiusProperty = new ShorthandProperty<any, string | CoreTypes.LengthType>({
|
137
|
+
// name: 'borderRadius',
|
138
|
+
// cssName: 'border-radius',
|
139
|
+
// getter(this) {
|
140
|
+
// if (
|
141
|
+
// Length.equals(this.borderTopLeftRadius, this.borderTopRightRadius) &&
|
142
|
+
// Length.equals(this.borderTopLeftRadius, this.borderBottomRightRadius) &&
|
143
|
+
// Length.equals(this.borderTopLeftRadius, this.borderBottomLeftRadius)
|
144
|
+
// ) {
|
145
|
+
// return this.borderTopLeftRadius;
|
146
|
+
// }
|
147
|
+
// return `${Length.convertToString(this.borderTopLeftRadius)} ${Length.convertToString(this.borderTopRightRadius)} ${Length.convertToString(
|
148
|
+
// this.borderBottomRightRadius
|
149
|
+
// )} ${Length.convertToString(this.borderBottomLeftRadius)}`;
|
150
|
+
// },
|
151
|
+
// //@ts-ignore
|
152
|
+
// converter(value) {
|
153
|
+
// if (typeof value === 'string') {
|
154
|
+
// const borderRadius = parseThickness(value);
|
155
|
+
// return [
|
156
|
+
// [roundTopLeftRadiusProperty, borderRadius.top],
|
157
|
+
// [roundTopRightRadiusProperty, borderRadius.right],
|
158
|
+
// [roundBottomRightRadiusProperty, borderRadius.bottom],
|
159
|
+
// [roundBottomLeftRadiusProperty, borderRadius.left]
|
160
|
+
// ];
|
161
|
+
// } else {
|
162
|
+
// return [
|
163
|
+
// [roundTopLeftRadiusProperty, value],
|
164
|
+
// [roundTopRightRadiusProperty, value],
|
165
|
+
// [roundBottomRightRadiusProperty, value],
|
166
|
+
// [roundBottomLeftRadiusProperty, value]
|
167
|
+
// ];
|
168
|
+
// }
|
169
|
+
// }
|
170
|
+
// });
|
171
|
+
export const loadModeProperty = new Property({
|
172
|
+
name: 'loadMode',
|
173
|
+
defaultValue: 'sync'
|
174
|
+
});
|
175
|
+
export const clipToBoundsProperty = new Property({ name: 'clipToBounds', defaultValue: true, valueConverter: booleanConverter });
|
176
|
+
export const animatedImageViewProperty = new Property({ name: 'animatedImageView', defaultValue: false, valueConverter: booleanConverter });
|
48
177
|
export class ImageBase extends View {
|
49
178
|
// public static blendingModeProperty = new Property<ImageBase, string>({ name: 'blendingMode' });
|
50
179
|
get nativeImageViewProtected() {
|
@@ -127,83 +256,35 @@ ImageBase.intermediateImageFailedEvent = 'intermediateImageFailed';
|
|
127
256
|
ImageBase.intermediateImageSetEvent = 'intermediateImageSet';
|
128
257
|
ImageBase.releaseEvent = 'release';
|
129
258
|
ImageBase.submitEvent = 'submit';
|
130
|
-
|
131
|
-
|
132
|
-
|
133
|
-
|
134
|
-
|
135
|
-
|
136
|
-
|
137
|
-
|
138
|
-
|
139
|
-
|
140
|
-
|
141
|
-
|
142
|
-
|
143
|
-
|
144
|
-
|
145
|
-
|
146
|
-
|
147
|
-
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
|
156
|
-
|
157
|
-
|
158
|
-
|
159
|
-
|
160
|
-
defaultValue: 0,
|
161
|
-
valueConverter: (v) => Length.toDevicePixels(Length.parse(v))
|
162
|
-
});
|
163
|
-
ImageBase.roundBottomLeftRadiusProperty = new Property({
|
164
|
-
name: 'roundBottomLeftRadius',
|
165
|
-
defaultValue: 0,
|
166
|
-
valueConverter: (v) => Length.toDevicePixels(Length.parse(v))
|
167
|
-
});
|
168
|
-
ImageBase.roundBottomRightRadiusProperty = new Property({
|
169
|
-
name: 'roundBottomRightRadius',
|
170
|
-
defaultValue: 0,
|
171
|
-
valueConverter: (v) => Length.toDevicePixels(Length.parse(v))
|
172
|
-
});
|
173
|
-
ImageBase.loadModeProperty = new Property({
|
174
|
-
name: 'loadMode',
|
175
|
-
defaultValue: 'sync'
|
176
|
-
});
|
177
|
-
ImageBase.clipToBoundsProperty = new Property({ name: 'clipToBounds', defaultValue: true, valueConverter: booleanConverter });
|
178
|
-
ImageBase.animatedImageViewProperty = new Property({ name: 'animatedImageView', defaultValue: false, valueConverter: booleanConverter });
|
179
|
-
ImageBase.srcProperty.register(ImageBase);
|
180
|
-
ImageBase.lowerResSrcProperty.register(ImageBase);
|
181
|
-
ImageBase.placeholderImageUriProperty.register(ImageBase);
|
182
|
-
ImageBase.failureImageUriProperty.register(ImageBase);
|
183
|
-
ImageBase.stretchProperty.register(ImageBase);
|
184
|
-
ImageBase.fadeDurationProperty.register(ImageBase);
|
185
|
-
ImageBase.backgroundUriProperty.register(ImageBase);
|
186
|
-
ImageBase.progressiveRenderingEnabledProperty.register(ImageBase);
|
187
|
-
ImageBase.localThumbnailPreviewsEnabledProperty.register(ImageBase);
|
188
|
-
ImageBase.showProgressBarProperty.register(ImageBase);
|
189
|
-
ImageBase.progressBarColorProperty.register(ImageBase);
|
190
|
-
ImageBase.roundAsCircleProperty.register(ImageBase);
|
191
|
-
ImageBase.roundTopLeftRadiusProperty.register(ImageBase);
|
192
|
-
ImageBase.roundTopRightRadiusProperty.register(ImageBase);
|
193
|
-
ImageBase.roundBottomLeftRadiusProperty.register(ImageBase);
|
194
|
-
ImageBase.roundBottomRightRadiusProperty.register(ImageBase);
|
195
|
-
ImageBase.blurRadiusProperty.register(ImageBase);
|
196
|
-
ImageBase.blurDownSamplingProperty.register(ImageBase);
|
197
|
-
ImageBase.imageRotationProperty.register(ImageBase);
|
198
|
-
ImageBase.autoPlayAnimationsProperty.register(ImageBase);
|
199
|
-
ImageBase.tapToRetryEnabledProperty.register(ImageBase);
|
200
|
-
ImageBase.aspectRatioProperty.register(ImageBase);
|
201
|
-
ImageBase.decodeWidthProperty.register(ImageBase);
|
202
|
-
ImageBase.decodeHeightProperty.register(ImageBase);
|
203
|
-
ImageBase.alwaysFadeProperty.register(ImageBase);
|
204
|
-
ImageBase.noCacheProperty.register(ImageBase);
|
205
|
-
ImageBase.clipToBoundsProperty.register(ImageBase);
|
206
|
-
ImageBase.animatedImageViewProperty.register(ImageBase);
|
207
|
-
ImageBase.loadModeProperty.register(ImageBase);
|
259
|
+
srcProperty.register(ImageBase);
|
260
|
+
lowerResSrcProperty.register(ImageBase);
|
261
|
+
placeholderImageUriProperty.register(ImageBase);
|
262
|
+
failureImageUriProperty.register(ImageBase);
|
263
|
+
stretchProperty.register(ImageBase);
|
264
|
+
fadeDurationProperty.register(ImageBase);
|
265
|
+
backgroundUriProperty.register(ImageBase);
|
266
|
+
progressiveRenderingEnabledProperty.register(ImageBase);
|
267
|
+
localThumbnailPreviewsEnabledProperty.register(ImageBase);
|
268
|
+
showProgressBarProperty.register(ImageBase);
|
269
|
+
progressBarColorProperty.register(ImageBase);
|
270
|
+
roundAsCircleProperty.register(ImageBase);
|
271
|
+
roundTopLeftRadiusProperty.register(ImageBase);
|
272
|
+
roundTopRightRadiusProperty.register(ImageBase);
|
273
|
+
roundBottomLeftRadiusProperty.register(ImageBase);
|
274
|
+
roundBottomRightRadiusProperty.register(ImageBase);
|
275
|
+
blurRadiusProperty.register(ImageBase);
|
276
|
+
blurDownSamplingProperty.register(ImageBase);
|
277
|
+
imageRotationProperty.register(ImageBase);
|
278
|
+
autoPlayAnimationsProperty.register(ImageBase);
|
279
|
+
tapToRetryEnabledProperty.register(ImageBase);
|
280
|
+
aspectRatioProperty.register(ImageBase);
|
281
|
+
decodeWidthProperty.register(ImageBase);
|
282
|
+
decodeHeightProperty.register(ImageBase);
|
283
|
+
alwaysFadeProperty.register(ImageBase);
|
284
|
+
noCacheProperty.register(ImageBase);
|
285
|
+
clipToBoundsProperty.register(ImageBase);
|
286
|
+
animatedImageViewProperty.register(ImageBase);
|
287
|
+
loadModeProperty.register(ImageBase);
|
288
|
+
// roundRadiusProperty.register(ImageBase as any);
|
208
289
|
// ImageBase.blendingModeProperty.register(ImageBase);
|
209
290
|
//# sourceMappingURL=index-common.js.map
|
package/index.android.d.ts
CHANGED
@@ -74,7 +74,9 @@ export declare class Img extends ImageBase {
|
|
74
74
|
onResumeNativeUpdates(): void;
|
75
75
|
createNativeView(): com.nativescript.image.DraweeView;
|
76
76
|
updateViewSize(imageInfo: any): void;
|
77
|
+
disposeNativeView(): void;
|
77
78
|
updateImageUri(): void;
|
79
|
+
controllerListener: com.facebook.drawee.controller.ControllerListener<com.facebook.imagepipeline.image.ImageInfo>;
|
78
80
|
private initImage;
|
79
81
|
private updateHierarchy;
|
80
82
|
private getDrawable;
|