Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.

Commit a02cc68

Browse files
committed
Fixed formatting
1 parent 8e6bb19 commit a02cc68

File tree

3 files changed

+418
-394
lines changed

3 files changed

+418
-394
lines changed

packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/CameraProperties.java

Lines changed: 127 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -14,155 +14,153 @@
1414
import android.util.Size;
1515
import androidx.annotation.RequiresApi;
1616

17-
/**
18-
* An interface allowing access to the different characteristics of the device's camera.
19-
*/
17+
/** An interface allowing access to the different characteristics of the device's camera. */
2018
public interface CameraProperties {
21-
String getCameraName();
19+
String getCameraName();
2220

23-
Range<Integer>[] getControlAutoExposureAvailableTargetFpsRanges();
21+
Range<Integer>[] getControlAutoExposureAvailableTargetFpsRanges();
2422

25-
Range<Integer> getControlAutoExposureCompensationRange();
23+
Range<Integer> getControlAutoExposureCompensationRange();
2624

27-
double getControlAutoExposureCompensationStep();
25+
double getControlAutoExposureCompensationStep();
2826

29-
int[] getControlAutoFocusAvailableModes();
27+
int[] getControlAutoFocusAvailableModes();
3028

31-
Integer getControlMaxRegionsAutoExposure();
29+
Integer getControlMaxRegionsAutoExposure();
3230

33-
Integer getControlMaxRegionsAutoFocus();
31+
Integer getControlMaxRegionsAutoFocus();
3432

35-
int[] getDistortionCorrectionAvailableModes();
33+
int[] getDistortionCorrectionAvailableModes();
3634

37-
Boolean getFlashInfoAvailable();
35+
Boolean getFlashInfoAvailable();
3836

39-
int getLensFacing();
37+
int getLensFacing();
4038

41-
Float getLensInfoMinimumFocusDistance();
39+
Float getLensInfoMinimumFocusDistance();
4240

43-
Float getScalerAvailableMaxDigitalZoom();
41+
Float getScalerAvailableMaxDigitalZoom();
4442

45-
Rect getSensorInfoActiveArraySize();
43+
Rect getSensorInfoActiveArraySize();
4644

47-
Size getSensorInfoPixelArraySize();
45+
Size getSensorInfoPixelArraySize();
4846

49-
Rect getSensorInfoPreCorrectionActiveArraySize();
47+
Rect getSensorInfoPreCorrectionActiveArraySize();
5048

51-
int getSensorOrientation();
49+
int getSensorOrientation();
5250

53-
int getHardwareLevel();
51+
int getHardwareLevel();
5452

55-
int[] getAvailableNoiseReductionModes();
53+
int[] getAvailableNoiseReductionModes();
5654
}
5755

