From 66aa676461239daf071b9ed36f818c206aa4c01f Mon Sep 17 00:00:00 2001 From: kamu Date: Mon, 25 Dec 2017 19:47:04 +0900 Subject: [PATCH] fixed AddCommand --- .../AddCommandPlatformEffect.cs | 20 +++++-------- AiForms.Effects/AiForms.Effects.nuget.props | 6 ++-- README.md | 4 +-- .../AiEffects.TestApp.Droid.csproj | 14 +++++---- .../AiEffects.TestApp.Droid/packages.config | 1 - .../AiEffects.TestApp.iOS.csproj | 14 +++++---- .../AiEffects.TestApp.iOS/packages.config | 1 - .../AiEffects.TestApp.csproj | 14 +++++++++ .../AiEffects.TestApp.nuget.props | 6 ++-- .../ViewModels/ViewCellPageViewModel.cs | 23 +++++++++++++++ .../AiEffects.TestApp/Views/MainPage.xaml | 5 ++++ .../AiEffects.TestApp/Views/ViewCellPage.xaml | 29 +++++++++++++++++++ .../Views/ViewCellPage.xaml.cs | 15 ++++++++++ .../AiEffects.TestApp/project.json | 1 - nuget/AiEffects_mac.nuspec | 14 ++------- 15 files changed, 120 insertions(+), 47 deletions(-) create mode 100644 Tests/AiEffects.TestApp/AiEffects.TestApp/ViewModels/ViewCellPageViewModel.cs create mode 100644 Tests/AiEffects.TestApp/AiEffects.TestApp/Views/ViewCellPage.xaml create mode 100644 Tests/AiEffects.TestApp/AiEffects.TestApp/Views/ViewCellPage.xaml.cs diff --git a/AiForms.Effects.Droid/AddCommandPlatformEffect.cs b/AiForms.Effects.Droid/AddCommandPlatformEffect.cs index 013205e..362dcdc 100644 --- a/AiForms.Effects.Droid/AddCommandPlatformEffect.cs +++ b/AiForms.Effects.Droid/AddCommandPlatformEffect.cs @@ -96,8 +96,6 @@ protected override void OnAttached() _view.Touch += _view_Touch; UpdateEnableRipple(); - - } protected override void OnDetached() @@ -300,12 +298,13 @@ void UpdateLongCommandParameter() void UpdateEffectColor() { - var color = AddCommand.GetEffectColor(Element); - if (color == Xamarin.Forms.Color.Default) { - return; - } - - if (_useRipple) { + if (_useRipple) + { + var color = AddCommand.GetEffectColor(Element); + if (color == Xamarin.Forms.Color.Default) { + color = Xamarin.Forms.Color.Accent; + } + _ripple?.SetColor(getPressedColorSelector(color.ToAndroid())); } @@ -315,11 +314,6 @@ void UpdateEnableRipple() { _useRipple = AddCommand.GetEnableRipple(Element); - var color = AddCommand.GetEffectColor(Element); - if (color == Xamarin.Forms.Color.Default) { - return; - } - if (_useRipple) { AddRipple(); } diff --git a/AiForms.Effects/AiForms.Effects.nuget.props b/AiForms.Effects/AiForms.Effects.nuget.props index 3f45c91..8e76ca5 100644 --- a/AiForms.Effects/AiForms.Effects.nuget.props +++ b/AiForms.Effects/AiForms.Effects.nuget.props @@ -3,9 +3,9 @@ True NuGet - /Users/kamu/Projects/AiForms.Effects/AiForms.Effects/project.lock.json - /Users/kamu/.nuget/packages/ - /Users/kamu/.nuget/packages/ + /Users/kamusoft/Projects/AiForms.Effects/AiForms.Effects/project.lock.json + /Users/kamusoft/.nuget/packages/ + /Users/kamusoft/.nuget/packages/ ProjectJson 4.3.1 diff --git a/README.md b/README.md index ebb45cd..570d694 100644 --- a/README.md +++ b/README.md @@ -307,10 +307,10 @@ There are properties of Command and Parameter for tap and long tap. * LongCommandParameter * Long Tap Command Parameter * EffectColor - * background color when to tap.if it doesn't setting,nothing will occur. + * background color when to tap. if it doesn't setting,nothing will occur. * EnableRipple * Ripple Effect On/Off (default true,android only)
- If you don't have to use ripple effect,it make EnableRipple false. + If you don't have to use ripple effect, it make EnableRipple false. * EnableSound * When tapped, whether play system sound effect.(Default false) * SyncCanExecute diff --git a/Tests/AiEffects.TestApp/AiEffects.TestApp.Droid/AiEffects.TestApp.Droid.csproj b/Tests/AiEffects.TestApp/AiEffects.TestApp.Droid/AiEffects.TestApp.Droid.csproj index 45cc2c4..89774a9 100644 --- a/Tests/AiEffects.TestApp/AiEffects.TestApp.Droid/AiEffects.TestApp.Droid.csproj +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp.Droid/AiEffects.TestApp.Droid.csproj @@ -146,12 +146,6 @@ ..\..\..\packages\ReactiveProperty.3.6.0\lib\MonoAndroid\ReactiveProperty.dll - - ..\..\..\packages\AiForms.Effects.1.1.1\lib\MonoAndroid\AiForms.Effects.dll - - - ..\..\..\packages\AiForms.Effects.1.1.1\lib\MonoAndroid\AiForms.Effects.Droid.dll - @@ -162,6 +156,14 @@ {02E2C54E-9A67-4255-BACC-C035A5529716} AiEffects.TestApp + + {14FCC004-FC52-4028-A5AE-228AFD6F6222} + AiForms.Effects + + + {49FC4DB1-A6EB-4670-A3A3-16E877E39D0C} + AiForms.Effects.Droid + diff --git a/Tests/AiEffects.TestApp/AiEffects.TestApp.Droid/packages.config b/Tests/AiEffects.TestApp/AiEffects.TestApp.Droid/packages.config index 5dab7e2..3b65884 100644 --- a/Tests/AiEffects.TestApp/AiEffects.TestApp.Droid/packages.config +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp.Droid/packages.config @@ -1,6 +1,5 @@  - diff --git a/Tests/AiEffects.TestApp/AiEffects.TestApp.iOS/AiEffects.TestApp.iOS.csproj b/Tests/AiEffects.TestApp/AiEffects.TestApp.iOS/AiEffects.TestApp.iOS.csproj index 74653f5..9cdc3aa 100644 --- a/Tests/AiEffects.TestApp/AiEffects.TestApp.iOS/AiEffects.TestApp.iOS.csproj +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp.iOS/AiEffects.TestApp.iOS.csproj @@ -138,12 +138,6 @@ ..\..\..\packages\ReactiveProperty.3.6.0\lib\Xamarin.iOS10\ReactiveProperty.iOS.dll - - ..\..\..\packages\AiForms.Effects.1.1.1\lib\Xamarin.iOS10\AiForms.Effects.dll - - - ..\..\..\packages\AiForms.Effects.1.1.1\lib\Xamarin.iOS10\AiForms.Effects.iOS.dll - @@ -154,6 +148,14 @@ {02E2C54E-9A67-4255-BACC-C035A5529716} AiEffects.TestApp + + {14FCC004-FC52-4028-A5AE-228AFD6F6222} + AiForms.Effects + + + {7E1357E0-74E7-4FBF-B2AB-052C6A175A9F} + AiForms.Effects.iOS + diff --git a/Tests/AiEffects.TestApp/AiEffects.TestApp.iOS/packages.config b/Tests/AiEffects.TestApp/AiEffects.TestApp.iOS/packages.config index 21e22d3..3d7d259 100644 --- a/Tests/AiEffects.TestApp/AiEffects.TestApp.iOS/packages.config +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp.iOS/packages.config @@ -1,6 +1,5 @@  - diff --git a/Tests/AiEffects.TestApp/AiEffects.TestApp/AiEffects.TestApp.csproj b/Tests/AiEffects.TestApp/AiEffects.TestApp/AiEffects.TestApp.csproj index 34febd2..6c04eb9 100644 --- a/Tests/AiEffects.TestApp/AiEffects.TestApp/AiEffects.TestApp.csproj +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp/AiEffects.TestApp.csproj @@ -80,6 +80,10 @@ SizeToFitPage.xaml + + ViewCellPage.xaml + + @@ -122,6 +126,10 @@ Designer MSBuild:UpdateDesignTimeXaml + + Designer + MSBuild:UpdateDesignTimeXaml + @@ -134,5 +142,11 @@ + + + {14FCC004-FC52-4028-A5AE-228AFD6F6222} + AiForms.Effects + + diff --git a/Tests/AiEffects.TestApp/AiEffects.TestApp/AiEffects.TestApp.nuget.props b/Tests/AiEffects.TestApp/AiEffects.TestApp/AiEffects.TestApp.nuget.props index 2e859dc..ec63790 100644 --- a/Tests/AiEffects.TestApp/AiEffects.TestApp/AiEffects.TestApp.nuget.props +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp/AiEffects.TestApp.nuget.props @@ -3,9 +3,9 @@ True NuGet - /Users/kamu/Projects/AiForms.Effects/Tests/AiEffects.TestApp/AiEffects.TestApp/project.lock.json - /Users/kamu/.nuget/packages/ - /Users/kamu/.nuget/packages/ + /Users/kamusoft/Projects/AiForms.Effects/Tests/AiEffects.TestApp/AiEffects.TestApp/project.lock.json + /Users/kamusoft/.nuget/packages/ + /Users/kamusoft/.nuget/packages/ ProjectJson 4.3.1 diff --git a/Tests/AiEffects.TestApp/AiEffects.TestApp/ViewModels/ViewCellPageViewModel.cs b/Tests/AiEffects.TestApp/AiEffects.TestApp/ViewModels/ViewCellPageViewModel.cs new file mode 100644 index 0000000..1623c3f --- /dev/null +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp/ViewModels/ViewCellPageViewModel.cs @@ -0,0 +1,23 @@ +using System; +using Reactive.Bindings; +using Prism.Services; +using System.Collections.ObjectModel; +namespace AiEffects.TestApp.ViewModels +{ + public class ViewCellPageViewModel + { + public ReactiveCommand TestCommand { get; } = new ReactiveCommand(); + public ObservableCollection ItemsSource { get; } = new ObservableCollection(); + + public ViewCellPageViewModel(IPageDialogService pageDlg) + { + for (var i = 0; i < 20;i++){ + ItemsSource.Add("Name"); + } + + TestCommand.Subscribe(async _=>{ + await pageDlg.DisplayAlertAsync("", "Tap", "OK"); + }); + } + } +} diff --git a/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/MainPage.xaml b/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/MainPage.xaml index da9777a..e22bdef 100644 --- a/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/MainPage.xaml +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/MainPage.xaml @@ -23,6 +23,11 @@ +