From 14dd8e2d7cc19f0a0fa446dd9e3b4f98464ada4a Mon Sep 17 00:00:00 2001 From: Martijn van Dijk Date: Mon, 30 Sep 2019 22:31:38 +0200 Subject: [PATCH] Code style cleanup --- .../Properties/AssemblyInfo.cs | 1 - Samples/MaterialMvvmSample.iOS/Main.cs | 7 +- .../Properties/AssemblyInfo.cs | 1 - .../Renderers/MViewCellRenderer.cs | 8 +- Samples/MaterialMvvmSample/App.xaml.cs | 1 - .../Controls/CustomNavigationPage.cs | 6 +- .../Utilities/NavigationService.cs | 4 +- .../ViewModels/MainViewModel.cs | 82 +++++++++---------- .../ViewModels/SecondViewModel.cs | 6 +- .../MaterialMvvmSample/Views/MainView.xaml.cs | 9 -- .../Views/SecondView.xaml.cs | 12 +-- .../MaterialColorConfiguration.cs | 2 +- .../FormsResources/MaterialConfiguration.cs | 4 +- .../FormsResources/MaterialSizes.xaml.cs | 14 ++-- XF.Material/Platforms/Android/Material.cs | 6 +- .../Platforms/Android/MaterialHelper.cs | 6 +- .../Internals/MaterialDatePickerRenderer.cs | 18 ++-- .../Internals/MaterialElementRenderer.cs | 6 +- .../Internals/MaterialEntryRenderer.cs | 8 +- .../Renderers/MaterialButtonRenderer.cs | 7 +- .../Android/Renderers/MaterialCardRenderer.cs | 4 +- .../MaterialCircularLoadingViewRenderer.cs | 1 - .../Renderers/MaterialDrawableHelper.cs | 8 +- .../Android/Renderers/MaterialIconRenderer.cs | 4 +- .../Renderers/MaterialLabelRenderer.cs | 12 +-- .../Android/Renderers/MaterialMenuRenderer.cs | 4 +- .../MaterialNavigationPageRenderer.cs | 4 +- ...MaterialRippleGestureRecognizerDelegate.cs | 2 +- .../MaterialRippleGestureRecognizer.cs | 14 ++-- XF.Material/Platforms/Ios/MaterialHelper.cs | 6 +- .../Internals/MaterialBoxViewRenderer.cs | 2 +- .../Internals/MaterialEntryRenderer.cs | 16 ++-- .../Ios/Renderers/MaterialButtonRenderer.cs | 11 ++- .../MaterialCircularLoadingViewRenderer.cs | 2 +- .../Ios/Renderers/MaterialLabelRenderer.cs | 8 +- .../MaterialNavigationPageRenderer.cs | 4 +- .../Platforms/Ios/Utility/MaterialUtility.cs | 2 +- .../Uap/Renderers/DropShadowViewRenderer.cs | 4 +- .../UI/Dialogs/BaseMaterialModalPage.cs | 8 +- .../UI/Dialogs/MaterialAlertDialog.xaml.cs | 4 +- .../UI/Dialogs/MaterialDialogFragment.xaml.cs | 10 +-- .../UI/Dialogs/MaterialInputDialog.xaml.cs | 3 +- .../UI/Dialogs/MaterialMenuDialog.xaml.cs | 5 +- .../UI/Dialogs/MaterialSimpleDialog.xaml.cs | 5 +- .../Internals/BaseMaterialInputView.xaml.cs | 7 +- XF.Material/UI/Internals/MaterialBoxView.cs | 1 - .../UI/Internals/MaterialDatePicker.cs | 2 +- .../Internals/NullableDateChangedEventArgs.cs | 2 - XF.Material/UI/MaterialCheckboxGroup.xaml.cs | 26 +++--- XF.Material/UI/MaterialChip.xaml.cs | 26 +++--- XF.Material/UI/MaterialDateField.xaml.cs | 6 +- XF.Material/UI/MaterialHorizontalThickness.cs | 2 - XF.Material/UI/MaterialIconButton.xaml.cs | 4 +- XF.Material/UI/MaterialLabel.cs | 2 +- XF.Material/UI/MaterialMenuButton.cs | 4 +- XF.Material/UI/MaterialNavigationPage.cs | 2 +- XF.Material/UI/MaterialSlider.xaml.cs | 12 +-- XF.Material/UI/MaterialTextField.xaml.cs | 26 +++--- 58 files changed, 204 insertions(+), 269 deletions(-) diff --git a/Samples/MaterialMvvmSample.Android/Properties/AssemblyInfo.cs b/Samples/MaterialMvvmSample.Android/Properties/AssemblyInfo.cs index f867f186..3c812fba 100644 --- a/Samples/MaterialMvvmSample.Android/Properties/AssemblyInfo.cs +++ b/Samples/MaterialMvvmSample.Android/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; using Android.App; diff --git a/Samples/MaterialMvvmSample.iOS/Main.cs b/Samples/MaterialMvvmSample.iOS/Main.cs index c8e472ab..5a339dc1 100644 --- a/Samples/MaterialMvvmSample.iOS/Main.cs +++ b/Samples/MaterialMvvmSample.iOS/Main.cs @@ -1,9 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; - -using Foundation; -using UIKit; +using UIKit; namespace MaterialMvvmSample.iOS { diff --git a/Samples/MaterialMvvmSample.iOS/Properties/AssemblyInfo.cs b/Samples/MaterialMvvmSample.iOS/Properties/AssemblyInfo.cs index 9e4f8fa0..29e5ea17 100644 --- a/Samples/MaterialMvvmSample.iOS/Properties/AssemblyInfo.cs +++ b/Samples/MaterialMvvmSample.iOS/Properties/AssemblyInfo.cs @@ -1,5 +1,4 @@ using System.Reflection; -using System.Runtime.CompilerServices; using System.Runtime.InteropServices; // General Information about an assembly is controlled through the following diff --git a/Samples/MaterialMvvmSample.iOS/Renderers/MViewCellRenderer.cs b/Samples/MaterialMvvmSample.iOS/Renderers/MViewCellRenderer.cs index 977eb961..fb0d0a24 100644 --- a/Samples/MaterialMvvmSample.iOS/Renderers/MViewCellRenderer.cs +++ b/Samples/MaterialMvvmSample.iOS/Renderers/MViewCellRenderer.cs @@ -1,10 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; - -using Foundation; -using MaterialMvvmSample.iOS.Renderers; +using MaterialMvvmSample.iOS.Renderers; using UIKit; using Xamarin.Forms; using Xamarin.Forms.Platform.iOS; diff --git a/Samples/MaterialMvvmSample/App.xaml.cs b/Samples/MaterialMvvmSample/App.xaml.cs index 036b52fa..b93f27ff 100644 --- a/Samples/MaterialMvvmSample/App.xaml.cs +++ b/Samples/MaterialMvvmSample/App.xaml.cs @@ -1,6 +1,5 @@ using MaterialMvvmSample.Utilities; using MaterialMvvmSample.Views; -using System; using Xamarin.Forms; using Xamarin.Forms.Xaml; diff --git a/Samples/MaterialMvvmSample/Controls/CustomNavigationPage.cs b/Samples/MaterialMvvmSample/Controls/CustomNavigationPage.cs index 9fc1c33d..d99451ed 100644 --- a/Samples/MaterialMvvmSample/Controls/CustomNavigationPage.cs +++ b/Samples/MaterialMvvmSample/Controls/CustomNavigationPage.cs @@ -1,8 +1,8 @@ -using MaterialMvvmSample.Utilities; -using MaterialMvvmSample.ViewModels; -using System; +using System; using System.Runtime.CompilerServices; using System.Threading.Tasks; +using MaterialMvvmSample.Utilities; +using MaterialMvvmSample.ViewModels; using Xamarin.Forms; using XF.Material.Forms.UI; diff --git a/Samples/MaterialMvvmSample/Utilities/NavigationService.cs b/Samples/MaterialMvvmSample/Utilities/NavigationService.cs index 3fe85587..b0fe6c88 100644 --- a/Samples/MaterialMvvmSample/Utilities/NavigationService.cs +++ b/Samples/MaterialMvvmSample/Utilities/NavigationService.cs @@ -1,5 +1,5 @@ -using MaterialMvvmSample.Controls; -using System.Threading.Tasks; +using System.Threading.Tasks; +using MaterialMvvmSample.Controls; using Xamarin.Forms; namespace MaterialMvvmSample.Utilities diff --git a/Samples/MaterialMvvmSample/ViewModels/MainViewModel.cs b/Samples/MaterialMvvmSample/ViewModels/MainViewModel.cs index ec021a33..d6670409 100644 --- a/Samples/MaterialMvvmSample/ViewModels/MainViewModel.cs +++ b/Samples/MaterialMvvmSample/ViewModels/MainViewModel.cs @@ -1,12 +1,12 @@ -using MaterialMvvmSample.Utilities.Dialogs; -using MaterialMvvmSample.Views; -using System; +using System; using System.Collections.Generic; using System.Collections.ObjectModel; using System.Diagnostics; using System.Linq; using System.Threading.Tasks; using System.Windows.Input; +using MaterialMvvmSample.Utilities.Dialogs; +using MaterialMvvmSample.Views; using Xamarin.Forms; using Xamarin.Forms.Internals; using XF.Material.Forms.Models; @@ -96,7 +96,7 @@ public bool HasError "San Miguel Corporation", "YNGEN Holdings Inc.", "ERNI Development Center Philippines, Inc., Bern, Switzerland" - }; + }; public ICommand JobSelectedCommand => new Command(async (s) => await this.ViewItemSelected(s)); @@ -146,29 +146,29 @@ private async Task ListMenuSelected(MaterialMenuResult s) switch (s.Index) { case 0: - { - var result = await _dialogService.AddNewJob(); - - if (this.Models.Any(m => m.Title == result)) - { - await _dialogService.AlertExistingJob(result); - } - else if (!string.IsNullOrEmpty(result)) { - this.Models.Where(m => m.IsNew).ForEach(m => m.IsNew = false); + var result = await _dialogService.AddNewJob(); - var model = new TestModel + if (this.Models.Any(m => m.Title == result)) { - Title = result, - Id = Guid.NewGuid().ToString("N"), - IsNew = true - }; + await _dialogService.AlertExistingJob(result); + } + else if (!string.IsNullOrEmpty(result)) + { + this.Models.Where(m => m.IsNew).ForEach(m => m.IsNew = false); - this.Models.Add(model); - } + var model = new TestModel + { + Title = result, + Id = Guid.NewGuid().ToString("N"), + IsNew = true + }; - break; - } + this.Models.Add(model); + } + + break; + } case 1: this.Models = new ObservableCollection(this.Models.OrderBy(m => m.Title)); break; @@ -192,35 +192,35 @@ private async Task MenuSelected(MaterialMenuResult i) switch (i.Index) { case 0: - { - if (model != null) { - var result = await _dialogService.EditJob(model.Title); - - if (!string.IsNullOrEmpty(result)) + if (model != null) { - model.Title = result; + var result = await _dialogService.EditJob(model.Title); + + if (!string.IsNullOrEmpty(result)) + { + model.Title = result; + } } - } - break; - } + break; + } case 1: - { - if (model != null) { - var confirmed = await _dialogService.DeleteJob(model.Title); - - if (confirmed == true) + if (model != null) { - this.Models.Remove(model); + var confirmed = await _dialogService.DeleteJob(model.Title); - await _dialogService.JobDeleted(); + if (confirmed == true) + { + this.Models.Remove(model); + + await _dialogService.JobDeleted(); + } } - } - break; - } + break; + } } } } diff --git a/Samples/MaterialMvvmSample/ViewModels/SecondViewModel.cs b/Samples/MaterialMvvmSample/ViewModels/SecondViewModel.cs index 5f6e99ab..2a059361 100644 --- a/Samples/MaterialMvvmSample/ViewModels/SecondViewModel.cs +++ b/Samples/MaterialMvvmSample/ViewModels/SecondViewModel.cs @@ -1,8 +1,4 @@ -using System; -using System.Collections.Generic; -using System.Text; - -namespace MaterialMvvmSample.ViewModels +namespace MaterialMvvmSample.ViewModels { public class SecondViewModel : BaseViewModel { diff --git a/Samples/MaterialMvvmSample/Views/MainView.xaml.cs b/Samples/MaterialMvvmSample/Views/MainView.xaml.cs index 7a03cd38..93affb80 100644 --- a/Samples/MaterialMvvmSample/Views/MainView.xaml.cs +++ b/Samples/MaterialMvvmSample/Views/MainView.xaml.cs @@ -1,14 +1,5 @@ using MaterialMvvmSample.ViewModels; -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Threading.Tasks; -using Xamarin.Forms; -using XF.Material.Forms; using Xamarin.Forms.Xaml; -using XF.Material.Forms.UI; -using XF.Material.Forms.UI.Dialogs; -using Xamarin.Forms.Internals; namespace MaterialMvvmSample.Views { diff --git a/Samples/MaterialMvvmSample/Views/SecondView.xaml.cs b/Samples/MaterialMvvmSample/Views/SecondView.xaml.cs index 2184146b..ac0d435b 100644 --- a/Samples/MaterialMvvmSample/Views/SecondView.xaml.cs +++ b/Samples/MaterialMvvmSample/Views/SecondView.xaml.cs @@ -4,13 +4,13 @@ namespace MaterialMvvmSample.Views { [XamlCompilation(XamlCompilationOptions.Compile)] - public partial class SecondView : BaseSecondView + public partial class SecondView : BaseSecondView { - public SecondView () - { - this.InitializeComponent (); - } - } + public SecondView() + { + this.InitializeComponent(); + } + } public abstract class BaseSecondView : BaseView { } } \ No newline at end of file diff --git a/XF.Material/FormsResources/MaterialColorConfiguration.cs b/XF.Material/FormsResources/MaterialColorConfiguration.cs index 5f3a9ae9..dddedcdb 100644 --- a/XF.Material/FormsResources/MaterialColorConfiguration.cs +++ b/XF.Material/FormsResources/MaterialColorConfiguration.cs @@ -165,7 +165,7 @@ public Color Secondary { var color = (Color)this.GetValue(SecondaryProperty); - if(color.IsDefault && this.Primary.IsDefault) + if (color.IsDefault && this.Primary.IsDefault) { return Color.Accent; } diff --git a/XF.Material/FormsResources/MaterialConfiguration.cs b/XF.Material/FormsResources/MaterialConfiguration.cs index 91b7381e..00748edc 100644 --- a/XF.Material/FormsResources/MaterialConfiguration.cs +++ b/XF.Material/FormsResources/MaterialConfiguration.cs @@ -24,7 +24,7 @@ public class MaterialConfiguration : BindableObject /// public MaterialFontConfiguration FontConfiguration { - get => (MaterialFontConfiguration) this.GetValue(FontConfigurationProperty); + get => (MaterialFontConfiguration)this.GetValue(FontConfigurationProperty); set => this.SetValue(FontConfigurationProperty, value); } @@ -33,7 +33,7 @@ public MaterialFontConfiguration FontConfiguration /// public MaterialColorConfiguration ColorConfiguration { - get => (MaterialColorConfiguration) this.GetValue(ColorConfigurationProperty); + get => (MaterialColorConfiguration)this.GetValue(ColorConfigurationProperty); set => this.SetValue(ColorConfigurationProperty, value); } } diff --git a/XF.Material/FormsResources/MaterialSizes.xaml.cs b/XF.Material/FormsResources/MaterialSizes.xaml.cs index db17eacc..1765b8f5 100644 --- a/XF.Material/FormsResources/MaterialSizes.xaml.cs +++ b/XF.Material/FormsResources/MaterialSizes.xaml.cs @@ -4,11 +4,11 @@ namespace XF.Material.Forms.Resources { [XamlCompilation(XamlCompilationOptions.Compile)] - public partial class MaterialSizes : ResourceDictionary - { - public MaterialSizes () - { - this.InitializeComponent (); - } - } + public partial class MaterialSizes : ResourceDictionary + { + public MaterialSizes() + { + this.InitializeComponent(); + } + } } \ No newline at end of file diff --git a/XF.Material/Platforms/Android/Material.cs b/XF.Material/Platforms/Android/Material.cs index 51536fec..4519ec05 100644 --- a/XF.Material/Platforms/Android/Material.cs +++ b/XF.Material/Platforms/Android/Material.cs @@ -1,11 +1,11 @@ -using Android.App; +using System; +using System.Linq; +using Android.App; using Android.Content; using Android.OS; using Android.Support.V7.App; using Rg.Plugins.Popup; using Rg.Plugins.Popup.Services; -using System; -using System.Linq; using XF.Material.Forms.UI.Dialogs; namespace XF.Material.Droid diff --git a/XF.Material/Platforms/Android/MaterialHelper.cs b/XF.Material/Platforms/Android/MaterialHelper.cs index 9ba70628..61367040 100644 --- a/XF.Material/Platforms/Android/MaterialHelper.cs +++ b/XF.Material/Platforms/Android/MaterialHelper.cs @@ -1,5 +1,4 @@ -using Android.App; -using Android.Content; +using System; using Android.Content.Res; using Android.Graphics; using Android.Graphics.Drawables; @@ -8,9 +7,6 @@ using Android.Support.V4.Graphics.Drawable; using Android.Support.V4.View; using Android.Util; -using Android.Views.InputMethods; -using Android.Widget; -using System; using Xamarin.Forms.Platform.Android; namespace XF.Material.Droid diff --git a/XF.Material/Platforms/Android/Renderers/Internals/MaterialDatePickerRenderer.cs b/XF.Material/Platforms/Android/Renderers/Internals/MaterialDatePickerRenderer.cs index 7ee7b8c6..6653cae9 100644 --- a/XF.Material/Platforms/Android/Renderers/Internals/MaterialDatePickerRenderer.cs +++ b/XF.Material/Platforms/Android/Renderers/Internals/MaterialDatePickerRenderer.cs @@ -1,18 +1,10 @@ -using Android.App; +using System.ComponentModel; using Android.Content; using Android.Graphics.Drawables; -using Android.Runtime; -using Android.Support.V4.Content; -using Android.Views; -using Android.Views.InputMethods; -using Android.Widget; -using System.ComponentModel; using Xamarin.Forms; using Xamarin.Forms.Platform.Android; using XF.Material.Droid.Renderers.Internals; using XF.Material.Forms.UI.Internals; -using static Android.Text.TextUtils; -using static Android.Widget.TextView; [assembly: ExportRenderer(typeof(MaterialDatePicker), typeof(MaterialDatePickerRenderer))] namespace XF.Material.Droid.Renderers.Internals @@ -36,12 +28,12 @@ protected override void OnElementChanged(ElementChangedEventArgs { - public MaterialElementRenderer(Context context): base(context) { } + public MaterialElementRenderer(Context context) : base(context) { } protected override void OnElementChanged(ElementChangedEventArgs e) { base.OnElementChanged(e); - if(e?.OldElement != null) + if (e?.OldElement != null) { (this.Element as IMaterialElementConfiguration)?.ElementChanged(false); } - if(e?.NewElement != null) + if (e?.NewElement != null) { (this.Element as IMaterialElementConfiguration)?.ElementChanged(true); } diff --git a/XF.Material/Platforms/Android/Renderers/Internals/MaterialEntryRenderer.cs b/XF.Material/Platforms/Android/Renderers/Internals/MaterialEntryRenderer.cs index cdf7649c..3e7bf1f0 100644 --- a/XF.Material/Platforms/Android/Renderers/Internals/MaterialEntryRenderer.cs +++ b/XF.Material/Platforms/Android/Renderers/Internals/MaterialEntryRenderer.cs @@ -1,4 +1,5 @@ -using Android.App; +using System.ComponentModel; +using Android.App; using Android.Content; using Android.Graphics.Drawables; using Android.Runtime; @@ -6,13 +7,10 @@ using Android.Views; using Android.Views.InputMethods; using Android.Widget; -using System.ComponentModel; using Xamarin.Forms; using Xamarin.Forms.Platform.Android; using XF.Material.Droid.Renderers.Internals; using XF.Material.Forms.UI.Internals; -using static Android.Text.TextUtils; -using static Android.Widget.TextView; [assembly: ExportRenderer(typeof(MaterialEntry), typeof(MaterialEntryRenderer))] namespace XF.Material.Droid.Renderers.Internals @@ -47,7 +45,7 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE private void SetControl() { - if(this.Control == null) + if (this.Control == null) { return; } diff --git a/XF.Material/Platforms/Android/Renderers/MaterialButtonRenderer.cs b/XF.Material/Platforms/Android/Renderers/MaterialButtonRenderer.cs index 39bc99ca..091a5050 100644 --- a/XF.Material/Platforms/Android/Renderers/MaterialButtonRenderer.cs +++ b/XF.Material/Platforms/Android/Renderers/MaterialButtonRenderer.cs @@ -1,8 +1,7 @@ -using Android.Content; -using Android.Content.Res; -using Android.Graphics.Drawables; -using System.ComponentModel; +using System.ComponentModel; using System.Linq; +using Android.Content; +using Android.Content.Res; using Xamarin.Forms; using Xamarin.Forms.Platform.Android; using XF.Material.Droid.Renderers; diff --git a/XF.Material/Platforms/Android/Renderers/MaterialCardRenderer.cs b/XF.Material/Platforms/Android/Renderers/MaterialCardRenderer.cs index 8df8de80..2ab8e7cf 100644 --- a/XF.Material/Platforms/Android/Renderers/MaterialCardRenderer.cs +++ b/XF.Material/Platforms/Android/Renderers/MaterialCardRenderer.cs @@ -1,10 +1,8 @@ -using Android.App; +using System.ComponentModel; using Android.Content; using Android.Graphics.Drawables; -using Android.OS; using Android.Util; using Android.Views; -using System.ComponentModel; using Xamarin.Forms; using Xamarin.Forms.Platform.Android; using XF.Material.Droid.Renderers; diff --git a/XF.Material/Platforms/Android/Renderers/MaterialCircularLoadingViewRenderer.cs b/XF.Material/Platforms/Android/Renderers/MaterialCircularLoadingViewRenderer.cs index 191f14d9..3966b854 100644 --- a/XF.Material/Platforms/Android/Renderers/MaterialCircularLoadingViewRenderer.cs +++ b/XF.Material/Platforms/Android/Renderers/MaterialCircularLoadingViewRenderer.cs @@ -7,7 +7,6 @@ using XF.Material.Droid.Renderers; using XF.Material.Forms.UI; using static Android.Widget.ImageView; -using static Com.Airbnb.Lottie.LottieAnimationView; [assembly: ExportRenderer(typeof(MaterialCircularLoadingView), typeof(MaterialCircularLoadingViewRenderer))] namespace XF.Material.Droid.Renderers diff --git a/XF.Material/Platforms/Android/Renderers/MaterialDrawableHelper.cs b/XF.Material/Platforms/Android/Renderers/MaterialDrawableHelper.cs index f55d77e0..96294b87 100644 --- a/XF.Material/Platforms/Android/Renderers/MaterialDrawableHelper.cs +++ b/XF.Material/Platforms/Android/Renderers/MaterialDrawableHelper.cs @@ -1,11 +1,11 @@ -using Android.Animation; +using System; +using System.Collections.Generic; +using Android.Animation; using Android.Content.Res; using Android.Graphics; using Android.Graphics.Drawables; using Android.Support.V7.Widget; using Android.Views; -using System; -using System.Collections.Generic; using Xamarin.Forms; using Xamarin.Forms.Platform.Android; using XF.Material.Forms.UI; @@ -113,7 +113,7 @@ private GradientDrawable CreateShapeDrawable(float cornerRadius, int borderWidth if (_button.ButtonType != MaterialButtonType.Text) { - shapeDrawable = _withIcon ? MaterialHelper.GetDrawableCopyFromResource(Resource.Drawable.drawable_shape_with_icon) + shapeDrawable = _withIcon ? MaterialHelper.GetDrawableCopyFromResource(Resource.Drawable.drawable_shape_with_icon) : MaterialHelper.GetDrawableCopyFromResource(Resource.Drawable.drawable_shape); } else diff --git a/XF.Material/Platforms/Android/Renderers/MaterialIconRenderer.cs b/XF.Material/Platforms/Android/Renderers/MaterialIconRenderer.cs index 2969fb48..d7d4403f 100644 --- a/XF.Material/Platforms/Android/Renderers/MaterialIconRenderer.cs +++ b/XF.Material/Platforms/Android/Renderers/MaterialIconRenderer.cs @@ -1,7 +1,7 @@ -using Android.Content; +using System.ComponentModel; +using Android.Content; using Android.Graphics.Drawables; using Android.Support.V4.Graphics.Drawable; -using System.ComponentModel; using Xamarin.Forms; using Xamarin.Forms.Platform.Android; using XF.Material.Droid.Renderers; diff --git a/XF.Material/Platforms/Android/Renderers/MaterialLabelRenderer.cs b/XF.Material/Platforms/Android/Renderers/MaterialLabelRenderer.cs index 8ac8e8cc..deccf6be 100644 --- a/XF.Material/Platforms/Android/Renderers/MaterialLabelRenderer.cs +++ b/XF.Material/Platforms/Android/Renderers/MaterialLabelRenderer.cs @@ -1,13 +1,5 @@ -using System; -using System.Collections.Generic; -using System.ComponentModel; -using System.Linq; -using System.Text; -using Android.App; +using System.ComponentModel; using Android.Content; -using Android.OS; -using Android.Runtime; -using Android.Views; using Android.Widget; using Xamarin.Forms; using Xamarin.Forms.Platform.Android; @@ -47,7 +39,7 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE private void OnLetterSpacingChanged(TextView textView, double letterSpacing) { - if(!Material.IsLollipop) + if (!Material.IsLollipop) { return; } diff --git a/XF.Material/Platforms/Android/Renderers/MaterialMenuRenderer.cs b/XF.Material/Platforms/Android/Renderers/MaterialMenuRenderer.cs index 9dcb9f6e..456d6ba5 100644 --- a/XF.Material/Platforms/Android/Renderers/MaterialMenuRenderer.cs +++ b/XF.Material/Platforms/Android/Renderers/MaterialMenuRenderer.cs @@ -1,9 +1,9 @@ -using Android.Content; +using System.Linq; +using Android.Content; using Xamarin.Forms; using Xamarin.Forms.Platform.Android; using XF.Material.Droid.Renderers; using XF.Material.Forms.UI; -using System.Linq; [assembly: ExportRenderer(typeof(MaterialMenuButton), typeof(MaterialMenuRenderer))] namespace XF.Material.Droid.Renderers diff --git a/XF.Material/Platforms/Android/Renderers/MaterialNavigationPageRenderer.cs b/XF.Material/Platforms/Android/Renderers/MaterialNavigationPageRenderer.cs index 21f9b038..5d7fab1c 100644 --- a/XF.Material/Platforms/Android/Renderers/MaterialNavigationPageRenderer.cs +++ b/XF.Material/Platforms/Android/Renderers/MaterialNavigationPageRenderer.cs @@ -1,6 +1,6 @@ -using Android.Content; -using System.Linq; +using System.Linq; using System.Threading.Tasks; +using Android.Content; using Xamarin.Forms; using Xamarin.Forms.Platform.Android; using XF.Material.Droid.Renderers; diff --git a/XF.Material/Platforms/Ios/Delegates/MaterialRippleGestureRecognizerDelegate.cs b/XF.Material/Platforms/Ios/Delegates/MaterialRippleGestureRecognizerDelegate.cs index 902e5dde..4893f274 100644 --- a/XF.Material/Platforms/Ios/Delegates/MaterialRippleGestureRecognizerDelegate.cs +++ b/XF.Material/Platforms/Ios/Delegates/MaterialRippleGestureRecognizerDelegate.cs @@ -31,7 +31,7 @@ public MaterialRippleGestureRecognizerDelegate(CGColor rippleColor) _fadeAnimation.From = FromObject(0.66f); _fadeAnimation.To = FromObject(0.32f); - _rippleLayer = new CAShapeLayer {FillColor = rippleColor, MasksToBounds = true}; + _rippleLayer = new CAShapeLayer { FillColor = rippleColor, MasksToBounds = true }; } public override bool ShouldReceiveTouch(UIGestureRecognizer recognizer, UITouch touch) diff --git a/XF.Material/Platforms/Ios/GestureRecognizers/MaterialRippleGestureRecognizer.cs b/XF.Material/Platforms/Ios/GestureRecognizers/MaterialRippleGestureRecognizer.cs index 9a5fa08d..6a3c1fc9 100644 --- a/XF.Material/Platforms/Ios/GestureRecognizers/MaterialRippleGestureRecognizer.cs +++ b/XF.Material/Platforms/Ios/GestureRecognizers/MaterialRippleGestureRecognizer.cs @@ -64,9 +64,9 @@ public MaterialRippleGestureRecognizer(CGColor rippleColor, UIView view) _backgroundFadeOutAnimation.From = FromObject(0.20f); _backgroundFadeOutAnimation.To = FromObject(0.0f); - _rippleLayer = new CAShapeLayer {FillColor = rippleColor, MasksToBounds = true}; + _rippleLayer = new CAShapeLayer { FillColor = rippleColor, MasksToBounds = true }; - _backgroundLayer = new CALayer {BackgroundColor = rippleColor, MasksToBounds = true, Opacity = 0}; + _backgroundLayer = new CALayer { BackgroundColor = rippleColor, MasksToBounds = true, Opacity = 0 }; _isStarted = false; _touchView = view; @@ -120,7 +120,7 @@ private void AnimateStart(UITouch touch) _isStarted = true; } - + private void AnimateComplete() { @@ -150,9 +150,9 @@ private void AnimateBackgroundFadeIn() group.Duration = 1.7; group.RepeatCount = 1; group.TimingFunction = CAMediaTimingFunction.FromName(CAMediaTimingFunction.Linear); - group.Animations = new CAAnimation[] { - _backgroundFadeInAnimation, - _backgroundFadeInHoldAnimation, + group.Animations = new CAAnimation[] { + _backgroundFadeInAnimation, + _backgroundFadeInHoldAnimation, _backgroundFadeOutAfterHoldAnimation }; _backgroundLayer.AddAnimation(group, "backgroundFadeInAnimation"); @@ -197,7 +197,7 @@ private void AnimateRipple(UITouch touch) /// private static void SetupAnimationLayer(CALayer layer, UIView view, int indexToInsertLayer) { - layer.Frame = view is MaterialCardRenderer ? new CGRect(0, 0, view.Frame.Width, view.Frame.Height) : + layer.Frame = view is MaterialCardRenderer ? new CGRect(0, 0, view.Frame.Width, view.Frame.Height) : new CGRect(6, 6, view.Frame.Width - 12, view.Frame.Height - 12); layer.CornerRadius = view.Layer.CornerRadius; diff --git a/XF.Material/Platforms/Ios/MaterialHelper.cs b/XF.Material/Platforms/Ios/MaterialHelper.cs index 91988a16..89ac3124 100644 --- a/XF.Material/Platforms/Ios/MaterialHelper.cs +++ b/XF.Material/Platforms/Ios/MaterialHelper.cs @@ -1,5 +1,5 @@ -using CoreGraphics; -using System; +using System; +using CoreGraphics; using UIKit; namespace XF.Material.iOS @@ -74,7 +74,7 @@ internal static UIColor GetDisabledColor(this UIColor color) a = 0.38f; - return new UIColor(r, g,b,a); + return new UIColor(r, g, b, a); } internal static UIColor MixColor(this UIColor color1, UIColor color2) diff --git a/XF.Material/Platforms/Ios/Renderers/Internals/MaterialBoxViewRenderer.cs b/XF.Material/Platforms/Ios/Renderers/Internals/MaterialBoxViewRenderer.cs index 4196d775..bc34e373 100644 --- a/XF.Material/Platforms/Ios/Renderers/Internals/MaterialBoxViewRenderer.cs +++ b/XF.Material/Platforms/Ios/Renderers/Internals/MaterialBoxViewRenderer.cs @@ -13,7 +13,7 @@ protected override void OnElementChanged(ElementChangedEventArgs e) { base.OnElementChanged(e); - if(e?.NewElement != null) + if (e?.NewElement != null) { this.NativeView?.AddGestureRecognizer(new UIGestureRecognizer() { Delegate = new BoxViewGestureRecognizerDelegate(this.Element as MaterialBoxView) }); } diff --git a/XF.Material/Platforms/Ios/Renderers/Internals/MaterialEntryRenderer.cs b/XF.Material/Platforms/Ios/Renderers/Internals/MaterialEntryRenderer.cs index ba5f1613..76a229fe 100644 --- a/XF.Material/Platforms/Ios/Renderers/Internals/MaterialEntryRenderer.cs +++ b/XF.Material/Platforms/Ios/Renderers/Internals/MaterialEntryRenderer.cs @@ -1,10 +1,10 @@ -using UIKit; +using System.ComponentModel; +using System.Drawing; +using UIKit; using Xamarin.Forms; using Xamarin.Forms.Platform.iOS; -using XF.Material.iOS.Renderers.Internals; using XF.Material.Forms.UI.Internals; -using System.ComponentModel; -using System.Drawing; +using XF.Material.iOS.Renderers.Internals; [assembly: ExportRenderer(typeof(MaterialEntry), typeof(MaterialEntryRenderer))] namespace XF.Material.iOS.Renderers.Internals @@ -25,7 +25,7 @@ protected override void OnElementChanged(ElementChangedEventArgs e) private void SetControl() { - if(this.Control == null) + if (this.Control == null) { return; } @@ -50,7 +50,7 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE this.Control.TintColor = (this.Element as MaterialEntry)?.TintColor.ToUIColor(); } - if(e?.PropertyName == nameof(MaterialEntry.IsNumericKeyboard)) + if (e?.PropertyName == nameof(MaterialEntry.IsNumericKeyboard)) { this.AddRemoveReturnKeyToNumericInput((this.Element as MaterialEntry).IsNumericKeyboard); } @@ -58,11 +58,11 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE private void AddRemoveReturnKeyToNumericInput(bool isNumeric) { - if(isNumeric) + if (isNumeric) { UIToolbar toolbar = null; - if(!_returnButtonAdded) + if (!_returnButtonAdded) { toolbar = new UIToolbar(new RectangleF(0.0f, 0.0f, 50.0f, 44.0f)); diff --git a/XF.Material/Platforms/Ios/Renderers/MaterialButtonRenderer.cs b/XF.Material/Platforms/Ios/Renderers/MaterialButtonRenderer.cs index 7197d67d..902a1099 100644 --- a/XF.Material/Platforms/Ios/Renderers/MaterialButtonRenderer.cs +++ b/XF.Material/Platforms/Ios/Renderers/MaterialButtonRenderer.cs @@ -1,10 +1,9 @@ -using CoreAnimation; -using CoreGraphics; -using Foundation; -using System; +using System; using System.ComponentModel; -using System.Diagnostics; using System.Threading.Tasks; +using CoreAnimation; +using CoreGraphics; +using Foundation; using UIKit; using Xamarin.Forms; using Xamarin.Forms.Platform.iOS; @@ -248,7 +247,7 @@ private void CreateStateAnimations() _colorResting.To = FromObject(_restingBackgroundColor.CGColor); - if(_rippleGestureRecognizer == null) + if (_rippleGestureRecognizer == null) { _rippleGestureRecognizer = new UITapGestureRecognizer() { Delegate = new MaterialRippleGestureRecognizerDelegate(_rippleColor.CGColor) }; this.Control.AddGestureRecognizer(_rippleGestureRecognizer); diff --git a/XF.Material/Platforms/Ios/Renderers/MaterialCircularLoadingViewRenderer.cs b/XF.Material/Platforms/Ios/Renderers/MaterialCircularLoadingViewRenderer.cs index 37f733b2..adfc0fb8 100644 --- a/XF.Material/Platforms/Ios/Renderers/MaterialCircularLoadingViewRenderer.cs +++ b/XF.Material/Platforms/Ios/Renderers/MaterialCircularLoadingViewRenderer.cs @@ -3,8 +3,8 @@ using UIKit; using Xamarin.Forms; using Xamarin.Forms.Platform.iOS; -using XF.Material.iOS.Renderers; using XF.Material.Forms.UI; +using XF.Material.iOS.Renderers; [assembly: ExportRenderer(typeof(MaterialCircularLoadingView), typeof(MaterialCircularLoadingViewRenderer))] namespace XF.Material.iOS.Renderers diff --git a/XF.Material/Platforms/Ios/Renderers/MaterialLabelRenderer.cs b/XF.Material/Platforms/Ios/Renderers/MaterialLabelRenderer.cs index 3c08c488..c56a8d21 100644 --- a/XF.Material/Platforms/Ios/Renderers/MaterialLabelRenderer.cs +++ b/XF.Material/Platforms/Ios/Renderers/MaterialLabelRenderer.cs @@ -1,7 +1,7 @@ -using CoreGraphics; -using Foundation; -using System; +using System; using System.ComponentModel; +using CoreGraphics; +using Foundation; using UIKit; using Xamarin.Forms; using Xamarin.Forms.Platform.iOS; @@ -78,7 +78,7 @@ protected override void OnElementChanged(ElementChangedEventArgs