diff --git a/.gitignore b/.gitignore index 1ae82d7..10f16da 100644 --- a/.gitignore +++ b/.gitignore @@ -1,6 +1,8 @@ ## Ignore Visual Studio temporary files, build results, and ## files generated by popular Visual Studio add-ons. +.vs/ + # User-specific files *.suo *.user diff --git a/README-ja.md b/README-ja.md index 4f5a649..13c8457 100644 --- a/README-ja.md +++ b/README-ja.md @@ -239,10 +239,10 @@ SettingsViewのプロパティ設定はApp.xamlに記述した方が良いかも * [NumberPickerCell](#numberpickercell) * [TimePickerCell](#timepickercell) * [DatePickerCell](#datepickercell) +* [TextPickerCell](#textpickercell) * [PickerCell](#pickercell) * [EntryCell](#entrycell) - ## CellBase ### 基本セルのレイアウト @@ -419,6 +419,24 @@ ValueTextは使用できません。 ValueTextは使用できません。 +## TextPickerCell + +セルタップ時にテキストを選択できるピッカーを呼び出すことができるLabelCellです。 +NumberPickerCellをNumber以外に対応させたもので、データソースにListを設定できます。 + +### Properties + +* Items + * IListを実装したデータソース。 + * このプロパティには組み込みの型のList\等が設定できます。(List\, List\,List\ など) + * ピッカーの表示テキストにはToString()の結果が使用されます。 +* SelectedItem + * 選択したアイテム。 (two-way binding) +* SelectedCommand + * アイテム選択時に発火するコマンド。 + +ValueTextは使用できません。 + ## PickerCell セルタップ時に複数選択可能なピッカーを呼び出すことができるLabelCellです。 @@ -487,6 +505,10 @@ Xamarin.Forms.EntryCellとは別物です。 * AccentColor * 入力欄の下線の色(Androidのみ) +## Contributors + +* [codegrue](https://github.com/codegrue) + ## 謝辞 NaturalSortの実装に以下のソースを利用させていただきました。 diff --git a/README.md b/README.md index cd40347..091b806 100644 --- a/README.md +++ b/README.md @@ -237,10 +237,10 @@ Whereby any SettingsView in App will become the same property setttings. * [NumberPickerCell](#numberpickercell) * [TimePickerCell](#timepickercell) * [DatePickerCell](#datepickercell) +* [TextPickerCell](#textpickercell) * [PickerCell](#pickercell) * [EntryCell](#entrycell) - ## CellBase ### Layout of cellbase @@ -378,7 +378,7 @@ This is a LabelCell calling a number picker. * SelectedCommand * A command invoked when a number is selected. -This cell can't use ValueText propertiy. +This cell can't use ValueText property. ## TimePickerCell @@ -393,7 +393,7 @@ This is a LabelCell calling a time picker. * PickerTitle * Picker title text. -This cell can't use ValueText propertiy. +This cell can't use ValueText property. ## DatePickerCell @@ -411,7 +411,24 @@ This is a LabelCell calling a date picker. * Text of the button selecting today's date. (only iOS) * If this text is empty, the button will be hidden. -This cell can't use ValueText propertiy. +This cell can't use ValueText property. + +## TextPickerCell + +This is a LabelCell calling a text picker. + +### Properties + +* Items + * Picker data source implementing IList. + * This property can be set a list of built-in type. (e.g. List\, List\, List\) + * The result of ToString method is used as appearance text. +* SelectedItem + * Selected item is set. (two-way binding) +* SelectedCommand + * A command invoked when an item is selected. + +This cell can't use ValueText property. ## PickerCell @@ -476,6 +493,10 @@ This is a cell inputing some text. * AccentColor * Under line color on focus. (only android) +## Contributors + +* [codegrue](https://github.com/codegrue) + ## Thanks * NaturalComparer diff --git a/Sample/Sample.Droid/Sample.Droid.csproj b/Sample/Sample.Droid/Sample.Droid.csproj index 40f4805..765ee62 100644 --- a/Sample/Sample.Droid/Sample.Droid.csproj +++ b/Sample/Sample.Droid/Sample.Droid.csproj @@ -9,7 +9,7 @@ Library Sample.Droid Sample.Droid - v8.0 + v8.1 True Resources\Resource.designer.cs Resource @@ -60,9 +60,6 @@ ..\packages\Prism.Unity.Forms.6.3.0\lib\MonoAndroid1.0\Prism.Unity.Forms.dll - - ..\packages\System.Reactive.Interfaces.3.0.0\lib\netstandard1.0\System.Reactive.Interfaces.dll - ..\packages\System.Reactive.Core.3.0.0\lib\netstandard1.3\System.Reactive.Core.dll @@ -155,27 +152,32 @@ ..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll - - ..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Platform.dll - ..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll - - ..\packages\AiForms.SettingsView.0.2.0-pre3\lib\MonoAndroid\SettingsView.dll - - - ..\packages\AiForms.SettingsView.0.2.0-pre3\lib\MonoAndroid\SettingsView.Droid.dll - ..\packages\AiForms.Layouts.1.0.3\lib\netstandard1.1\AiForms.Layouts.dll + + ..\packages\System.Reactive.Interfaces.3.0.0\lib\netstandard1.0\System.Reactive.Interfaces.dll + + + ..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Platform.dll + {2DB58246-77D5-4190-B0A0-F125B538309B} Sample + + {2CC418E1-CE33-48E2-8E89-A87669BD9E28} + SettingsView.Droid + + + {8FFB1EF3-FAF3-478C-B9F1-4D02E599C3C6} + SettingsView + diff --git a/Sample/Sample.Droid/packages.config b/Sample/Sample.Droid/packages.config index e5b9bbf..447c091 100644 --- a/Sample/Sample.Droid/packages.config +++ b/Sample/Sample.Droid/packages.config @@ -2,7 +2,6 @@ - diff --git a/Sample/Sample.iOS/Sample.iOS.csproj b/Sample/Sample.iOS/Sample.iOS.csproj index da4d0d7..342402f 100644 --- a/Sample/Sample.iOS/Sample.iOS.csproj +++ b/Sample/Sample.iOS/Sample.iOS.csproj @@ -83,9 +83,6 @@ - - ..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll - ..\packages\Unity.4.0.1\lib\portable-net45+wp80+win8+wpa81+MonoAndroid10+MonoTouch10\Microsoft.Practices.Unity.dll @@ -146,21 +143,26 @@ ..\packages\Xamarin.Forms.2.5.0.121934\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll - - ..\packages\AiForms.SettingsView.0.2.0-pre3\lib\Xamarin.iOS10\SettingsView.dll - - - ..\packages\AiForms.SettingsView.0.2.0-pre3\lib\Xamarin.iOS10\SettingsView.iOS.dll - ..\packages\AiForms.Layouts.1.0.3\lib\netstandard1.1\AiForms.Layouts.dll + + ..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll + {2DB58246-77D5-4190-B0A0-F125B538309B} Sample + + {4601EE49-52E1-448E-98A1-EFDCBA7A64AC} + SettingsView.iOS + + + {8FFB1EF3-FAF3-478C-B9F1-4D02E599C3C6} + SettingsView + diff --git a/Sample/Sample.iOS/packages.config b/Sample/Sample.iOS/packages.config index 2dba5ad..99a56cc 100644 --- a/Sample/Sample.iOS/packages.config +++ b/Sample/Sample.iOS/packages.config @@ -2,7 +2,6 @@ - diff --git a/Sample/Sample/Sample.csproj b/Sample/Sample/Sample.csproj index 203cd33..17c55a6 100644 --- a/Sample/Sample/Sample.csproj +++ b/Sample/Sample/Sample.csproj @@ -260,6 +260,12 @@ + + + {8FFB1EF3-FAF3-478C-B9F1-4D02E599C3C6} + SettingsView + + \ No newline at end of file diff --git a/Sample/Sample/Sample.nuget.props b/Sample/Sample/Sample.nuget.props index 2dea0e7..82aeaa9 100644 --- a/Sample/Sample/Sample.nuget.props +++ b/Sample/Sample/Sample.nuget.props @@ -3,7 +3,7 @@ True NuGet - /Users/kamu/Projects/AiForms.Renderers/Sample/Sample/project.lock.json + /Users/kamu/Dropbox/work/projects/AiForms.Renderers/Sample/Sample/project.lock.json /Users/kamu/.nuget/packages/ /Users/kamu/.nuget/packages/ ProjectJson diff --git a/Sample/Sample/ViewModels/LabelCellTestViewModel.cs b/Sample/Sample/ViewModels/LabelCellTestViewModel.cs index ec555f1..8f02e5f 100644 --- a/Sample/Sample/ViewModels/LabelCellTestViewModel.cs +++ b/Sample/Sample/ViewModels/LabelCellTestViewModel.cs @@ -6,6 +6,8 @@ using Prism.Services; using System.Reactive.Linq; using Prism.Navigation; +using System.Collections; +using System.Collections.Generic; namespace Sample.ViewModels { @@ -33,10 +35,17 @@ public class LabelCellTestViewModel : ViewModelBase public ReactiveProperty CommandParameter { get; } = new ReactiveProperty(); public ReactiveProperty CanExecute { get; } = new ReactiveProperty(); public ReactiveProperty KeepSelected { get; } = new ReactiveProperty(); + public ReactiveProperty TextItems { get; } = new ReactiveProperty(); + public ReactiveProperty TextSelectedItem { get; } = new ReactiveProperty(); public ReactiveCommand NumberSelectedCommand { get; set; } = new ReactiveCommand(); + public ReactiveCommand TextSelectedCommand { get; set; } = new ReactiveCommand(); public ReactiveProperty Command { get; set; } = new ReactiveProperty(); + enum Fruit + { + Apple, Grape, Orange + } static int[] Numbers = { 0, 5, 10, 15 }; static int[] MaxNumbers = { 0, 10, 15, 1 }; @@ -52,6 +61,8 @@ public class LabelCellTestViewModel : ViewModelBase static ReactiveCommand[] Commands = { null, null }; static object[] Parameters = { null, "Def", "Xzy" }; static bool[] CanExecutes = { true, false }; + static IList[] TextLists = { new List { "A", "B", "C" }, new List { 1, 2, 3 }, new List { Fruit.Apple, Fruit.Grape, Fruit.Orange } }; + static object[] TextSelectedItems = { "B", 2, Fruit.Orange }; public LabelCellTestViewModel(INavigationService navigationService,IPageDialogService pageDialog) { @@ -89,6 +100,9 @@ public LabelCellTestViewModel(INavigationService navigationService,IPageDialogSe { await pageDialog.DisplayAlertAsync("", p.ToString(), "OK"); }); + TextSelectedCommand.Subscribe(async p => { + await pageDialog.DisplayAlertAsync("", p?.ToString(), "OK"); + }); } protected override void CellChanged(object obj) @@ -141,6 +155,20 @@ protected override void CellChanged(object obj) case nameof(KeepSelected): NextVal(KeepSelected, CanExecutes); break; + case nameof(TextItems): + NextVal(TextItems, TextLists); + break; + case nameof(TextSelectedItem): + if(TextItems.Value is List){ + TextSelectedItem.Value = TextSelectedItems[0]; + } + else if(TextItems.Value is List){ + TextSelectedItem.Value = TextSelectedItems[1]; + } + else{ + TextSelectedItem.Value = TextSelectedItems[2]; + } + break; } } diff --git a/Sample/Sample/ViewModels/SettingsViewPageViewModel.cs b/Sample/Sample/ViewModels/SettingsViewPageViewModel.cs index 663d9c9..3f86588 100644 --- a/Sample/Sample/ViewModels/SettingsViewPageViewModel.cs +++ b/Sample/Sample/ViewModels/SettingsViewPageViewModel.cs @@ -31,6 +31,9 @@ public class SettingsViewPageViewModel : BindableBase public ObservableCollection ItemsSource { get; } = new ObservableCollection(); public ObservableCollection SelectedItems { get; } = new ObservableCollection(); + public ObservableCollection TextItems { get; } = new ObservableCollection(new List{"Red","Blue","Green"}); + public ReactiveProperty SelectedText { get; } = new ReactiveProperty("Green"); + string[] languages = { "Java", "C#", "JavaScript", "PHP", "Perl", "C++", "Swift", "Kotlin", "Python", "Ruby", "Scala", "F#" }; public SettingsViewPageViewModel(INavigationService navigationService, IPageDialogService pageDlg) @@ -62,8 +65,6 @@ public SettingsViewPageViewModel(INavigationService navigationService, IPageDial SelectedItems.Add(ItemsSource[2]); SelectedItems.Add(ItemsSource[3]); - - } public class Person{ diff --git a/Sample/Sample/Views/LabelCellTest.xaml b/Sample/Sample/Views/LabelCellTest.xaml index 95ab14f..7a8697c 100644 --- a/Sample/Sample/Views/LabelCellTest.xaml +++ b/Sample/Sample/Views/LabelCellTest.xaml @@ -30,6 +30,9 @@