Skip to content
This repository was archived by the owner on Feb 22, 2023. It is now read-only.
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
20 commits
Select commit Hold shift + click to select a range
475f4ab
Replicated existing code and migrated references to new embedding, ad…
matthew-carroll Sep 24, 2019
8cde03b
Introduced CameraPreviewDisplay and CameraImageStream to remove Flutt…
matthew-carroll Sep 24, 2019
2081f42
Introduced a CameraEventListener to completely decouple Camera from E…
matthew-carroll Sep 24, 2019
b78bfcb
Removed all references of Result from Camera by introducing a combina…
matthew-carroll Sep 24, 2019
b45ae68
Refactored Camera such that getFlutterTexture() no longer needs to ex…
matthew-carroll Sep 24, 2019
6780abf
Moved ResolutionPreset to standalone class and made Camera package pr…
matthew-carroll Sep 24, 2019
8b93f68
Re-organized Camera code order to clearly separate preview images, fr…
matthew-carroll Sep 24, 2019
c85fcc2
Removed Activity reference from Camera.
matthew-carroll Sep 24, 2019
e04653b
Refactored CameraPermissions to eliminate Activity, ActivityCompat, C…
matthew-carroll Sep 24, 2019
60c1d20
Refactored CameraPermissions into an Interface and AndroidCameraPermi…
matthew-carroll Sep 25, 2019
13e4303
Separated the CameraPlugin class from the concept of the comms Camera…
matthew-carroll Sep 25, 2019
d5da9ce
Introduced CameraDetails data structure & wrote unit tests for Camera…
matthew-carroll Sep 25, 2019
436d9ca
Added unit tests for CameraPluginProtocol and reached 100% coverage f…
matthew-carroll Sep 25, 2019
3dcc0ab
Moved CameraPreviewDisplay and CameraImageStream implementations into…
matthew-carroll Sep 26, 2019
02ab397
Extracted per-camera channel construction out into CameraPlugin for t…
matthew-carroll Sep 26, 2019
e5408d9
Refactored so that CameraSystem and AndroidCameraSystem could be redu…
matthew-carroll Sep 26, 2019
6ea1b4f
Deleted CameraUtils, and continued to cleanup relationships.
matthew-carroll Sep 26, 2019
4669cb4
Added tests for CameraSystem - at 93% line coverage.
matthew-carroll Sep 26, 2019
410d0ac
Added tests to ensure that CameraPlugin does nothing without an Activ…
matthew-carroll Sep 26, 2019
0bd6522
Added tests for ChannelCameraEventHandler - now at CameraSystem (93%)…
matthew-carroll Sep 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Refactored Camera such that getFlutterTexture() no longer needs to ex…
…ist in Camera.
  • Loading branch information
matthew-carroll committed Sep 24, 2019
commit b45ae6828f61a86cedaff88fcf65263e2735c127
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,6 @@
import java.util.Arrays;
import java.util.List;

import io.flutter.view.TextureRegistry;
import io.flutter.view.TextureRegistry.SurfaceTextureEntry;

import static android.view.OrientationEventListener.ORIENTATION_UNKNOWN;
Expand Down Expand Up @@ -74,7 +73,7 @@ public enum ResolutionPreset {

public Camera(
final Activity activity,
final TextureRegistry textureRegistry,
final SurfaceTextureEntry flutterTexture,
final String cameraName,
final String resolutionPreset,
final boolean enableAudio)
Expand All @@ -85,7 +84,7 @@ public Camera(

this.cameraName = cameraName;
this.enableAudio = enableAudio;
this.flutterTexture = textureRegistry.createSurfaceTexture();
this.flutterTexture = flutterTexture;
this.cameraManager = (CameraManager) activity.getSystemService(Context.CAMERA_SERVICE);
orientationEventListener =
new OrientationEventListener(activity.getApplicationContext()) {
Expand Down Expand Up @@ -240,10 +239,6 @@ private void writeToFile(ByteBuffer buffer, File file) throws IOException {
}
}

SurfaceTextureEntry getFlutterTexture() {
return flutterTexture;
}

public void takePicture(String filePath, @NonNull final OnPictureTakenCallback callback) {
final File file = new File(filePath);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
import io.flutter.plugin.common.MethodChannel;
import io.flutter.plugin.common.MethodChannel.MethodCallHandler;
import io.flutter.plugin.common.MethodChannel.Result;
import io.flutter.view.TextureRegistry;

public class CameraPlugin implements FlutterPlugin, ActivityAware, MethodCallHandler {

Expand Down Expand Up @@ -89,9 +90,13 @@ private void instantiateCamera(MethodCall call, Result result) throws CameraAcce
String cameraName = call.argument("cameraName");
String resolutionPreset = call.argument("resolutionPreset");
boolean enableAudio = call.argument("enableAudio");
TextureRegistry.SurfaceTextureEntry textureEntry = pluginBinding
.getFlutterEngine()
.getRenderer()
.createSurfaceTexture();
camera = new Camera(
activityBinding.getActivity(),
pluginBinding.getFlutterEngine().getRenderer(),
textureEntry,
cameraName,
resolutionPreset,
enableAudio
Expand All @@ -115,7 +120,7 @@ public void onCameraOpenFailed(@NonNull String message) {

EventChannel cameraEventChannel = new EventChannel(
pluginBinding.getFlutterEngine().getDartExecutor(),
"flutter.io/cameraPlugin/cameraEvents" + camera.getFlutterTexture().id()
"flutter.io/cameraPlugin/cameraEvents" + textureEntry.id()
);
cameraEventChannel.setStreamHandler(new EventChannel.StreamHandler() {
@Override
Expand Down