Skip to content

Commit fb75e94

Browse files
Fixes #2943
Fix camera package version, fix obsolete warnings
1 parent 32a0883 commit fb75e94

File tree

19 files changed

+72
-132
lines changed

19 files changed

+72
-132
lines changed

samples/CommunityToolkit.Maui.Sample/Pages/Views/Expander/ExpanderPage.xaml

Lines changed: 0 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -48,32 +48,6 @@
4848
</mct:Expander.Content>
4949
</mct:Expander>
5050

51-
<Label Text="Expander in ListView" FontSize="24" FontAttributes="Bold"/>
52-
53-
<ListView ItemsSource="{Binding ContentCreators}"
54-
HasUnevenRows="True">
55-
<ListView.ItemTemplate>
56-
<DataTemplate>
57-
<ViewCell>
58-
<mct:Expander x:DataType="sample:ContentCreator"
59-
ExpandedChanged="Expander_ExpandedChanged">
60-
<mct:Expander.Header>
61-
<Label Text="{Binding Name}"/>
62-
</mct:Expander.Header>
63-
<mct:Expander.Content>
64-
<VerticalStackLayout>
65-
<Label Text="{Binding Resource}"/>
66-
<Image Source="{Binding Image}"
67-
WidthRequest="100"
68-
HeightRequest="100"/>
69-
</VerticalStackLayout>
70-
</mct:Expander.Content>
71-
</mct:Expander>
72-
</ViewCell>
73-
</DataTemplate>
74-
</ListView.ItemTemplate>
75-
</ListView>
76-
7751
<Label Text="Expander in CollectionView with LinearItemsLayout" FontSize="24" FontAttributes="Bold"/>
7852

7953
<CollectionView ItemsSource="{Binding ContentCreators}">

samples/CommunityToolkit.Maui.Sample/Resources/Styles/Styles.xaml

Lines changed: 11 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,7 @@
22
<?xaml-comp compile="true" ?>
33
<ResourceDictionary
44
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
5-
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
6-
xmlns:toolkit="http://schemas.microsoft.com/dotnet/2022/maui/toolkit">
5+
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml">
76

87
<!-- Explicit styles -->
98
<Style x:Key="PopupLayout" TargetType="Layout" ApplyToDerivedTypes="true">
@@ -123,13 +122,6 @@
123122
</Setter>
124123
</Style>
125124

126-
<Style TargetType="Frame" ApplyToDerivedTypes="true" >
127-
<Setter Property="HasShadow" Value="True" />
128-
<Setter Property="BorderColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}" />
129-
<Setter Property="BackgroundColor" Value="{AppThemeBinding Light={StaticResource White}, Dark={StaticResource Gray950}}" />
130-
<Setter Property="CornerRadius" Value="8" />
131-
</Style>
132-
133125
<Style TargetType="ImageButton">
134126
<Setter Property="Opacity" Value="1" />
135127
<Setter Property="BorderColor" Value="Transparent"/>
@@ -166,11 +158,6 @@
166158
</Setter>
167159
</Style>
168160

169-
<Style TargetType="ListView">
170-
<Setter Property="SeparatorColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray500}}" />
171-
<Setter Property="RefreshControlColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
172-
</Style>
173-
174161
<Style TargetType="Picker">
175162
<Setter Property="TextColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource White}}" />
176163
<Setter Property="TitleColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
@@ -349,16 +336,16 @@
349336
</Style>
350337

