Skip to content

Commit

Permalink
Merge branch 'Added_a_TextPickerCell' Issue #24 Pull Request #25 #26
Browse files Browse the repository at this point in the history
  • Loading branch information
kamu authored and kamu committed Mar 20, 2018
2 parents 73c6b8e + 2c8835c commit 9bcd713
Show file tree
Hide file tree
Showing 24 changed files with 760 additions and 54 deletions.
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -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
Expand Down
24 changes: 23 additions & 1 deletion README-ja.md
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,10 @@ SettingsViewのプロパティ設定はApp.xamlに記述した方が良いかも
* [NumberPickerCell](#numberpickercell)
* [TimePickerCell](#timepickercell)
* [DatePickerCell](#datepickercell)
* [TextPickerCell](#textpickercell)
* [PickerCell](#pickercell)
* [EntryCell](#entrycell)


## CellBase

### 基本セルのレイアウト
Expand Down Expand Up @@ -419,6 +419,24 @@ ValueTextは使用できません。

ValueTextは使用できません。

## TextPickerCell

セルタップ時にテキストを選択できるピッカーを呼び出すことができるLabelCellです。
NumberPickerCellをNumber以外に対応させたもので、データソースにListを設定できます。

### Properties

* Items
* IListを実装したデータソース。
* このプロパティには組み込みの型のList\<T>等が設定できます。(List\<string>, List\<int>,List\<double> など)
* ピッカーの表示テキストにはToString()の結果が使用されます。
* SelectedItem
* 選択したアイテム。 (two-way binding)
* SelectedCommand
* アイテム選択時に発火するコマンド。

ValueTextは使用できません。

## PickerCell

セルタップ時に複数選択可能なピッカーを呼び出すことができるLabelCellです。
Expand Down Expand Up @@ -487,6 +505,10 @@ Xamarin.Forms.EntryCellとは別物です。
* AccentColor
* 入力欄の下線の色(Androidのみ)

## Contributors

* [codegrue](https://github.com/codegrue)

## 謝辞

NaturalSortの実装に以下のソースを利用させていただきました。
Expand Down
29 changes: 25 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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

Expand All @@ -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

Expand All @@ -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\<string>, List\<int>, List\<double>)
* 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

Expand Down Expand Up @@ -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
Expand Down
28 changes: 15 additions & 13 deletions Sample/Sample.Droid/Sample.Droid.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<OutputType>Library</OutputType>
<RootNamespace>Sample.Droid</RootNamespace>
<AssemblyName>Sample.Droid</AssemblyName>
<TargetFrameworkVersion>v8.0</TargetFrameworkVersion>
<TargetFrameworkVersion>v8.1</TargetFrameworkVersion>
<AndroidApplication>True</AndroidApplication>
<AndroidResgenFile>Resources\Resource.designer.cs</AndroidResgenFile>
<AndroidResgenClass>Resource</AndroidResgenClass>
Expand Down Expand Up @@ -60,9 +60,6 @@
<Reference Include="Prism.Unity.Forms">
<HintPath>..\packages\Prism.Unity.Forms.6.3.0\lib\MonoAndroid1.0\Prism.Unity.Forms.dll</HintPath>
</Reference>
<Reference Include="System.Reactive.Interfaces">
<HintPath>..\packages\System.Reactive.Interfaces.3.0.0\lib\netstandard1.0\System.Reactive.Interfaces.dll</HintPath>
</Reference>
<Reference Include="System.Reactive.Core">
<HintPath>..\packages\System.Reactive.Core.3.0.0\lib\netstandard1.3\System.Reactive.Core.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -155,27 +152,32 @@
<Reference Include="Xamarin.Forms.Platform.Android">
<HintPath>..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Platform.Android.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform">
<HintPath>..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Platform.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Xaml">
<HintPath>..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
<Reference Include="SettingsView">
<HintPath>..\packages\AiForms.SettingsView.0.2.0-pre3\lib\MonoAndroid\SettingsView.dll</HintPath>
</Reference>
<Reference Include="SettingsView.Droid">
<HintPath>..\packages\AiForms.SettingsView.0.2.0-pre3\lib\MonoAndroid\SettingsView.Droid.dll</HintPath>
</Reference>
<Reference Include="AiForms.Layouts">
<HintPath>..\packages\AiForms.Layouts.1.0.3\lib\netstandard1.1\AiForms.Layouts.dll</HintPath>
</Reference>
<Reference Include="System.Reactive.Interfaces">
<HintPath>..\packages\System.Reactive.Interfaces.3.0.0\lib\netstandard1.0\System.Reactive.Interfaces.dll</HintPath>
</Reference>
<Reference Include="Xamarin.Forms.Platform">
<HintPath>..\packages\Xamarin.Forms.2.5.0.121934\lib\MonoAndroid10\Xamarin.Forms.Platform.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Sample\Sample.csproj">
<Project>{2DB58246-77D5-4190-B0A0-F125B538309B}</Project>
<Name>Sample</Name>
</ProjectReference>
<ProjectReference Include="..\..\SettingsView.Droid\SettingsView.Droid.csproj">
<Project>{2CC418E1-CE33-48E2-8E89-A87669BD9E28}</Project>
<Name>SettingsView.Droid</Name>
</ProjectReference>
<ProjectReference Include="..\..\SettingsView\SettingsView.csproj">
<Project>{8FFB1EF3-FAF3-478C-B9F1-4D02E599C3C6}</Project>
<Name>SettingsView</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<Compile Include="MainActivity.cs" />
Expand Down
1 change: 0 additions & 1 deletion Sample/Sample.Droid/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<packages>
<package id="AiForms.Effects" version="1.1.0-pre1" targetFramework="monoandroid80" />
<package id="AiForms.Layouts" version="1.0.3" targetFramework="monoandroid80" />
<package id="AiForms.SettingsView" version="0.2.0-pre3" targetFramework="monoandroid80" />
<package id="CommonServiceLocator" version="1.3" targetFramework="monoandroid71" />
<package id="NGraphics" version="0.4.0" targetFramework="monoandroid71" />
<package id="Prism.Core" version="6.3.0" targetFramework="monoandroid71" />
Expand Down
20 changes: 11 additions & 9 deletions Sample/Sample.iOS/Sample.iOS.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,6 @@
<Reference Include="System.Xml" />
<Reference Include="System.Core" />
<Reference Include="Xamarin.iOS" />
<Reference Include="Microsoft.Practices.ServiceLocation">
<HintPath>..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.Unity">
<HintPath>..\packages\Unity.4.0.1\lib\portable-net45+wp80+win8+wpa81+MonoAndroid10+MonoTouch10\Microsoft.Practices.Unity.dll</HintPath>
</Reference>
Expand Down Expand Up @@ -146,21 +143,26 @@
<Reference Include="Xamarin.Forms.Xaml">
<HintPath>..\packages\Xamarin.Forms.2.5.0.121934\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll</HintPath>
</Reference>
<Reference Include="SettingsView">
<HintPath>..\packages\AiForms.SettingsView.0.2.0-pre3\lib\Xamarin.iOS10\SettingsView.dll</HintPath>
</Reference>
<Reference Include="SettingsView.iOS">
<HintPath>..\packages\AiForms.SettingsView.0.2.0-pre3\lib\Xamarin.iOS10\SettingsView.iOS.dll</HintPath>
</Reference>
<Reference Include="AiForms.Layouts">
<HintPath>..\packages\AiForms.Layouts.1.0.3\lib\netstandard1.1\AiForms.Layouts.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.ServiceLocation">
<HintPath>..\packages\CommonServiceLocator.1.3\lib\portable-net4+sl5+netcore45+wpa81+wp8\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Sample\Sample.csproj">
<Project>{2DB58246-77D5-4190-B0A0-F125B538309B}</Project>
<Name>Sample</Name>
</ProjectReference>
<ProjectReference Include="..\..\SettingsView.iOS\SettingsView.iOS.csproj">
<Project>{4601EE49-52E1-448E-98A1-EFDCBA7A64AC}</Project>
<Name>SettingsView.iOS</Name>
</ProjectReference>
<ProjectReference Include="..\..\SettingsView\SettingsView.csproj">
<Project>{8FFB1EF3-FAF3-478C-B9F1-4D02E599C3C6}</Project>
<Name>SettingsView</Name>
</ProjectReference>
</ItemGroup>
<ItemGroup>
<ImageAsset Include="Resources\Images.xcassets\AppIcons.appiconset\Contents.json" />
Expand Down
1 change: 0 additions & 1 deletion Sample/Sample.iOS/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
<packages>
<package id="AiForms.Effects" version="1.1.0-pre1" targetFramework="xamarinios10" />
<package id="AiForms.Layouts" version="1.0.3" targetFramework="xamarinios10" />
<package id="AiForms.SettingsView" version="0.2.0-pre3" targetFramework="xamarinios10" />
<package id="CommonServiceLocator" version="1.3" targetFramework="xamarinios10" />
<package id="NGraphics" version="0.4.0" targetFramework="xamarinios10" />
<package id="Prism.Core" version="6.3.0" targetFramework="xamarinios10" />
Expand Down
6 changes: 6 additions & 0 deletions Sample/Sample/Sample.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -260,6 +260,12 @@
<ItemGroup>
<Folder Include="Resources\" />
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\..\SettingsView\SettingsView.csproj">
<Project>{8FFB1EF3-FAF3-478C-B9F1-4D02E599C3C6}</Project>
<Name>SettingsView</Name>
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildExtensionsPath32)\Microsoft\Portable\$(TargetFrameworkVersion)\Microsoft.Portable.CSharp.targets" />
<!-- <Import Project="..\packages\Xamarin.Forms.2.5.0.121934\build\portable-win+net45+wp80+win81+wpa81\Xamarin.Forms.targets" Condition="Exists('..\packages\Xamarin.Forms.2.5.0.121934\build\portable-win+net45+wp80+win81+wpa81\Xamarin.Forms.targets')" /> -->
</Project>
2 changes: 1 addition & 1 deletion Sample/Sample/Sample.nuget.props
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<PropertyGroup Condition=" '$(ExcludeRestorePackageImports)' != 'true' ">
<RestoreSuccess Condition=" '$(RestoreSuccess)' == '' ">True</RestoreSuccess>
<RestoreTool Condition=" '$(RestoreTool)' == '' ">NuGet</RestoreTool>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">/Users/kamu/Projects/AiForms.Renderers/Sample/Sample/project.lock.json</ProjectAssetsFile>
<ProjectAssetsFile Condition=" '$(ProjectAssetsFile)' == '' ">/Users/kamu/Dropbox/work/projects/AiForms.Renderers/Sample/Sample/project.lock.json</ProjectAssetsFile>
<NuGetPackageRoot Condition=" '$(NuGetPackageRoot)' == '' ">/Users/kamu/.nuget/packages/</NuGetPackageRoot>
<NuGetPackageFolders Condition=" '$(NuGetPackageFolders)' == '' ">/Users/kamu/.nuget/packages/</NuGetPackageFolders>
<NuGetProjectStyle Condition=" '$(NuGetProjectStyle)' == '' ">ProjectJson</NuGetProjectStyle>
Expand Down
28 changes: 28 additions & 0 deletions Sample/Sample/ViewModels/LabelCellTestViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
using Prism.Services;
using System.Reactive.Linq;
using Prism.Navigation;
using System.Collections;
using System.Collections.Generic;

namespace Sample.ViewModels
{
Expand Down Expand Up @@ -33,10 +35,17 @@ public class LabelCellTestViewModel : ViewModelBase
public ReactiveProperty<object> CommandParameter { get; } = new ReactiveProperty<object>();
public ReactiveProperty<bool> CanExecute { get; } = new ReactiveProperty<bool>();
public ReactiveProperty<bool> KeepSelected { get; } = new ReactiveProperty<bool>();
public ReactiveProperty<IList> TextItems { get; } = new ReactiveProperty<IList>();
public ReactiveProperty<object> TextSelectedItem { get; } = new ReactiveProperty<object>();

public ReactiveCommand<int> NumberSelectedCommand { get; set; } = new ReactiveCommand<int>();
public ReactiveCommand TextSelectedCommand { get; set; } = new ReactiveCommand();
public ReactiveProperty<ReactiveCommand> Command { get; set; } = new ReactiveProperty<ReactiveCommand>();

enum Fruit
{
Apple, Grape, Orange
}

static int[] Numbers = { 0, 5, 10, 15 };
static int[] MaxNumbers = { 0, 10, 15, 1 };
Expand All @@ -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<string> { "A", "B", "C" }, new List<int> { 1, 2, 3 }, new List<Fruit> { Fruit.Apple, Fruit.Grape, Fruit.Orange } };
static object[] TextSelectedItems = { "B", 2, Fruit.Orange };

public LabelCellTestViewModel(INavigationService navigationService,IPageDialogService pageDialog)
{
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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<string>){
TextSelectedItem.Value = TextSelectedItems[0];
}
else if(TextItems.Value is List<int>){
TextSelectedItem.Value = TextSelectedItems[1];
}
else{
TextSelectedItem.Value = TextSelectedItems[2];
}
break;
}

}
Expand Down
5 changes: 3 additions & 2 deletions Sample/Sample/ViewModels/SettingsViewPageViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,9 @@ public class SettingsViewPageViewModel : BindableBase
public ObservableCollection<Person> ItemsSource { get; } = new ObservableCollection<Person>();
public ObservableCollection<Person> SelectedItems { get; } = new ObservableCollection<Person>();

public ObservableCollection<string> TextItems { get; } = new ObservableCollection<string>(new List<string>{"Red","Blue","Green"});
public ReactiveProperty<string> SelectedText { get; } = new ReactiveProperty<string>("Green");

string[] languages = { "Java", "C#", "JavaScript", "PHP", "Perl", "C++", "Swift", "Kotlin", "Python", "Ruby", "Scala", "F#" };

public SettingsViewPageViewModel(INavigationService navigationService, IPageDialogService pageDlg)
Expand Down Expand Up @@ -62,8 +65,6 @@ public SettingsViewPageViewModel(INavigationService navigationService, IPageDial
SelectedItems.Add(ItemsSource[2]);
SelectedItems.Add(ItemsSource[3]);



}

public class Person{
Expand Down
Loading

0 comments on commit 9bcd713

Please sign in to comment.