Skip to content

Commit

Permalink
wip maui migration
Browse files Browse the repository at this point in the history
  • Loading branch information
roubachof committed Jul 22, 2022
1 parent 57e6ce6 commit 907ad17
Show file tree
Hide file tree
Showing 8 changed files with 456 additions and 0 deletions.
55 changes: 55 additions & 0 deletions Maui.Tabs/BottomTabItem.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
<?xml version="1.0" encoding="UTF-8" ?>

<tabs:TabTextItem
x:Class="Sharpnado.Tabs.BottomTabItem"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:effects="clr-namespace:Sharpnado.Tabs.Effects"
xmlns:tabs="clr-namespace:Sharpnado.Tabs"
x:Name="RootLayout">

<ContentView.Resources>
<ResourceDictionary>
<Style x:Key="TabIcon" TargetType="Image">
<Setter Property="VerticalOptions" Value="End" />
<Setter Property="HorizontalOptions" Value="Center" />
</Style>

<Style x:Key="TabIconLabel" TargetType="Label">
<Setter Property="LineBreakMode" Value="TailTruncation" />
<Setter Property="HorizontalOptions" Value="Center" />
<Setter Property="VerticalOptions" Value="Start" />
</Style>
</ResourceDictionary>
</ContentView.Resources>

<ContentView.Content>
<Grid
x:Name="Grid"
BackgroundColor="Transparent"
ColumnSpacing="0"
RowSpacing="0">

<Grid.RowDefinitions>
<RowDefinition Height="8*" />
<RowDefinition x:Name="TextRowDefinition" Height="5*" />
</Grid.RowDefinitions>

<Image
x:Name="Icon"
Grid.Row="0"
HeightRequest="{Binding Source={x:Reference RootLayout}, Path=IconSize}"
Source="{Binding Source={x:Reference RootLayout}, Path=IconImageSource}"
Style="{StaticResource TabIcon}"
WidthRequest="{Binding Source={x:Reference RootLayout}, Path=IconSize}" />

