Skip to content

Commit

Permalink
Merge branch 'main' into pj/bindable-property-SG
Browse files Browse the repository at this point in the history
  • Loading branch information
brminnick authored Mar 26, 2024
2 parents e4142a6 + 154d9fb commit 4038c78
Show file tree
Hide file tree
Showing 84 changed files with 1,901 additions and 577 deletions.
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<Project>
<PropertyGroup>
<NetVersion>net8.0</NetVersion>
<MauiPackageVersion>8.0.3</MauiPackageVersion>
<MauiPackageVersion>8.0.14</MauiPackageVersion>
<LangVersion>latest</LangVersion>
<Nullable>enable</Nullable>
<ImplicitUsings>enable</ImplicitUsings>
Expand Down
16 changes: 10 additions & 6 deletions azure-pipelines.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ variables:
NugetPackageVersion: '$(CurrentSemanticVersion)'
NugetPackageVersionMediaElement: '$(CurrentSemanticVersion)'
NugetPackageVersionMaps: '$(CurrentSemanticVersion)'
TOOLKIT_NET_VERSION: '8.0.100'
TOOLKIT_NET_VERSION: '8.0.203'
LATEST_NET_VERSION: '8.0.x'
PathToLibrarySolution: 'src/CommunityToolkit.Maui.sln'
PathToSamplesSolution: 'samples/CommunityToolkit.Maui.Sample.sln'
Expand All @@ -21,8 +21,9 @@ variables:
PathToCommunityToolkitAnalyzersCodeFixCsproj: 'src/CommunityToolkit.Maui.Analyzers.CodeFixes/CommunityToolkit.Maui.Analyzers.CodeFixes.csproj'
PathToCommunityToolkitMediaElementAnalyzersCodeFixCsproj: 'src/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes/CommunityToolkit.Maui.MediaElement.Analyzers.CodeFixes.csproj'
PathToCommunityToolkitAnalyzersUnitTestCsproj: 'src/CommunityToolkit.Maui.Analyzers.UnitTests/CommunityToolkit.Maui.Analyzers.UnitTests.csproj'
CommunityToolkitSampleApp_Xcode_Version: '15.1.0'
CommunityToolkitLibrary_Xcode_Version: '15.0.1'
DotNetMauiRollbackFile: 'https://maui.blob.core.windows.net/metadata/rollbacks/8.0.6.json'
CommunityToolkitSampleApp_Xcode_Version: '15.2.0'
CommunityToolkitLibrary_Xcode_Version: '15.2.0'

trigger:
branches:
Expand Down Expand Up @@ -71,8 +72,10 @@ jobs:
version: '$(LATEST_NET_VERSION)'
includePreviewVersions: false

- powershell: dotnet workload install maui --skip-sign-check --source https://api.nuget.org/v3/index.json
displayName: Install Latest .NET MAUI Workload
- task: CmdLine@2
displayName: 'Install Latest .NET MAUI Workload'
inputs:
script: 'dotnet workload install maui'

- pwsh: |
Invoke-WebRequest 'https://raw.githubusercontent.com/Samsung/Tizen.NET/main/workload/scripts/workload-install.ps1' -OutFile 'workload-install.ps1'
Expand Down Expand Up @@ -166,6 +169,7 @@ jobs:
Write-Host("GitHub PR = $prNumber, Commit = $commitId");
Write-Host ("##vso[task.setvariable variable=NugetPackageVersion;]$fullVersionString")
Write-Host ("##vso[task.setvariable variable=NugetPackageVersionMediaElement;]$fullVersionString")
Write-Host ("##vso[task.setvariable variable=NugetPackageVersionMaps;]$fullVersionString")
Write-Host "##vso[build.updatebuildnumber]$fullVersionString"
displayName: Set NuGet Version to PR Version
condition: and(succeeded(), eq(variables['Agent.OS'], 'Windows_NT'), eq(variables['build.reason'], 'PullRequest')) # Only run this step on Windows when a Pull Request has triggered the CI Pipeline
Expand Down Expand Up @@ -244,7 +248,7 @@ jobs:
testResultsFiles: '**/*.trx'
searchFolder: $(Agent.TempDirectory)

- task: PublishCodeCoverageResults@1
- task: PublishCodeCoverageResults@2
condition: eq(variables['Agent.OS'], 'Windows_NT') # Only run this step on Windows
displayName: 'Publish Code Coverage Results'
inputs:
Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"sdk": {
"version": "8.0.100",
"version": "8.0.203",
"rollForward": "latestFeature",
"allowPrerelease": false
}
Expand Down
7 changes: 7 additions & 0 deletions samples/CommunityToolkit.Maui.Sample/AppShell.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,13 @@
<ShellContent ContentTemplate="{DataTemplate layouts:LayoutsGalleryPage}" />
</FlyoutItem>

