-
Notifications
You must be signed in to change notification settings - Fork 2.6k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
69 changed files
with
3,453 additions
and
355 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1 +1 @@ | ||
f52fe4f7e55de60a25f11f17fc6a8140544d03e0 | ||
83134ac7e44c9c9a9637955de23abecc304b492e |
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,14 @@ | ||
#!/bin/bash | ||
# Copyright 2013 The Flutter Authors. All rights reserved. | ||
# Use of this source code is governed by a BSD-style license that can be | ||
# found in the LICENSE file. | ||
set -e | ||
|
||
# The name here must match create_simulator.sh | ||
readonly DEVICE_NAME=Flutter-iPhone | ||
|
||
# Allow boot to fail; cases like "Unable to boot device in current state: Booted" | ||
# exit with failure. | ||
xcrun simctl boot "$DEVICE_NAME" || : | ||
echo -e "" | ||
xcrun simctl list |
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
Validating CODEOWNERS rules …
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,7 @@ | ||
## 0.5.0+19 | ||
|
||
* Implements torch flash mode. | ||
|
||
## 0.5.0+18 | ||
|
||
* Implements `startVideoCapturing`. | ||
|
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
29 changes: 29 additions & 0 deletions
29
...camerax/android/src/main/java/io/flutter/plugins/camerax/CameraControlFlutterApiImpl.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,29 @@ | ||
// Copyright 2013 The Flutter 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.camerax; | ||
|
||
import androidx.annotation.NonNull; | ||
import androidx.camera.core.CameraControl; | ||
import io.flutter.plugin.common.BinaryMessenger; | ||
import io.flutter.plugins.camerax.GeneratedCameraXLibrary.CameraControlFlutterApi; | ||
|
||
public class CameraControlFlutterApiImpl extends CameraControlFlutterApi { | ||
private final @NonNull InstanceManager instanceManager; | ||
|
||
public CameraControlFlutterApiImpl( | ||
@NonNull BinaryMessenger binaryMessenger, @NonNull InstanceManager instanceManager) { | ||
super(binaryMessenger); | ||
this.instanceManager = instanceManager; | ||
} | ||
|
||
/** | ||
* Creates a {@link CameraControl} instance in Dart. {@code reply} is not used so it can be empty. | ||
*/ | ||
void create(CameraControl cameraControl, Reply<Void> reply) { | ||
if (!instanceManager.containsInstance(cameraControl)) { | ||
create(instanceManager.addHostCreatedInstance(cameraControl), reply); | ||
} | ||
} | ||
} |
101 changes: 101 additions & 0 deletions
101
...id_camerax/android/src/main/java/io/flutter/plugins/camerax/CameraControlHostApiImpl.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,101 @@ | ||
// Copyright 2013 The Flutter 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.camerax; | ||
|
||
import android.content.Context; | ||
import androidx.annotation.NonNull; | ||
import androidx.annotation.VisibleForTesting; | ||
import androidx.camera.core.CameraControl; | ||
import androidx.core.content.ContextCompat; | ||
import com.google.common.util.concurrent.FutureCallback; | ||
import com.google.common.util.concurrent.Futures; | ||
import com.google.common.util.concurrent.ListenableFuture; | ||
import io.flutter.plugins.camerax.GeneratedCameraXLibrary.CameraControlHostApi; | ||
import java.util.Objects; | ||
|
||
/** | ||
* Host API implementation for {@link CameraControl}. | ||
* | ||
* <p>This class handles instantiating and adding native object instances that are attached to a | ||
* Dart instance or handle method calls on the associated native class or an instance of the class. | ||
*/ | ||
public class CameraControlHostApiImpl implements CameraControlHostApi { | ||
private final InstanceManager instanceManager; | ||
private final CameraControlProxy proxy; | ||
|
||
/** Proxy for constructors and static method of {@link CameraControl}. */ | ||
@VisibleForTesting | ||
public static class CameraControlProxy { | ||
Context context; | ||
|
||
/** Enables or disables the torch of the specified {@link CameraControl} instance. */ | ||
@NonNull | ||
public void enableTorch( | ||
@NonNull CameraControl cameraControl, | ||
@NonNull Boolean torch, | ||
@NonNull GeneratedCameraXLibrary.Result<Void> result) { | ||
ListenableFuture<Void> enableTorchFuture = cameraControl.enableTorch(torch); | ||
|
||
Futures.addCallback( | ||
enableTorchFuture, | ||
new FutureCallback<Void>() { | ||
public void onSuccess(Void voidResult) { | ||
result.success(null); | ||
} | ||
|
||
public void onFailure(Throwable t) { | ||
result.error(t); | ||
} | ||
}, | ||
ContextCompat.getMainExecutor(context)); | ||
} | ||
} | ||
|
||
/** | ||
* Constructs an {@link CameraControlHostApiImpl}. | ||
* | ||
* @param instanceManager maintains instances stored to communicate with attached Dart objects | ||
*/ | ||
public CameraControlHostApiImpl( | ||
@NonNull InstanceManager instanceManager, @NonNull Context context) { | ||
this(instanceManager, new CameraControlProxy(), context); | ||
} | ||
|
||
/** | ||
* Constructs an {@link CameraControlHostApiImpl}. | ||
* | ||
* @param instanceManager maintains instances stored to communicate with attached Dart objects | ||
* @param proxy proxy for constructors and static method of {@link CameraControl} | ||
* @param context {@link Context} used to retrieve {@code Executor} used to enable torch mode | ||
*/ | ||
@VisibleForTesting | ||
CameraControlHostApiImpl( | ||
@NonNull InstanceManager instanceManager, | ||
@NonNull CameraControlProxy proxy, | ||
@NonNull Context context) { | ||
this.instanceManager = instanceManager; | ||
this.proxy = proxy; | ||
proxy.context = context; | ||
} | ||
|
||
/** | ||
* Sets the context that the {@code ProcessCameraProvider} will use to enable/disable torch mode. | ||
* | ||
* <p>If using the camera plugin in an add-to-app context, ensure that a new instance of the | ||
* {@code CameraControl} is fetched via {@code #enableTorch} anytime the context changes. | ||
*/ | ||
public void setContext(@NonNull Context context) { | ||
this.proxy.context = context; | ||
} | ||
|
||
@Override | ||
public void enableTorch( | ||
@NonNull Long identifier, | ||
@NonNull Boolean torch, | ||
@NonNull GeneratedCameraXLibrary.Result<Void> result) { | ||
proxy.enableTorch( | ||
Objects.requireNonNull(instanceManager.getInstance(identifier)), torch, result); | ||
} | ||
} |
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.