diff --git a/AiForms.Effects.Droid/AddCommandPlatformEffect.cs b/AiForms.Effects.Droid/AddCommandPlatformEffect.cs index f6b50d9..9b38f8a 100644 --- a/AiForms.Effects.Droid/AddCommandPlatformEffect.cs +++ b/AiForms.Effects.Droid/AddCommandPlatformEffect.cs @@ -68,9 +68,6 @@ protected override void OnAttached() protected override void OnDetached() { - base.OnDetached(); - - System.Diagnostics.Debug.WriteLine(Element.GetType().FullName); if (!IsDisposed) { _view.Touch -= _view_Touch; } @@ -92,6 +89,8 @@ protected override void OnDetached() _gestureDetector = null; _view = null; + + base.OnDetached(); } protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e) diff --git a/AiForms.Effects.Droid/AddDatePickerPlatformEffect.cs b/AiForms.Effects.Droid/AddDatePickerPlatformEffect.cs index 1fb5b3d..d86c261 100644 --- a/AiForms.Effects.Droid/AddDatePickerPlatformEffect.cs +++ b/AiForms.Effects.Droid/AddDatePickerPlatformEffect.cs @@ -29,8 +29,6 @@ protected override void OnAttached() protected override void OnDetached() { - base.OnDetached(); - var renderer = Container as IVisualElementRenderer; if (!IsDisposed) { _view.Touch -= _view_Touch; @@ -43,6 +41,8 @@ protected override void OnDetached() _view = null; _command = null; System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached completely"); + + base.OnDetached(); } protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e) diff --git a/AiForms.Effects.Droid/AddNumberPickerPlatform.cs b/AiForms.Effects.Droid/AddNumberPickerPlatform.cs index fedf1e0..d6ff5e4 100644 --- a/AiForms.Effects.Droid/AddNumberPickerPlatform.cs +++ b/AiForms.Effects.Droid/AddNumberPickerPlatform.cs @@ -42,8 +42,6 @@ void _view_Touch(object sender, Android.Views.View.TouchEventArgs e) protected override void OnDetached() { - base.OnDetached(); - if (!IsDisposed) { _view.Touch -= _view_Touch; System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached Disposing"); @@ -55,6 +53,8 @@ protected override void OnDetached() _view = null; _command = null; System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached completely"); + + base.OnDetached(); } protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e) diff --git a/AiForms.Effects.Droid/AddTextPlatformEffect.cs b/AiForms.Effects.Droid/AddTextPlatformEffect.cs index 8c0166f..dc0921e 100644 --- a/AiForms.Effects.Droid/AddTextPlatformEffect.cs +++ b/AiForms.Effects.Droid/AddTextPlatformEffect.cs @@ -52,7 +52,6 @@ protected override void OnAttached() protected override void OnDetached() { - base.OnDetached(); System.Diagnostics.Debug.WriteLine(Element.GetType().FullName); if (!IsDisposed) { @@ -75,6 +74,8 @@ protected override void OnDetached() _fastListener?.Dispose(); _fastListener = null; System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached completely"); + + base.OnDetached(); } protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs args) diff --git a/AiForms.Effects.Droid/AddTimePickerPlatformEffect.cs b/AiForms.Effects.Droid/AddTimePickerPlatformEffect.cs index 64fe8a7..252d054 100644 --- a/AiForms.Effects.Droid/AddTimePickerPlatformEffect.cs +++ b/AiForms.Effects.Droid/AddTimePickerPlatformEffect.cs @@ -32,8 +32,6 @@ protected override void OnAttached() protected override void OnDetached() { - base.OnDetached(); - if (!IsDisposed) { _view.Touch -= _view_Touch; System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached Disposing"); @@ -45,6 +43,8 @@ protected override void OnDetached() _view = null; _command = null; System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached completely"); + + base.OnDetached(); } protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e) diff --git a/AiForms.Effects.Droid/AddTouchPlatformEffect.cs b/AiForms.Effects.Droid/AddTouchPlatformEffect.cs index 16890e3..49f75be 100644 --- a/AiForms.Effects.Droid/AddTouchPlatformEffect.cs +++ b/AiForms.Effects.Droid/AddTouchPlatformEffect.cs @@ -65,8 +65,6 @@ void _view_Touch(object sender, Android.Views.View.TouchEventArgs e) protected override void OnDetached() { - base.OnDetached(); - if (!IsDisposed) { if (_viewRef.TryGetTarget(out var view)) @@ -80,6 +78,8 @@ protected override void OnDetached() _recognizer = null; _viewRef = null; System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached completely"); + + base.OnDetached(); } } diff --git a/AiForms.Effects.Droid/AiEffectBase.cs b/AiForms.Effects.Droid/AiEffectBase.cs index d79bd9f..4d36bff 100644 --- a/AiForms.Effects.Droid/AiEffectBase.cs +++ b/AiForms.Effects.Droid/AiEffectBase.cs @@ -14,6 +14,7 @@ public abstract class AiEffectBase : PlatformEffect IVisualElementRenderer _renderer; bool _isDisposed = false; + WeakReference _pageRef; protected bool IsDisposed { get { @@ -45,12 +46,29 @@ protected bool IsNullOrDisposed{ protected override void OnAttached() { - Element.BindingContextChanged += BindingContextChanged; + var visual = Element as VisualElement; + + var page = visual.Navigation.NavigationStack.LastOrDefault() ?? + visual.Navigation.ModalStack.LastOrDefault(); + + if (page == null) + return; + + page.Disappearing += Page_Disappearing; + + _pageRef = new WeakReference(page); } protected override void OnDetached() { - Element.BindingContextChanged -= BindingContextChanged; + System.Diagnostics.Debug.WriteLine($"Detached {GetType().Name} from {Element.GetType().FullName}"); + if (_pageRef != null && _pageRef.TryGetTarget(out var page)) + { + page.Disappearing -= Page_Disappearing; + } + + _renderer = null; + _pageRef = null; } @@ -107,25 +125,15 @@ Func CreateGetField(Type t) return lambda.Compile(); } - void BindingContextChanged(object sender, EventArgs e) - { - if (Element.BindingContext == null) - { - Clear(); - } - } - - void Clear() + void Page_Disappearing(object sender, EventArgs e) { - Element.BindingContextChanged -= BindingContextChanged; - // For Android, when a page is popped, OnDetached is automatically not called. (when iOS, it is called) - // So, made the BindingContextChanged event subscribe in advance - // and make the effect manually removed when the BindingContext is null. + // So, made the Page.Disappearing event subscribe in advance + // and make the effect manually removed when the page is popped. if (IsAttached && !IsDisposed) { var toRemove = Element.Effects.OfType().FirstOrDefault(x => x.EffectId == ResolveId); - Device.BeginInvokeOnMainThread(()=>Element.Effects.Remove(toRemove)); + Device.BeginInvokeOnMainThread(() => Element.Effects.Remove(toRemove)); } } } diff --git a/AiForms.Effects.Droid/AlterColorPlatformEffect.cs b/AiForms.Effects.Droid/AlterColorPlatformEffect.cs index 3573918..ab3dbf9 100644 --- a/AiForms.Effects.Droid/AlterColorPlatformEffect.cs +++ b/AiForms.Effects.Droid/AlterColorPlatformEffect.cs @@ -38,8 +38,6 @@ protected override void OnAttached() protected override void OnDetached() { - base.OnDetached(); - if (!IsDisposed) { _effect?.OnDetachedIfNotDisposed(); System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached Disposing"); @@ -47,6 +45,8 @@ protected override void OnDetached() _effect?.OnDetached(); _effect = null; System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached completely"); + + base.OnDetached(); } protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs args) diff --git a/AiForms.Effects.Droid/AlterColorSlider.cs b/AiForms.Effects.Droid/AlterColorSlider.cs index db2a37c..43769b6 100644 --- a/AiForms.Effects.Droid/AlterColorSlider.cs +++ b/AiForms.Effects.Droid/AlterColorSlider.cs @@ -1,11 +1,14 @@ -using Android.Graphics; +using Android.Content.Res; +using Android.Graphics; using Android.Graphics.Drawables; using Android.Widget; using Xamarin.Forms; using Xamarin.Forms.Platform.Android; namespace AiForms.Effects.Droid -{ +{ + // References: + // http://www.zoftino.com/android-seekbar-and-custom-seekbar-examples [Android.Runtime.Preserve(AllMembers = true)] public class AlterColorSlider : IAiEffectDroid { @@ -16,9 +19,8 @@ public class AlterColorSlider : IAiEffectDroid Drawable _orgThumb; LayerDrawable _progress; - Drawable _minDrawable; - Drawable _maxDrawable; - Drawable _thumb; + Drawable _thumb; + ColorStateList _orgProgressBackground; bool notSupported = false; @@ -34,14 +36,13 @@ public AlterColorSlider(SeekBar seekbar, Element element) } _progress = (LayerDrawable)(_seekbar.ProgressDrawable.Current.GetConstantState().NewDrawable()); - - _minDrawable = _progress.GetDrawable(2); - _maxDrawable = _progress.GetDrawable(0); + + _orgProgressBackground = _seekbar.ProgressBackgroundTintList; _orgThumb = _seekbar.Thumb; _thumb = _seekbar.Thumb.GetConstantState().NewDrawable(); - _seekbar.ProgressDrawable = _progress; + _seekbar.ProgressDrawable = _progress; _seekbar.SetThumb(_thumb); } @@ -49,7 +50,8 @@ public void OnDetachedIfNotDisposed() { if (notSupported) { return; - } + } + _seekbar.ProgressBackgroundTintList = _orgProgressBackground; _seekbar.ProgressDrawable = _orgProgress; _seekbar.SetThumb(_orgThumb); } @@ -60,20 +62,14 @@ public void OnDetached() return; } - _minDrawable.ClearColorFilter(); - _maxDrawable.ClearColorFilter(); - - _minDrawable.Dispose(); - _maxDrawable.Dispose(); _thumb.Dispose(); _progress.Dispose(); - _minDrawable = null; - _maxDrawable = null; _thumb = null; _progress = null; _orgProgress = null; - _orgThumb = null; + _orgThumb = null; + _orgProgressBackground = null; _seekbar = null; _element = null; } @@ -83,12 +79,19 @@ public void Update() if (notSupported) { return; } - var color = AlterColor.GetAccent(_element).ToAndroid(); - var altColor = Android.Graphics.Color.Argb(76, color.R, color.G, color.B); + var color = AlterColor.GetAccent(_element).ToAndroid(); + + _progress.SetColorFilter(color, PorterDuff.Mode.SrcIn); + _seekbar.ProgressBackgroundTintList = new ColorStateList( + new int[][] + { + new int[]{} + }, + new int[] + { + color, + }); - //if use SetTint,it cannot restore. - _minDrawable.SetColorFilter(color, PorterDuff.Mode.SrcIn); - _maxDrawable.SetColorFilter(altColor, PorterDuff.Mode.SrcIn); _thumb.SetTint(color); } diff --git a/AiForms.Effects.Droid/AlterColorStatusbar.cs b/AiForms.Effects.Droid/AlterColorStatusbar.cs index a16cb0f..b588bc6 100644 --- a/AiForms.Effects.Droid/AlterColorStatusbar.cs +++ b/AiForms.Effects.Droid/AlterColorStatusbar.cs @@ -15,36 +15,26 @@ public class AlterColorStatusbar : IAiEffectDroid public AlterColorStatusbar(Element element,Context context) { - System.Diagnostics.Debug.WriteLine("Constructor Start"); - _window = (context as FormsAppCompatActivity).Window; _element = element; _orgColor = _window.StatusBarColor; - - System.Diagnostics.Debug.WriteLine("Constructor Completed"); } public void OnDetachedIfNotDisposed() { } public void OnDetached() { - System.Diagnostics.Debug.WriteLine("OnDetached Start"); var color = new Android.Graphics.Color(_orgColor); _window.SetStatusBarColor(color); _window = null; _element = null; - - System.Diagnostics.Debug.WriteLine("OnDetached Completed"); } public void Update() { - System.Diagnostics.Debug.WriteLine("Update Start"); var color = AlterColor.GetAccent(_element).ToAndroid(); _window.SetStatusBarColor(color); - - System.Diagnostics.Debug.WriteLine("Update Completed"); } } } diff --git a/AiForms.Effects.Droid/AlterLineHeightPlatformEffect.cs b/AiForms.Effects.Droid/AlterLineHeightPlatformEffect.cs index d688035..993f2fb 100644 --- a/AiForms.Effects.Droid/AlterLineHeightPlatformEffect.cs +++ b/AiForms.Effects.Droid/AlterLineHeightPlatformEffect.cs @@ -27,8 +27,6 @@ protected override void OnAttached() protected override void OnDetached() { - base.OnDetached(); - if (!IsDisposed) { _effect.OnDetachedIfNotDisposed(); System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached Disposing"); @@ -36,6 +34,8 @@ protected override void OnDetached() _effect?.OnDetached(); _effect = null; System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached completely"); + + base.OnDetached(); } diff --git a/AiForms.Effects.Droid/BorderPlatformEffect.cs b/AiForms.Effects.Droid/BorderPlatformEffect.cs index 9a960fd..da2fcb8 100644 --- a/AiForms.Effects.Droid/BorderPlatformEffect.cs +++ b/AiForms.Effects.Droid/BorderPlatformEffect.cs @@ -35,8 +35,6 @@ protected override void OnAttached() protected override void OnDetached() { - base.OnDetached(); - if (!IsDisposed) { // Check disposed _view.Background = _orgDrawable; @@ -49,6 +47,8 @@ protected override void OnDetached() _border = null; _view = null; System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached completely"); + + base.OnDetached(); } protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs args) @@ -71,6 +71,9 @@ protected override void OnElementPropertyChanged(System.ComponentModel.PropertyC UpdateColor(); UpdateBorder(); } + else if (args.PropertyName == VisualElement.BackgroundColorProperty.PropertyName) { + UpdateBackgroundColor(); + } } void UpdateRadius() @@ -109,7 +112,12 @@ void UpdateBorder() _view.ClipToOutline = true; //not to overflow children _view.SetBackground(_border); + } + void UpdateBackgroundColor() + { + _orgDrawable = _view.Background; + UpdateBorder(); } } } diff --git a/AiForms.Effects.Droid/FeedbackPlatformEffect.cs b/AiForms.Effects.Droid/FeedbackPlatformEffect.cs index e7ddde2..c8de888 100644 --- a/AiForms.Effects.Droid/FeedbackPlatformEffect.cs +++ b/AiForms.Effects.Droid/FeedbackPlatformEffect.cs @@ -72,9 +72,6 @@ protected override void OnAttached() protected override void OnDetached() { - base.OnDetached(); - - System.Diagnostics.Debug.WriteLine(Element.GetType().FullName); if (!IsDisposed) { if (!IsClickable) @@ -100,6 +97,8 @@ protected override void OnDetached() _audioManager = null; _view = null; + + base.OnDetached(); } protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e) diff --git a/AiForms.Effects.Droid/PlaceholderPlatformEffect.cs b/AiForms.Effects.Droid/PlaceholderPlatformEffect.cs index 0714d13..4b94c86 100644 --- a/AiForms.Effects.Droid/PlaceholderPlatformEffect.cs +++ b/AiForms.Effects.Droid/PlaceholderPlatformEffect.cs @@ -25,14 +25,14 @@ protected override void OnAttached() protected override void OnDetached() { - base.OnDetached(); - if (!IsDisposed) { _editText.Hint = string.Empty; System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached Disposing"); } _editText = null; System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached completely"); + + base.OnDetached(); } protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e) diff --git a/AiForms.Effects.Droid/SizeToFitPlatformEffect.cs b/AiForms.Effects.Droid/SizeToFitPlatformEffect.cs index 78b61db..cb999e7 100644 --- a/AiForms.Effects.Droid/SizeToFitPlatformEffect.cs +++ b/AiForms.Effects.Droid/SizeToFitPlatformEffect.cs @@ -29,14 +29,14 @@ protected override void OnAttached() protected override void OnDetached() { - base.OnDetached(); - if (!IsDisposed){ _view.SetTextSize(ComplexUnitType.Px, _orgFontSize); System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached Disposing"); } _view = null; System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached completely"); + + base.OnDetached(); } protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs args) diff --git a/AiForms.Effects.Droid/ToFlatButtonPlatformEffect.cs b/AiForms.Effects.Droid/ToFlatButtonPlatformEffect.cs index 3f74797..d4f4833 100644 --- a/AiForms.Effects.Droid/ToFlatButtonPlatformEffect.cs +++ b/AiForms.Effects.Droid/ToFlatButtonPlatformEffect.cs @@ -54,8 +54,6 @@ protected override void OnAttached() protected override void OnDetached() { - base.OnDetached(); - if (!IsDisposed) { NativeButton.Background = OrgBackground; NativeButton.StateListAnimator = OrgStateListAnimator; @@ -76,6 +74,8 @@ protected override void OnDetached() Ripple = null; Inset = null; System.Diagnostics.Debug.WriteLine($"{this.GetType().FullName} Detached completely"); + + base.OnDetached(); } protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e) diff --git a/AiForms.Effects.iOS/AddCommandPlatformEffect.cs b/AiForms.Effects.iOS/AddCommandPlatformEffect.cs index 498c107..8b40753 100644 --- a/AiForms.Effects.iOS/AddCommandPlatformEffect.cs +++ b/AiForms.Effects.iOS/AddCommandPlatformEffect.cs @@ -85,6 +85,8 @@ protected override void OnDetached() _longCommandParameter = null; _view = null; + + System.Diagnostics.Debug.WriteLine($"Detached {GetType().Name} from {Element.GetType().FullName}"); } protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e) diff --git a/AiForms.Effects.iOS/AddDatePickerPlatformEffect.cs b/AiForms.Effects.iOS/AddDatePickerPlatformEffect.cs index eb0456a..8ff8268 100644 --- a/AiForms.Effects.iOS/AddDatePickerPlatformEffect.cs +++ b/AiForms.Effects.iOS/AddDatePickerPlatformEffect.cs @@ -38,6 +38,8 @@ protected override void OnDetached() _entry.Dispose(); _picker.Dispose(); _preSelectedDate.Dispose(); + + System.Diagnostics.Debug.WriteLine($"Detached {GetType().Name} from {Element.GetType().FullName}"); } protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e) diff --git a/AiForms.Effects.iOS/AddNumberPickerPlatform.cs b/AiForms.Effects.iOS/AddNumberPickerPlatform.cs index 6cd296b..d3bc036 100644 --- a/AiForms.Effects.iOS/AddNumberPickerPlatform.cs +++ b/AiForms.Effects.iOS/AddNumberPickerPlatform.cs @@ -40,6 +40,8 @@ protected override void OnDetached() _model.Dispose(); _title.Dispose(); _picker.Dispose(); + + System.Diagnostics.Debug.WriteLine($"Detached {GetType().Name} from {Element.GetType().FullName}"); } protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e) diff --git a/AiForms.Effects.iOS/AddTextPlatformEffect.cs b/AiForms.Effects.iOS/AddTextPlatformEffect.cs index 2dd8be4..94da3e4 100644 --- a/AiForms.Effects.iOS/AddTextPlatformEffect.cs +++ b/AiForms.Effects.iOS/AddTextPlatformEffect.cs @@ -44,6 +44,8 @@ protected override void OnDetached() _textLabel.Dispose(); _constraint = null; _textLabel = null; + + System.Diagnostics.Debug.WriteLine($"Detached {GetType().Name} from {Element.GetType().FullName}"); } protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs args) diff --git a/AiForms.Effects.iOS/AddTimePickerPlatformEffect.cs b/AiForms.Effects.iOS/AddTimePickerPlatformEffect.cs index f73a8cb..61abda1 100644 --- a/AiForms.Effects.iOS/AddTimePickerPlatformEffect.cs +++ b/AiForms.Effects.iOS/AddTimePickerPlatformEffect.cs @@ -38,6 +38,8 @@ protected override void OnDetached() _title.Dispose(); _picker.Dispose(); _preSelectedDate.Dispose(); + + System.Diagnostics.Debug.WriteLine($"Detached {GetType().Name} from {Element.GetType().FullName}"); } protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e) diff --git a/AiForms.Effects.iOS/AddTouchPlatformEffect.cs b/AiForms.Effects.iOS/AddTouchPlatformEffect.cs index 2db038a..4f01ab7 100644 --- a/AiForms.Effects.iOS/AddTouchPlatformEffect.cs +++ b/AiForms.Effects.iOS/AddTouchPlatformEffect.cs @@ -29,6 +29,8 @@ protected override void OnDetached() _view = null; _recognizer?.Dispose(); _recognizer = null; + + System.Diagnostics.Debug.WriteLine($"Detached {GetType().Name} from {Element.GetType().FullName}"); } } } diff --git a/AiForms.Effects.iOS/AlterColorPlatformEffect.cs b/AiForms.Effects.iOS/AlterColorPlatformEffect.cs index 149d2f0..840b6ab 100644 --- a/AiForms.Effects.iOS/AlterColorPlatformEffect.cs +++ b/AiForms.Effects.iOS/AlterColorPlatformEffect.cs @@ -32,6 +32,8 @@ protected override void OnDetached() { _effect?.OnDetached(); _effect = null; + + System.Diagnostics.Debug.WriteLine($"Detached {GetType().Name} from {Element.GetType().FullName}"); } protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs args) diff --git a/AiForms.Effects.iOS/AlterLineHeightPlatformEffect.cs b/AiForms.Effects.iOS/AlterLineHeightPlatformEffect.cs index 81c14cb..044fcd8 100644 --- a/AiForms.Effects.iOS/AlterLineHeightPlatformEffect.cs +++ b/AiForms.Effects.iOS/AlterLineHeightPlatformEffect.cs @@ -28,6 +28,8 @@ protected override void OnDetached() { _effect?.OnDetached(); _effect = null; + + System.Diagnostics.Debug.WriteLine($"Detached {GetType().Name} from {Element.GetType().FullName}"); } diff --git a/AiForms.Effects.iOS/BorderPlatformEffect.cs b/AiForms.Effects.iOS/BorderPlatformEffect.cs index b492e46..3f51c07 100644 --- a/AiForms.Effects.iOS/BorderPlatformEffect.cs +++ b/AiForms.Effects.iOS/BorderPlatformEffect.cs @@ -56,6 +56,8 @@ protected override void OnDetached() } _view = null; + + System.Diagnostics.Debug.WriteLine($"Detached {GetType().Name} from {Element.GetType().FullName}"); } protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs args) diff --git a/AiForms.Effects.iOS/FeedbackPlatformEffect.cs b/AiForms.Effects.iOS/FeedbackPlatformEffect.cs index 87e4d12..d0ae158 100644 --- a/AiForms.Effects.iOS/FeedbackPlatformEffect.cs +++ b/AiForms.Effects.iOS/FeedbackPlatformEffect.cs @@ -83,6 +83,8 @@ protected override void OnDetached() _clickSound = null; _view = null; + + System.Diagnostics.Debug.WriteLine($"Detached {GetType().Name} from {Element.GetType().FullName}"); } protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e) diff --git a/AiForms.Effects.iOS/FloatingPlatformEffect.cs b/AiForms.Effects.iOS/FloatingPlatformEffect.cs index 7d69d26..3b3bce8 100644 --- a/AiForms.Effects.iOS/FloatingPlatformEffect.cs +++ b/AiForms.Effects.iOS/FloatingPlatformEffect.cs @@ -65,6 +65,8 @@ protected override void OnDetached() _formsLayout = null; _nativePage = null; _page = null; + + System.Diagnostics.Debug.WriteLine($"Detached {GetType().Name} from {Element.GetType().FullName}"); } diff --git a/AiForms.Effects.iOS/PlaceholderPlatformEffect.cs b/AiForms.Effects.iOS/PlaceholderPlatformEffect.cs index bf11cdf..b047ff9 100644 --- a/AiForms.Effects.iOS/PlaceholderPlatformEffect.cs +++ b/AiForms.Effects.iOS/PlaceholderPlatformEffect.cs @@ -53,6 +53,8 @@ protected override void OnDetached() _placeholderLabel.Dispose(); _placeholderLabel = null; _textView = null; + + System.Diagnostics.Debug.WriteLine($"Detached {GetType().Name} from {Element.GetType().FullName}"); } protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs e) diff --git a/AiForms.Effects.iOS/SizeToFitPlatformEffect.cs b/AiForms.Effects.iOS/SizeToFitPlatformEffect.cs index 1f11970..e9a2090 100644 --- a/AiForms.Effects.iOS/SizeToFitPlatformEffect.cs +++ b/AiForms.Effects.iOS/SizeToFitPlatformEffect.cs @@ -31,6 +31,8 @@ protected override void OnDetached() var render = Platform.GetRenderer(Element as Label) as LabelRenderer; render?.LayoutSubviews(); _view = null; + + System.Diagnostics.Debug.WriteLine($"Detached {GetType().Name} from {Element.GetType().FullName}"); } protected override void OnElementPropertyChanged(System.ComponentModel.PropertyChangedEventArgs args) diff --git a/AiForms.Effects/AiForms.Effects.csproj b/AiForms.Effects/AiForms.Effects.csproj index 35d8f0c..756f947 100644 --- a/AiForms.Effects/AiForms.Effects.csproj +++ b/AiForms.Effects/AiForms.Effects.csproj @@ -17,4 +17,9 @@ + + + AzurePipelines.nuspec + + \ No newline at end of file diff --git a/Tests/AiEffects.TestApp/AiEffects.TestApp/ViewModels/ForInvestigationViewModel.cs b/Tests/AiEffects.TestApp/AiEffects.TestApp/ViewModels/ForInvestigationViewModel.cs new file mode 100644 index 0000000..b8daba6 --- /dev/null +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp/ViewModels/ForInvestigationViewModel.cs @@ -0,0 +1,26 @@ +using System; +using Reactive.Bindings; +using Xamarin.Forms; +using Prism.Navigation; +namespace AiEffects.TestApp.ViewModels +{ + public class ForInvestigationViewModel + { + public ReactivePropertySlim BackColor { get; } = new ReactivePropertySlim(); + public ReactiveCommand GoCommand { get; set; } = new ReactiveCommand(); + + + public ForInvestigationViewModel(INavigationService navigationService) + { + BackColor.Value = Color.Blue; + + var toggle = false; + GoCommand.Subscribe(_ => + { + //BackColor.Value = toggle ? Color.Blue : Color.Green; + //toggle = !toggle; + navigationService.GoBackAsync(null, false); + }); + } + } +} diff --git a/Tests/AiEffects.TestApp/AiEffects.TestApp/ViewModels/MainPageViewModel.cs b/Tests/AiEffects.TestApp/AiEffects.TestApp/ViewModels/MainPageViewModel.cs index 5c360c5..efe393c 100644 --- a/Tests/AiEffects.TestApp/AiEffects.TestApp/ViewModels/MainPageViewModel.cs +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp/ViewModels/MainPageViewModel.cs @@ -4,7 +4,7 @@ namespace AiEffects.TestApp.ViewModels { - public class MainPageViewModel : BindableBase, INavigationAware + public class MainPageViewModel : BindableBase { private string _title; public string Title { @@ -31,22 +31,6 @@ public MainPageViewModel(INavigationService navigationService) { Navigation = navigationService; } - - public void OnNavigatedFrom(NavigationParameters parameters) - { - - } - - public void OnNavigatedTo(NavigationParameters parameters) - { - if (parameters.ContainsKey("title")) - Title = (string)parameters["title"] + " and Prism"; - } - - public void OnNavigatingTo(NavigationParameters parameters) - { - //throw new NotImplementedException(); - } } } diff --git a/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/ForInvestigation.xaml b/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/ForInvestigation.xaml new file mode 100644 index 0000000..1740d33 --- /dev/null +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/ForInvestigation.xaml @@ -0,0 +1,18 @@ + + + + + + + + + + diff --git a/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/ForInvestigation.xaml.cs b/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/ForInvestigation.xaml.cs new file mode 100644 index 0000000..b94a8dc --- /dev/null +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/ForInvestigation.xaml.cs @@ -0,0 +1,15 @@ +using System; +using System.Collections.Generic; + +using Xamarin.Forms; + +namespace AiEffects.TestApp.Views +{ + public partial class ForInvestigation : ContentPage + { + public ForInvestigation() + { + InitializeComponent(); + } + } +} diff --git a/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/MainPage.xaml b/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/MainPage.xaml index 834a4ee..fb63f76 100644 --- a/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/MainPage.xaml +++ b/Tests/AiEffects.TestApp/AiEffects.TestApp/Views/MainPage.xaml @@ -10,6 +10,7 @@ + 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 - + ## New Features * Feedback – add touch feedback effect (color and sound) without command. * Floating – arrange some floating views (e.g. FAB) at any place over a page. * TriggerProperty – An Effect can be invoked by setting main properties. + +## Bug fixes + +* Border – When changing the BackgroundColor dynamically, the border disappears. #35 +* AlterColor – Slider progressbar color isn't changed. Xamarin.Forms Effects Command NumberPikcer LineHeight LineSpacing FlatButton Validation SoundEffect Border TimePicker DatePicker Placeholder Color SizeToFit TouchEvents Floating en-US