Skip to content

Commit

Permalink
Merge branch 'main' into main
Browse files Browse the repository at this point in the history
  • Loading branch information
misos1 authored Aug 15, 2023
2 parents 2339bfe + 003a6c0 commit 4b1ec91
Show file tree
Hide file tree
Showing 111 changed files with 2,810 additions and 375 deletions.
2 changes: 1 addition & 1 deletion .ci/flutter_master.version
Original file line number Diff line number Diff line change
@@ -1 +1 @@
436df69a4684aaf7d0d1b09b61bb29c75b32ad61
9b6945b465a104c7dea41f3042a70781abc39718
2 changes: 1 addition & 1 deletion .github/workflows/scorecards-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,6 @@ jobs:

# Upload the results to GitHub's code scanning dashboard.
- name: "Upload to code-scanning"
uses: github/codeql-action/upload-sarif@0ba4244466797eb048eb91a6cd43d5c03ca8bd05 # v1.0.26
uses: github/codeql-action/upload-sarif@a09933a12a80f87b87005513f0abb1494c27a716 # v1.0.26
with:
sarif_file: results.sarif
4 changes: 4 additions & 0 deletions packages/camera/camera/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.10.5+3

* Migrates `styleFrom` usage in examples off of deprecated `primary` and `onPrimary` parameters.

## 0.10.5+2

* Fixes unawaited_futures violations.
Expand Down
16 changes: 4 additions & 12 deletions packages/camera/camera/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -365,16 +365,12 @@ class _CameraExampleHomeState extends State<CameraExampleHome>

