@nativescript-community/ui-image 5.0.17 → 5.1.0
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 +17 -0
- package/README.md +21 -0
- package/index-common.d.ts +87 -5
- package/index-common.js +69 -5
- package/index-common.js.map +1 -1
- package/index.android.d.ts +2 -6
- package/index.android.js +22 -8
- package/index.android.js.map +1 -1
- package/index.d.ts +15 -87
- package/index.ios.d.ts +13 -3
- package/index.ios.js +88 -45
- package/index.ios.js.map +1 -1
- package/package.json +3 -3
- package/platforms/android/include.gradle +13 -4
- package/platforms/android/java/com/nativescript/image/CustomDataFetcher.java +11 -7
- package/platforms/android/java/com/nativescript/image/CustomGlideModule.java +5 -8
- package/platforms/android/java/com/nativescript/image/CustomUrlLoader.java +2 -14
- package/platforms/android/java/com/nativescript/image/GlideConfiguration.java +18 -1
- package/platforms/android/java/com/nativescript/image/MatrixImageView.java +59 -2
- package/platforms/android/java/com/nativescript/image/OkHttpSupport.java +29 -0
- package/platforms/android/java/com/nativescript/image/UrlConnectionLoader.java +159 -0
- package/platforms/android/native-api-usage.json +3 -1
- package/shared-transition.android.d.ts +12 -0
- package/shared-transition.android.js +46 -0
- package/shared-transition.android.js.map +1 -0
- package/tsconfig.tsbuildinfo +1 -1
- package/typings/ui_image.android.d.ts +11 -0
|
@@ -0,0 +1,46 @@
|
|
|
1
|
+
import { SharedTransition } from '@nativescript/core';
|
|
2
|
+
/**
|
|
3
|
+
* Shared element transitions with the @akylas/nativescript fork: the fork lets plugins register how to animate their own views.
|
|
4
|
+
* On main NativeScript `registerElementHandler` does not exist and nothing is registered.
|
|
5
|
+
*
|
|
6
|
+
* A MatrixImageView applies its scale type itself: the platform transitions (ChangeBounds + ChangeImageTransform)
|
|
7
|
+
* only resize it, and the image is drawn with the scale type of the start (eg a cropped thumbnail stretched in a fullscreen bounds)
|
|
8
|
+
* until the end of the transition.
|
|
9
|
+
* Here we start with the scale type of the view we leave and morph it to the scale type of the view we enter,
|
|
10
|
+
* following the size of the view while the transition resizes it.
|
|
11
|
+
*/
|
|
12
|
+
export function registerSharedTransitionHandler(ImgClass) {
|
|
13
|
+
const register = SharedTransition?.registerElementHandler;
|
|
14
|
+
if (typeof register !== 'function') {
|
|
15
|
+
return;
|
|
16
|
+
}
|
|
17
|
+
register.call(SharedTransition, {
|
|
18
|
+
handle({ from, onEnd, progress, skipImageTransform, to }) {
|
|
19
|
+
if (!(from instanceof ImgClass) || !(to instanceof ImgClass)) {
|
|
20
|
+
return false;
|
|
21
|
+
}
|
|
22
|
+
const fromView = from.nativeViewProtected;
|
|
23
|
+
const toView = to.nativeViewProtected;
|
|
24
|
+
const fromType = fromView?.getAppliedScaleType();
|
|
25
|
+
const toType = toView?.getAppliedScaleType();
|
|
26
|
+
if (!fromType || !toType || fromType.toString() === toType.toString()) {
|
|
27
|
+
return false;
|
|
28
|
+
}
|
|
29
|
+
// the image matrix is computed by the view, we update it ourselves while the view is resized
|
|
30
|
+
skipImageTransform();
|
|
31
|
+
toView.setScaleTypeBlend(fromType, toType, new com.nativescript.image.MatrixImageView.BlendProgressProvider({
|
|
32
|
+
getProgress: (width, height) => progress(width, height)
|
|
33
|
+
}));
|
|
34
|
+
// the view sets its own outline provider (for its border radius) at each size change,
|
|
35
|
+
// which would replace the one which animates the corner radius
|
|
36
|
+
const wasUsingOutlineProvider = toView.isUsingOutlineProvider;
|
|
37
|
+
toView.isUsingOutlineProvider = false;
|
|
38
|
+
onEnd(() => {
|
|
39
|
+
toView.isUsingOutlineProvider = wasUsingOutlineProvider;
|
|
40
|
+
toView.setScaleTypeBlend(null, null, null);
|
|
41
|
+
});
|
|
42
|
+
return true;
|
|
43
|
+
}
|
|
44
|
+
});
|
|
45
|
+
}
|
|
46
|
+
//# sourceMappingURL=shared-transition.android.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"shared-transition.android.js","sourceRoot":"","sources":["../../src/image/shared-transition.android.ts"],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AM,uBAAuB,GAAG,MAAM,CAAC,sBAAsB,CAAC;YAC9D,MAAM,CAAC,sBAAsB,GAAG,KAAK,CAAC;YAEtC,KAAK,CAAC,GAAG,EAAE;gBACP,MAAM,CAAC,sBAAsB,GAAG,uBAAuB,CAAC;gBACxD,MAAM,CAAC,iBAAiB,CAAC,IAAI,EAAE,IAAI,EAAE,IAAI,CAAC,CAAC;YAC/C,CAAC,CAAC,CAAC;YACH,OAAO,IAAI,CAAC;QAChB,CAAC;KACJ,CAAC,CAAC;AACP,CAAC"}
|
package/tsconfig.tsbuildinfo
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"root":["../../src/image/index-common.ts","../../src/image/index.android.ts","../../src/image/index.d.ts","../../src/image/index.ios.ts","../../src/image/references.d.ts","../../src/image/typings/android.d.ts","../../src/image/typings/glide.android.d.ts","../../src/image/typings/glide.okhttp.android.d.ts","../../src/image/typings/glide.transform.android.d.ts","../../src/image/typings/ios.d.ts","../../src/image/typings/objc!
|
|
1
|
+
{"root":["../../src/image/index-common.ts","../../src/image/index.android.ts","../../src/image/index.d.ts","../../src/image/index.ios.ts","../../src/image/references.d.ts","../../src/image/shared-transition.android.ts","../../src/image/typings/android.d.ts","../../src/image/typings/glide.android.d.ts","../../src/image/typings/glide.okhttp.android.d.ts","../../src/image/typings/glide.transform.android.d.ts","../../src/image/typings/ios.d.ts","../../src/image/typings/objc!sdwebimage.d.ts","../../src/image/typings/objc!sdwebimagephotosplugin.d.ts","../../src/image/typings/ui_image.android.d.ts","../../src/image/vue/index.ts","../../references.d.ts","../../tools/references.d.ts"],"version":"5.8.3"}
|
|
@@ -49,6 +49,8 @@ declare namespace com {
|
|
|
49
49
|
setMemoryCacheScreens(memoryCacheScreens: number);
|
|
50
50
|
getMemoryCacheSize(): number;
|
|
51
51
|
setMemoryCacheSize(memoryCacheSize: number);
|
|
52
|
+
setOkHttpClient(client: any);
|
|
53
|
+
getOkHttpClient(): any;
|
|
52
54
|
static getInstance():GlideConfiguration;
|
|
53
55
|
}
|
|
54
56
|
export class CacheKeyStore {
|
|
@@ -455,6 +457,8 @@ declare namespace com {
|
|
|
455
457
|
public mBaseMatrix: globalAndroid.graphics.Matrix;
|
|
456
458
|
public mExtraMatrix: globalAndroid.graphics.Matrix;
|
|
457
459
|
public isUsingOutlineProvider: boolean;
|
|
460
|
+
public getAppliedScaleType(): globalAndroid.widget.ImageView.ScaleType;
|
|
461
|
+
public setScaleTypeBlend(from: globalAndroid.widget.ImageView.ScaleType, to: globalAndroid.widget.ImageView.ScaleType, provider: com.nativescript.image.MatrixImageView.BlendProgressProvider): void;
|
|
458
462
|
public constructor(context: globalAndroid.content.Context);
|
|
459
463
|
public cancelRotationAnimation(): void;
|
|
460
464
|
public setImageRotation(degrees: number): void;
|
|
@@ -484,6 +488,13 @@ declare namespace com {
|
|
|
484
488
|
public onAttachedToWindow(): void;
|
|
485
489
|
public onDraw(saveCount: globalAndroid.graphics.Canvas): void;
|
|
486
490
|
}
|
|
491
|
+
export namespace MatrixImageView {
|
|
492
|
+
export class BlendProgressProvider {
|
|
493
|
+
public static class: java.lang.Class<com.nativescript.image.MatrixImageView.BlendProgressProvider>;
|
|
494
|
+
public constructor(implementation: { getProgress(viewWidth: number, viewHeight: number): number });
|
|
495
|
+
public getProgress(viewWidth: number, viewHeight: number): number;
|
|
496
|
+
}
|
|
497
|
+
}
|
|
487
498
|
export class ProgressInterceptor {
|
|
488
499
|
public static class: java.lang.Class<com.nativescript.image.ProgressInterceptor>;
|
|
489
500
|
public intercept(chain: okhttp3.Interceptor.Chain): okhttp3.Response;
|