-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[camerax] Wrap classes to implement resolution configuration for image capture, image analysis, and preview #4523
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from 26 commits
Commits
Show all changes
29 commits
Select commit
Hold shift + click to select a range
dec3d69
Merge remote-tracking branch 'upstream/main' into camx_occ
camsim99 0e0333b
Merge remote-tracking branch 'upstream/main'
camsim99 bd7ac99
Merge remote-tracking branch 'upstream/main'
camsim99 5c3363b
Merge remote-tracking branch 'upstream/main'
camsim99 fed9621
Undo changes
camsim99 5aabe34
Merge remote-tracking branch 'upstream/main'
camsim99 2b9a352
Merge remote-tracking branch 'upstream/main'
camsim99 a1173da
Merge remote-tracking branch 'upstream/main'
camsim99 cbc3d6b
Merge remote-tracking branch 'upstream/main'
camsim99 cae5a4c
Merge remote-tracking branch 'upstream/main'
camsim99 72283db
Merge remote-tracking branch 'upstream/main'
camsim99 166a77c
Merge remote-tracking branch 'upstream/main'
camsim99 399780e
Merge remote-tracking branch 'upstream/main'
camsim99 8d5d0e7
Merge remote-tracking branch 'upstream/main'
camsim99 084d960
Merge remote-tracking branch 'upstream/main'
camsim99 d2a59ac
Merge remote-tracking branch 'upstream/main'
camsim99 a1422bf
Merge remote-tracking branch 'upstream/main'
camsim99 bdd87a6
Merge remote-tracking branch 'upstream/main'
camsim99 137a28b
Merge remote-tracking branch 'upstream/main'
camsim99 c78e0b8
Add wrapped classes, tests, and remove deprecated apis
camsim99 3cd06e8
Modify null check to fix integration test
camsim99 a383e8f
Cleanup
camsim99 725a4ec
Add missing import
camsim99 bdfb634
Fix some spelling errors
camsim99 fc7c977
Merge remote-tracking branch 'upstream/main' into camx_wrapres
camsim99 41fdabc
Mark new classes as immutable
camsim99 996ce03
Address review
camsim99 d9ab6c3
Merge remote-tracking branch 'upstream/main' into camx_wrapres
camsim99 98e1035
Address review
camsim99 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
65 changes: 65 additions & 0 deletions
65
...erax/android/src/main/java/io/flutter/plugins/camerax/AspectRatioStrategyHostApiImpl.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,65 @@ | ||
| // 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.annotation.VisibleForTesting; | ||
| import androidx.camera.core.resolutionselector.AspectRatioStrategy; | ||
| import io.flutter.plugins.camerax.GeneratedCameraXLibrary.AspectRatioStrategyHostApi; | ||
|
|
||
| /** | ||
| * Host API implementation for {@link AspectRatioStrategy}. | ||
| * | ||
| * <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 AspectRatioStrategyHostApiImpl implements AspectRatioStrategyHostApi { | ||
| private final InstanceManager instanceManager; | ||
| private final AspectRatioStrategyProxy proxy; | ||
|
|
||
| /** Proxy for constructors and static method of {@link AspectRatioStrategy}. */ | ||
| @VisibleForTesting | ||
| public static class AspectRatioStrategyProxy { | ||
| /** Creates an instance of {@link AspectRatioStrategy}. */ | ||
| @NonNull | ||
| public AspectRatioStrategy create( | ||
| @NonNull Long preferredAspectRatio, @NonNull Long fallbackRule) { | ||
| return new AspectRatioStrategy(preferredAspectRatio.intValue(), fallbackRule.intValue()); | ||
| } | ||
| } | ||
|
|
||
| /** | ||
| * Constructs a {@link AspectRatioStrategyHostApiImpl}. | ||
| * | ||
| * @param instanceManager maintains instances stored to communicate with attached Dart objects | ||
| */ | ||
| public AspectRatioStrategyHostApiImpl(@NonNull InstanceManager instanceManager) { | ||
| this(instanceManager, new AspectRatioStrategyProxy()); | ||
| } | ||
|
|
||
| /** | ||
| * Constructs a {@link AspectRatioStrategyHostApiImpl}. | ||
camsim99 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * | ||
| * @param instanceManager maintains instances stored to communicate with attached Dart objects | ||
| * @param proxy proxy for constructors and static method of {@link AspectRatioStrategy} | ||
| */ | ||
| @VisibleForTesting | ||
| AspectRatioStrategyHostApiImpl( | ||
| @NonNull InstanceManager instanceManager, @NonNull AspectRatioStrategyProxy proxy) { | ||
| this.instanceManager = instanceManager; | ||
| this.proxy = proxy; | ||
| } | ||
|
|
||
| /** | ||
| * Creates a {@link AspectRatioStrategy} instance with the preferred aspect ratio and fallback | ||
camsim99 marked this conversation as resolved.
Outdated
Show resolved
Hide resolved
|
||
| * rule specified. | ||
| */ | ||
| @Override | ||
| public void create( | ||
| @NonNull Long identifier, @NonNull Long preferredAspectRatio, @NonNull Long fallbackRule) { | ||
| instanceManager.addDartCreatedInstance( | ||
| proxy.create(preferredAspectRatio, fallbackRule), identifier); | ||
| } | ||
| } | ||
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
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.