@capacitor-community/camera-preview 7.0.1 → 7.0.2

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.
@@ -122,11 +122,11 @@ public class CameraActivity extends Fragment {
122
122
  return view;
123
123
  }
124
124
 
125
- public void setRect(int x, int y, int width, int height) {
125
+ public void setRect(int x, int y, Integer width, Integer height) {
126
126
  this.x = x;
127
127
  this.y = y;
128
- this.width = width;
129
- this.height = height;
128
+ this.width = width == null ? ViewGroup.LayoutParams.MATCH_PARENT : width;
129
+ this.height = height == null ? ViewGroup.LayoutParams.MATCH_PARENT : height;
130
130
  }
131
131
 
132
132
  private void createCameraPreview() {
@@ -318,36 +318,21 @@ public class CameraPreview extends Plugin implements CameraActivity.CameraPrevie
318
318
  int computedY = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, y, metrics);
319
319
 
320
320
  // size
321
- int computedWidth;
322
- int computedHeight;
323
- int computedPaddingBottom;
321
+ Integer computedWidth = null;
322
+ Integer computedHeight = null;
323
+ int computedPaddingBottom = 0;
324
324
 
325
325
  if (paddingBottom != 0) {
326
326
  computedPaddingBottom = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, paddingBottom, metrics);
327
- } else {
328
- computedPaddingBottom = 0;
329
327
  }
330
328
 
331
329
  if (width != 0) {
332
330
  computedWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, width, metrics);
333
- } else {
334
- Display defaultDisplay = getBridge().getActivity().getWindowManager().getDefaultDisplay();
335
- final Point size = new Point();
336
- defaultDisplay.getSize(size);
337
-
338
- computedWidth = (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, size.x, metrics);
339
331
  }
340
332
 
341
333
  if (height != 0) {
342
334
  computedHeight =
343
335
  (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, height, metrics) - computedPaddingBottom;
344
- } else {
345
- Display defaultDisplay = getBridge().getActivity().getWindowManager().getDefaultDisplay();
346
- final Point size = new Point();
347
- defaultDisplay.getSize(size);
348
-
349
- computedHeight =
350
- (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_PX, size.y, metrics) - computedPaddingBottom;
351
336
  }
352
337
 
353
338
  fragment.setRect(computedX, computedY, computedWidth, computedHeight);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@capacitor-community/camera-preview",
3
- "version": "7.0.1",
3
+ "version": "7.0.2",
4
4
  "description": "Camera preview",
5
5
  "main": "dist/plugin.cjs.js",
6
6
  "module": "dist/esm/index.js",
@@ -25,9 +25,9 @@
25
25
  "author": "Ariel Hernandez Musa",
26
26
  "license": "MIT",
27
27
  "devDependencies": {
28
- "@capacitor/android": "^7.2.0",
29
- "@capacitor/core": "^7.2.0",
30
- "@capacitor/ios": "^7.2.0",
28
+ "@capacitor/android": "^7.3.0",
29
+ "@capacitor/core": "^7.3.0",
30
+ "@capacitor/ios": "^7.3.0",
31
31
  "@ionic/eslint-config": "^0.4.0",
32
32
  "@ionic/prettier-config": "^4.0.0",
33
33
  "@ionic/swiftlint-config": "^2.0.0",