<FlyoutItem
Title="Platform-Specific"
Icon="{OnPlatform Default='dotnet_bot.png', MacCatalyst={x:Null}}"
Route="PlatformSpecificGallerypage">
<ShellContent ContentTemplate="{DataTemplate pages:PlatformSpecificGalleryPage}" />
</FlyoutItem>

<FlyoutItem Title="Views"
Route="ViewsGalleryPage"
Icon="{OnPlatform Default='dotnet_bot.png', MacCatalyst={x:Null}}">
Expand Down
5 changes: 5 additions & 0 deletions samples/CommunityToolkit.Maui.Sample/AppShell.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
using CommunityToolkit.Maui.Sample.Pages.Extensions;
using CommunityToolkit.Maui.Sample.Pages.ImageSources;
using CommunityToolkit.Maui.Sample.Pages.Layouts;
using CommunityToolkit.Maui.Sample.Pages.PlatformSpecific;
using CommunityToolkit.Maui.Sample.Pages.Views;
using CommunityToolkit.Maui.Sample.ViewModels;
using CommunityToolkit.Maui.Sample.ViewModels.Alerts;
Expand All @@ -15,6 +16,7 @@
using CommunityToolkit.Maui.Sample.ViewModels.Extensions;
using CommunityToolkit.Maui.Sample.ViewModels.ImageSources;
using CommunityToolkit.Maui.Sample.ViewModels.Layouts;
using CommunityToolkit.Maui.Sample.ViewModels.PlatformSpecific;
using CommunityToolkit.Maui.Sample.ViewModels.Views;
using CommunityToolkit.Maui.Sample.ViewModels.Views.AvatarView;

Expand Down Expand Up @@ -130,6 +132,9 @@ public partial class AppShell : Shell
CreateViewModelMapping<SemanticOrderViewPage, SemanticOrderViewPageViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
CreateViewModelMapping<ShowPopupInOnAppearingPage, ShowPopupInOnAppearingPageViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),
CreateViewModelMapping<StylePopupPage, StylePopupViewModel, ViewsGalleryPage, ViewsGalleryViewModel>(),

// Add PlatformSpecific View Models
CreateViewModelMapping<NavigationBarPage, NavigationBarAndroidViewModel, PlatformSpecificGalleryPage, PlatformSpecificGalleryViewModel>(),
});

public AppShell() => InitializeComponent();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -52,9 +52,11 @@
<!-- Custom Fonts -->
<MauiFont Include="Resources\Fonts\*" />

<PackageReference Include="Microsoft.Maui.Controls" Version="[$(MauiPackageVersion),)"/>
<PackageReference Include="Microsoft.Maui.Controls.Compatibility" Version="[$(MauiPackageVersion),)"/>
<PackageReference Include="CommunityToolkit.Maui.Markup" Version="4.0.0" />
<PackageReference Include="CommunityToolkit.Mvvm" Version="8.2.2" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.1.0" />
<PackageReference Include="Microsoft.Extensions.Http.Resilience" Version="8.3.0" />
<PackageReference Include="Microsoft.Extensions.Logging.Debug" Version="8.0.0" />
</ItemGroup>

Expand Down
7 changes: 7 additions & 0 deletions samples/CommunityToolkit.Maui.Sample/MauiProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
using CommunityToolkit.Maui.Sample.Pages.Extensions;
using CommunityToolkit.Maui.Sample.Pages.ImageSources;
using CommunityToolkit.Maui.Sample.Pages.Layouts;
using CommunityToolkit.Maui.Sample.Pages.PlatformSpecific;
using CommunityToolkit.Maui.Sample.Pages.Views;
using CommunityToolkit.Maui.Sample.Resources.Fonts;
using CommunityToolkit.Maui.Sample.ViewModels;
Expand All @@ -21,6 +22,7 @@
using CommunityToolkit.Maui.Sample.ViewModels.Extensions;
using CommunityToolkit.Maui.Sample.ViewModels.ImageSources;
using CommunityToolkit.Maui.Sample.ViewModels.Layouts;
using CommunityToolkit.Maui.Sample.ViewModels.PlatformSpecific;
using CommunityToolkit.Maui.Sample.ViewModels.Views;
using CommunityToolkit.Maui.Sample.ViewModels.Views.AvatarView;
using CommunityToolkit.Maui.Sample.Views.Popups;
Expand Down Expand Up @@ -83,6 +85,8 @@ static void RegisterViewsAndViewModels(in IServiceCollection services)
services.AddTransient<ImageSourcesGalleryPage, ImageSourcesGalleryViewModel>();
services.AddTransient<LayoutsGalleryPage, LayoutsGalleryViewModel>();
services.AddTransient<ViewsGalleryPage, ViewsGalleryViewModel>();
services.AddTransient<PlatformSpecificGalleryPage, PlatformSpecificGalleryViewModel>();


