-
Notifications
You must be signed in to change notification settings - Fork 3.6k
[image_picker] Remove MethodCall from most Android code #3438
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
auto-submit
merged 6 commits into
flutter:main
from
stuartmorgan-g:image-picker-android-pigeon-prep
Mar 11, 2023
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
44da036
Move MethodCall out of ImagePickerCache
stuartmorgan-g 12041c3
Remove MethodCall from delegate
stuartmorgan-g b3b3b55
Consolidate state, fix test names
stuartmorgan-g 442031a
More test name fixes
stuartmorgan-g 889e0bd
static
stuartmorgan-g 0df3a02
License
stuartmorgan-g 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
29 changes: 29 additions & 0 deletions
29
...cker_android/android/src/main/java/io/flutter/plugins/imagepicker/ImageOutputOptions.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,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.imagepicker; | ||
|
|
||
| import androidx.annotation.Nullable; | ||
|
|
||
| /** Stores settings for image output options. */ | ||
| public class ImageOutputOptions { | ||
| /** The maximum width of the image, if the width should be constrained. */ | ||
| @Nullable public final Double maxWidth; | ||
| /** The maximum height of the image, if the width should be constrained. */ | ||
| @Nullable public final Double maxHeight; | ||
| /** | ||
| * The output quality of the image, as a number from 0 to 100. | ||
| * | ||
| * <p>Defaults to 100. | ||
| */ | ||
| final int quality; | ||
|
|
||
| public ImageOutputOptions( | ||
| @Nullable Double maxWidth, @Nullable Double maxHeight, @Nullable Integer quality) { | ||
| this.maxWidth = maxWidth; | ||
| this.maxHeight = maxHeight; | ||
| // Treat any invalid value as full quality. | ||
| this.quality = quality == null || quality < 0 || quality > 100 ? 100 : quality; | ||
| } | ||
| } | ||
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The previous code treated quality at a nullable value until the very bottom layer where it was used, at which point
nulland100were actually handled the same, so I moved that logic into this layer to simplify things.