-
Notifications
You must be signed in to change notification settings - Fork 9.7k
[camerax] Wrap methods necessary for preview implementation #7046
Changes from 22 commits
496ca83
c9593ba
8e8779e
6e5bc8e
268d9f5
2001c33
7552ad9
7ff2a94
dfc3071
4ba07e2
754939c
fb44db3
858815d
78edaa2
3527322
335372b
4dd9c4c
24b1bdb
e0efef2
e90f45c
73cb5f8
abf4e58
659c2e0
5f269c7
a6fe15c
78e0d0f
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -5,8 +5,13 @@ | |
package io.flutter.plugins.camerax; | ||
|
||
import android.app.Activity; | ||
import android.graphics.SurfaceTexture; | ||
import android.view.Surface; | ||
import androidx.camera.core.CameraSelector; | ||
import androidx.camera.core.Preview; | ||
import io.flutter.plugin.common.BinaryMessenger; | ||
|
||
/** Utility class used to create CameraX-related objects primarily for testing purposes. */ | ||
public class CameraXProxy { | ||
public CameraSelector.Builder createCameraSelectorBuilder() { | ||
return new CameraSelector.Builder(); | ||
|
@@ -23,4 +28,23 @@ public DeviceOrientationManager createDeviceOrientationManager( | |
DeviceOrientationManager.DeviceOrientationChangeCallback callback) { | ||
return new DeviceOrientationManager(activity, isFrontFacing, sensorOrientation, callback); | ||
} | ||
|
||
public Preview.Builder createPreviewBuilder() { | ||
return new Preview.Builder(); | ||
} | ||
|
||
public Surface createSurface(SurfaceTexture surfaceTexture) { | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I don't think so. I don't see anything about it in the style guide. @bparrishMines can you verify? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We don't have an enforced repo wide policy yet. Mainly because we don't run a linter for Java code. I just created flutter/flutter#119836 to track this. For I mostly recommend to be consistent whichever way you choose for the package. But, a consistent repo wide policy could be chosen when we start running a linter for Java code. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. For now lets lean towards documenting Nullable. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Sounds good to me. I'll start adding it from here on out and most likely do a cleanup PR for this in the future to achieve consistency in the plugin. |
||
return new Surface(surfaceTexture); | ||
} | ||
|
||
/** | ||
* Creates an instance of the {@code SystemServicesFlutterApiImpl}. | ||
* | ||
* <p>Included in this class to utilize the callback methods it provides, e.g. {@code | ||
* onCameraError(String)}. | ||
*/ | ||
public SystemServicesFlutterApiImpl createSystemServicesFlutterApiImpl( | ||
BinaryMessenger binaryMessenger) { | ||
return new SystemServicesFlutterApiImpl(binaryMessenger); | ||
} | ||
} |
Uh oh!
There was an error while loading. Please reload this page.