// Add Alerts Pages + ViewModels
services.AddTransientWithShellRoute<SnackbarPage, SnackbarViewModel>();
Expand Down Expand Up @@ -174,6 +178,9 @@ static void RegisterViewsAndViewModels(in IServiceCollection services)
services.AddTransientWithShellRoute<StateContainerPage, StateContainerViewModel>();
services.AddTransientWithShellRoute<UniformItemsLayoutPage, UniformItemsLayoutViewModel>();

// Add PlatformSpecific Pages + ViewModels
services.AddTransientWithShellRoute<NavigationBarPage, NavigationBarAndroidViewModel>();

// Add Views Pages + ViewModels
services.AddTransientWithShellRoute<DrawingViewPage, DrawingViewViewModel>();
services.AddTransientWithShellRoute<ExpanderPage, ExpanderViewModel>();
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using CommunityToolkit.Maui.Sample.ViewModels.Behaviors;
using CommunityToolkit.Maui.Behaviors;
using CommunityToolkit.Maui.Sample.ViewModels.Behaviors;

namespace CommunityToolkit.Maui.Sample.Pages.Behaviors;

Expand All @@ -7,5 +8,18 @@ public class BehaviorsGalleryPage : BaseGalleryPage<BehaviorsGalleryViewModel>
public BehaviorsGalleryPage(IDeviceInfo deviceInfo, BehaviorsGalleryViewModel behaviorsGalleryViewModel)
: base("Behaviors", deviceInfo, behaviorsGalleryViewModel)
{
#if ANDROID || IOS
AddStatusBarBehavior();
#endif
}