<Label
x:Name="IconText"
Grid.Row="1"
FontFamily="{Binding Source={x:Reference RootLayout}, Path=FontFamily}"
FontSize="{Binding Source={x:Reference RootLayout}, Path=LabelSize}"
Style="{StaticResource TabIconLabel}"
Text="{Binding Source={x:Reference RootLayout}, Path=Label}" />
</Grid>
</ContentView.Content>
</tabs:TabTextItem>
41 changes: 41 additions & 0 deletions Maui.Tabs/Configuration/Settings.XamlStyler
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
{
"AttributesTolerance": 2,
"KeepFirstAttributeOnSameLine": true,
"MaxAttributeCharactersPerLine": 0,
"MaxAttributesPerLine": 1,
"NewlineExemptionElements": "RadialGradientBrush, GradientStop, LinearGradientBrush, ScaleTransfom, SkewTransform, RotateTransform, TranslateTransform, Trigger, Condition, Setter",
"SeparateByGroups": false,
"AttributeIndentation": 0,
"AttributeIndentationStyle": 1,
"RemoveDesignTimeReferences": false,
"EnableAttributeReordering": true,
"AttributeOrderingRuleGroups": [
"x:Class",
"xmlns, xmlns:x, xmlns:d, xmlns:mc, mc:Ignorable",
"xmlns:*",
"x:Key, Key, x:Name, Name, x:Uid, Uid, Title",
"Grid.Row, Grid.RowSpan, Grid.Column, Grid.ColumnSpan, AbsoluteLayout.LayoutFlags, AbsoluteLayout.LayoutBounds",
"Style, WidthRequest, HeightRequest, MinimumWidthRequest, MinimumHeightRequest",
"Margin, Padding, HorizontalOptions, VerticalOptions, HorizontalTextAlignment, VerticalTextAlignment",
"*:*, *",
"PageSource, PageIndex, Offset, Color, TargetName, Property, Value, StartPoint, EndPoint",
"mc:Ignorable, d:IsDataSource, d:LayoutOverrides, d:IsStaticText",
"Storyboard.*, From, To, Duration"
],
"FirstLineAttributes": "",
"OrderAttributesByName": true,
"PutEndingBracketOnNewLine": false,
"RemoveEndingTagOfEmptyElement": true,
"SpaceBeforeClosingSlash": true,
"RootElementLineBreakRule": 0,
"ReorderVSM": 2,
"ReorderGridChildren": false,
"ReorderCanvasChildren": false,
"ReorderSetters": 0,
"FormatMarkupExtension": true,
"NoNewLineMarkupExtensions": "x:Bind, Binding",
"ThicknessSeparator": 2,
"ThicknessAttributes": "Margin, Padding, BorderThickness, ThumbnailClipMargin",
"FormatOnSave": true,
"CommentPadding": 2,
}
56 changes: 56 additions & 0 deletions Maui.Tabs/Configuration/StyleCopRules.ruleset
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
<?xml version="1.0" encoding="utf-8"?>
<RuleSet Name="StyleCopRules" Description="StyleCopRules custom ruleset" ToolsVersion="16.0">
<IncludeAll Action="Warning" />
<Rules AnalyzerId="StyleCop.Analyzers" RuleNamespace="StyleCop.Analyzers">
<Rule Id="SA1101" Action="None" />
<Rule Id="SA1200" Action="None" />
<Rule Id="SA1305" Action="Warning" />
<Rule Id="SA1309" Action="None" />
<Rule Id="SA1402" Action="None" />
<Rule Id="SA1407" Action="None" />
<Rule Id="SA1412" Action="Warning" />
<Rule Id="SA1503" Action="None" />
<Rule Id="SA1600" Action="None" />
<Rule Id="SA1601" Action="None" />
<Rule Id="SA1602" Action="None" />
<Rule Id="SA1604" Action="None" />
<Rule Id="SA1605" Action="None" />
<Rule Id="SA1606" Action="None" />
<Rule Id="SA1607" Action="None" />
<Rule Id="SA1608" Action="None" />
<Rule Id="SA1610" Action="None" />
<Rule Id="SA1611" Action="None" />
<Rule Id="SA1612" Action="None" />
<Rule Id="SA1613" Action="None" />
<Rule Id="SA1614" Action="None" />
<Rule Id="SA1615" Action="None" />
<Rule Id="SA1616" Action="None" />
<Rule Id="SA1617" Action="None" />
<Rule Id="SA1618" Action="None" />
<Rule Id="SA1619" Action="None" />
<Rule Id="SA1620" Action="None" />
<Rule Id="SA1621" Action="None" />
<Rule Id="SA1622" Action="None" />
<Rule Id="SA1623" Action="None" />
<Rule Id="SA1624" Action="None" />
<Rule Id="SA1625" Action="None" />
<Rule Id="SA1626" Action="None" />
<Rule Id="SA1627" Action="None" />
<Rule Id="SA1633" Action="None" />
<Rule Id="SA1634" Action="None" />
<Rule Id="SA1635" Action="None" />
<Rule Id="SA1636" Action="None" />
<Rule Id="SA1637" Action="None" />
<Rule Id="SA1638" Action="None" />
<Rule Id="SA1640" Action="None" />
<Rule Id="SA1641" Action="None" />
<Rule Id="SA1642" Action="None" />
<Rule Id="SA1643" Action="None" />
<Rule Id="SA1648" Action="None" />
<Rule Id="SA1649" Action="None" />
<Rule Id="SA1651" Action="None" />
<Rule Id="SA1652" Action="None" />
<Rule Id="SX1101" Action="Warning" />
<Rule Id="SX1309" Action="Warning" />
</Rules>
</RuleSet>
9 changes: 9 additions & 0 deletions Maui.Tabs/Configuration/stylecop.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"settings": {
"namingRules": {
"allowedNamespaceComponents": [
"iOS"
]
}
}
}
75 changes: 75 additions & 0 deletions Maui.Tabs/MaterialUnderlinedTabItem.xaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
<?xml version="1.0" encoding="UTF-8" ?>

