This repository was archived by the owner on Feb 22, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9.8k
[camera] Flash functionality for Android and iOS #3314
Merged
Merged
Changes from 106 commits
Commits
Show all changes
108 commits
Select commit
Hold shift + click to select a range
2394d40
Move camera to camera/camera
mvanbeusekom 8a361ba
Fix relative path after move
mvanbeusekom 0662dc4
First suggestion for camera platform interface
mvanbeusekom fdac99f
Remove test coverage folder
mvanbeusekom c92210f
Update the version to 1.0.0
mvanbeusekom 4d78819
Remove redundant analysis overrides
mvanbeusekom d98a51e
Renamed onLatestImageAvailableHandler definition
mvanbeusekom 96b40fc
Merge branch 'master' into camera_federated
mvanbeusekom 69f573b
Split CameraEvents into separate streams
mvanbeusekom 613a92b
Updated platform interface to have recording methods return XFile ins…
BeMacized 247d9c9
Update documentation and unit tests to match platform interface changes
BeMacized 51c25b5
Make file input optional for recording methods in platform interface.…
BeMacized 1b06322
Add missing full stop in docs.
BeMacized 8e94057
Run dartfmt. Wrapped docs after max 80 cols. Added missing full stop.
BeMacized 05a8f83
Implemented & tested first parts of method channel implementation
BeMacized 5206bff
Remove unused EventChannelMock class
BeMacized 492fae0
Add missing unit tests
BeMacized 6b381ef
Add availableCameras to method channel implementation
BeMacized 96bccd4
Updated platform interface
BeMacized 79b58c8
Update packages/camera/camera_platform_interface/lib/src/platform_int…
BeMacized 6c32fa9
Update packages/camera/camera_platform_interface/lib/src/platform_int…
BeMacized 994e342
Merge pull request #9 from Baseflow/subpr/camera_federated/platform-i…
mvanbeusekom 7a38720
Added placeholders in default method channel implementation
BeMacized 15fed4b
Merge branch 'camera_federated' into subpr/camera_federated/default_m…
BeMacized 5b90760
Add missing implementations to default method channel implementation
BeMacized 6eb0e38
Fix formatting
mvanbeusekom af21985
Fix PR feedback
BeMacized 7ba6b1d
Add unit test for availableCameras
BeMacized a9cd0aa
Expand availableCameras unit test. Added unit test for takePicture.
BeMacized e56dd6c
Add unit test for startVideoRecording
BeMacized ea263a7
Add unit test for prepareForVideoRecording
BeMacized ae8cfc0
Add unit test for stopVideoRecording
BeMacized 782fe6a
Add unit test for pauseVideoRecording
BeMacized d701a76
Add unit test for buildView
BeMacized debb8bc
Remove TODO comment
BeMacized 55782fd
Update packages/camera/camera_platform_interface/lib/src/method_chann…
BeMacized 576ef94
Update packages/camera/camera_platform_interface/lib/src/method_chann…
BeMacized 8e7e954
Update packages/camera/camera_platform_interface/lib/src/method_chann…
BeMacized 5c743b2
Merge branch 'camera_federated' into subpr/camera_federated/default_m…
BeMacized 821710c
WIP: Dart and Android implementation
danielroek 6902112
Have resolution stream replay last value on subscription. Replace str…
BeMacized bebe969
Merge branch 'subpr/camera_federated/default_method_channel_impl' int…
BeMacized 4c217ed
Added reverse method channel to replace event channel. Updated initia…
BeMacized 01fcfe7
Fixed example app for Android. Removed isRecordingVideo and isStreami…
danielroek 918033e
iOS implementation: Removed standard event channel. Added reverse met…
BeMacized f5c0615
Added some first tests for camera/camera
danielroek 837cef7
Started splitting initialize method
mvanbeusekom b7b33e5
More tests and some feedback
danielroek 8bd9718
Finish splitting up initialize for iOS
BeMacized c7ffb49
Update unit tests
BeMacized b8f286c
Remove unused listener in plugin
BeMacized 349b26f
Fix takePicture method on iOS
BeMacized 31cf90f
Merged iOS - split initialize method
mvanbeusekom efcfcb4
Fix video recording on iOS. Updated platform interface.
BeMacized 8b22d10
Update unit tests
BeMacized f11850a
Update error handling of video methods in iOS code. Make iOS code mor…
BeMacized 7f14ff7
Split initialize method on Android
mvanbeusekom dea57c7
Merge branch 'subpr/camera_federated/default_method_channel_impl_ios'…
mvanbeusekom a6f8985
Updated startVideoRecording documentation
mvanbeusekom 3e53a35
Make sure file is returned by stopVideoRecording
mvanbeusekom 418abc0
Change cast
BeMacized d36789b
Use correct event-type after initializing
mvanbeusekom 2a5cc5a
Fix DartMessenger unit-tests
mvanbeusekom fc3c160
Merge branch 'subpr/camera_federated/default_method_channel_impl_ios'…
mvanbeusekom 885b960
Added Android and iOS implementation
mvanbeusekom 1e7d19a
Fix formatting
mvanbeusekom 6b93430
Fixed tests, formatting and analysis warnings
mvanbeusekom 5d58410
Added missing documentation public APIs
mvanbeusekom 8ee0442
Added missing license to Dart files
mvanbeusekom 987eba1
Fix formatting issues
mvanbeusekom 2b2f207
Updated CHANGELOG and version
mvanbeusekom 1f9c343
Added more tests
danielroek 23dd28d
Merge remote-tracking branch 'origin/camera_federated' into camera_fe…
danielroek 1c8a1a1
Formatted code
danielroek cac52fc
Added additional unit-tests to platform_interface
mvanbeusekom 9c065e1
Merge branch 'camera_federated' of github.com:Baseflow/flutter-plugin…
mvanbeusekom 3e991dd
Fix formatting issues
mvanbeusekom d613724
Re-added the CameraPreview widget
mvanbeusekom 343294a
Refactored CameraException not to use
mvanbeusekom f385a29
Use import/export instead of part implementation
mvanbeusekom 557d056
fixed formatting
mvanbeusekom ab30e1d
Resolved additional feedback
mvanbeusekom 22ec1d7
Resolved additional feedback
mvanbeusekom 4cbb191
Flash WIP
BeMacized 884a24e
Implement flash modes for Android
BeMacized 413934f
Merge branch 'camera_federated_implementation' into feature/camera_flash
BeMacized 33788a1
Rebased on master
mvanbeusekom b38bfa9
Update dependency to git repo
mvanbeusekom d7b2e1c
Add missing PictureCaptureRequest class
BeMacized 7448e04
Add PR feedback
BeMacized c469adb
Move enums out of Camera.java
BeMacized b9ece62
Merge branch 'camera_federated_implementation' into feature/camera_flash
mvanbeusekom 6fc1593
Expanded platform interface so support setting flash mode
BeMacized ab5a338
Formatted dart code
BeMacized 6902ea8
Manually serialize flash mode enum rather than relying on stringifica…
BeMacized 9c0d015
Add default to flash mode serialization
BeMacized a2b3020
Merge branch 'feature/camera_flash_platform_interface' into feature/c…
BeMacized fc0f410
Fix for unit tests and reformatting
BeMacized 292db7a
Merge branch 'master' into feature/camera_flash
BeMacized 85ade8a
Merged with master
mvanbeusekom 048c7be
Fixed CHANGELOG and remove redundant iOS files
mvanbeusekom 1694bcc
Expose FlashMode through camera package
mvanbeusekom b68cc80
Add reqeusted unit tests
BeMacized 0c7f391
Clean up new tests
BeMacized 04cca39
Add unit tests for Android implementation
BeMacized 97ed5d9
Update platform interface dependency to point to pub.dev release.
BeMacized 53af749
Merge branch 'master' into feature/camera_flash
BeMacized 2a31b5e
Update version number
mvanbeusekom File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 hidden or 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 hidden or 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 hidden or 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
49 changes: 49 additions & 0 deletions
49
.../camera/camera/android/src/main/java/io/flutter/plugins/camera/PictureCaptureRequest.java
This file contains hidden or 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,49 @@ | ||
package io.flutter.plugins.camera; | ||
|
||
import androidx.annotation.Nullable; | ||
import io.flutter.plugin.common.MethodChannel; | ||
|
||
class PictureCaptureRequest { | ||
|
||
enum State { | ||
idle, | ||
awaitingPreCapture, | ||
capturing, | ||
finished, | ||
error, | ||
} | ||
|
||
private final MethodChannel.Result result; | ||
private State state; | ||
|
||
public PictureCaptureRequest(MethodChannel.Result result) { | ||
this.result = result; | ||
state = State.idle; | ||
} | ||
|
||
public void setState(State state) { | ||
if (isFinished()) throw new IllegalStateException("Request has already been finished"); | ||
this.state = state; | ||
} | ||
|
||
public State getState() { | ||
return state; | ||
} | ||
|
||
public boolean isFinished() { | ||
return state == State.finished || state == State.error; | ||
} | ||
|
||
public void finish(String absolutePath) { | ||
if (isFinished()) throw new IllegalStateException("Request has already been finished"); | ||
result.success(absolutePath); | ||
state = State.finished; | ||
} | ||
|
||
public void error( | ||
String errorCode, @Nullable String errorMessage, @Nullable Object errorDetails) { | ||
if (isFinished()) throw new IllegalStateException("Request has already been finished"); | ||
result.error(errorCode, errorMessage, errorDetails); | ||
state = State.error; | ||
} | ||
} | ||
16 changes: 16 additions & 0 deletions
16
packages/camera/camera/android/src/main/java/io/flutter/plugins/camera/types/FlashMode.java
This file contains hidden or 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,16 @@ | ||
package io.flutter.plugins.camera.types; | ||
|
||
// Mirrors flash_mode.dart | ||
public enum FlashMode { | ||
off, | ||
auto, | ||
always; | ||
|
||
public static FlashMode getValueForString(String modeStr) { | ||
try { | ||
return valueOf(modeStr); | ||
} catch (IllegalArgumentException | NullPointerException e) { | ||
return null; | ||
} | ||
} | ||
mvanbeusekom marked this conversation as resolved.
Show resolved
Hide resolved
|
||
} |
11 changes: 11 additions & 0 deletions
11
...camera/camera/android/src/main/java/io/flutter/plugins/camera/types/ResolutionPreset.java
This file contains hidden or 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,11 @@ | ||
package io.flutter.plugins.camera.types; | ||
|
||
// Mirrors camera.dart | ||
public enum ResolutionPreset { | ||
low, | ||
medium, | ||
high, | ||
veryHigh, | ||
ultraHigh, | ||
max, | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.