[camera] android-rework part 4: Android flash and zoom features#3798
[camera] android-rework part 4: Android flash and zoom features#3798mvanbeusekom merged 12 commits intoflutter:masterfrom
Conversation
|
All (the pull request submitter and all commit authors) CLAs are signed, but one or more commits were authored or co-authored by someone other than the pull request submitter. We need to confirm that all authors are ok with their commits being contributed to this project. Please have them confirm that by leaving a comment that contains only Note to project maintainer: There may be cases where the author cannot leave a comment, or the comment is not properly detected as consent. In those cases, you can manually confirm consent of the commit author(s), and set the ℹ️ Googlers: Go here for more info. |
|
@googlebot I consent. |
Co-authored-by: Andrew Coutts <andrewjohncoutts@gmail.com>
Co-authored-by: Andrew Coutts <andrewjohncoutts@gmail.com>
6868a50 to
3402d95
Compare
…ash_zoom_features
...mera/camera/android/src/main/java/io/flutter/plugins/camera/features/flash/FlashFeature.java
Show resolved
Hide resolved
| import androidx.annotation.Nullable; | ||
| import androidx.core.math.MathUtils; | ||
|
|
||
| public final class CameraZoom { |
There was a problem hiding this comment.
Javadoc for the class itself and its public members.
There was a problem hiding this comment.
Done.
I have renamed this class to ZoomUtils and made it package private. Also I simplified the class moving all state into the ZoomLevelFeature class where it belongs.
This reduces method chains and makes the whole design a lot simpler.
| } | ||
|
|
||
| this.maxZoom = | ||
| ((maxZoom == null) || (maxZoom < DEFAULT_ZOOM_FACTOR)) ? DEFAULT_ZOOM_FACTOR : maxZoom; |
There was a problem hiding this comment.
Why does the default change the max, rather than the max changing the default?
There was a problem hiding this comment.
This statement is part of the constructor where one can pass in a parameter specifying the maximum zoom level. However if the specified maximum zoom level if not specified or below the minimum zoom level (which is named incorrectly and something I will fix), the maximum zoom level will be set equal to the minimum zoom level.
| return null; | ||
| } | ||
|
|
||
| final float newZoom = MathUtils.clamp(zoom, DEFAULT_ZOOM_FACTOR, this.maxZoom); |
There was a problem hiding this comment.
Why is the default a minimum?
There was a problem hiding this comment.
The constant DEFAULT_ZOOM_FACTOR is named incorrect and should have been named MIN_ZOOM_LEVEL. This is something I will correct.
| import io.flutter.plugins.camera.CameraProperties; | ||
| import io.flutter.plugins.camera.features.CameraFeature; | ||
|
|
||
| /** Exposure offset makes the image brighter or darker. */ |
There was a problem hiding this comment.
This looks like copypasta from another class.
There was a problem hiding this comment.
Fixed and documented the other public members in this class.
|
@stuartmorgan I have gone through your feedback and applied the necessary changes. I would appreciate it if you could have another look. |
stuartmorgan-g
left a comment
There was a problem hiding this comment.
LGTM with one comment nit.
| } | ||
|
|
||
| /** | ||
| * Gets the maximum supported zoom level. |
There was a problem hiding this comment.
The docs on these two methods are swapped.
There was a problem hiding this comment.
Excellent catch, I swapped the documentation around so they match the correct method.
…ter#3798) * Base classes to support Android camera features Co-authored-by: Andrew Coutts <andrewjohncoutts@gmail.com> * Fixed formatting * Applied feedback from PR * Added Android Flash and Zoom features Co-authored-by: Andrew Coutts <andrewjohncoutts@gmail.com> * Use mockito-inline * Fix formatting issue * Processed feedback on pull request. * Fixed formatting * Fixed formatting * Swap docs to match correct methods Co-authored-by: Andrew Coutts <andrewjohncoutts@gmail.com>
Adds flash and zoom features containing the implementation to handle flash and zoom via the Android Camera2 API.
This is the forth PR in a series of pull-requests which will gradually introduce changes from PR #3651, making it easier to review the code (as discussed with @stuartmorgan).
If you had to change anything in the flutter/tests repo, include a link to the migration guide as per the breaking change policy.
Pre-launch Checklist
[shared_preferences]///).If you need help, consider asking for advice on the #hackers-new channel on Discord.