<tabs:UnderlinedTabItemBase x:Class="Sharpnado.Tabs.MaterialUnderlinedTabItem"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:tabs="clr-namespace:Sharpnado.Tabs"
x:Name="RootLayout">

<ContentView.Resources>
<ResourceDictionary>
<Color x:Key="HeaderTextColor">#acacac</Color>

<Style x:Key="TabTextHeader" TargetType="Label">
<Setter Property="TextColor" Value="{StaticResource HeaderTextColor}" />
<Setter Property="LineBreakMode" Value="TailTruncation" />
<Setter Property="HorizontalTextAlignment" Value="Center" />
<Setter Property="VerticalTextAlignment" Value="Center" />
<Setter Property="HorizontalOptions" Value="Center" />
<Setter Property="Margin" Value="0" />
</Style>

<Style x:Key="TabIconPath" TargetType="Path">
<Setter Property="VerticalOptions" Value="Fill" />
<Setter Property="Aspect" Value="None" />
<Setter Property="HorizontalOptions" Value="Center" />
</Style>

<Style x:Key="TabIconImage" TargetType="Image">
<Setter Property="VerticalOptions" Value="Center" />
<Setter Property="HorizontalOptions" Value="Center" />
</Style>

<Style x:Key="LayoutIconWithText" TargetType="StackLayout">
<Setter Property="Padding" Value="0" />
<Setter Property="Spacing" Value="0" />
<Setter Property="HorizontalOptions" Value="Center" />
<Setter Property="VerticalOptions" Value="Center" />
</Style>
</ResourceDictionary>
</ContentView.Resources>

<ContentView.Content>
<Grid x:Name="Grid" RowSpacing="0">

<StackLayout x:Name="MainLayout" Style="{StaticResource LayoutIconWithText}">
<Path x:Name="IconPath"
Style="{StaticResource TabIconPath}"
Data="{Binding Source={x:Reference RootLayout}, Path=GeometryIcon}" />
<Image x:Name="IconImage"
Style="{StaticResource TabIconImage}"
WidthRequest="{Binding Source={x:Reference RootLayout}, Path=IconSize}"
HeightRequest="{Binding Source={x:Reference RootLayout}, Path=IconSize}"
Source="{Binding Source={x:Reference RootLayout}, Path=IconImageSource}" />
<Label x:Name="InnerLabel"
Style="{StaticResource TabTextHeader}"
FontFamily="{Binding Source={x:Reference RootLayout}, Path=FontFamily}"
FontSize="{Binding Source={x:Reference RootLayout}, Path=LabelSize}"
Text="{Binding Source={x:Reference RootLayout}, Path=Label}" />
</StackLayout>
<BoxView x:Name="Underline"
HeightRequest="0"
HorizontalOptions="Center"
VerticalOptions="End"
BackgroundColor="Transparent">
<BoxView.Triggers>
<DataTrigger Binding="{Binding Source={x:Reference RootLayout}, Path=IsSelected}"
TargetType="BoxView"
Value="true">
<Setter Property="HeightRequest" Value="{Binding Source={x:Reference RootLayout}, Path=UnderlineHeight}" />
</DataTrigger>
</BoxView.Triggers>
</BoxView>
</Grid>
</ContentView.Content>
</tabs:UnderlinedTabItemBase>
138 changes: 138 additions & 0 deletions Maui.Tabs/Maui.Tabs.csproj
Original file line number Diff line number Diff line change
@@ -0,0 +1,138 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks Condition="$([MSBuild]::IsOSPlatform('windows'))">$(TargetFrameworks);net6.0-windows10.0.19041.0</TargetFrameworks>
<!-- Uncomment to also build the tizen app. You will need to install tizen by following this: https://github.com/Samsung/Tizen.NET -->
<!-- <TargetFrameworks>$(TargetFrameworks);net6.0-tizen</TargetFrameworks> -->
<RootNamespace>Sharpnado.Tabs</RootNamespace>
<UseMaui>true</UseMaui>
<SingleProject>true</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">21.0</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</SupportedOSPlatformVersion>
<TargetPlatformMinVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'windows'">10.0.17763.0</TargetPlatformMinVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'tizen'">6.5</SupportedOSPlatformVersion>

