Skip to content

Commit 47d7fa3

Browse files
authored
Merge pull request #85 from muak/development
Development
2 parents 4467233 + eb7bee6 commit 47d7fa3

14 files changed

+81
-36
lines changed

README-ja.md

+2
Original file line numberDiff line numberDiff line change
@@ -729,6 +729,8 @@ Xamarin.Forms.EntryCellとは別物です。
729729
> 有効にした場合、アイコンの設定は無効になります。
730730
* Command
731731
* CommandParameter
732+
* LongCommand
733+
* 長押し時に発火するコマンド
732734
* KeepSelectedUntilBack
733735
* タップして次のページに遷移した時、遷移先ページから戻ってくるまで選択状態をそのままにしておくかの設定
734736
* trueの場合は選択状態をキープして、falseの場合は選択はすぐに解除されます。

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -719,6 +719,8 @@ It is envisaged that makes use of subclass of CustomCell.
719719
* Command
720720
* Invoked action.
721721
* CommandParameter
722+
* LongCommand
723+
* Long tap command action.
722724
* KeepSelectedUntilBack
723725
* When moving next page, whether keep the cell selected until being back to the page.
724726

Sample/Sample.iOS/Info.plist

+2-2
Original file line numberDiff line numberDiff line change
@@ -5,15 +5,15 @@
55
<key>CFBundleDisplayName</key>
66
<string>SettingsView</string>
77
<key>CFBundleIdentifier</key>
8-
<string>jp.kamusoft.sample</string>
8+
<string>jp.kamusoft.settingsview</string>
99
<key>CFBundleShortVersionString</key>
1010
<string>1.0</string>
1111
<key>CFBundleVersion</key>
1212
<string>1.0</string>
1313
<key>LSRequiresIPhoneOS</key>
1414
<true/>
1515
<key>MinimumOSVersion</key>
16-
<string>7.0</string>
16+
<string>10.1</string>
1717
<key>UIDeviceFamily</key>
1818
<array>
1919
<integer>1</integer>

Sample/Sample.iOS/Sample.iOS.csproj

+2-1
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
<DefineConstants>DEBUG;ENABLE_TEST_CLOUD;</DefineConstants>
2020
<ErrorReport>prompt</ErrorReport>
2121
<WarningLevel>4</WarningLevel>
22-
<CodesignKey>iPhone Developer</CodesignKey>
22+
<CodesignKey>Apple Development: Satoshi Nakamura (249YM2WC3W)</CodesignKey>
2323
<DeviceSpecificBuild>true</DeviceSpecificBuild>
2424
<MtouchDebug>true</MtouchDebug>
2525
<MtouchNoSymbolStrip>true</MtouchNoSymbolStrip>
@@ -29,6 +29,7 @@
2929
<MtouchArch>i386, x86_64</MtouchArch>
3030
<MtouchHttpClientHandler>HttpClientHandler</MtouchHttpClientHandler>
3131
<PlatformTarget>x86</PlatformTarget>
32+
<CodesignProvision>WildcardDev</CodesignProvision>
3233
</PropertyGroup>
3334
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|iPhone' ">
3435
<DebugType>pdbonly</DebugType>

Sample/Sample/Views/RowManipulation.xaml

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@
4646

4747
</StackLayout>
4848

49-
<sv:SettingsView Grid.Column="1" Style="{StaticResource settingsView}" x:Name="settings">
49+
<sv:SettingsView Grid.Column="1" HeaderHeight="36" Style="{StaticResource settingsView}" x:Name="settings">
5050
<sv:Section Title="Header" FooterText="Footer" x:Name="section">
5151
<sv:LabelCell IconSource="icon.png" Title="LabelCell" Description="HogeFuga" HintText="hint" ValueText="Value"/>
5252
<sv:CommandCell IconSource="icon.png" Title="CommandCell" Description="HogeFuga" HintText="hint" ValueText="Value"/>

Sample/Sample/Views/SettingsViewPage.xaml

+13
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,19 @@
101101
<sv:EntryCell Title="EntryCell" ValueText="{Binding InputText.Value}" Placeholder="Input text" Keyboard="Email" TextAlignment="End" HintText="{Binding InputError.Value}" />
102102
</sv:Section>
103103