5856
/**
59-
* Implementation of the @see CameraProperties interface using the @see android.hardware.camera2.CameraCharacteristics
60-
* class to access the different characteristics.
57+
* Implementation of the @see CameraProperties interface using the @see
58+
* android.hardware.camera2.CameraCharacteristics class to access the different characteristics.
6159
*/
6260
class CameraPropertiesImpl implements CameraProperties {
63-
private final CameraCharacteristics cameraCharacteristics;
64-
private final String cameraName;
65-
66-
public CameraPropertiesImpl(String cameraName, CameraManager cameraManager)
67-
throws CameraAccessException {
68-
this.cameraName = cameraName;
69-
this.cameraCharacteristics = cameraManager.getCameraCharacteristics(cameraName);
70-
}
71-
72-
@Override
73-
public String getCameraName() {
74-
return cameraName;
75-
}
76-
77-
@Override
78-
public Range<Integer>[] getControlAutoExposureAvailableTargetFpsRanges() {
79-
return cameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES);
80-
}
81-
82-
@Override
83-
public Range<Integer> getControlAutoExposureCompensationRange() {
84-
return cameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_COMPENSATION_RANGE);
85-
}
86-
87-
@Override
88-
public double getControlAutoExposureCompensationStep() {
89-
Rational rational =
90-
cameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_COMPENSATION_STEP);
91-
92-
return rational == null ? 0.0 : rational.doubleValue();
93-
}
94-
95-
@Override
96-
public int[] getControlAutoFocusAvailableModes() {
97-
return cameraCharacteristics.get(CameraCharacteristics.CONTROL_AF_AVAILABLE_MODES);
98-
}
99-
100-
@Override
101-
public Integer getControlMaxRegionsAutoExposure() {
102-
return cameraCharacteristics.get(CameraCharacteristics.CONTROL_MAX_REGIONS_AE);
103-
}
104-
105-
@Override
106-
public Integer getControlMaxRegionsAutoFocus() {
107-
return cameraCharacteristics.get(CameraCharacteristics.CONTROL_MAX_REGIONS_AF);
108-
}
109-
110-
@RequiresApi(api = VERSION_CODES.P)
111-
@Override
112-
public int[] getDistortionCorrectionAvailableModes() {
113-
return cameraCharacteristics.get(CameraCharacteristics.DISTORTION_CORRECTION_AVAILABLE_MODES);
114-
}
115-
116-
@Override
117-
public Boolean getFlashInfoAvailable() {
118-
return cameraCharacteristics.get(CameraCharacteristics.FLASH_INFO_AVAILABLE);
119-
}
120-
121-
@Override
122-
public int getLensFacing() {
123-
return cameraCharacteristics.get(CameraCharacteristics.LENS_FACING);
124-
}
125-
126-
@Override
127-
public Float getLensInfoMinimumFocusDistance() {
128-
return cameraCharacteristics.get(CameraCharacteristics.LENS_INFO_MINIMUM_FOCUS_DISTANCE);
129-
}
130-
131-
@Override
132-
public Float getScalerAvailableMaxDigitalZoom() {
133-
return cameraCharacteristics.get(CameraCharacteristics.SCALER_AVAILABLE_MAX_DIGITAL_ZOOM);
134-
}
135-
136-
@Override
137-
public Rect getSensorInfoActiveArraySize() {
138-
return cameraCharacteristics.get(CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE);
139-
}
140-
141-
@Override
142-
public Size getSensorInfoPixelArraySize() {
143-
return cameraCharacteristics.get(CameraCharacteristics.SENSOR_INFO_PIXEL_ARRAY_SIZE);
144-
}
145-
146-
@RequiresApi(api = VERSION_CODES.M)
147-
@Override
148-
public Rect getSensorInfoPreCorrectionActiveArraySize() {
149-
return cameraCharacteristics.get(
150-
CameraCharacteristics.SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE);
151-
}
152-
153-
@Override
154-
public int getSensorOrientation() {
155-
return cameraCharacteristics.get(CameraCharacteristics.SENSOR_ORIENTATION);
156-
}
157-
158-
@Override
159-
public int getHardwareLevel() {
160-
return cameraCharacteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
161-
}
162-
163-
@Override
164-
public int[] getAvailableNoiseReductionModes() {
165-
return cameraCharacteristics.get(
166-
CameraCharacteristics.NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES);
167-
}
168-
}
61+
private final CameraCharacteristics cameraCharacteristics;
62+
private final String cameraName;
63+
64+
public CameraPropertiesImpl(String cameraName, CameraManager cameraManager)
65+
throws CameraAccessException {
66+
this.cameraName = cameraName;
67+
this.cameraCharacteristics = cameraManager.getCameraCharacteristics(cameraName);
68+
}
69+
70+
@Override
71+
public String getCameraName() {
72+
return cameraName;
73+
}
74+
75+
@Override
76+
public Range<Integer>[] getControlAutoExposureAvailableTargetFpsRanges() {
77+
return cameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_AVAILABLE_TARGET_FPS_RANGES);
78+
}
79+
80+
@Override
81+
public Range<Integer> getControlAutoExposureCompensationRange() {
82+
return cameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_COMPENSATION_RANGE);
83+
}
84+
85+
@Override
86+
public double getControlAutoExposureCompensationStep() {
87+
Rational rational =
88+
cameraCharacteristics.get(CameraCharacteristics.CONTROL_AE_COMPENSATION_STEP);
89+
90+
return rational == null ? 0.0 : rational.doubleValue();
91+
}
92+
93+
@Override
94+
public int[] getControlAutoFocusAvailableModes() {
95+
return cameraCharacteristics.get(CameraCharacteristics.CONTROL_AF_AVAILABLE_MODES);
96+
}
97+
98+
@Override
99+
public Integer getControlMaxRegionsAutoExposure() {
100+
return cameraCharacteristics.get(CameraCharacteristics.CONTROL_MAX_REGIONS_AE);
101+
}
102+
103+
@Override
104+
public Integer getControlMaxRegionsAutoFocus() {
105+
return cameraCharacteristics.get(CameraCharacteristics.CONTROL_MAX_REGIONS_AF);
106+
}
107+
108+
@RequiresApi(api = VERSION_CODES.P)
109+
@Override
110+
public int[] getDistortionCorrectionAvailableModes() {
111+
return cameraCharacteristics.get(CameraCharacteristics.DISTORTION_CORRECTION_AVAILABLE_MODES);
112+
}
113+
114+
@Override
115+
public Boolean getFlashInfoAvailable() {
116+
return cameraCharacteristics.get(CameraCharacteristics.FLASH_INFO_AVAILABLE);
117+
}
118+
119+
@Override
120+
public int getLensFacing() {
121+
return cameraCharacteristics.get(CameraCharacteristics.LENS_FACING);
122+
}
123+
124+
@Override
125+
public Float getLensInfoMinimumFocusDistance() {
126+
return cameraCharacteristics.get(CameraCharacteristics.LENS_INFO_MINIMUM_FOCUS_DISTANCE);
127+
}
128+
129+
@Override
130+
public Float getScalerAvailableMaxDigitalZoom() {
131+
return cameraCharacteristics.get(CameraCharacteristics.SCALER_AVAILABLE_MAX_DIGITAL_ZOOM);
132+
}
133+
134+
@Override
135+
public Rect getSensorInfoActiveArraySize() {
136+
return cameraCharacteristics.get(CameraCharacteristics.SENSOR_INFO_ACTIVE_ARRAY_SIZE);
137+
}
138+
139+
@Override
140+
public Size getSensorInfoPixelArraySize() {
141+
return cameraCharacteristics.get(CameraCharacteristics.SENSOR_INFO_PIXEL_ARRAY_SIZE);
142+
}
143+
144+
@RequiresApi(api = VERSION_CODES.M)
145+
@Override
146+
public Rect getSensorInfoPreCorrectionActiveArraySize() {
147+
return cameraCharacteristics.get(
148+
CameraCharacteristics.SENSOR_INFO_PRE_CORRECTION_ACTIVE_ARRAY_SIZE);
149+
}
150+
151+
@Override
152+
public int getSensorOrientation() {
153+
return cameraCharacteristics.get(CameraCharacteristics.SENSOR_ORIENTATION);
154+
}
155+
156+
@Override
157+
public int getHardwareLevel() {
158+
return cameraCharacteristics.get(CameraCharacteristics.INFO_SUPPORTED_HARDWARE_LEVEL);
159+
}
160+
161+
@Override
162+
public int[] getAvailableNoiseReductionModes() {
163+
return cameraCharacteristics.get(
164+
CameraCharacteristics.NOISE_REDUCTION_AVAILABLE_NOISE_REDUCTION_MODES);
165+
}
166+
}

packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/features/CameraFeature.java

Lines changed: 37 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -17,40 +17,40 @@
1717
* @param <T>
1818
*/
1919
public abstract class CameraFeature<T> {
20-
protected final CameraProperties cameraProperties;
21-
22-
protected CameraFeature(@NonNull CameraProperties cameraProperties) {
23-
this.cameraProperties = cameraProperties;
24-
}
25-
26-
/** Debug name for this feature. */
27-
public abstract String getDebugName();
28-
29-
/**
30-
* Get the current value of this feature's setting.
31-
*
32-
* @return
33-
*/
34-
public abstract T getValue();
35-
36-
/**
37-
* Set a new value for this feature's setting.
38-
*
39-
* @param value
40-
*/
41-
public abstract void setValue(T value);
42-
43-
/**
44-
* Returns whether or not this feature is supported.
45-
*
46-
* @return
47-
*/
48-
public abstract boolean checkIsSupported();
49-
50-
/**
51-
* Update the setting in a provided request builder.
52-
*
53-
* @param requestBuilder
54-
*/
55-
public abstract void updateBuilder(CaptureRequest.Builder requestBuilder);
56-
}
20+
protected final CameraProperties cameraProperties;
21+
22+
protected CameraFeature(@NonNull CameraProperties cameraProperties) {
23+
this.cameraProperties = cameraProperties;
24+
}
25+
26+
/** Debug name for this feature. */
27+
public abstract String getDebugName();
28+
29+
/**
30+
* Get the current value of this feature's setting.
31+
*
32+
* @return
33+
*/
34+
public abstract T getValue();
35+
36+
/**
37+
* Set a new value for this feature's setting.
38+
*
39+
* @param value
40+
*/
41+
public abstract void setValue(T value);
42+
43+
/**
44+
* Returns whether or not this feature is supported.
45+
*
46+
* @return
47+
*/
48+
public abstract boolean checkIsSupported();
49+
50+
/**
51+
* Update the setting in a provided request builder.
52+
*
53+
* @param requestBuilder
54+
*/
55+
public abstract void updateBuilder(CaptureRequest.Builder requestBuilder);
56+
}

0 commit comments

Comments
 (0)