Skip to content

Commit

Permalink
Merge pull request #15 from muak/dev/net7
Browse files Browse the repository at this point in the history
Fix PickerCell / Update .NET 7.0
  • Loading branch information
muak committed Aug 11, 2023
2 parents b1ea2ec + d5f5d50 commit fd9bb22
Show file tree
Hide file tree
Showing 7 changed files with 152 additions and 35 deletions.
8 changes: 4 additions & 4 deletions Sample/Sample.csproj
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks>net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
<OutputType>Exe</OutputType>
<RootNamespace>Sample</RootNamespace>
<UseMaui>true</UseMaui>
Expand Down Expand Up @@ -31,18 +31,18 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
<LangVersion>10.0</LangVersion>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0-ios|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net7.0-ios|AnyCPU'">
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchLink>None</MtouchLink>
<CreatePackage>false</CreatePackage>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0-ios|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net7.0-ios|AnyCPU'">
<CodesignKey>iPhone Developer</CodesignKey>
<MtouchDebug>true</MtouchDebug>
<!--<CodesignProvision>自動</CodesignProvision>-->
<CreatePackage>false</CreatePackage>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0-maccatalyst|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net7.0-maccatalyst|AnyCPU'">
<CodesignKey>Mac Developer</CodesignKey>
<PackageSigningKey>3rd Party Mac Developer Installer</PackageSigningKey>
</PropertyGroup>
Expand Down
13 changes: 12 additions & 1 deletion SettingsView/Pages/PickerPage.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
using Microsoft.Maui;
using System.Collections;
using System.Runtime.InteropServices;

namespace AiForms.Settings.Pages;
Expand All @@ -24,7 +25,7 @@ public PickerPage(PickerCell cell)

foreach (var item in _pickerCell.ItemsSource)
{
var isSelected = _pickerCell.SelectedItems.IndexOf(item) >= 0;
var isSelected = _pickerCell.SelectedItems.IndexOf(item) >= 0;
var displayValue = new DisplayValue($"{_pickerCell.DisplayValue(item)}", $"{_pickerCell.SubDisplayValue(item)}", isSelected, item);
ItemsSource.Add(displayValue);

Expand Down Expand Up @@ -102,6 +103,15 @@ void SetUpProperties()
{
settingsView.CellBackgroundColor = _parent.CellBackgroundColor;
}

if(_pickerCell.SelectedItems == null)
{
_pickerCell.SelectedItems = new ArrayList();
if (_pickerCell.SelectedItem != null)
{
_pickerCell.SelectedItems.Add(_pickerCell.SelectedItem);
}
}
}

protected override void OnDisappearing()
Expand Down Expand Up @@ -153,6 +163,7 @@ void SelectedSingle(DisplayValue item)

item.IsSelected = true;

_selectedCache.Clear();
_selectedCache.Add(item);
}

Expand Down
71 changes: 67 additions & 4 deletions SettingsView/Platforms/iOS/CustomHeaderFooterView.cs
Original file line number Diff line number Diff line change
@@ -1,22 +1,65 @@
using System;
using System.ComponentModel;
using AiForms.Settings.Extensions;
using CoreGraphics;
using Foundation;
using Microsoft.Maui.Platform;
using ObjCRuntime;
using SpriteKit;
using UIKit;

namespace AiForms.Settings.Platforms.iOS;

public class CustomHeaderView : CustomHeaderFooterView
{
public CustomHeaderView(IntPtr handle) : base(handle)
public CustomHeaderView()
{
}

public CustomHeaderView(NSCoder coder) : base(coder)
{
}

public CustomHeaderView(CGRect frame) : base(frame)
{
}

public CustomHeaderView(NSString reuseIdentifier) : base(reuseIdentifier)
{
}

protected CustomHeaderView(NSObjectFlag t) : base(t)
{
}

protected internal CustomHeaderView(NativeHandle handle) : base(handle)
{
}
}

public class CustomFooterView : CustomHeaderFooterView
{
public CustomFooterView(IntPtr handle) : base(handle)
public CustomFooterView()
{
}

public CustomFooterView(NSString reuseIdentifier) : base(reuseIdentifier)
{
}

public CustomFooterView(NSCoder coder) : base(coder)
{
}

public CustomFooterView(CGRect frame) : base(frame)
{
}

protected CustomFooterView(NSObjectFlag t) : base(t)
{
}

protected internal CustomFooterView(NativeHandle handle) : base(handle)
{
}
}
Expand All @@ -27,9 +70,29 @@ public class CustomHeaderFooterView:UITableViewHeaderFooterView
bool _disposed;
NSLayoutConstraint _heightConstraint;
View _virtualCell;
IMauiContext _mauiContext => _virtualCell.FindMauiContext();
IMauiContext _mauiContext => _virtualCell.FindMauiContext();

public CustomHeaderFooterView()
{
}

public CustomHeaderFooterView(NSCoder coder) : base(coder)
{
}