<CodeAnalysisRuleSet>Configuration\StyleCopRules.ruleset</CodeAnalysisRuleSet>
</PropertyGroup>

<PropertyGroup>
<Product>$(AssemblyName) ($(TargetFramework))</Product>
<AssemblyVersion>2.3.0.0</AssemblyVersion>
<AssemblyFileVersion>2.3.0.0</AssemblyFileVersion>
<Version>2.3.0</Version>
<PackOnBuild>true</PackOnBuild>
<NeutralLanguage>en</NeutralLanguage>

<UseFullSemVerForNuGet>false</UseFullSemVerForNuGet>

<LangVersion>latest</LangVersion>
</PropertyGroup>

<PropertyGroup>
<PackageProjectUrl>https://github.com/roubachof/MetroLog</PackageProjectUrl>
<RepositoryUrl>https://github.com/roubachof/MetroLog</RepositoryUrl>
<PackageIconUrl></PackageIconUrl>
<PackageTags>maui, netmaui, Logging NLog log4net ios android xamarin dotnet netcore</PackageTags>

<PackageReleaseNotes>
First .Net 6 (MAUI) release \o/
</PackageReleaseNotes>

<Title>MetroLog Lightweight Logging for .net 6 (MAUI and beyond!)</Title>
<Summary />
<Description>
MetroLog is a lightweight logging framework designed for .net 6. Although the API is based on NLog and log4net, the intention is that it's a very basic logging system.

This version targets .net 6, which includes all platforms.
</Description>

<Owners>Jean-Marie Alfonsi</Owners>
<Authors>Jean-Marie Alfonsi</Authors>
<Copyright>Copyright 2022 Sharpnado</Copyright>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<PackageLicenseExpression>MIT</PackageLicenseExpression>

<PublishRepositoryUrl>true</PublishRepositoryUrl>
<EmbedUntrackedSources>true</EmbedUntrackedSources>
<IncludeSymbols>true</IncludeSymbols>
<SymbolPackageFormat>snupkg</SymbolPackageFormat>
<FileVersion>2.3.0.0</FileVersion>
</PropertyGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.iOS')) != true AND $(TargetFramework.StartsWith('net6.0-ios')) != true AND $(TargetFramework.StartsWith('net6.0-maccatalyst')) != true ">
<Compile Remove="**\**\*.ios.cs" />
<None Include="**\**\*.ios.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
<Compile Remove="**\ios\**\*.cs" />
<None Include="**\ios\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.Mac')) != true ">
<Compile Remove="**\*.macos.cs" />
<None Include="**\*.macos.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
<Compile Remove="**\macos\**\*.cs" />
<None Include="**\macos\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('Xamarin.Mac')) != true AND $(TargetFramework.StartsWith('Xamarin.iOS')) != true AND $(TargetFramework.StartsWith('net6.0-ios')) != true AND $(TargetFramework.StartsWith('net6.0-maccatalyst')) != true">
<Compile Remove="**\*.macios.cs" />
<None Include="**\*.macios.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
<Compile Remove="**\macios\**\*.cs" />
<None Include="**\macios\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.StartsWith('MonoAndroid')) != true AND $(TargetFramework.StartsWith('net6.0-android')) != true ">
<Compile Remove="**\**\*.android.cs" />
<None Include="**\**\*.android.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
<Compile Remove="**\android\**\*.cs" />
<None Include="**\android\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>
<ItemGroup Condition="$(TargetFramework.Contains('-windows')) != true ">
<Compile Remove="**\*.windows.cs" />
<None Include="**\*.windows.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
<Compile Remove="**\windows\**\*.cs" />
<None Include="**\windows\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>

