forked from flutter/plugins
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request flutter#7 from bottlepay/android-rework-fix-tests
Fix tests after feature refactor
- Loading branch information
Showing
37 changed files
with
692 additions
and
764 deletions.
There are no files selected for viewing
124 changes: 73 additions & 51 deletions
124
packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/Camera.java
Large diffs are not rendered by default.
Oops, something went wrong.
4 changes: 4 additions & 0 deletions
4
.../camera/camera/android/src/main/java/io/flutter/plugins/camera/CameraCaptureCallback.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/CameraProperties.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/CameraState.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
4 changes: 4 additions & 0 deletions
4
packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/ImageSaver.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
148 changes: 148 additions & 0 deletions
148
...camera/android/src/main/java/io/flutter/plugins/camera/features/CameraFeatureFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,148 @@ | ||
// Copyright 2019 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package io.flutter.plugins.camera.features; | ||
|
||
import android.app.Activity; | ||
import android.hardware.camera2.CaptureRequest; | ||
import androidx.annotation.NonNull; | ||
import io.flutter.plugins.camera.CameraProperties; | ||
import io.flutter.plugins.camera.DartMessenger; | ||
import io.flutter.plugins.camera.features.autofocus.AutoFocusFeature; | ||
import io.flutter.plugins.camera.features.exposurelock.ExposureLockFeature; | ||
import io.flutter.plugins.camera.features.exposureoffset.ExposureOffsetFeature; | ||
import io.flutter.plugins.camera.features.exposurepoint.ExposurePointFeature; | ||
import io.flutter.plugins.camera.features.flash.FlashFeature; | ||
import io.flutter.plugins.camera.features.focuspoint.FocusPointFeature; | ||
import io.flutter.plugins.camera.features.fpsrange.FpsRangeFeature; | ||
import io.flutter.plugins.camera.features.noisereduction.NoiseReductionFeature; | ||
import io.flutter.plugins.camera.features.regionboundaries.CameraRegions; | ||
import io.flutter.plugins.camera.features.regionboundaries.RegionBoundariesFeature; | ||
import io.flutter.plugins.camera.features.resolution.ResolutionFeature; | ||
import io.flutter.plugins.camera.features.resolution.ResolutionPreset; | ||
import io.flutter.plugins.camera.features.sensororientation.SensorOrientationFeature; | ||
import io.flutter.plugins.camera.features.zoomlevel.ZoomLevelFeature; | ||
import java.util.concurrent.Callable; | ||
|
||
public interface CameraFeatureFactory { | ||
|
||
/** | ||
* Creates a new instance of the auto focus feature. | ||
* | ||
* @param cameraProperties instance of the CameraProperties class containing information about the cameras features. | ||
* @param recordingVideo indicates if the camera is currently recording. | ||
* @return newly created instance of the AutoFocusFeature class. | ||
*/ | ||
AutoFocusFeature createAutoFocusFeature( | ||
@NonNull CameraProperties cameraProperties, | ||
boolean recordingVideo); | ||
|
||
/** | ||
* Creates a new instance of the exposure lock feature. | ||
* | ||
* @param cameraProperties instance of the CameraProperties class containing information about the cameras features. | ||
* @return newly created instance of the ExposureLockFeature class. | ||
*/ | ||
ExposureLockFeature createExposureLockFeature(@NonNull CameraProperties cameraProperties); | ||
|
||
/** | ||
* Creates a new instance of the exposure offset feature. | ||
* | ||
* @param cameraProperties instance of the CameraProperties class containing information about the cameras features. | ||
* @return newly created instance of the ExposureOffsetFeature class. | ||
*/ | ||
ExposureOffsetFeature createExposureOffsetFeature(@NonNull CameraProperties cameraProperties); | ||
|
||
/** | ||
* Creates a new instance of the flash feature. | ||
* | ||
* @param cameraProperties instance of the CameraProperties class containing information about the cameras features. | ||
* @return newly created instance of the FlashFeature class. | ||
*/ | ||
FlashFeature createFlashFeature(@NonNull CameraProperties cameraProperties); | ||
|
||
/** | ||
* Creates a new instance of the resolution feature. | ||
* | ||
* @param cameraProperties instance of the CameraProperties class containing information about the cameras features. | ||
* @param initialSetting initial resolution preset. | ||
* @param cameraName the name of the camera which can be used to identify the camera device. | ||
* @return newly created instance of the ResolutionFeature class. | ||
*/ | ||
ResolutionFeature createResolutionFeature( | ||
@NonNull CameraProperties cameraProperties, | ||
ResolutionPreset initialSetting, | ||
String cameraName); | ||
|
||
/** | ||
* Creates a new instance of the focus point feature. | ||
* | ||
* @param cameraProperties instance of the CameraProperties class containing information about the cameras features. | ||
* @param getCameraRegions function which is used to retrieve the current camera regions. | ||
* @return newly created instance of the FocusPointFeature class. | ||
*/ | ||
FocusPointFeature createFocusPointFeature( | ||
@NonNull CameraProperties cameraProperties, | ||
Callable<CameraRegions> getCameraRegions); | ||
|
||
/** | ||
* Creates a new instance of the FPS range feature. | ||
* | ||
* @param cameraProperties instance of the CameraProperties class containing information about the cameras features. | ||
* @return newly created instance of the FpsRangeFeature class. | ||
*/ | ||
FpsRangeFeature createFpsRangeFeature(@NonNull CameraProperties cameraProperties); | ||
|
||
/** | ||
* Creates a new instance of the sensor orientation feature. | ||
* | ||
* @param cameraProperties instance of the CameraProperties class containing information about the cameras features. | ||
* @param activity current activity associated with the camera plugin. | ||
* @param dartMessenger instance of the DartMessenger class, used to send state updates back to Dart. | ||
* @return newly created instance of the SensorOrientationFeature class. | ||
*/ | ||
SensorOrientationFeature createSensorOrientationFeature( | ||
@NonNull CameraProperties cameraProperties, | ||
@NonNull Activity activity, | ||
@NonNull DartMessenger dartMessenger); | ||
|
||
/** | ||
* Creates a new instance of the zoom level feature. | ||
* | ||
* @param cameraProperties instance of the CameraProperties class containing information about the cameras features. | ||
* @return newly created instance of the ZoomLevelFeature class. | ||
*/ | ||
ZoomLevelFeature createZoomLevelFeature(@NonNull CameraProperties cameraProperties); | ||
|
||
/** | ||
* Creates a new instance of the region boundaries feature. | ||
* | ||
* @param cameraProperties instance of the CameraProperties class containing information about the cameras features. | ||
* @param requestBuilder instance of the CaptureRequest.Builder class, used to inform the Camera2 API that the settings are updated. | ||
* @return newly created instance of the RegionBoundariesFeature class. | ||
*/ | ||
RegionBoundariesFeature createRegionBoundariesFeature( | ||
@NonNull CameraProperties cameraProperties, | ||
@NonNull CaptureRequest.Builder requestBuilder); | ||
|
||
/** | ||
* Creates a new instance of the exposure point feature. | ||
* | ||
* @param cameraProperties instance of the CameraProperties class containing information about the cameras features. | ||
* @param getCameraRegions function which is used to retrieve the current camera regions. | ||
* @return newly created instance of the ExposurePointFeature class. | ||
*/ | ||
ExposurePointFeature createExposurePointFeature( | ||
@NonNull CameraProperties cameraProperties, | ||
@NonNull Callable<CameraRegions> getCameraRegions); | ||
|
||
/** | ||
* Creates a new instance of the noise reduction feature. | ||
* | ||
* @param cameraProperties instance of the CameraProperties class containing information about the cameras features. | ||
* @return newly created instance of the NoiseReductionFeature class. | ||
*/ | ||
NoiseReductionFeature createNoiseReductionFeature( | ||
@NonNull CameraProperties cameraProperties); | ||
} |
105 changes: 105 additions & 0 deletions
105
...ra/android/src/main/java/io/flutter/plugins/camera/features/CameraFeatureFactoryImpl.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,105 @@ | ||
// Copyright 2019 The Chromium Authors. All rights reserved. | ||
// Use of this source code is governed by a BSD-style license that can be | ||
// found in the LICENSE file. | ||
|
||
package io.flutter.plugins.camera.features; | ||
|
||
import android.app.Activity; | ||
import android.hardware.camera2.CaptureRequest; | ||
import androidx.annotation.NonNull; | ||
import io.flutter.plugins.camera.CameraProperties; | ||
import io.flutter.plugins.camera.DartMessenger; | ||
import io.flutter.plugins.camera.features.autofocus.AutoFocusFeature; | ||
import io.flutter.plugins.camera.features.exposurelock.ExposureLockFeature; | ||
import io.flutter.plugins.camera.features.exposureoffset.ExposureOffsetFeature; | ||
import io.flutter.plugins.camera.features.exposurepoint.ExposurePointFeature; | ||
import io.flutter.plugins.camera.features.flash.FlashFeature; | ||
import io.flutter.plugins.camera.features.focuspoint.FocusPointFeature; | ||
import io.flutter.plugins.camera.features.fpsrange.FpsRangeFeature; | ||
import io.flutter.plugins.camera.features.noisereduction.NoiseReductionFeature; | ||
import io.flutter.plugins.camera.features.regionboundaries.CameraRegions; | ||
import io.flutter.plugins.camera.features.regionboundaries.RegionBoundariesFeature; | ||
import io.flutter.plugins.camera.features.resolution.ResolutionFeature; | ||
import io.flutter.plugins.camera.features.resolution.ResolutionPreset; | ||
import io.flutter.plugins.camera.features.sensororientation.SensorOrientationFeature; | ||
import io.flutter.plugins.camera.features.zoomlevel.ZoomLevelFeature; | ||
import java.util.concurrent.Callable; | ||
|
||
public class CameraFeatureFactoryImpl implements CameraFeatureFactory { | ||
|
||
@Override | ||
public AutoFocusFeature createAutoFocusFeature( | ||
@NonNull CameraProperties cameraProperties, | ||
boolean recordingVideo) { | ||
return new AutoFocusFeature(cameraProperties, recordingVideo); | ||
} | ||
|
||
@Override | ||
public ExposureLockFeature createExposureLockFeature(@NonNull CameraProperties cameraProperties) { | ||
return new ExposureLockFeature(cameraProperties); | ||
} | ||
|
||
@Override | ||
public ExposureOffsetFeature createExposureOffsetFeature( | ||
@NonNull CameraProperties cameraProperties) { | ||
return new ExposureOffsetFeature(cameraProperties); | ||
} | ||
|
||
@Override | ||
public FlashFeature createFlashFeature(@NonNull CameraProperties cameraProperties) { | ||
return new FlashFeature(cameraProperties); | ||
} | ||
|
||
@Override | ||
public ResolutionFeature createResolutionFeature( | ||
@NonNull CameraProperties cameraProperties, | ||
ResolutionPreset initialSetting, | ||
String cameraName) { | ||
return new ResolutionFeature(cameraProperties, initialSetting, cameraName); | ||
} | ||
|
||
@Override | ||
public FocusPointFeature createFocusPointFeature( | ||
@NonNull CameraProperties cameraProperties, | ||
Callable<CameraRegions> getCameraRegions) { | ||
return new FocusPointFeature(cameraProperties, getCameraRegions); | ||
} | ||
|
||
@Override | ||
public FpsRangeFeature createFpsRangeFeature(@NonNull CameraProperties cameraProperties) { | ||
return new FpsRangeFeature(cameraProperties); | ||
} | ||
|
||
@Override | ||
public SensorOrientationFeature createSensorOrientationFeature( | ||
@NonNull CameraProperties cameraProperties, | ||
@NonNull Activity activity, | ||
@NonNull DartMessenger dartMessenger) { | ||
return new SensorOrientationFeature(cameraProperties, activity, dartMessenger); | ||
} | ||
|
||
@Override | ||
public ZoomLevelFeature createZoomLevelFeature(@NonNull CameraProperties cameraProperties) { | ||
return new ZoomLevelFeature(cameraProperties); | ||
} | ||
|
||
@Override | ||
public RegionBoundariesFeature createRegionBoundariesFeature( | ||
@NonNull CameraProperties cameraProperties, | ||
@NonNull CaptureRequest.Builder requestBuilder) { | ||
return new RegionBoundariesFeature(cameraProperties, requestBuilder); | ||
} | ||
|
||
@Override | ||
public ExposurePointFeature createExposurePointFeature( | ||
@NonNull CameraProperties cameraProperties, | ||
@NonNull Callable<CameraRegions> getCameraRegions) { | ||
return new ExposurePointFeature(cameraProperties, getCameraRegions); | ||
} | ||
|
||
@Override | ||
public NoiseReductionFeature createNoiseReductionFeature( | ||
@NonNull CameraProperties cameraProperties) { | ||
return new NoiseReductionFeature(cameraProperties); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.