104+
<sv:Section>
105+
<sv:Section.HeaderView>
106+
<FlexLayout Direction="Row" JustifyContent="SpaceBetween" AlignItems="End" HeightRequest="50" Padding="10,0,10,6">
107+
<Label Text="CustomHeaderView" TextColor="DeepSkyBlue" />
108+
<ImageButton Source="icon.png" WidthRequest="20" HeightRequest="20" />
109+
</FlexLayout>
110+
</sv:Section.HeaderView>
111+
<sv:Section.FooterView>
112+
<Label Text="CustomFooterView. " TextColor="DeepSkyBlue" Padding="10,6,10,0" />
113+
</sv:Section.FooterView>
114+
<cell:SliderCell Value="0.5" HintText="CustomCell" />
115+
</sv:Section>
116+
104117
<sv:Section Title="FormsCell">
105118
<ViewCell>
106119
<StackLayout Padding="14,8,8,8" BackgroundColor="White">

SettingsView.iOS/CustomHeaderFooterView.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ public override void LayoutSubviews()
104104
//This sets the content views frame.
105105
base.LayoutSubviews();
106106

107-
var contentFrame = ContentView.Frame;
107+
var contentFrame = ContentView.Bounds;
108108
var view = FormsCell;
109109

110110
Layout.LayoutChildIntoBoundingRegion(view, contentFrame.ToRectangle());

SettingsView.iOS/SettingsTableSource.cs

+2-2
Original file line numberDiff line numberDiff line change
@@ -162,7 +162,7 @@ public override UIView GetViewForHeader(UITableView tableView, nint section)
162162

163163

164164
var headerView = _tableView.DequeueReusableHeaderFooterView(SettingsViewRenderer.TextHeaderId) as TextHeaderView;
165-
headerView.Initialzie(_settingsView.HeaderPadding.ToUIEdgeInsets(),_settingsView.HeaderTextVerticalAlign);
165+
headerView.Initialzie(_settingsView.HeaderPadding.ToUIEdgeInsets(),_settingsView.HeaderTextVerticalAlign,_tableView);
166166

167167
headerView.Label.Text = _settingsView.Model.GetSectionTitle((int)section);
168168
headerView.Label.TextColor = _settingsView.HeaderTextColor == Color.Default ?
@@ -224,7 +224,7 @@ public override UIView GetViewForFooter(UITableView tableView, nint section)
224224
}
225225

226226
var footerView = _tableView.DequeueReusableHeaderFooterView(SettingsViewRenderer.TextFooterId) as TextFooterView;
227-
footerView.Initialzie(_settingsView.FooterPadding.ToUIEdgeInsets());
227+
footerView.Initialzie(_settingsView.FooterPadding.ToUIEdgeInsets(), _tableView);
228228

229229
footerView.Label.Text = text;
230230
footerView.Label.TextColor = _settingsView.FooterTextColor == Color.Default ?

SettingsView.iOS/SettingsView.iOS.csproj

+4-4
Original file line numberDiff line numberDiff line change
@@ -101,15 +101,15 @@
101101
<Compile Include="FormsInternals.cs" />
102102
<Compile Include="Cells\CustomCellContent.cs" />
103103
</ItemGroup>
104+
<ItemGroup>
105+
<None Include="packages.config" />
106+
</ItemGroup>
104107
<ItemGroup>
105108
<ProjectReference Include="..\SettingsView\SettingsView.csproj">
106-
<Project>{8FFB1EF3-FAF3-478C-B9F1-4D02E599C3C6}</Project>
109+
<Project>{1BE95507-DABA-43AD-954A-6CDFEB25B5E4}</Project>
107110
<Name>SettingsView</Name>
108111
</ProjectReference>
109112
</ItemGroup>
110-
<ItemGroup>
111-
<None Include="packages.config" />
112-
</ItemGroup>
113113
<Import Project="$(MSBuildExtensionsPath)\Xamarin\iOS\Xamarin.iOS.CSharp.targets" />
114114
<Import Project="..\packages\Xamarin.Forms.4.4.0.991477\build\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.4.4.0.991477\build\Xamarin.Forms.targets')" />
115115
<Import Project="..\packages\Xamarin.Android.Support.CustomTabs.28.0.0.3\build\monoandroid90\Xamarin.Android.Support.CustomTabs.targets" Condition="Exists('..\packages\Xamarin.Android.Support.CustomTabs.28.0.0.3\build\monoandroid90\Xamarin.Android.Support.CustomTabs.targets')" />

SettingsView.iOS/TextFooterView.cs