protected CustomHeaderFooterView(NSObjectFlag t) : base(t)
{
}

protected internal CustomHeaderFooterView(NativeHandle handle) : base(handle)
{
}

public CustomHeaderFooterView(CGRect frame) : base(frame)
{
}

public CustomHeaderFooterView(IntPtr handle):base(handle)
public CustomHeaderFooterView(NSString reuseIdentifier) : base(reuseIdentifier)
{
}

Expand Down
25 changes: 24 additions & 1 deletion SettingsView/Platforms/iOS/TextFooterView.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
using System;
using UIKit;
using System.Collections.Generic;
using Foundation;
using ObjCRuntime;
using CoreGraphics;

namespace AiForms.Settings.Platforms.iOS;

Expand All @@ -9,7 +12,19 @@ public class TextFooterView : UITableViewHeaderFooterView
public PaddingLabel Label { get; set; }
List<NSLayoutConstraint> _constraints = new List<NSLayoutConstraint>();

public TextFooterView(IntPtr handle):base(handle)
public TextFooterView()
{
}

public TextFooterView(NSCoder coder) : base(coder)
{
}

protected TextFooterView(NSObjectFlag t) : base(t)
{
}

protected internal TextFooterView(NativeHandle handle) : base(handle)
{
Label = new PaddingLabel();
Label.Lines = 0;
Expand All @@ -31,6 +46,14 @@ public TextFooterView(IntPtr handle):base(handle)
this.BackgroundView = new UIView();
}

public TextFooterView(CGRect frame) : base(frame)
{
}

public TextFooterView(NSString reuseIdentifier) : base(reuseIdentifier)
{
}

protected override void Dispose(bool disposing)
{
base.Dispose(disposing);
Expand Down
26 changes: 23 additions & 3 deletions SettingsView/Platforms/iOS/TextHeaderView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@
using UIKit;
using System.Collections.Generic;
using CoreGraphics;
using Foundation;
using ObjCRuntime;

namespace AiForms.Settings.Platforms.iOS;

Expand All @@ -10,11 +12,22 @@ public class TextHeaderView : UITableViewHeaderFooterView
public PaddingLabel Label { get; set; }
List<NSLayoutConstraint> _constraints = new List<NSLayoutConstraint>();
LayoutAlignment _curAlignment;
bool _isInitialized;
bool _isInitialized;

public TextHeaderView(IntPtr handle): base(handle)
public TextHeaderView()
{
}

public TextHeaderView(NSCoder coder) : base(coder)
{
}

protected TextHeaderView(NSObjectFlag t) : base(t)
{
}

protected internal TextHeaderView(NativeHandle handle) : base(handle)
{
Label = new PaddingLabel();
Label.Lines = 0;
Label.LineBreakMode = UILineBreakMode.CharacterWrap;
Expand All @@ -31,11 +44,18 @@ public TextHeaderView(IntPtr handle): base(handle)
c.Priority = 999f; // fix warning-log:Unable to simultaneously satisfy constraints.
c.Active = true;
});


this.BackgroundView = new UIView();
}

public TextHeaderView(CGRect frame) : base(frame)
{
}

public TextHeaderView(NSString reuseIdentifier) : base(reuseIdentifier)
{
}

public void SetVerticalAlignment(LayoutAlignment align)
{
Expand Down
13 changes: 6 additions & 7 deletions SettingsView/SettingsView.csproj
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<TargetFrameworks>net6.0;net6.0-android;net6.0-ios;net6.0-maccatalyst</TargetFrameworks>
<TargetFrameworks>net7.0;net7.0-android;net7.0-ios;net7.0-maccatalyst</TargetFrameworks>
<UseMaui>true</UseMaui>
<SingleProject>false</SingleProject>
<ImplicitUsings>enable</ImplicitUsings>

<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'ios'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'maccatalyst'">14.2</SupportedOSPlatformVersion>
<SupportedOSPlatformVersion Condition="$([MSBuild]::GetTargetPlatformIdentifier('$(TargetFramework)')) == 'android'">27.0</SupportedOSPlatformVersion>
<RootNamespace>AiForms.Settings</RootNamespace>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net6.0-ios|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Debug|net7.0-ios|AnyCPU'">
<EnableCodeSigning>False</EnableCodeSigning>
<CreatePackage>false</CreatePackage>
</PropertyGroup>
Expand All @@ -25,7 +24,7 @@
<DebugType>pdbonly</DebugType>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net6.0-ios|AnyCPU'">
<PropertyGroup Condition="'$(Configuration)|$(TargetFramework)|$(Platform)'=='Release|net7.0-ios|AnyCPU'">
<DebugSymbols>true</DebugSymbols>
<EnableCodeSigning>false</EnableCodeSigning>
</PropertyGroup>
Expand All @@ -43,19 +42,19 @@
<None Include="**\iOS\**\*.cs" Exclude="$(DefaultItemExcludes);$(DefaultExcludesInProjectFolder)" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'net6.0'">
<ItemGroup Condition="'$(TargetFramework)' == 'net7.0'">
<Compile Include="**\**\*.Net.cs" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('net6.0-android')) == true">
<ItemGroup Condition="$(TargetFramework.StartsWith('net7.0-android')) == true">
<Compile Include="**\**\*.Android.cs" />
<Compile Include="**\Android\**\*.cs" />
<AndroidResource Include="**\Resources\**\*.axml" Generator="MSBuild:UpdateGeneratedFiles" />
<AndroidResource Include="**\Resources\**\*.xml" Generator="MSBuild:UpdateGeneratedFiles" />
<AndroidResource Include="**\Resources\**\*.png" Generator="MSBuild:UpdateGeneratedFiles" />
</ItemGroup>