351338
<Style TargetType="Shell" ApplyToDerivedTypes="True">
352-
<Setter Property="Shell.BackgroundColor" Value="{OnPlatform WinUI=Transparent, Default={AppThemeBinding Light={StaticResource NavBarColor}, Dark={StaticResource Gray950}}}" />
353-
<Setter Property="Shell.ForegroundColor" Value="{AppThemeBinding Light={OnPlatform WinUI={StaticResource Black}, Default={StaticResource White}}, Dark={StaticResource White}}" />
354-
<Setter Property="Shell.TitleColor" Value="{AppThemeBinding Light={OnPlatform WinUI={StaticResource Black}, Default={StaticResource White}}, Dark={StaticResource White}}" />
355-
<Setter Property="Shell.DisabledColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}" />
356-
<Setter Property="Shell.UnselectedColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray200}}" />
357-
<Setter Property="Shell.NavBarHasShadow" Value="True" />
358-
<Setter Property="Shell.TabBarBackgroundColor" Value="{OnPlatform WinUI=Transparent, Default={AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}}" />
359-
<Setter Property="Shell.TabBarForegroundColor" Value="{AppThemeBinding Light={StaticResource PrimaryColor}, Dark={StaticResource White}}" />
360-
<Setter Property="Shell.TabBarTitleColor" Value="{AppThemeBinding Light={StaticResource PrimaryColor}, Dark={StaticResource White}}" />
361-
<Setter Property="Shell.TabBarUnselectedColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
339+
<Setter Property="BackgroundColor" Value="{OnPlatform WinUI=Transparent, Default={AppThemeBinding Light={StaticResource NavBarColor}, Dark={StaticResource Gray950}}}" />
340+
<Setter Property="ForegroundColor" Value="{AppThemeBinding Light={OnPlatform WinUI={StaticResource Black}, Default={StaticResource White}}, Dark={StaticResource White}}" />
341+
<Setter Property="TitleColor" Value="{AppThemeBinding Light={OnPlatform WinUI={StaticResource Black}, Default={StaticResource White}}, Dark={StaticResource White}}" />
342+
<Setter Property="DisabledColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray950}}" />
343+
<Setter Property="UnselectedColor" Value="{AppThemeBinding Light={StaticResource Gray200}, Dark={StaticResource Gray200}}" />
344+
<Setter Property="NavBarHasShadow" Value="True" />
345+
<Setter Property="TabBarBackgroundColor" Value="{OnPlatform WinUI=Transparent, Default={AppThemeBinding Light={StaticResource White}, Dark={StaticResource Black}}}" />
346+
<Setter Property="TabBarForegroundColor" Value="{AppThemeBinding Light={StaticResource PrimaryColor}, Dark={StaticResource White}}" />
347+
<Setter Property="TabBarTitleColor" Value="{AppThemeBinding Light={StaticResource PrimaryColor}, Dark={StaticResource White}}" />
348+
<Setter Property="TabBarUnselectedColor" Value="{AppThemeBinding Light={StaticResource Gray900}, Dark={StaticResource Gray200}}" />
362349
</Style>
363350

364351
<Style TargetType="TabbedPage">

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

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,16 +19,11 @@
1919
<ItemGroup>
2020
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Analyzer.Testing" Version="1.1.2" />
2121
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.CodeFix.Testing" Version="1.1.2" />
22-
<PackageReference Include="xunit.v3" Version="3.2.0" />
22+
<PackageReference Include="xunit.v3.mtp-v2" Version="3.2.0" />
2323
<PackageReference Include="Microsoft.Testing.Extensions.CodeCoverage" Version="18.1.0" />
2424
<PackageReference Include="Microsoft.CodeAnalysis.CSharp.Workspaces" Version="4.14.0" />
2525
</ItemGroup>
2626

27-
<ItemGroup>
28-
<!--Fix vulnerabilities-->
29-
<PackageReference Include="System.Formats.Asn1" Version="10.0.0" />
30-
</ItemGroup>
31-
3227
<ItemGroup>
3328
<ProjectReference Include="..\CommunityToolkit.Maui.Analyzers.CodeFixes\CommunityToolkit.Maui.Analyzers.CodeFixes.csproj" />
3429
<ProjectReference Include="..\CommunityToolkit.Maui.Camera.Analyzers.CodeFixes\CommunityToolkit.Maui.Camera.Analyzers.CodeFixes.csproj" />

src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpAnalyzerVerifier`1.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
using Microsoft.CodeAnalysis.CSharp.Testing;
33
using Microsoft.CodeAnalysis.Diagnostics;
44
using Microsoft.CodeAnalysis.Testing;
5+
using Xunit;
56

67
namespace CommunityToolkit.Maui.Analyzers.UnitTests;
78

src/CommunityToolkit.Maui.Analyzers.UnitTests/Verifiers/CSharpCodeFixVerifier`2.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
using Microsoft.CodeAnalysis.CSharp.Testing;
44
using Microsoft.CodeAnalysis.Diagnostics;
55
using Microsoft.CodeAnalysis.Testing;
6+
using Xunit;
67

78
namespace CommunityToolkit.Maui.Analyzers.UnitTests;
89

src/CommunityToolkit.Maui.Camera/CameraManager.android.cs

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -256,10 +256,10 @@ protected async Task StartUseCase(CancellationToken token)
256256

257257
if (Quality.Highest is not null)
258258
{
259-
videoRecorderBuilder = videoRecorderBuilder?.SetQualitySelector(QualitySelector.From(Quality.Highest));
259+
videoRecorderBuilder = videoRecorderBuilder.SetQualitySelector(QualitySelector.From(Quality.Highest));
260260
}
261261

262-
videoRecorder = videoRecorderBuilder?.Build();
262+
videoRecorder = videoRecorderBuilder.Build();
263263
videoCapture = VideoCapture.WithOutput(videoRecorder);
264264