<ItemGroup>
<PackageReference Include="StyleCop.Analyzers" Version="1.2.0-beta.164">
<PrivateAssets>all</PrivateAssets>
<IncludeAssets>runtime; build; native; contentfiles; analyzers; buildtransitive</IncludeAssets>
</PackageReference>
</ItemGroup>

<ItemGroup>
<Compile Include="..\Tabs\Tabs\AssemblyConfiguration.cs" Link="AssemblyConfiguration.cs" />
<Compile Include="..\Tabs\Tabs\AssemblyInfo.cs" Link="AssemblyInfo.cs" />
<Compile Include="..\Tabs\Tabs\BadgeView.cs" Link="BadgeView.cs" />
<Compile Include="..\Tabs\Tabs\BottomTabItem.xaml.cs" Link="BottomTabItem.xaml.cs" />
<Compile Include="..\Tabs\Tabs\Effects\ImageEffect.cs" Link="Effects\ImageEffect.cs" />
<Compile Include="..\Tabs\Tabs\Effects\TapCommandEffect.cs" Link="Effects\TapCommandEffect.cs" />
<Compile Include="..\Tabs\Tabs\Effects\ViewEffect.cs" Link="Effects\ViewEffect.cs" />
<Compile Include="..\Tabs\Tabs\IAnimatableReveal.cs" Link="IAnimatableReveal.cs" />
<Compile Include="..\Tabs\Tabs\IconOptions.cs" Link="IconOptions.cs" />
<Compile Include="..\Tabs\Tabs\Initializer.cs" Link="Initializer.cs" />
<Compile Include="..\Tabs\Tabs\InternalLogger.cs" Link="InternalLogger.cs" />
<Compile Include="..\Tabs\Tabs\LazyView.cs" Link="LazyView.cs" />
<Compile Include="..\Tabs\Tabs\MaterialUnderlinedTabItem.xaml.cs" Link="MaterialUnderlinedTabItem.xaml.cs" />
<Compile Include="..\Tabs\Tabs\SegmentedTabItem.cs" Link="SegmentedTabItem.cs" />
<Compile Include="..\Tabs\Tabs\TabButton.cs" Link="TabButton.cs" />
<Compile Include="..\Tabs\Tabs\TabHostView.cs" Link="TabHostView.cs" />
<Compile Include="..\Tabs\Tabs\TabItem.cs" Link="TabItem.cs" />
<Compile Include="..\Tabs\Tabs\TabTextItem.cs" Link="TabTextItem.cs" />
<Compile Include="..\Tabs\Tabs\TapCommand.cs" Link="TapCommand.cs" />
<Compile Include="..\Tabs\Tabs\UnderlinedTabItem.xaml.cs" Link="UnderlinedTabItem.xaml.cs" />
<Compile Include="..\Tabs\Tabs\UnderlinedTabItemBase.cs" Link="UnderlinedTabItemBase.cs" />
<Compile Include="..\Tabs\Tabs\ViewSwitcher.cs" Link="ViewSwitcher.cs" />
</ItemGroup>
<ItemGroup>
<Folder Include="Effects\" />
<Folder Include="Platforms\Android\" />
<Folder Include="Platforms\iOS\" />
<Folder Include="Platforms\MacCatalyst\" />
<Folder Include="Platforms\Tizen\" />
<Folder Include="Platforms\Windows\" />
</ItemGroup>

</Project>
Loading

0 comments on commit 907ad17

Please sign in to comment.