void AddStatusBarBehavior()
{
Behaviors.Add(new StatusBarBehavior
{
StatusBarColor = Color.FromRgb(25, 118, 210),
StatusBarStyle = Core.StatusBarStyle.LightContent,
ApplyOn = StatusBarApplyOn.OnPageNavigatedTo,
});
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -115,11 +115,10 @@

<Label Text="Select StatusBar and NavigationBar style" />

<RadioButton VerticalOptions="Center" IsChecked="{Binding IsDefaultChecked}">
<RadioButton.Content>
<Label Text="Default" Margin="10,0,0,0" VerticalTextAlignment="Center" VerticalOptions="Center" />
</RadioButton.Content>
</RadioButton>
<RadioButton
Content="Default"
IsChecked="{Binding IsDefaultChecked}"
VerticalOptions="Center" />

<RadioButton VerticalOptions="Center" IsChecked="{Binding IsLightContentChecked}">
<RadioButton.Content>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,4 @@ public StatusBarBehaviorPage(StatusBarBehaviorViewModel viewModel)
{
InitializeComponent();
}

protected override void OnNavigatedTo(NavigatedToEventArgs args)
{
base.OnNavigatedTo(args);

var statusBarColor = Color.FromRgb(BindingContext.RedSliderValue, BindingContext.GreenSliderValue, BindingContext.BlueSliderValue);
CommunityToolkit.Maui.Core.Platform.StatusBar.SetColor(statusBarColor);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,8 @@
<Button Command="{Binding SaveFileInstanceCommand}"
Text="Save using new instance of FileSaver"
HorizontalOptions="Center"/>

<ProgressBar Progress="{Binding Progress}" />

</VerticalStackLayout>

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,146 @@
<?xml version="1.0" encoding="utf-8" ?>
<pages:BasePage
x:Class="CommunityToolkit.Maui.Sample.Pages.PlatformSpecific.NavigationBarPage"
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:droid="clr-namespace:CommunityToolkit.Maui.PlatformConfiguration.AndroidSpecific;assembly=CommunityToolkit.Maui"
xmlns:pages="clr-namespace:CommunityToolkit.Maui.Sample.Pages"
xmlns:vm="clr-namespace:CommunityToolkit.Maui.Sample.ViewModels.PlatformSpecific"
Title="NavigationBarPage"
droid:NavigationBar.Color="{Binding NavigationBarColor}"
droid:NavigationBar.Style="{Binding NavigationBarStyle}"
x:DataType="vm:NavigationBarAndroidViewModel"
x:TypeArguments="vm:NavigationBarAndroidViewModel">


<ContentPage.Resources>
<ControlTemplate x:Key="RadioButtonTemplate">
<Border
BackgroundColor="#F3F2F1"
HeightRequest="90"
HorizontalOptions="Start"
Stroke="#F3F2F1"
StrokeShape="RoundRectangle 10"
StrokeThickness="2"
VerticalOptions="Start"
WidthRequest="90">
<Grid
Margin="4"
BackgroundColor="Transparent"
WidthRequest="90">
<Grid
Margin="0,0,4,0"
HeightRequest="18"
HorizontalOptions="End"
VerticalOptions="Start"
WidthRequest="18">
<Ellipse
Fill="White"
HeightRequest="16"
HorizontalOptions="Center"
Stroke="Blue"
VerticalOptions="Center"
WidthRequest="16" />
<Ellipse
x:Name="check"
Fill="Blue"
HeightRequest="8"
HorizontalOptions="Center"
VerticalOptions="Center"
WidthRequest="8" />
</Grid>
<ContentPresenter />
</Grid>
<VisualStateManager.VisualStateGroups>
<VisualStateGroupList>
<VisualStateGroup x:Name="CheckedStates">
<VisualState x:Name="Checked">
<VisualState.Setters>
<Setter TargetName="check" Property="Opacity" Value="1" />
</VisualState.Setters>
</VisualState>
<VisualState x:Name="Unchecked">
<VisualState.Setters>
<Setter TargetName="check" Property="Opacity" Value="0" />
</VisualState.Setters>
</VisualState>
</VisualStateGroup>
</VisualStateGroupList>
</VisualStateManager.VisualStateGroups>
</Border>
</ControlTemplate>

<Style TargetType="RadioButton">
<Setter Property="ControlTemplate" Value="{StaticResource RadioButtonTemplate}" />
</Style>
</ContentPage.Resources>


<ScrollView>
<VerticalStackLayout Padding="15,0" Spacing="30">

<Label Text="Slide to change NavigationBar color" />

<Slider
Margin="20,10"
Maximum="255"
MaximumTrackColor="Red"
Minimum="0"
MinimumTrackColor="Red"
ThumbColor="Red"
Value="{Binding RedSliderValue}" />

<Slider
Margin="20,10"
Maximum="255"
MaximumTrackColor="Green"
Minimum="0"
MinimumTrackColor="Green"
ThumbColor="Green"
Value="{Binding GreenSliderValue}" />

<Slider
Margin="20,10"
Maximum="255"
MaximumTrackColor="Blue"
Minimum="0"
MinimumTrackColor="Blue"
ThumbColor="Blue"
Value="{Binding BlueSliderValue}" />

<VerticalStackLayout Spacing="15">
<Label Text="Select NavigationBar style" />

<RadioButton IsChecked="{Binding IsDefaultChecked}" VerticalOptions="Center">
<RadioButton.Content>
<Label
Margin="10,0,0,0"
Text="Default"
VerticalOptions="Center"
VerticalTextAlignment="Center" />
</RadioButton.Content>
</RadioButton>

<RadioButton IsChecked="{Binding IsLightContentChecked}" VerticalOptions="Center">
<RadioButton.Content>
<Label
Margin="10,0,0,0"
Text="Light Content"
VerticalOptions="Center"
VerticalTextAlignment="Center" />
</RadioButton.Content>
</RadioButton>

<RadioButton IsChecked="{Binding IsDarkContentChecked}">
<RadioButton.Content>
<Label
Margin="10,0,0,0"
Text="Dark Content"
VerticalOptions="Center"
VerticalTextAlignment="Center" />
</RadioButton.Content>
</RadioButton>
</VerticalStackLayout>
</VerticalStackLayout>
</ScrollView>
</pages:BasePage>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
using CommunityToolkit.Maui.Sample.ViewModels.PlatformSpecific;

namespace CommunityToolkit.Maui.Sample.Pages.PlatformSpecific;

public partial class NavigationBarPage : BasePage<NavigationBarAndroidViewModel>
{
public NavigationBarPage(NavigationBarAndroidViewModel vm) : base(vm)
{
InitializeComponent();
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
using CommunityToolkit.Maui.Sample.ViewModels.PlatformSpecific;

namespace CommunityToolkit.Maui.Sample.Pages;

public class PlatformSpecificGalleryPage(IDeviceInfo deviceInfo, PlatformSpecificGalleryViewModel viewModel) : BaseGalleryPage<PlatformSpecificGalleryViewModel>("Platform Specific", deviceInfo, viewModel)
{
}
Loading

0 comments on commit 4038c78

Please sign in to comment.