<ItemGroup Condition="$(TargetFramework.StartsWith('net6.0-ios')) == true OR $(TargetFramework.StartsWith('net6.0-maccatalyst')) == true">
<ItemGroup Condition="$(TargetFramework.StartsWith('net7.0-ios')) == true OR $(TargetFramework.StartsWith('net7.0-maccatalyst')) == true">
<Compile Include="**\**\*.iOS.cs" />
<Compile Include="**\iOS\**\*.cs" />
</ItemGroup>
Expand Down
31 changes: 16 additions & 15 deletions nuget/AzurePipelines.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -15,28 +15,29 @@ There are various cells such as (LabelCell,ButtonCell,CommandCell,SwitchCell,Che
</description>
<summary></summary>
<releaseNotes>
bug fixes
- Update .NET 7.0
- Fix PickerCell SingleSelectMode not working.
</releaseNotes>
<tags>MAUI TableView Cell Setting Configuration Option ListView UITableView RecyclerView ReOrder DragDrop</tags>
<language>en-US</language>
</metadata>
<files>
<!-- NET6 -->
<file src="artifacts/net6.0/SettingsView.dll" target="lib/net6.0" />
<file src="artifacts/net6.0/SettingsView.xml" target="lib/net6.0" />
<file src="artifacts/net6.0/SettingsView.pdb" target="lib/net6.0" />
<!-- NET7.0 -->
<file src="artifacts/net7.0/SettingsView.dll" target="lib/net7.0" />
<file src="artifacts/net7.0/SettingsView.xml" target="lib/net7.0" />
<file src="artifacts/net7.0/SettingsView.pdb" target="lib/net7.0" />
<!-- Android -->
<file src="artifacts/net6.0-android/SettingsView.dll" target="lib/net6.0-android27.0" />
<file src="artifacts/net6.0-android/SettingsView.xml" target="lib/net6.0-android27.0" />
<file src="artifacts/net6.0-android/SettingsView.pdb" target="lib/net6.0-android27.0" />
<file src="artifacts/net6.0-android/SettingsView.aar" target="lib/net6.0-android27.0" />
<file src="artifacts/net7.0-android/SettingsView.dll" target="lib/net7.0-android27.0" />
<file src="artifacts/net7.0-android/SettingsView.xml" target="lib/net7.0-android27.0" />
<file src="artifacts/net7.0-android/SettingsView.pdb" target="lib/net7.0-android27.0" />
<file src="artifacts/net7.0-android/SettingsView.aar" target="lib/net7.0-android27.0" />
<!-- iOS -->
<file src="artifacts/net6.0-ios/SettingsView.dll" target="lib/net6.0-ios14.2" />
<file src="artifacts/net6.0-ios/SettingsView.xml" target="lib/net6.0-ios14.2" />
<file src="artifacts/net6.0-ios/SettingsView.pdb" target="lib/net6.0-ios14.2" />
<file src="artifacts/net7.0-ios/SettingsView.dll" target="lib/net7.0-ios14.2" />
<file src="artifacts/net7.0-ios/SettingsView.xml" target="lib/net7.0-ios14.2" />
<file src="artifacts/net7.0-ios/SettingsView.pdb" target="lib/net7.0-ios14.2" />
<!-- MacCatalyst -->
<file src="artifacts/net6.0-maccatalyst/SettingsView.dll" target="lib/net6.0-maccatalyst14.2" />
<file src="artifacts/net6.0-maccatalyst/SettingsView.xml" target="lib/net6.0-maccatalyst14.2" />
<file src="artifacts/net6.0-maccatalyst/SettingsView.pdb" target="lib/net6.0-maccatalyst14.2" />
<file src="artifacts/net7.0-maccatalyst/SettingsView.dll" target="lib/net7.0-maccatalyst14.2" />
<file src="artifacts/net7.0-maccatalyst/SettingsView.xml" target="lib/net7.0-maccatalyst14.2" />
<file src="artifacts/net7.0-maccatalyst/SettingsView.pdb" target="lib/net7.0-maccatalyst14.2" />
</files>
</package>

0 comments on commit fd9bb22

Please sign in to comment.