Widget _exposureModeControlRowWidget() {
final ButtonStyle styleAuto = TextButton.styleFrom(
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
// ignore: deprecated_member_use
primary: controller?.value.exposureMode == ExposureMode.auto
foregroundColor: controller?.value.exposureMode == ExposureMode.auto
? Colors.orange
: Colors.blue,
);
final ButtonStyle styleLocked = TextButton.styleFrom(
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
// ignore: deprecated_member_use
primary: controller?.value.exposureMode == ExposureMode.locked
foregroundColor: controller?.value.exposureMode == ExposureMode.locked
? Colors.orange
: Colors.blue,
);
Expand Down Expand Up @@ -452,16 +448,12 @@ class _CameraExampleHomeState extends State<CameraExampleHome>

Widget _focusModeControlRowWidget() {
final ButtonStyle styleAuto = TextButton.styleFrom(
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
// ignore: deprecated_member_use
primary: controller?.value.focusMode == FocusMode.auto
foregroundColor: controller?.value.focusMode == FocusMode.auto
? Colors.orange
: Colors.blue,
);
final ButtonStyle styleLocked = TextButton.styleFrom(
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
// ignore: deprecated_member_use
primary: controller?.value.focusMode == FocusMode.locked
foregroundColor: controller?.value.focusMode == FocusMode.locked
? Colors.orange
: Colors.blue,
);
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ description: A Flutter plugin for controlling the camera. Supports previewing
Dart.
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22
version: 0.10.5+2
version: 0.10.5+3

environment:
sdk: ">=2.18.0 <4.0.0"
Expand Down
4 changes: 4 additions & 0 deletions packages/camera/camera_android/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## 0.10.8+6

* Migrates `styleFrom` usage in examples off of deprecated `primary` and `onPrimary` parameters.

## 0.10.8+5

* Provides a default exposure point if null.
Expand Down
16 changes: 4 additions & 12 deletions packages/camera/camera_android/example/lib/main.dart
Original file line number Diff line number Diff line change
Expand Up @@ -368,16 +368,12 @@ class _CameraExampleHomeState extends State<CameraExampleHome>

Widget _exposureModeControlRowWidget() {
final ButtonStyle styleAuto = TextButton.styleFrom(
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
// ignore: deprecated_member_use
primary: controller?.value.exposureMode == ExposureMode.auto
foregroundColor: controller?.value.exposureMode == ExposureMode.auto
? Colors.orange
: Colors.blue,
);
final ButtonStyle styleLocked = TextButton.styleFrom(
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
// ignore: deprecated_member_use
primary: controller?.value.exposureMode == ExposureMode.locked
foregroundColor: controller?.value.exposureMode == ExposureMode.locked
? Colors.orange
: Colors.blue,
);
Expand Down Expand Up @@ -456,16 +452,12 @@ class _CameraExampleHomeState extends State<CameraExampleHome>

Widget _focusModeControlRowWidget() {
final ButtonStyle styleAuto = TextButton.styleFrom(
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
// ignore: deprecated_member_use
primary: controller?.value.focusMode == FocusMode.auto
foregroundColor: controller?.value.focusMode == FocusMode.auto
? Colors.orange
: Colors.blue,
);
final ButtonStyle styleLocked = TextButton.styleFrom(
// TODO(darrenaustin): Migrate to new API once it lands in stable: https://github.com/flutter/flutter/issues/105724
// ignore: deprecated_member_use
primary: controller?.value.focusMode == FocusMode.locked
foregroundColor: controller?.value.focusMode == FocusMode.locked
? Colors.orange
: Colors.blue,
);
Expand Down
2 changes: 1 addition & 1 deletion packages/camera/camera_android/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ description: Android implementation of the camera plugin.
repository: https://github.com/flutter/packages/tree/main/packages/camera/camera_android
issue_tracker: https://github.com/flutter/flutter/issues?q=is%3Aissue+is%3Aopen+label%3A%22p%3A+camera%22

version: 0.10.8+5
version: 0.10.8+6

environment:
sdk: ">=2.18.0 <4.0.0"
Expand Down
8 changes: 8 additions & 0 deletions packages/camera/camera_android_camerax/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,11 @@
## 0.5.0+14

* Wraps classes needed to implement resolution configuration for video recording.

## 0.5.0+13

* Migrates `styleFrom` usage in examples off of deprecated `primary` and `onPrimary` parameters.

## 0.5.0+12

* Wraps classes needed to implement resolution configuration for image capture, image analysis, and preview.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,10 @@ public void setUp(
binaryMessenger, new ResolutionStrategyHostApiImpl(instanceManager));
GeneratedCameraXLibrary.AspectRatioStrategyHostApi.setup(
binaryMessenger, new AspectRatioStrategyHostApiImpl(instanceManager));
GeneratedCameraXLibrary.FallbackStrategyHostApi.setup(
binaryMessenger, new FallbackStrategyHostApiImpl(instanceManager));
GeneratedCameraXLibrary.QualitySelectorHostApi.setup(
binaryMessenger, new QualitySelectorHostApiImpl(instanceManager));
}

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
// 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.video.FallbackStrategy;
import androidx.camera.video.Quality;
import io.flutter.plugins.camerax.GeneratedCameraXLibrary.FallbackStrategyHostApi;
import io.flutter.plugins.camerax.GeneratedCameraXLibrary.VideoQualityConstraint;
import io.flutter.plugins.camerax.GeneratedCameraXLibrary.VideoResolutionFallbackRule;

/**
* Host API implementation for {@link FallbackStrategy}.
*
* <p>This class may handle 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 FallbackStrategyHostApiImpl implements FallbackStrategyHostApi {
private final InstanceManager instanceManager;

private final FallbackStrategyProxy proxy;

/** Proxy for constructors and static method of {@link FallbackStrategy}. */
@VisibleForTesting
public static class FallbackStrategyProxy {
/** Creates an instance of {@link FallbackStrategy}. */
public @NonNull FallbackStrategy create(
@NonNull VideoQualityConstraint videoQualityConstraint,
@NonNull VideoResolutionFallbackRule fallbackRule) {
Quality videoQuality =
QualitySelectorHostApiImpl.getQualityFromVideoQualityConstraint(videoQualityConstraint);

switch (fallbackRule) {
case HIGHER_QUALITY_OR_LOWER_THAN:
return FallbackStrategy.higherQualityOrLowerThan(videoQuality);
case HIGHER_QUALITY_THAN:
return FallbackStrategy.higherQualityThan(videoQuality);
case LOWER_QUALITY_OR_HIGHER_THAN:
return FallbackStrategy.lowerQualityOrHigherThan(videoQuality);
case LOWER_QUALITY_THAN:
return FallbackStrategy.lowerQualityThan(videoQuality);
}
throw new IllegalArgumentException(
"Specified fallback rule " + fallbackRule + " unrecognized.");
}
}

/**
* Constructs a {@link FallbackStrategyHostApiImpl}.
*
* @param instanceManager maintains instances stored to communicate with attached Dart objects
*/
public FallbackStrategyHostApiImpl(@NonNull InstanceManager instanceManager) {
this(instanceManager, new FallbackStrategyProxy());
}

/**
* Constructs a {@link FallbackStrategyHostApiImpl}.
*
* @param instanceManager maintains instances stored to communicate with attached Dart objects
* @param proxy proxy for constructors and static method of {@link FallbackStrategy}
*/
FallbackStrategyHostApiImpl(
@NonNull InstanceManager instanceManager, @NonNull FallbackStrategyProxy proxy) {
this.instanceManager = instanceManager;
this.proxy = proxy;
}

/**
* Creates a {@link FallbackStrategy} instance with the video quality and fallback rule specified.
*/
@Override
public void create(
@NonNull Long identifier,
@NonNull VideoQualityConstraint videoQualityConstraint,
@NonNull VideoResolutionFallbackRule fallbackRule) {
instanceManager.addDartCreatedInstance(
proxy.create(videoQualityConstraint, fallbackRule), identifier);
}
}
Loading

0 comments on commit 4b1ec91

Please sign in to comment.