@capgo/camera-preview 7.13.10 → 7.13.11
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.
|
@@ -7,6 +7,8 @@ import android.Manifest;
|
|
|
7
7
|
import android.content.pm.ActivityInfo;
|
|
8
8
|
import android.content.res.Configuration;
|
|
9
9
|
import android.graphics.Color;
|
|
10
|
+
import android.graphics.drawable.ColorDrawable;
|
|
11
|
+
import android.graphics.drawable.Drawable;
|
|
10
12
|
import android.location.Location;
|
|
11
13
|
import android.util.DisplayMetrics;
|
|
12
14
|
import android.util.Log;
|
|
@@ -116,6 +118,7 @@ public class CameraPreview
|
|
|
116
118
|
private OrientationEventListener orientationListener;
|
|
117
119
|
private int lastOrientation = Configuration.ORIENTATION_UNDEFINED;
|
|
118
120
|
private boolean lastDisableAudio = true;
|
|
121
|
+
private Drawable originalWindowBackground;
|
|
119
122
|
|
|
120
123
|
@PluginMethod
|
|
121
124
|
public void getExposureModes(PluginCall call) {
|
|
@@ -379,6 +382,16 @@ public class CameraPreview
|
|
|
379
382
|
cameraXView.stopSession();
|
|
380
383
|
cameraXView = null;
|
|
381
384
|
}
|
|
385
|
+
// Restore original window background if modified earlier
|
|
386
|
+
if (originalWindowBackground != null) {
|
|
387
|
+
try {
|
|
388
|
+
getBridge()
|
|
389
|
+
.getActivity()
|
|
390
|
+
.getWindow()
|
|
391
|
+
.setBackgroundDrawable(originalWindowBackground);
|
|
392
|
+
} catch (Exception ignored) {}
|
|
393
|
+
originalWindowBackground = null;
|
|
394
|
+
}
|
|
382
395
|
call.resolve();
|
|
383
396
|
});
|
|
384
397
|
}
|
|
@@ -788,6 +801,22 @@ public class CameraPreview
|
|
|
788
801
|
getBridge()
|
|
789
802
|
.getActivity()
|
|
790
803
|
.runOnUiThread(() -> {
|
|
804
|
+
// Ensure transparent background when preview is behind the WebView (Android 10 fix)
|
|
805
|
+
if (toBack) {
|
|
806
|
+
try {
|
|
807
|
+
if (originalWindowBackground == null) {
|
|
808
|
+
originalWindowBackground = getBridge()
|
|
809
|
+
.getActivity()
|
|
810
|
+
.getWindow()
|
|
811
|
+
.getDecorView()
|
|
812
|
+
.getBackground();
|
|
813
|
+
}
|
|
814
|
+
getBridge()
|
|
815
|
+
.getActivity()
|
|
816
|
+
.getWindow()
|
|
817
|
+
.setBackgroundDrawable(new ColorDrawable(Color.TRANSPARENT));
|
|
818
|
+
} catch (Exception ignored) {}
|
|
819
|
+
}
|
|
791
820
|
DisplayMetrics metrics = getBridge()
|
|
792
821
|
.getActivity()
|
|
793
822
|
.getResources()
|