+22-2
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ public class TextFooterView : UITableViewHeaderFooterView
1111
List<NSLayoutConstraint> _constraints = new List<NSLayoutConstraint>();
1212
UIEdgeInsets _curPadding;
1313
bool _isInitialized;
14+
NSLayoutConstraint _leftConstraint;
15+
UITableView _tableView;
1416

1517
public TextFooterView(IntPtr handle):base(handle)
1618
{
@@ -24,7 +26,22 @@ public TextFooterView(IntPtr handle):base(handle)
2426
this.BackgroundView = new UIView();
2527
}
2628

27-
public void Initialzie(UIEdgeInsets padding)
29+
public override void LayoutSubviews()
30+
{
31+
base.LayoutSubviews();
32+
33+
if (_leftConstraint != null)
34+
{
35+
_leftConstraint.Active = false;
36+
_leftConstraint.Dispose();
37+
_leftConstraint = null;
38+
}
39+
40+
_leftConstraint = Label.LeftAnchor.ConstraintEqualTo(LeftAnchor, _curPadding.Left + _tableView.SafeAreaInsets.Left);
41+
_leftConstraint.Active = true;
42+
}
43+
44+
public void Initialzie(UIEdgeInsets padding, UITableView tableView)
2845
{
2946
if(_isInitialized && _curPadding == padding)
3047
{
@@ -39,7 +56,6 @@ public void Initialzie(UIEdgeInsets padding)
3956
_constraints.Clear();
4057

4158
_constraints.Add(Label.TopAnchor.ConstraintEqualTo(this.TopAnchor, padding.Top));
42-
_constraints.Add(Label.LeftAnchor.ConstraintEqualTo(this.LeftAnchor, padding.Left));
4359
_constraints.Add(Label.RightAnchor.ConstraintEqualTo(this.RightAnchor, -padding.Right));
4460
_constraints.Add(Label.BottomAnchor.ConstraintEqualTo(this.BottomAnchor, -padding.Bottom));
4561

@@ -49,6 +65,7 @@ public void Initialzie(UIEdgeInsets padding)
4965
});
5066

5167
_curPadding = padding;
68+
_tableView = tableView;
5269
_isInitialized = true;
5370
}
5471

@@ -58,10 +75,13 @@ protected override void Dispose(bool disposing)
5875
if (disposing)
5976
{
6077
_constraints.ForEach(c => c.Dispose());
78+
_leftConstraint?.Dispose();
79+
_leftConstraint = null;
6180
Label?.Dispose();
6281
Label = null;
6382
BackgroundView?.Dispose();
6483
BackgroundView = null;
84+
_tableView = null;
6585
}
6686
}
6787
}

SettingsView.iOS/TextHeaderView.cs

+26-4
Original file line numberDiff line numberDiff line change
@@ -9,12 +9,14 @@ public class TextHeaderView : UITableViewHeaderFooterView
99
{
1010
public UILabel Label { get; set; }
1111
List<NSLayoutConstraint> _constraints = new List<NSLayoutConstraint>();
12+
NSLayoutConstraint _leftConstraint;
1213
UIEdgeInsets _curPadding;
14+
UITableView _tableView;
1315
LayoutAlignment _curAlignment;
1416
bool _isInitialized;
1517

1618
public TextHeaderView(IntPtr handle): base(handle)
17-
{
19+
{
1820
Label = new UILabel();
1921
Label.Lines = 1;
2022
Label.LineBreakMode = UILineBreakMode.TailTruncation;
@@ -24,7 +26,23 @@ public TextHeaderView(IntPtr handle): base(handle)
2426

2527
this.BackgroundView = new UIView();
2628
}
27-
public void Initialzie(UIEdgeInsets padding, LayoutAlignment align)
29+
30+
public override void LayoutSubviews()
31+
{
32+
base.LayoutSubviews();
33+
34+
if(_leftConstraint != null)
35+
{
36+
_leftConstraint.Active = false;
37+
_leftConstraint.Dispose();
38+
_leftConstraint = null;
39+
}
40+
41+
_leftConstraint = Label.LeftAnchor.ConstraintEqualTo(LeftAnchor, _curPadding.Left + _tableView.SafeAreaInsets.Left);
42+
_leftConstraint.Active = true;
43+
}
44+
45+
public void Initialzie(UIEdgeInsets padding, LayoutAlignment align, UITableView tableView)
2846
{
2947
if(_isInitialized && _curPadding == padding && align == _curAlignment)
3048
{
@@ -37,8 +55,8 @@ public void Initialzie(UIEdgeInsets padding, LayoutAlignment align)
3755
c.Dispose();
3856
}
3957
_constraints.Clear();
40-
41-
_constraints.Add(Label.LeftAnchor.ConstraintEqualTo(this.LeftAnchor, padding.Left));
58+
59+
//_constraints.Add(Label.LeftAnchor.ConstraintEqualTo(this.LeftAnchor, padding.Left + safeAreaInsets.Left));
4260
_constraints.Add(Label.RightAnchor.ConstraintEqualTo(this.RightAnchor, -padding.Right));
4361

4462
if (align == LayoutAlignment.Start)
@@ -61,6 +79,7 @@ public void Initialzie(UIEdgeInsets padding, LayoutAlignment align)
6179

6280
_curPadding = padding;
6381
_curAlignment = align;
82+
_tableView = tableView;
6483
_isInitialized = true;
6584
}
6685

@@ -70,10 +89,13 @@ protected override void Dispose(bool disposing)
7089
if(disposing)
7190
{
7291
_constraints.ForEach(c => c.Dispose());
92+
_leftConstraint?.Dispose();
93+
_leftConstraint = null;
7394
Label?.Dispose();
7495
Label = null;
7596
BackgroundView?.Dispose();
7697
BackgroundView = null;
98+
_tableView = null;
7799
}
78100
}
79101
}

