Skip to content

Commit

Permalink
Merge pull request #36 from muak/fixProp
Browse files Browse the repository at this point in the history
Release 0.2.6
  • Loading branch information
muak authored Aug 6, 2018
2 parents 0350770 + 91306ca commit d0c3d2b
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 8 deletions.
5 changes: 5 additions & 0 deletions Sample/Sample/ViewModels/CollectionChangedTestViewModel.cs
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
using System;
using Reactive.Bindings;
using System.Diagnostics;
namespace Sample.ViewModels
{
public class CollectionChangedTestViewModel:ViewModelBase
Expand Down Expand Up @@ -32,6 +33,10 @@ public CollectionChangedTestViewModel()
}
}
});

CellIconSize.Subscribe(x => {
Debug.WriteLine($"CellIconSizeChange {x.Width} {x.Height}");
});
}
}
}
1 change: 1 addition & 0 deletions Sample/Sample/Views/MainPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@
<Button Text="ButtonCellTest" Command="{Binding GoToTest}" CommandParameter="ButtonCellTest" />
<Button Text="FormsCellTest" Command="{Binding GoToTest}" CommandParameter="FormsCellTest" />
<Button Text="OnTableViewTest" Command="{Binding GoToTest}" CommandParameter="OnTableViewTest" />
<Button Text="Fix" Command="{Binding GoToTest}" CommandParameter="FixProp" />
</StackLayout>
</ScrollView>
</ContentPage>
5 changes: 5 additions & 0 deletions SettingsView.Droid/Cells/CellBaseView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -193,6 +193,11 @@ public virtual void CellPropertyChanged(object sender, PropertyChangedEventArgs
/// <param name="e">E.</param>
public virtual void ParentPropertyChanged(object sender, PropertyChangedEventArgs e)
{
// avoid running the vain process when popping a page.
if((sender as BindableObject)?.BindingContext == null){
return;
}

if (e.PropertyName == SettingsView.CellTitleColorProperty.PropertyName) {
UpdateTitleColor();
}
Expand Down
13 changes: 12 additions & 1 deletion SettingsView.Droid/SettingsViewRecyclerAdapter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,18 @@ void FillCache()

_cellCaches = newCellCaches;

_viewTypes = _cellCaches.Select(x => x.Cell.GetType()).Distinct().Select((x, idx) => new { x, index = idx }).ToDictionary(key => key.x, val => val.index + 2);
if(_viewTypes == null)
{
_viewTypes = _cellCaches.Select(x => x.Cell.GetType()).Distinct().Select((x, idx) => new { x, index = idx }).ToDictionary(key => key.x, val => val.index + 2);
}
else
{
var idx = _viewTypes.Values.Max() + 1;
foreach(var t in _cellCaches.Select(x=>x.Cell.GetType()).Distinct().Except(_viewTypes.Keys).ToList())
{
_viewTypes.Add(t, idx++);
}
}
}

/// <summary>
Expand Down
9 changes: 2 additions & 7 deletions nuget/SettingsView_mac.nuspec
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<package xmlns="http://schemas.microsoft.com/packaging/2012/06/nuspec.xsd">
<metadata>
<id>AiForms.SettingsView</id>
<version>0.2.5</version>
<version>0.2.6</version>
<title>SettingsView for Xamarin.Forms</title>
<authors>kamu</authors>
<owners>kamu</owners>
Expand All @@ -16,12 +16,7 @@ There are various cells such as (LabelCell,ButtonCell,CommandCell,SwitchCell,Che
<releaseNotes>
## Bug fixes

* Null exception on Dispose in SettingsViewRecyclerAdapter (Android).

## Others

* Support .NETStandard2.0
* Minimum Xamarin.Forms version >= 3.0.0.482510
* When doing with toggling section visibility and changing cell properties simultaneously, null exception occurs. (Android)
</releaseNotes>
<tags>Xamarin.Forms TableView Cell Setting Configuration Option ListView UITableView RecyclerView ReOrder DragDrop</tags>
<language>en-US</language>
Expand Down

0 comments on commit d0c3d2b

Please sign in to comment.