Browse Source

Update ViewShot.java

聂先生 7 years ago
parent
commit
dd394a1356

+ 4
- 0
android/src/main/java/fr/greweb/reactnativeviewshot/ViewShot.java View File

37
     private String result;
37
     private String result;
38
     private Promise promise;
38
     private Promise promise;
39
     private Boolean snapshotContentContainer;
39
     private Boolean snapshotContentContainer;
40
+    private  ReactApplicationContext reactContext;
40
 
41
 
41
     public ViewShot(
42
     public ViewShot(
42
             int tag,
43
             int tag,
48
             File output,
49
             File output,
49
             String result,
50
             String result,
50
             Boolean snapshotContentContainer,
51
             Boolean snapshotContentContainer,
52
+            ReactApplicationContext reactContext,
51
             Promise promise) {
53
             Promise promise) {
52
         this.tag = tag;
54
         this.tag = tag;
53
         this.extension = extension;
55
         this.extension = extension;
58
         this.output = output;
60
         this.output = output;
59
         this.result = result;
61
         this.result = result;
60
         this.snapshotContentContainer = snapshotContentContainer;
62
         this.snapshotContentContainer = snapshotContentContainer;
63
+        this.reactContext = reactContext;
61
         this.promise = promise;
64
         this.promise = promise;
62
     }
65
     }
63
 
66
 
74
                 os = new FileOutputStream(output);
77
                 os = new FileOutputStream(output);
75
                 captureView(view, os);
78
                 captureView(view, os);
76
                 String uri = Uri.fromFile(output).toString();
79
                 String uri = Uri.fromFile(output).toString();
80
+                reactContext.sendBroadcast(new Intent(Intent.ACTION_MEDIA_SCANNER_SCAN_FILE, Uri.parse(uri)));
77
                 promise.resolve(uri);
81
                 promise.resolve(uri);
78
             }
82
             }
79
             else if ("base64".equals(result)) {
83
             else if ("base64".equals(result)) {