Skip to content

Commit 4ed306b

Browse files
authored
Bindable property for camera view (#2974)
1 parent 8c25005 commit 4ed306b

File tree

23 files changed

+138
-244
lines changed

23 files changed

+138
-244
lines changed

Directory.Build.props

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,11 @@
1111
<AccelerateBuildsInVisualStudio>true</AccelerateBuildsInVisualStudio>
1212
<GenerateErrorForMissingTargetingPacks>false</GenerateErrorForMissingTargetingPacks>
1313

14+
<!--Uncomment the line below if you need to debug code generated by Source Generators
15+
If you see any LongPath issue on Windows, check this doc
16+
https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd#enable-long-paths-in-windows-10-version-1607-and-later-->
17+
<!--<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles> -->
18+
1419
<!-- Prevent NuGet Package Vulnerabilities -->
1520
<NuGetAudit>enable</NuGetAudit>
1621
<NuGetAuditMode>all</NuGetAuditMode>

samples/CommunityToolkit.Maui.Sample/CommunityToolkit.Maui.Sample.csproj

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,6 @@
2323
<ApplicationDisplayVersion>1.0</ApplicationDisplayVersion>
2424
<ApplicationVersion>1</ApplicationVersion>
2525

26-
<!--
27-
Uncomment the lines below if you need to debug the SG code
28-
If you see any LongPath issue on Windows, check this doc
29-
https://docs.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation?tabs=cmd#enable-long-paths-in-windows-10-version-1607-and-later
30-
-->
31-
<!--<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
32-
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GeneratedFiles</CompilerGeneratedFilesOutputPath> -->
33-
3426
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
3527

3628
<NoWarn>IL2026</NoWarn>

src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,6 @@
22

33
<PropertyGroup>
44
<TargetFramework>$(NetVersion)</TargetFramework>
5-
<EmitCompilerGeneratedFiles>true</EmitCompilerGeneratedFiles>
65
<CompilerGeneratedFilesOutputPath>$(BaseIntermediateOutputPath)\GF</CompilerGeneratedFilesOutputPath>
76
<AutoGenerateBindingRedirects>true</AutoGenerateBindingRedirects>
87
<GenerateBindingRedirectsOutputType>true</GenerateBindingRedirectsOutputType>

src/CommunityToolkit.Maui.Camera/CommunityToolkit.Maui.Camera.csproj

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,10 @@
5151
<None Include="ReadMe.txt" pack="true" PackagePath="." />
5252
</ItemGroup>
5353

54+
<ItemGroup>
55+
<ProjectReference Include="..\CommunityToolkit.Maui.SourceGenerators.Internal\CommunityToolkit.Maui.SourceGenerators.Internal.csproj" OutputItemType="Analyzer" ReferenceOutputAssembly="false" />
56+
</ItemGroup>
57+
5458
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
5559
<!-- Required NuGet Packages -->
5660
<PackageReference Include="Xamarin.AndroidX.Camera.Camera2" Version="1.4.2.3" />

src/CommunityToolkit.Maui.Camera/Interfaces/ICameraView.shared.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public interface ICameraView : IView
1616
Size ImageCaptureResolution { get; }
1717

1818
/// <summary>
19-
/// Gets a value indicating whether the torch is on.
19+
/// Gets a value indicating whether the torch (flash) is on.
2020
/// </summary>
2121
bool IsTorchOn { get; }
2222

@@ -39,12 +39,12 @@ public interface ICameraView : IView
3939
float ZoomFactor { get; internal set; }
4040

4141
/// <summary>
42-
/// Gets whether the implementation is available.
42+
/// Gets a value indicating whether the camera feature is available on the current device.
4343
/// </summary>
4444
bool IsAvailable { get; internal set; }
4545

4646
/// <summary>
47-
/// Gets whether the implementation is busy.
47+
/// Gets a value indicating whether the camera is currently busy.
4848
/// </summary>
4949
bool IsBusy { get; internal set; }
5050

src/CommunityToolkit.Maui.Camera/Primitives/CameraViewDefaults.shared.cs

Lines changed: 1 addition & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ namespace CommunityToolkit.Maui.Core;
77

88
/// <summary>Default Values for <see cref="ICameraView"/></summary>
99
[EditorBrowsable(EditorBrowsableState.Never)]
10-
public static class CameraViewDefaults
10+
static class CameraViewDefaults
1111
{
1212
/// <summary>
1313
/// Default value for <see cref="ICameraView.IsAvailable"/>
@@ -38,34 +38,4 @@ public static class CameraViewDefaults
3838
/// Default value for <see cref="ICameraView.CameraFlashMode"/>
3939
/// </summary>
4040
public static CameraFlashMode CameraFlashMode { get; } = CameraFlashMode.Off;
41-
42-
internal static Command<CancellationToken> CreateCaptureImageCommand(BindableObject bindable)
43-
{
44-
var cameraView = (CameraView)bindable;
45-
return new(async token => await cameraView.CaptureImage(token).ConfigureAwait(false));
46-
}
47-
48-
internal static Command<CancellationToken> CreateStartCameraPreviewCommand(BindableObject bindable)
49-
{
50-
var cameraView = (CameraView)bindable;
51-
return new(async token => await cameraView.StartCameraPreview(token).ConfigureAwait(false));
52-
}
53-
54-
internal static ICommand CreateStopCameraPreviewCommand(BindableObject bindable)
55-
{
56-
var cameraView = (CameraView)bindable;
57-
return new Command(_ => cameraView.StopCameraPreview());
58-
}
59-
60-
internal static Command<Stream> CreateStartVideoRecordingCommand(BindableObject bindable)
61-
{
62-
var cameraView = (CameraView)bindable;
63-
return new Command<Stream>(async stream => await cameraView.StartVideoRecording(stream).ConfigureAwait(false));
64-
}
65-
66-
internal static Command<CancellationToken> CreateStopVideoRecordingCommand(BindableObject bindable)
67-
{
68-
var cameraView = (CameraView)bindable;
69-
return new Command<CancellationToken>(async token => await cameraView.StopVideoRecording(token).ConfigureAwait(false));
70-
}
7141
}

0 commit comments

Comments
 (0)