SettingsView/Section.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -427,7 +427,7 @@ void OnItemsSourceCollectionChanged(object sender, NotifyCollectionChangedEventA
427427

428428
RemoveAt(e.OldStartingIndex + TemplateStartIndex);
429429

430-
var item = e.NewItems[e.NewStartingIndex];
430+
var item = e.NewItems[0];
431431
var view = CreateChildViewFor(ItemTemplate, item, this);
432432

433433
Insert(e.NewStartingIndex + TemplateStartIndex, view);

SettingsView/SettingsView.DefineProperites.cs

+1-1
Original file line numberDiff line numberDiff line change
@@ -837,7 +837,7 @@ void OnItemsSourceCollectionChanged(object sender, NotifyCollectionChangedEventA
837837

838838
Root.RemoveAt(e.OldStartingIndex + TemplateStartIndex);
839839

840-
var item = e.NewItems[e.NewStartingIndex];
840+
var item = e.NewItems[0];
841841
var view = CreateChildViewFor(this.ItemTemplate, item, this);
842842

843843
Root.Insert(e.NewStartingIndex + TemplateStartIndex, view);

nuget/AzurePipelines.nuspec

+2-17
Original file line numberDiff line numberDiff line change
@@ -15,28 +15,13 @@ There are various cells such as (LabelCell,ButtonCell,CommandCell,SwitchCell,Che
1515
</description>
1616
<summary></summary>
1717
<releaseNotes>
18-
## New Features
19-
20-
* [CustomCell] set XAML in SettingsView's cell
21-
* [EntryCell] SetFocus method #63
22-
* [EntryCell] CompletedCommand property
23-
* [PickerCell] SelectionMode property
24-
* [PickerCell] SelectedItem property
25-
* [SettingsView] ShowArrowIndicatorForAndroid Property – show an arrow indicator at the right side of CommandCell and PickerCell.
26-
* [SettingsView][Section] TemplateStartIndex property – the index that starts inserting the template.
27-
* [Section] HeaderView and FooterView property – can set a Forms view to a section header / footer.
28-
29-
3018
## Changes
3119

32-
* EntryCell's keyboard is now hidden when scrolling on iOS. #59
33-
* EntryCell Completed event is now occurred when a cell is lost focus too.
34-
* Improved cell maniputation performance.
20+
* [Header/Footer] Section header/footer does not respect SafeAreaInsets #83
3521

3622
## Bug fixes
3723

38-
* [TextPickerCell] Show the soft keyboard when tapping the dialog. #68
39-
* [EntryCell][Android] A binding sometimes lost.
24+
* [SettingsView][Section] Crash when ItemsSource element is replaced.
4025

4126
</releaseNotes>
4227
<tags>Xamarin.Forms TableView Cell Setting Configuration Option ListView UITableView RecyclerView ReOrder DragDrop</tags>

0 commit comments

Comments
 (0)