From 0df5ad3537ff4122301a06f2778b0995e8197725 Mon Sep 17 00:00:00 2001 From: kamu Date: Sat, 18 Jan 2020 19:25:42 +0900 Subject: [PATCH 1/2] ReadMe --- README-ja.md | 2 ++ README.md | 2 ++ 2 files changed, 4 insertions(+) diff --git a/README-ja.md b/README-ja.md index a7de3c7..40bfe83 100644 --- a/README-ja.md +++ b/README-ja.md @@ -729,6 +729,8 @@ Xamarin.Forms.EntryCellとは別物です。 > 有効にした場合、アイコンの設定は無効になります。 * Command * CommandParameter +* LongCommand + * 長押し時に発火するコマンド * KeepSelectedUntilBack * タップして次のページに遷移した時、遷移先ページから戻ってくるまで選択状態をそのままにしておくかの設定 * trueの場合は選択状態をキープして、falseの場合は選択はすぐに解除されます。 diff --git a/README.md b/README.md index a3051a2..91e649f 100644 --- a/README.md +++ b/README.md @@ -719,6 +719,8 @@ It is envisaged that makes use of subclass of CustomCell. * Command * Invoked action. * CommandParameter +* LongCommand + * Long tap command action. * KeepSelectedUntilBack * When moving next page, whether keep the cell selected until being back to the page. From eb7bee6e244e91af58a2e7c14eda51092e3f3821 Mon Sep 17 00:00:00 2001 From: Satoshi Nakamura Date: Sat, 22 Feb 2020 21:50:41 +0900 Subject: [PATCH 2/2] Fix ItemsSource Replace / Header/Footer SafeAreaInsets #83 --- Sample/Sample.iOS/Info.plist | 4 +-- Sample/Sample.iOS/Sample.iOS.csproj | 3 +- Sample/Sample/Views/RowManipulation.xaml | 2 +- Sample/Sample/Views/SettingsViewPage.xaml | 13 ++++++++ SettingsView.iOS/CustomHeaderFooterView.cs | 2 +- SettingsView.iOS/SettingsTableSource.cs | 4 +-- SettingsView.iOS/SettingsView.iOS.csproj | 8 ++--- SettingsView.iOS/TextFooterView.cs | 24 +++++++++++++-- SettingsView.iOS/TextHeaderView.cs | 30 ++++++++++++++++--- SettingsView/Section.cs | 2 +- SettingsView/SettingsView.DefineProperites.cs | 2 +- nuget/AzurePipelines.nuspec | 19 ++---------- 12 files changed, 77 insertions(+), 36 deletions(-) diff --git a/Sample/Sample.iOS/Info.plist b/Sample/Sample.iOS/Info.plist index b017d24..109037d 100644 --- a/Sample/Sample.iOS/Info.plist +++ b/Sample/Sample.iOS/Info.plist @@ -5,7 +5,7 @@ CFBundleDisplayName SettingsView CFBundleIdentifier - jp.kamusoft.sample + jp.kamusoft.settingsview CFBundleShortVersionString 1.0 CFBundleVersion @@ -13,7 +13,7 @@ LSRequiresIPhoneOS MinimumOSVersion - 7.0 + 10.1 UIDeviceFamily 1 diff --git a/Sample/Sample.iOS/Sample.iOS.csproj b/Sample/Sample.iOS/Sample.iOS.csproj index 28512cb..ff49a95 100644 --- a/Sample/Sample.iOS/Sample.iOS.csproj +++ b/Sample/Sample.iOS/Sample.iOS.csproj @@ -19,7 +19,7 @@ DEBUG;ENABLE_TEST_CLOUD; prompt 4 - iPhone Developer + Apple Development: Satoshi Nakamura (249YM2WC3W) true true true @@ -29,6 +29,7 @@ i386, x86_64 HttpClientHandler x86 + WildcardDev pdbonly diff --git a/Sample/Sample/Views/RowManipulation.xaml b/Sample/Sample/Views/RowManipulation.xaml index 502965d..0eb7333 100644 --- a/Sample/Sample/Views/RowManipulation.xaml +++ b/Sample/Sample/Views/RowManipulation.xaml @@ -46,7 +46,7 @@ - + diff --git a/Sample/Sample/Views/SettingsViewPage.xaml b/Sample/Sample/Views/SettingsViewPage.xaml index 12d0f84..c0a47cb 100644 --- a/Sample/Sample/Views/SettingsViewPage.xaml +++ b/Sample/Sample/Views/SettingsViewPage.xaml @@ -101,6 +101,19 @@ + + + + + + + + + + diff --git a/SettingsView.iOS/CustomHeaderFooterView.cs b/SettingsView.iOS/CustomHeaderFooterView.cs index 7a891ef..c9ba815 100644 --- a/SettingsView.iOS/CustomHeaderFooterView.cs +++ b/SettingsView.iOS/CustomHeaderFooterView.cs @@ -104,7 +104,7 @@ public override void LayoutSubviews() //This sets the content views frame. base.LayoutSubviews(); - var contentFrame = ContentView.Frame; + var contentFrame = ContentView.Bounds; var view = FormsCell; Layout.LayoutChildIntoBoundingRegion(view, contentFrame.ToRectangle()); diff --git a/SettingsView.iOS/SettingsTableSource.cs b/SettingsView.iOS/SettingsTableSource.cs index 439dcce..2803439 100644 --- a/SettingsView.iOS/SettingsTableSource.cs +++ b/SettingsView.iOS/SettingsTableSource.cs @@ -162,7 +162,7 @@ public override UIView GetViewForHeader(UITableView tableView, nint section) var headerView = _tableView.DequeueReusableHeaderFooterView(SettingsViewRenderer.TextHeaderId) as TextHeaderView; - headerView.Initialzie(_settingsView.HeaderPadding.ToUIEdgeInsets(),_settingsView.HeaderTextVerticalAlign); + headerView.Initialzie(_settingsView.HeaderPadding.ToUIEdgeInsets(),_settingsView.HeaderTextVerticalAlign,_tableView); headerView.Label.Text = _settingsView.Model.GetSectionTitle((int)section); headerView.Label.TextColor = _settingsView.HeaderTextColor == Color.Default ? @@ -224,7 +224,7 @@ public override UIView GetViewForFooter(UITableView tableView, nint section) } var footerView = _tableView.DequeueReusableHeaderFooterView(SettingsViewRenderer.TextFooterId) as TextFooterView; - footerView.Initialzie(_settingsView.FooterPadding.ToUIEdgeInsets()); + footerView.Initialzie(_settingsView.FooterPadding.ToUIEdgeInsets(), _tableView); footerView.Label.Text = text; footerView.Label.TextColor = _settingsView.FooterTextColor == Color.Default ? diff --git a/SettingsView.iOS/SettingsView.iOS.csproj b/SettingsView.iOS/SettingsView.iOS.csproj index aa1d8a0..c1b700a 100644 --- a/SettingsView.iOS/SettingsView.iOS.csproj +++ b/SettingsView.iOS/SettingsView.iOS.csproj @@ -101,15 +101,15 @@ + + + - {8FFB1EF3-FAF3-478C-B9F1-4D02E599C3C6} + {1BE95507-DABA-43AD-954A-6CDFEB25B5E4} SettingsView - - - diff --git a/SettingsView.iOS/TextFooterView.cs b/SettingsView.iOS/TextFooterView.cs index c80911d..d324dda 100644 --- a/SettingsView.iOS/TextFooterView.cs +++ b/SettingsView.iOS/TextFooterView.cs @@ -11,6 +11,8 @@ public class TextFooterView : UITableViewHeaderFooterView List _constraints = new List(); UIEdgeInsets _curPadding; bool _isInitialized; + NSLayoutConstraint _leftConstraint; + UITableView _tableView; public TextFooterView(IntPtr handle):base(handle) { @@ -24,7 +26,22 @@ public TextFooterView(IntPtr handle):base(handle) this.BackgroundView = new UIView(); } - public void Initialzie(UIEdgeInsets padding) + public override void LayoutSubviews() + { + base.LayoutSubviews(); + + if (_leftConstraint != null) + { + _leftConstraint.Active = false; + _leftConstraint.Dispose(); + _leftConstraint = null; + } + + _leftConstraint = Label.LeftAnchor.ConstraintEqualTo(LeftAnchor, _curPadding.Left + _tableView.SafeAreaInsets.Left); + _leftConstraint.Active = true; + } + + public void Initialzie(UIEdgeInsets padding, UITableView tableView) { if(_isInitialized && _curPadding == padding) { @@ -39,7 +56,6 @@ public void Initialzie(UIEdgeInsets padding) _constraints.Clear(); _constraints.Add(Label.TopAnchor.ConstraintEqualTo(this.TopAnchor, padding.Top)); - _constraints.Add(Label.LeftAnchor.ConstraintEqualTo(this.LeftAnchor, padding.Left)); _constraints.Add(Label.RightAnchor.ConstraintEqualTo(this.RightAnchor, -padding.Right)); _constraints.Add(Label.BottomAnchor.ConstraintEqualTo(this.BottomAnchor, -padding.Bottom)); @@ -49,6 +65,7 @@ public void Initialzie(UIEdgeInsets padding) }); _curPadding = padding; + _tableView = tableView; _isInitialized = true; } @@ -58,10 +75,13 @@ protected override void Dispose(bool disposing) if (disposing) { _constraints.ForEach(c => c.Dispose()); + _leftConstraint?.Dispose(); + _leftConstraint = null; Label?.Dispose(); Label = null; BackgroundView?.Dispose(); BackgroundView = null; + _tableView = null; } } } diff --git a/SettingsView.iOS/TextHeaderView.cs b/SettingsView.iOS/TextHeaderView.cs index 628eb4c..67a0439 100644 --- a/SettingsView.iOS/TextHeaderView.cs +++ b/SettingsView.iOS/TextHeaderView.cs @@ -9,12 +9,14 @@ public class TextHeaderView : UITableViewHeaderFooterView { public UILabel Label { get; set; } List _constraints = new List(); + NSLayoutConstraint _leftConstraint; UIEdgeInsets _curPadding; + UITableView _tableView; LayoutAlignment _curAlignment; bool _isInitialized; public TextHeaderView(IntPtr handle): base(handle) - { + { Label = new UILabel(); Label.Lines = 1; Label.LineBreakMode = UILineBreakMode.TailTruncation; @@ -24,7 +26,23 @@ public TextHeaderView(IntPtr handle): base(handle) this.BackgroundView = new UIView(); } - public void Initialzie(UIEdgeInsets padding, LayoutAlignment align) + + public override void LayoutSubviews() + { + base.LayoutSubviews(); + + if(_leftConstraint != null) + { + _leftConstraint.Active = false; + _leftConstraint.Dispose(); + _leftConstraint = null; + } + + _leftConstraint = Label.LeftAnchor.ConstraintEqualTo(LeftAnchor, _curPadding.Left + _tableView.SafeAreaInsets.Left); + _leftConstraint.Active = true; + } + + public void Initialzie(UIEdgeInsets padding, LayoutAlignment align, UITableView tableView) { if(_isInitialized && _curPadding == padding && align == _curAlignment) { @@ -37,8 +55,8 @@ public void Initialzie(UIEdgeInsets padding, LayoutAlignment align) c.Dispose(); } _constraints.Clear(); - - _constraints.Add(Label.LeftAnchor.ConstraintEqualTo(this.LeftAnchor, padding.Left)); + + //_constraints.Add(Label.LeftAnchor.ConstraintEqualTo(this.LeftAnchor, padding.Left + safeAreaInsets.Left)); _constraints.Add(Label.RightAnchor.ConstraintEqualTo(this.RightAnchor, -padding.Right)); if (align == LayoutAlignment.Start) @@ -61,6 +79,7 @@ public void Initialzie(UIEdgeInsets padding, LayoutAlignment align) _curPadding = padding; _curAlignment = align; + _tableView = tableView; _isInitialized = true; } @@ -70,10 +89,13 @@ protected override void Dispose(bool disposing) if(disposing) { _constraints.ForEach(c => c.Dispose()); + _leftConstraint?.Dispose(); + _leftConstraint = null; Label?.Dispose(); Label = null; BackgroundView?.Dispose(); BackgroundView = null; + _tableView = null; } } } diff --git a/SettingsView/Section.cs b/SettingsView/Section.cs index 5148cbf..7a752c7 100644 --- a/SettingsView/Section.cs +++ b/SettingsView/Section.cs @@ -427,7 +427,7 @@ void OnItemsSourceCollectionChanged(object sender, NotifyCollectionChangedEventA RemoveAt(e.OldStartingIndex + TemplateStartIndex); - var item = e.NewItems[e.NewStartingIndex]; + var item = e.NewItems[0]; var view = CreateChildViewFor(ItemTemplate, item, this); Insert(e.NewStartingIndex + TemplateStartIndex, view); diff --git a/SettingsView/SettingsView.DefineProperites.cs b/SettingsView/SettingsView.DefineProperites.cs index e3f8af7..fa6d40d 100644 --- a/SettingsView/SettingsView.DefineProperites.cs +++ b/SettingsView/SettingsView.DefineProperites.cs @@ -837,7 +837,7 @@ void OnItemsSourceCollectionChanged(object sender, NotifyCollectionChangedEventA Root.RemoveAt(e.OldStartingIndex + TemplateStartIndex); - var item = e.NewItems[e.NewStartingIndex]; + var item = e.NewItems[0]; var view = CreateChildViewFor(this.ItemTemplate, item, this); Root.Insert(e.NewStartingIndex + TemplateStartIndex, view); diff --git a/nuget/AzurePipelines.nuspec b/nuget/AzurePipelines.nuspec index 09111d0..d6fc59d 100644 --- a/nuget/AzurePipelines.nuspec +++ b/nuget/AzurePipelines.nuspec @@ -15,28 +15,13 @@ There are various cells such as (LabelCell,ButtonCell,CommandCell,SwitchCell,Che -## New Features - -* [CustomCell] set XAML in SettingsView's cell -* [EntryCell] SetFocus method #63 -* [EntryCell] CompletedCommand property -* [PickerCell] SelectionMode property -* [PickerCell] SelectedItem property -* [SettingsView] ShowArrowIndicatorForAndroid Property – show an arrow indicator at the right side of CommandCell and PickerCell. -* [SettingsView][Section] TemplateStartIndex property – the index that starts inserting the template. -* [Section] HeaderView and FooterView property – can set a Forms view to a section header / footer. - - ## Changes -* EntryCell's keyboard is now hidden when scrolling on iOS. #59 -* EntryCell Completed event is now occurred when a cell is lost focus too. -* Improved cell maniputation performance. +* [Header/Footer] Section header/footer does not respect SafeAreaInsets #83 ## Bug fixes -* [TextPickerCell] Show the soft keyboard when tapping the dialog. #68 -* [EntryCell][Android] A binding sometimes lost. +* [SettingsView][Section] Crash when ItemsSource element is replaced. Xamarin.Forms TableView Cell Setting Configuration Option ListView UITableView RecyclerView ReOrder DragDrop