265265
await StartCameraPreview(token);
@@ -285,7 +285,7 @@ protected virtual async partial Task PlatformStartCameraPreview(CancellationToke
285285
camera = await RebindCamera(processCameraProvider, cameraView.SelectedCamera, token, cameraPreview, imageCapture, videoCapture);
286286
cameraControl = camera.CameraControl;
287287

288-
var point = previewView.MeteringPointFactory?.CreatePoint(previewView.Width / 2.0f, previewView.Height / 2.0f, 0.1f);
288+
var point = previewView.MeteringPointFactory.CreatePoint(previewView.Width / 2.0f, previewView.Height / 2.0f, 0.1f);
289289
var action = new FocusMeteringAction.Builder(point).Build();
290290
camera.CameraControl?.StartFocusAndMetering(action);
291291

@@ -476,7 +476,7 @@ void SetImageCaptureTargetRotation(int rotation)
476476

477477
sealed class ImageCallBack(ICameraView cameraView) : ImageCapture.OnImageCapturedCallback
478478
{
479-
public override void OnCaptureSuccess(IImageProxy? image)
479+
public override void OnCaptureSuccess(IImageProxy image)
480480
{
481481
base.OnCaptureSuccess(image);
482482
var img = image?.Image;
@@ -524,7 +524,7 @@ public override void OnCaptureSuccess(IImageProxy? image)
524524
}
525525
}
526526

527-
public override void OnError(ImageCaptureException? exception)
527+
public override void OnError(ImageCaptureException exception)
528528
{
529529
base.OnError(exception);
530530
cameraView.OnMediaCapturedFailed(exception?.Message ?? "An unknown error occurred.");

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,11 @@
5353

5454
<ItemGroup Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">
5555
<!-- Required NuGet Packages -->
56-
<PackageReference Include="Xamarin.AndroidX.Camera.Camera2" Version="1.5.0" />
57-
<PackageReference Include="Xamarin.AndroidX.Camera.View" Version="1.5.0" />
58-
<PackageReference Include="Xamarin.AndroidX.Camera.Extensions" Version="1.5.0" />
56+
<PackageReference Include="Xamarin.AndroidX.Camera.Camera2" Version="1.4.2.3" />
57+
<PackageReference Include="Xamarin.AndroidX.Camera.View" Version="1.4.2.3" />
58+
<PackageReference Include="Xamarin.AndroidX.Camera.Extensions" Version="1.4.2.3" />
5959

60-
<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.11.0" />
60+
<PackageReference Include="Xamarin.AndroidX.Activity.Ktx" Version="1.10.1.3" />
6161

6262
<!-- Ensure Linker does not remove required libraries -->
6363
<None Include="linker.xml" Pack="true" PackagePath="build\$(PackageId).LinkerConfigurationFile.xml" />

src/CommunityToolkit.Maui.Core/CommunityToolkit.Maui.Core.csproj

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@
5555
<PackageReference Include="Microsoft.Maui.Core" Version="$(MauiPackageVersion)" />
5656
<PackageReference Include="Microsoft.Maui.Essentials" Version="$(MauiPackageVersion)" />
5757
<PackageReference Include="Microsoft.SourceLink.GitHub" Version="8.0.0" Condition=" '$(Configuration)'=='Release' " PrivateAssets="All" />
58-
<PackageReference Include="System.Speech" Version="9.0.5" Condition="'$(TargetFramework)' == '$(NetVersion)-windows10.0.19041.0'" />
58+
<PackageReference Include="System.Speech" Version="10.0.0" Condition="'$(TargetFramework)' == '$(NetVersion)-windows10.0.19041.0'" />
5959
</ItemGroup>
6060

6161
<ItemGroup Condition="$(TargetFramework.Contains('-tizen'))">

src/CommunityToolkit.Maui.UnitTests/Behaviors/MaskedBehaviorTests.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -63,7 +63,6 @@ public void AttachedToInvalidElementTest()
6363
IReadOnlyList<VisualElement> invalidVisualElements =
6464
[
6565
new Button(),
66-
new Frame(),
6766
new Label(),
6867
new ProgressBar(),
6968
new VisualElement(),

src/CommunityToolkit.Maui.UnitTests/Behaviors/MaxLengthReachedBehaviorTests.cs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ public void ShouldNotDismissKeyboardWhenOptionSetToFalse()
139139
// assert
140140
Assert.True(entry.IsFocused);
141141
}
142-
142+
143143
static Entry CreateEntry(int? maxLength = 2,
144144
bool shouldDismissKeyboardAutomatically = false,
145145
ICommand? command = null,
@@ -151,7 +151,7 @@ static Entry CreateEntry(int? maxLength = 2,
151151
Command = command
152152
};
153153

154-
if (eventHandler != null)
154+
if (eventHandler is not null)
155155
{
156156
behavior.MaxLengthReached += eventHandler;
157157
}
@@ -168,6 +168,8 @@ static Entry CreateEntry(int? maxLength = 2,
168168
// We simulate Focus/Unfocus behavior ourselves
169169
// because unit tests doesn't have "platform-specific" part
170170
// where IsFocused is controlled in the real app
171+
entry.Focused += (s, e) => entry.SetValue(VisualElement.IsFocusedPropertyKey, true);
172+
entry.Unfocused += (s, e) => entry.SetValue(VisualElement.IsFocusedPropertyKey, false);
171173
entry.FocusChangeRequested += (s, e) => entry.SetValue(VisualElement.IsFocusedPropertyKey, e.Focus);
172174

173175
return entry;

0 commit comments

Comments
 (0)