@nativescript-community/ui-image 4.3.15 → 4.3.17

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 CHANGED
@@ -3,6 +3,16 @@
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.3.17](https://github.com/nativescript-community/ui-image/compare/v4.3.16...v4.3.17) (2023-10-05)
7
+
8
+ **Note:** Version bump only for package @nativescript-community/ui-image
9
+
10
+ ## [4.3.16](https://github.com/nativescript-community/ui-image/compare/v4.3.15...v4.3.16) (2023-09-29)
11
+
12
+ ### Bug Fixes
13
+
14
+ * **android:** fix for image disappearing on fragment/ativity transitions. See https://github.com/facebook/fresco/issues/1446 ([b36d001](https://github.com/nativescript-community/ui-image/commit/b36d0012af443fadcdb969e901f7f0e69f4e0c80))
15
+
6
16
  ## [4.3.15](https://github.com/nativescript-community/ui-image/compare/v4.3.14...v4.3.15) (2023-09-28)
7
17
 
8
18
  ### Bug Fixes
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nativescript-community/ui-image",
3
- "version": "4.3.15",
3
+ "version": "4.3.17",
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": "b2f5267f7fb2098d3bc7d6c77f4c88f6235005b7"
47
+ "gitHead": "8b04fc76e2cf7a61516801c2aae0739b0d394428"
48
48
  }
@@ -39,12 +39,24 @@ public class DraweeView extends SimpleDraweeView {
39
39
  public boolean isUsingOutlineProvider = false;
40
40
  private static Paint clipPaint;
41
41
 
42
+ private boolean mLegacyVisibilityHandlingEnabled = false;
43
+
44
+ private static boolean sGlobalLegacyVisibilityHandlingEnabled = true;
45
+
46
+ public static void setGlobalLegacyVisibilityHandlingEnabled(
47
+ boolean legacyVisibilityHandlingEnabled) {
48
+ sGlobalLegacyVisibilityHandlingEnabled = legacyVisibilityHandlingEnabled;
49
+ }
50
+
42
51
  public DraweeView(Context context, GenericDraweeHierarchy hierarchy) {
43
52
  super(context);
44
53
  }
45
54
 
46
55
  public DraweeView(Context context) {
47
56
  super(context);
57
+ // In Android N and above, visibility handling for Drawables has been changed, which breaks
58
+ // activity transitions with DraweeViews.
59
+ mLegacyVisibilityHandlingEnabled = sGlobalLegacyVisibilityHandlingEnabled && context.getApplicationInfo().targetSdkVersion >= 24; //Build.VERSION_CODES.N
48
60
  }
49
61
 
50
62
  public DraweeView(Context context, AttributeSet attrs) {
@@ -55,6 +67,61 @@ public class DraweeView extends SimpleDraweeView {
55
67
  super(context, attrs, defStyle);
56
68
  }
57
69
 
70
+ @Override
71
+ protected void onAttachedToWindow() {
72
+ super.onAttachedToWindow();
73
+ maybeOverrideVisibilityHandling();
74
+ onAttach();
75
+ }
76
+
77
+ @Override
78
+ protected void onDetachedFromWindow() {
79
+ super.onDetachedFromWindow();
80
+ maybeOverrideVisibilityHandling();
81
+ onDetach();
82
+ }
83
+
84
+ @Override
85
+ public void onStartTemporaryDetach() {
86
+ super.onStartTemporaryDetach();
87
+ maybeOverrideVisibilityHandling();
88
+ onDetach();
89
+ }
90
+
91
+ @Override
92
+ public void onFinishTemporaryDetach() {
93
+ super.onFinishTemporaryDetach();
94
+ maybeOverrideVisibilityHandling();
95
+ onAttach();
96
+ }
97
+
98
+ @Override
99
+ protected void onVisibilityChanged(
100
+ View changedView,
101
+ int visibility) {
102
+ super.onVisibilityChanged(changedView, visibility);
103
+ maybeOverrideVisibilityHandling();
104
+ }
105
+
106
+ @Override
107
+ public void onVisibilityAggregated (boolean isVisible) {
108
+ super.onVisibilityAggregated(isVisible);
109
+ maybeOverrideVisibilityHandling();
110
+ }
111
+
112
+ private void maybeOverrideVisibilityHandling() {
113
+ if (mLegacyVisibilityHandlingEnabled) {
114
+ Drawable drawable = getDrawable();
115
+ if (drawable != null) {
116
+ drawable.setVisible(getVisibility() == VISIBLE, false);
117
+ }
118
+ }
119
+ }
120
+
121
+ public void setLegacyVisibilityHandlingEnabled(boolean legacyVisibilityHandlingEnabled) {
122
+ mLegacyVisibilityHandlingEnabled = legacyVisibilityHandlingEnabled;
123
+ }
124
+
58
125
  // private final Rect outlineRect = new RectF();
59
126
  public void updateOutlineProvider() {
60
127
  Drawable drawable = getBackground();
Binary file
@@ -1,7 +0,0 @@
1
- import * as i0 from "@angular/core";
2
- export declare class ImgDirective {
3
- constructor();
4
- static ɵfac: i0.ɵɵFactoryDeclaration<ImgDirective, never>;
5
- static ɵdir: i0.ɵɵDirectiveDeclaration<ImgDirective, "NSImg", never, {}, {}, never, never, false, never>;
6
- }
7
- export declare const NSIMG_DIRECTIVES: (typeof ImgDirective)[];
@@ -1 +0,0 @@
1
- export * from './module';
@@ -1,9 +0,0 @@
1
- import { ImgDirective } from './directives';
2
- import * as i0 from "@angular/core";
3
- import * as i1 from "./directives";
4
- export { ImgDirective };
5
- export declare class TNSImageModule {
6
- static ɵfac: i0.ɵɵFactoryDeclaration<TNSImageModule, never>;
7
- static ɵmod: i0.ɵɵNgModuleDeclaration<TNSImageModule, [typeof i1.ImgDirective], never, [typeof i1.ImgDirective]>;
8
- static ɵinj: i0.ɵɵInjectorDeclaration<TNSImageModule>;
9
- }