diff --git a/AiForms.Effects.Droid/AiForms.Effects.Droid.csproj b/AiForms.Effects.Droid/AiForms.Effects.Droid.csproj index b12e500..bfea391 100644 --- a/AiForms.Effects.Droid/AiForms.Effects.Droid.csproj +++ b/AiForms.Effects.Droid/AiForms.Effects.Droid.csproj @@ -1,6 +1,6 @@ - + Debug AnyCPU @@ -105,19 +105,19 @@ ..\packages\Xamarin.Android.Support.v7.MediaRouter.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.v7.MediaRouter.dll - ..\packages\Xamarin.Forms.4.4.0.991537\lib\MonoAndroid90\FormsViewGroup.dll + ..\packages\Xamarin.Forms.4.6.0.800\lib\MonoAndroid90\FormsViewGroup.dll - ..\packages\Xamarin.Forms.4.4.0.991537\lib\MonoAndroid90\Xamarin.Forms.Core.dll + ..\packages\Xamarin.Forms.4.6.0.800\lib\MonoAndroid90\Xamarin.Forms.Core.dll - ..\packages\Xamarin.Forms.4.4.0.991537\lib\MonoAndroid90\Xamarin.Forms.Platform.Android.dll + ..\packages\Xamarin.Forms.4.6.0.800\lib\MonoAndroid90\Xamarin.Forms.Platform.Android.dll - ..\packages\Xamarin.Forms.4.4.0.991537\lib\MonoAndroid90\Xamarin.Forms.Platform.dll + ..\packages\Xamarin.Forms.4.6.0.800\lib\MonoAndroid90\Xamarin.Forms.Platform.dll - ..\packages\Xamarin.Forms.4.4.0.991537\lib\MonoAndroid90\Xamarin.Forms.Xaml.dll + ..\packages\Xamarin.Forms.4.6.0.800\lib\MonoAndroid90\Xamarin.Forms.Xaml.dll @@ -264,5 +264,5 @@ - + \ No newline at end of file diff --git a/AiForms.Effects.Droid/BorderPlatformEffect.cs b/AiForms.Effects.Droid/BorderPlatformEffect.cs index 794286c..2f4bad9 100644 --- a/AiForms.Effects.Droid/BorderPlatformEffect.cs +++ b/AiForms.Effects.Droid/BorderPlatformEffect.cs @@ -1,7 +1,9 @@ using System; using AiForms.Effects; using AiForms.Effects.Droid; +using Android.Content.Res; using Android.Graphics.Drawables; +using Android.Widget; using Xamarin.Forms; using Xamarin.Forms.Platform.Android; @@ -17,13 +19,20 @@ public class BorderPlatformEffect : AiEffectBase int _width; float _radius; Drawable _orgDrawable; + Drawable _orgTextBackground; protected override void OnAttachedOverride() { _view = Container ?? Control; - + _border = new GradientDrawable(); _orgDrawable = _view.Background; + if(Control is FormsEditTextBase editText) + { + _orgTextBackground = editText.Background; + // hide underline. + editText.Background = null; + } UpdateRadius(); UpdateWidth(); @@ -34,7 +43,23 @@ protected override void OnAttachedOverride() protected override void OnDetachedOverride() { if (!IsDisposed) { // Check disposed - _view.Background = _orgDrawable; + if(Control is FormsEditTextBase editText) + { + editText.Background = _orgTextBackground; + } + + if(Element is Label label) + { + (_view as FormsTextView).SetBackgroundColor(label.BackgroundColor.ToAndroid()); + } + else if(Element is Image image) + { + (_view as ImageView).SetBackgroundColor(image.BackgroundColor.ToAndroid()); + } + else + { + _view.Background = _orgDrawable; + } _view.SetPadding(0, 0, 0, 0); _view.ClipToOutline = false; @@ -43,6 +68,8 @@ protected override void OnDetachedOverride() } _border?.Dispose(); _border = null; + _orgDrawable = null; + _orgTextBackground = null; _view = null; System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached completely"); } @@ -82,7 +109,7 @@ void UpdateRadius() void UpdateWidth() { - _width = (int)_view.Context.ToPixels(Border.GetWidth(Element)); + _width = (int)_view.Context.ToPixels(Border.GetWidth(Element) ?? 0); } void UpdateColor() @@ -110,7 +137,7 @@ void UpdateBorder() _view.SetPadding(_width, _width, _width, _width); _view.ClipToOutline = true; //not to overflow children - _view.SetBackground(_border); + _view.SetBackground(_border); } void UpdateBackgroundColor() diff --git a/AiForms.Effects.Droid/packages.config b/AiForms.Effects.Droid/packages.config index 04b768b..a801393 100644 --- a/AiForms.Effects.Droid/packages.config +++ b/AiForms.Effects.Droid/packages.config @@ -39,5 +39,5 @@ - + \ No newline at end of file diff --git a/AiForms.Effects.iOS/AiForms.Effects.iOS.csproj b/AiForms.Effects.iOS/AiForms.Effects.iOS.csproj index fbfa80c..8a11540 100644 --- a/AiForms.Effects.iOS/AiForms.Effects.iOS.csproj +++ b/AiForms.Effects.iOS/AiForms.Effects.iOS.csproj @@ -1,6 +1,6 @@ - + Debug AnyCPU @@ -52,16 +52,13 @@ - ..\packages\Xamarin.Forms.4.4.0.991537\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll + ..\packages\Xamarin.Forms.4.6.0.800\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll - ..\packages\Xamarin.Forms.4.4.0.991537\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll - - - ..\packages\Xamarin.Forms.4.4.0.991537\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll + ..\packages\Xamarin.Forms.4.6.0.800\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll - ..\packages\Xamarin.Forms.4.4.0.991537\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll + ..\packages\Xamarin.Forms.4.6.0.800\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll @@ -103,5 +100,5 @@ - + \ No newline at end of file diff --git a/AiForms.Effects.iOS/BorderPlatformEffect.cs b/AiForms.Effects.iOS/BorderPlatformEffect.cs index 3f51c07..c1e6254 100644 --- a/AiForms.Effects.iOS/BorderPlatformEffect.cs +++ b/AiForms.Effects.iOS/BorderPlatformEffect.cs @@ -47,6 +47,8 @@ protected override void OnDetached() if (hasBorderTypes.Any(x => x == Element.GetType())) { var textfield = _view as UITextField; textfield.BorderStyle = UITextBorderStyle.RoundedRect; + // restore the BackgroundColor, because it is sometimes lost. + textfield.BackgroundColor = (Element as VisualElement)?.BackgroundColor.ToUIColor(); } _view.ClipsToBounds = _clipsToBounds; if(_view.Layer != null) @@ -83,7 +85,7 @@ void UpdateRadius() void UpdateWidth() { - _view.Layer.BorderWidth = (float)Border.GetWidth(Element); + _view.Layer.BorderWidth = (float)(Border.GetWidth(Element) ?? 0); } void UpdateColor() diff --git a/AiForms.Effects.iOS/packages.config b/AiForms.Effects.iOS/packages.config index cf45b19..69df5ce 100644 --- a/AiForms.Effects.iOS/packages.config +++ b/AiForms.Effects.iOS/packages.config @@ -1,4 +1,4 @@  - + \ No newline at end of file diff --git a/AiForms.Effects/AiForms.Effects.csproj b/AiForms.Effects/AiForms.Effects.csproj index d12e02a..f530df9 100644 --- a/AiForms.Effects/AiForms.Effects.csproj +++ b/AiForms.Effects/AiForms.Effects.csproj @@ -15,7 +15,7 @@ 8.0 - + diff --git a/AiForms.Effects/Border.cs b/AiForms.Effects/Border.cs index c8c935d..60da8a3 100644 --- a/AiForms.Effects/Border.cs +++ b/AiForms.Effects/Border.cs @@ -79,9 +79,9 @@ public static double GetRadius(BindableObject view) public static readonly BindableProperty WidthProperty = BindableProperty.CreateAttached( "Width", - typeof(double), + typeof(double?), typeof(Border), - default(double), + default(double?), propertyChanged: AiRoutingEffectBase.AddEffectHandler ); @@ -90,7 +90,7 @@ public static double GetRadius(BindableObject view) /// /// View. /// Value. - public static void SetWidth(BindableObject view, double value) + public static void SetWidth(BindableObject view, double? value) { view.SetValue(WidthProperty, value); } @@ -100,9 +100,9 @@ public static void SetWidth(BindableObject view, double value) /// /// The width. /// View. - public static double GetWidth(BindableObject view) + public static double? GetWidth(BindableObject view) { - return (double)view.GetValue(WidthProperty); + return (double?)view.GetValue(WidthProperty); } /// diff --git a/README-ja.md b/README-ja.md index 71d1c7d..1917b79 100644 --- a/README-ja.md +++ b/README-ja.md @@ -317,7 +317,7 @@ Entry・Picker・DatePicker・TimePickerはiOSではデフォルトで罫線を * On * Effect On/Off (true is On) * Width (trigger) - * Border width (default 0) + * Border width (default null) * Color * Border color (default transparent) * Radius (trigger) diff --git a/README.md b/README.md index 16b000a..0cbad69 100644 --- a/README.md +++ b/README.md @@ -331,7 +331,7 @@ When specifying their width 0, it is possible that hide border. * On * Effect On/Off (true is On) * Width (trigger) - * Border width (default 0) + * Border width (default null) * Color * Border color (default transparent) * Radius (trigger) 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 89705b5..21cb0bb 100644 --- a/Tests/AiEffects.TestApp/AiEffects.TestApp.Droid/AiEffects.TestApp.Droid.csproj +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp.Droid/AiEffects.TestApp.Droid.csproj @@ -1,6 +1,6 @@ - + Debug AnyCPU @@ -150,19 +150,19 @@ ..\..\..\packages\Xamarin.Android.Support.v7.MediaRouter.28.0.0.3\lib\monoandroid90\Xamarin.Android.Support.v7.MediaRouter.dll - ..\..\..\packages\Xamarin.Forms.4.4.0.991537\lib\MonoAndroid90\FormsViewGroup.dll + ..\..\..\packages\Xamarin.Forms.4.6.0.800\lib\MonoAndroid90\FormsViewGroup.dll - ..\..\..\packages\Xamarin.Forms.4.4.0.991537\lib\MonoAndroid90\Xamarin.Forms.Core.dll + ..\..\..\packages\Xamarin.Forms.4.6.0.800\lib\MonoAndroid90\Xamarin.Forms.Core.dll - ..\..\..\packages\Xamarin.Forms.4.4.0.991537\lib\MonoAndroid90\Xamarin.Forms.Platform.Android.dll + ..\..\..\packages\Xamarin.Forms.4.6.0.800\lib\MonoAndroid90\Xamarin.Forms.Platform.Android.dll - ..\..\..\packages\Xamarin.Forms.4.4.0.991537\lib\MonoAndroid90\Xamarin.Forms.Platform.dll + ..\..\..\packages\Xamarin.Forms.4.6.0.800\lib\MonoAndroid90\Xamarin.Forms.Platform.dll - ..\..\..\packages\Xamarin.Forms.4.4.0.991537\lib\MonoAndroid90\Xamarin.Forms.Xaml.dll + ..\..\..\packages\Xamarin.Forms.4.6.0.800\lib\MonoAndroid90\Xamarin.Forms.Xaml.dll ..\..\..\packages\AiForms.SettingsView.0.4.15\lib\MonoAndroid\SettingsView.dll @@ -318,5 +318,5 @@ - + \ No newline at end of file diff --git a/Tests/AiEffects.TestApp/AiEffects.TestApp.Droid/packages.config b/Tests/AiEffects.TestApp/AiEffects.TestApp.Droid/packages.config index 6936b66..7a89c0b 100644 --- a/Tests/AiEffects.TestApp/AiEffects.TestApp.Droid/packages.config +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp.Droid/packages.config @@ -105,5 +105,5 @@ - + \ No newline at end of file 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 61c7d6f..e4ca9bf 100644 --- a/Tests/AiEffects.TestApp/AiEffects.TestApp.iOS/AiEffects.TestApp.iOS.csproj +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp.iOS/AiEffects.TestApp.iOS.csproj @@ -1,6 +1,6 @@  - + Debug iPhoneSimulator @@ -137,16 +137,13 @@ ..\..\..\packages\ReactiveProperty.4.2.2\lib\Xamarin.iOS10\ReactiveProperty.iOS.dll - ..\..\..\packages\Xamarin.Forms.4.4.0.991537\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll + ..\..\..\packages\Xamarin.Forms.4.6.0.800\lib\Xamarin.iOS10\Xamarin.Forms.Core.dll - ..\..\..\packages\Xamarin.Forms.4.4.0.991537\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll - - - ..\..\..\packages\Xamarin.Forms.4.4.0.991537\lib\Xamarin.iOS10\Xamarin.Forms.Platform.iOS.dll + ..\..\..\packages\Xamarin.Forms.4.6.0.800\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll - ..\..\..\packages\Xamarin.Forms.4.4.0.991537\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll + ..\..\..\packages\Xamarin.Forms.4.6.0.800\lib\Xamarin.iOS10\Xamarin.Forms.Xaml.dll ..\..\..\packages\AiForms.SettingsView.0.4.15\lib\Xamarin.iOS10\SettingsView.dll @@ -194,5 +191,5 @@ - + \ No newline at end of file diff --git a/Tests/AiEffects.TestApp/AiEffects.TestApp.iOS/packages.config b/Tests/AiEffects.TestApp/AiEffects.TestApp.iOS/packages.config index 61a381c..0562487 100644 --- a/Tests/AiEffects.TestApp/AiEffects.TestApp.iOS/packages.config +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp.iOS/packages.config @@ -69,6 +69,6 @@ - + \ No newline at end of file diff --git a/Tests/AiEffects.TestApp/AiEffects.TestApp/AiEffects.TestApp.csproj b/Tests/AiEffects.TestApp/AiEffects.TestApp/AiEffects.TestApp.csproj index 53c5b8d..02541c7 100644 --- a/Tests/AiEffects.TestApp/AiEffects.TestApp/AiEffects.TestApp.csproj +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp/AiEffects.TestApp.csproj @@ -6,7 +6,7 @@ - + diff --git a/Tests/AiEffects.TestApp/AiEffects.TestApp/ViewModels/ForInvestigationViewModel.cs b/Tests/AiEffects.TestApp/AiEffects.TestApp/ViewModels/ForInvestigationViewModel.cs index 0cb1a7a..1a9c23c 100644 --- a/Tests/AiEffects.TestApp/AiEffects.TestApp/ViewModels/ForInvestigationViewModel.cs +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp/ViewModels/ForInvestigationViewModel.cs @@ -4,28 +4,36 @@ using Prism.Navigation; using System.Diagnostics; using System.Collections.Generic; +using System.Runtime.InteropServices.ComTypes; +using Prism.Mvvm; namespace AiEffects.TestApp.ViewModels { - public class ForInvestigationViewModel + public class ForInvestigationViewModel:BindableBase, INavigatingAware { public ReactivePropertySlim BackColor { get; } = new ReactivePropertySlim(); public ReactiveCommand GoCommand { get; set; } = new ReactiveCommand(); - public ReactiveCommand HogeCommand { get; set; } + public ReactiveCommand HogeCommand { get; set; } + + public ReactiveProperty On { get; } = new ReactiveProperty(false); + public ReactiveProperty Width { get; } = new ReactiveProperty(); + public ReactiveProperty Radius { get; } = new ReactiveProperty(); + public ReactiveProperty Color { get; } = new ReactiveProperty(); + public ReactiveProperty WidthToggle { get; } = new ReactiveProperty(true); + public ReactiveProperty RadiusToggle { get; } = new ReactiveProperty(true); public ReactivePropertySlim CanExecute { get; } = new ReactivePropertySlim(); public ForInvestigationViewModel(INavigationService navigationService) { - BackColor.Value = Color.Blue; - + //BackColor.Value = Color.Blue; var toggle = false; GoCommand.Subscribe(async _ => { - CanExecute.Value = !CanExecute.Value; + On.Value = !On.Value; }); HogeCommand = CanExecute.ToReactiveCommand(); @@ -34,6 +42,20 @@ public ForInvestigationViewModel(INavigationService navigationService) { Debug.WriteLine("Cell Tap!"); }); + + Color.Value = Xamarin.Forms.Color.Blue; + + WidthToggle.Subscribe(x => { + Width.Value = x ? 2.0d : 0.0d; + }); + + RadiusToggle.Subscribe(x => { + Radius.Value = x ? 8.0d : 0.0d; + }); + } + + public void OnNavigatingTo(NavigationParameters parameters) + { } } } diff --git a/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/ForInvestigation.xaml b/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/ForInvestigation.xaml index ab8f2b6..0a8c74d 100644 --- a/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/ForInvestigation.xaml +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/ForInvestigation.xaml @@ -10,10 +10,9 @@ - - + + + + diff --git a/nuget/AzurePipelines.nuspec b/nuget/AzurePipelines.nuspec index 87486c2..fda0410 100644 --- a/nuget/AzurePipelines.nuspec +++ b/nuget/AzurePipelines.nuspec @@ -10,15 +10,21 @@ https://github.com/muak/AiForms.Effects/blob/master/LICENSE.txt https://raw.githubusercontent.com/muak/AiForms.Effects/master/images/icon.png false - Xamarin.Forms Effects(add Border / add placeholder / add Text / add Command / add NumberPicker, TimePicker and DatePicker / alter color for switch and slider / alter LineHeight of Label and Editor / Button to flat / Size to fit for Label / add touch events / Floating / Feedback) for iOS / Android + Xamarin.Forms Effects(add Border / add placeholder / add Text / add Command / add NumberPicker, TimePicker and DatePicker / alter color for switch and slider / alter LineHeight of Label and Editor / Button to flat / Size to fit for Label / add touch events / Floating / Feedback / Gradient) for iOS / Android +## Bug fixes + +* Border – Specifying the Width property is not invoked effects. +* Border – The BackgroundColor is sometimes lost. +* Border – The input underline can't be hidden for Android(Entry,Editor etc). + ## New fueature * Gradient – the effect that the gradient background is set to a Layout Element. - Xamarin.Forms Effects Command NumberPikcer LineHeight LineSpacing FlatButton Validation SoundEffect Border TimePicker DatePicker Placeholder Color SizeToFit TouchEvents Floating + Xamarin.Forms Effects Command NumberPikcer LineHeight LineSpacing FlatButton Validation SoundEffect Border TimePicker DatePicker Placeholder Color SizeToFit TouchEvents Floating Gradient en-US