diff --git a/Samples/MaterialMvvmSample.Android/MainActivity.cs b/Samples/MaterialMvvmSample.Android/MainActivity.cs index b3f5bf16..cca726db 100644 --- a/Samples/MaterialMvvmSample.Android/MainActivity.cs +++ b/Samples/MaterialMvvmSample.Android/MainActivity.cs @@ -22,7 +22,7 @@ protected override void OnCreate(Bundle savedInstanceState) var app = CommonServiceLocator.ServiceLocator.Current.GetInstance(); - this.LoadApplication(app); + LoadApplication(app); } public override void OnBackPressed() diff --git a/Samples/MaterialMvvmSample.Core/AppContainer.cs b/Samples/MaterialMvvmSample.Core/AppContainer.cs index 961b460e..ec8580e4 100644 --- a/Samples/MaterialMvvmSample.Core/AppContainer.cs +++ b/Samples/MaterialMvvmSample.Core/AppContainer.cs @@ -15,7 +15,7 @@ public void Setup() { var containerBuilder = new ContainerBuilder(); - this.RegisterServices(containerBuilder); + RegisterServices(containerBuilder); var container = containerBuilder.Build(); diff --git a/Samples/MaterialMvvmSample.iOS/AppDelegate.cs b/Samples/MaterialMvvmSample.iOS/AppDelegate.cs index 4027f560..b58d8c8e 100644 --- a/Samples/MaterialMvvmSample.iOS/AppDelegate.cs +++ b/Samples/MaterialMvvmSample.iOS/AppDelegate.cs @@ -15,7 +15,7 @@ public override bool FinishedLaunching(UIApplication uiApplication, NSDictionary var appContainer = new PlatformContainer(); appContainer.Setup(); - this.LoadApplication(CommonServiceLocator.ServiceLocator.Current.GetInstance()); + LoadApplication(CommonServiceLocator.ServiceLocator.Current.GetInstance()); return base.FinishedLaunching(uiApplication, launchOptions); } diff --git a/Samples/MaterialMvvmSample.iOS/Main.cs b/Samples/MaterialMvvmSample.iOS/Main.cs index 5a339dc1..ffbe01df 100644 --- a/Samples/MaterialMvvmSample.iOS/Main.cs +++ b/Samples/MaterialMvvmSample.iOS/Main.cs @@ -5,7 +5,7 @@ namespace MaterialMvvmSample.iOS public class Application { // This is the main entry point of the application. - static void Main(string[] args) + private static void Main(string[] args) { // if you want to use a different Application Delegate class from "AppDelegate" // you can specify it here. diff --git a/Samples/MaterialMvvmSample/App.xaml.cs b/Samples/MaterialMvvmSample/App.xaml.cs index b93f27ff..d7343037 100644 --- a/Samples/MaterialMvvmSample/App.xaml.cs +++ b/Samples/MaterialMvvmSample/App.xaml.cs @@ -10,7 +10,7 @@ public partial class App : Application { public App(INavigationService navigationService) { - this.InitializeComponent(); + InitializeComponent(); XF.Material.Forms.Material.Init(this, "Material.Style"); diff --git a/Samples/MaterialMvvmSample/Controls/CustomNavigationPage.cs b/Samples/MaterialMvvmSample/Controls/CustomNavigationPage.cs index d99451ed..d7118115 100644 --- a/Samples/MaterialMvvmSample/Controls/CustomNavigationPage.cs +++ b/Samples/MaterialMvvmSample/Controls/CustomNavigationPage.cs @@ -19,35 +19,35 @@ public CustomNavigationPage(string rootViewName, object parameter = null) : base public async Task PopViewAsync() { - await this.Navigation.PopAsync(true); + await Navigation.PopAsync(true); } public async Task PushViewAsync(string rootViewName, object parameter = null) { _currentNavigationParameter = parameter; var view = ViewFactory.GetView(rootViewName); - await this.Navigation.PushAsync(view, true); + await Navigation.PushAsync(view, true); } public async Task PushModalAsync(string rootViewName, object parameter = null) { _currentNavigationParameter = parameter; var view = ViewFactory.GetView(rootViewName); - await this.Navigation.PushModalAsync(view, true); + await Navigation.PushModalAsync(view, true); } public async Task PopModalAsync() { - await this.Navigation.PopModalAsync(true); + await Navigation.PopModalAsync(true); } protected override void OnPropertyChanged([CallerMemberName] string propertyName = null) { base.OnPropertyChanged(propertyName); - if (propertyName == nameof(this.RootPage) && this.RootPage != null) + if (propertyName == nameof(RootPage) && RootPage != null) { - this.RootPage.Appearing += this.AppearingHandler; + RootPage.Appearing += AppearingHandler; } } @@ -55,7 +55,11 @@ protected override void OnPagePush(Page page) { base.OnPagePush(page); - if (!(page.BindingContext is BaseViewModel viewModel)) return; + if (!(page.BindingContext is BaseViewModel viewModel)) + { + return; + } + viewModel?.OnViewPushed(_currentNavigationParameter); _currentNavigationParameter = null; } @@ -72,10 +76,10 @@ protected override void OnPagePop(Page previousPage, Page poppedPage) private void AppearingHandler(object sender, EventArgs e) { - var viewModel = this.RootPage.BindingContext as BaseViewModel; + var viewModel = RootPage.BindingContext as BaseViewModel; viewModel?.OnViewPushed(_currentNavigationParameter); _currentNavigationParameter = null; - this.RootPage.Appearing -= this.AppearingHandler; + RootPage.Appearing -= AppearingHandler; } } } diff --git a/Samples/MaterialMvvmSample/ViewModels/BaseViewModel.cs b/Samples/MaterialMvvmSample/ViewModels/BaseViewModel.cs index 84699259..de9cc5ca 100644 --- a/Samples/MaterialMvvmSample/ViewModels/BaseViewModel.cs +++ b/Samples/MaterialMvvmSample/ViewModels/BaseViewModel.cs @@ -11,8 +11,8 @@ public abstract class BaseViewModel : PropertyChangeAware, ICleanUp protected BaseViewModel() { - this.ServiceLocator = CommonServiceLocator.ServiceLocator.Current; - this.Navigation = this.ServiceLocator.GetInstance(); + ServiceLocator = CommonServiceLocator.ServiceLocator.Current; + Navigation = ServiceLocator.GetInstance(); } /// @@ -26,7 +26,7 @@ public virtual void OnViewPushed(object navigationParameter = null) { } /// public virtual void OnViewPopped() { - this.CleanUp(); + CleanUp(); } public virtual void CleanUp() { } diff --git a/Samples/MaterialMvvmSample/ViewModels/MainViewModel.cs b/Samples/MaterialMvvmSample/ViewModels/MainViewModel.cs index d6670409..fe479b32 100644 --- a/Samples/MaterialMvvmSample/ViewModels/MainViewModel.cs +++ b/Samples/MaterialMvvmSample/ViewModels/MainViewModel.cs @@ -21,7 +21,7 @@ public MainViewModel(IJobDialogService dialogService) { _dialogService = dialogService; - this.Models = new ObservableCollection() + Models = new ObservableCollection() { new TestModel { @@ -39,7 +39,7 @@ public MainViewModel(IJobDialogService dialogService) Id = Guid.NewGuid().ToString("N") } }; - this.SelectedFilters = new List(); + SelectedFilters = new List(); } public Color PrimaryColor => Color.Red; @@ -62,8 +62,8 @@ public string SelectedChoice get => _selectedChoice; set { - this.HasError = string.Equals(value, Choices[0]); - this.Set(ref _selectedChoice, value); + HasError = string.Equals(value, Choices[0]); + Set(ref _selectedChoice, value); } } @@ -71,16 +71,16 @@ public string SelectedChoice public bool HasError { get => _hasError; - set => this.Set(ref _hasError, value); + set => Set(ref _hasError, value); } public static string[] Filters => new string[] { "None", "Alhpabetical" }; public string[] ListActions => new string[] { "Add job", "Sort" }; - public ICommand ListMenuCommand => new Command(async (s) => await this.ListMenuSelected(s)); + public ICommand ListMenuCommand => new Command(async (s) => await ListMenuSelected(s)); - public ICommand MenuCommand => new Command(async (s) => await this.MenuSelected(s)); + public ICommand MenuCommand => new Command(async (s) => await MenuSelected(s)); public ICommand FiltersSelectedCommand => new Command((s) => { @@ -98,18 +98,18 @@ public bool HasError "ERNI Development Center Philippines, Inc., Bern, Switzerland" }; - public ICommand JobSelectedCommand => new Command(async (s) => await this.ViewItemSelected(s)); + public ICommand JobSelectedCommand => new Command(async (s) => await ViewItemSelected(s)); public ICommand EmailFocusCommand => new Command((s) => { - if (!s && this.Email?.Length > 3) + if (!s && Email?.Length > 3) { - this.EmailHasError = true; + EmailHasError = true; } - else if (!s && this.Email?.Length <= 3) + else if (!s && Email?.Length <= 3) { - this.EmailHasError = false; + EmailHasError = false; } }); @@ -117,28 +117,28 @@ public bool HasError public bool EmailHasError { get => _emailHasError; - set => this.Set(ref _emailHasError, value); + set => Set(ref _emailHasError, value); } private string _email; public string Email { get => _email; - set => this.Set(ref _email, value); + set => Set(ref _email, value); } private ObservableCollection _models; public ObservableCollection Models { get => _models; - set => this.Set(ref _models, value); + set => Set(ref _models, value); } private List _selectedFilters; public List SelectedFilters { get => _selectedFilters; - set => this.Set(ref _selectedFilters, value); + set => Set(ref _selectedFilters, value); } private async Task ListMenuSelected(MaterialMenuResult s) @@ -149,13 +149,13 @@ private async Task ListMenuSelected(MaterialMenuResult s) { var result = await _dialogService.AddNewJob(); - if (this.Models.Any(m => m.Title == result)) + if (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); + Models.Where(m => m.IsNew).ForEach(m => m.IsNew = false); var model = new TestModel { @@ -164,30 +164,30 @@ private async Task ListMenuSelected(MaterialMenuResult s) IsNew = true }; - this.Models.Add(model); + Models.Add(model); } break; } case 1: - this.Models = new ObservableCollection(this.Models.OrderBy(m => m.Title)); + Models = new ObservableCollection(Models.OrderBy(m => m.Title)); break; case 2: - this.SelectedFilters = new List(); + SelectedFilters = new List(); break; } } private async Task ViewItemSelected(string id) { - var selectedModel = this.Models.FirstOrDefault(m => m.Id == id); + var selectedModel = Models.FirstOrDefault(m => m.Id == id); - await this.Navigation.PushAsync(ViewNames.SecondView, selectedModel); + await Navigation.PushAsync(ViewNames.SecondView, selectedModel); } private async Task MenuSelected(MaterialMenuResult i) { - var model = this.Models.FirstOrDefault(m => m.Title == (string)i.Parameter); + var model = Models.FirstOrDefault(m => m.Title == (string)i.Parameter); switch (i.Index) { @@ -213,7 +213,7 @@ private async Task MenuSelected(MaterialMenuResult i) if (confirmed == true) { - this.Models.Remove(model); + Models.Remove(model); await _dialogService.JobDeleted(); } @@ -234,19 +234,19 @@ public class TestModel : PropertyChangeAware public string Id { get => _id; - set => this.Set(ref _id, value); + set => Set(ref _id, value); } public string Title { get => _title; - set => this.Set(ref _title, value); + set => Set(ref _title, value); } public bool IsNew { get => _isNew; - set => this.Set(ref _isNew, value); + set => Set(ref _isNew, value); } } } \ No newline at end of file diff --git a/Samples/MaterialMvvmSample/ViewModels/PropertyChangeAware.cs b/Samples/MaterialMvvmSample/ViewModels/PropertyChangeAware.cs index 475e2220..cec9a710 100644 --- a/Samples/MaterialMvvmSample/ViewModels/PropertyChangeAware.cs +++ b/Samples/MaterialMvvmSample/ViewModels/PropertyChangeAware.cs @@ -27,15 +27,19 @@ public abstract class PropertyChangeAware : INotifyPropertyChanged { if (!EqualityComparer.Default.Equals(field, default(T))) { - if (field.Equals(newValue)) return; + if (field.Equals(newValue)) + { + return; + } + field = newValue; - this.OnPropertyChanged(propertyName); + OnPropertyChanged(propertyName); } else if (!EqualityComparer.Default.Equals(newValue, default(T))) { field = newValue; - this.OnPropertyChanged(propertyName); + OnPropertyChanged(propertyName); } } @@ -45,7 +49,7 @@ public abstract class PropertyChangeAware : INotifyPropertyChanged /// The name of the property who's value has changed. protected virtual void OnPropertyChanged([CallerMemberName]string propertyName = null) { - this.PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); + PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); } } } diff --git a/Samples/MaterialMvvmSample/ViewModels/SecondViewModel.cs b/Samples/MaterialMvvmSample/ViewModels/SecondViewModel.cs index 2a059361..532706d9 100644 --- a/Samples/MaterialMvvmSample/ViewModels/SecondViewModel.cs +++ b/Samples/MaterialMvvmSample/ViewModels/SecondViewModel.cs @@ -6,13 +6,13 @@ public class SecondViewModel : BaseViewModel public string JobTitle { get => _jobTitle; - set => this.Set(ref _jobTitle, value); + set => Set(ref _jobTitle, value); } public override void OnViewPushed(object navigationParameter = null) { var selectedJob = (TestModel)navigationParameter; - this.JobTitle = selectedJob?.Title; + JobTitle = selectedJob?.Title; } } } diff --git a/Samples/MaterialMvvmSample/Views/BaseView.cs b/Samples/MaterialMvvmSample/Views/BaseView.cs index ddb89633..8ac4f883 100644 --- a/Samples/MaterialMvvmSample/Views/BaseView.cs +++ b/Samples/MaterialMvvmSample/Views/BaseView.cs @@ -11,9 +11,9 @@ public abstract class BaseView : ContentPage where TViewModel : Base protected BaseView() { - this.ViewModel = CommonServiceLocator.ServiceLocator.Current.GetInstance(); - this.BindingContext = this.ViewModel; - this.On().SetUseSafeArea(true); + ViewModel = CommonServiceLocator.ServiceLocator.Current.GetInstance(); + BindingContext = ViewModel; + On().SetUseSafeArea(true); } } } diff --git a/Samples/MaterialMvvmSample/Views/MainView.xaml.cs b/Samples/MaterialMvvmSample/Views/MainView.xaml.cs index 93affb80..4a60685b 100644 --- a/Samples/MaterialMvvmSample/Views/MainView.xaml.cs +++ b/Samples/MaterialMvvmSample/Views/MainView.xaml.cs @@ -8,7 +8,7 @@ public partial class MainView : BaseMainView { public MainView() { - this.InitializeComponent(); + InitializeComponent(); } } diff --git a/Samples/MaterialMvvmSample/Views/SecondView.xaml.cs b/Samples/MaterialMvvmSample/Views/SecondView.xaml.cs index ac0d435b..976d2125 100644 --- a/Samples/MaterialMvvmSample/Views/SecondView.xaml.cs +++ b/Samples/MaterialMvvmSample/Views/SecondView.xaml.cs @@ -8,7 +8,7 @@ public partial class SecondView : BaseSecondView { public SecondView() { - this.InitializeComponent(); + InitializeComponent(); } } diff --git a/XF.Material/FormsResources/MaterialColorConfiguration.cs b/XF.Material/FormsResources/MaterialColorConfiguration.cs index dddedcdb..904a6610 100644 --- a/XF.Material/FormsResources/MaterialColorConfiguration.cs +++ b/XF.Material/FormsResources/MaterialColorConfiguration.cs @@ -73,8 +73,8 @@ public sealed class MaterialColorConfiguration : BindableObject /// public Color Background { - get => (Color)this.GetValue(BackgroundProperty); - set => this.SetValue(BackgroundProperty, value); + get => (Color)GetValue(BackgroundProperty); + set => SetValue(BackgroundProperty, value); } /// @@ -82,8 +82,8 @@ public Color Background /// public Color Error { - get => (Color)this.GetValue(ErrorProperty); - set => this.SetValue(ErrorProperty, value); + get => (Color)GetValue(ErrorProperty); + set => SetValue(ErrorProperty, value); } /// @@ -91,8 +91,8 @@ public Color Error /// public Color OnBackground { - get => (Color)this.GetValue(OnBackgroundProperty); - set => this.SetValue(OnBackgroundProperty, value); + get => (Color)GetValue(OnBackgroundProperty); + set => SetValue(OnBackgroundProperty, value); } /// @@ -100,8 +100,8 @@ public Color OnBackground /// public Color OnError { - get => (Color)this.GetValue(OnErrorProperty); - set => this.SetValue(OnErrorProperty, value); + get => (Color)GetValue(OnErrorProperty); + set => SetValue(OnErrorProperty, value); } /// @@ -109,8 +109,8 @@ public Color OnError /// public Color OnPrimary { - get => (Color)this.GetValue(OnPrimaryProperty); - set => this.SetValue(OnPrimaryProperty, value); + get => (Color)GetValue(OnPrimaryProperty); + set => SetValue(OnPrimaryProperty, value); } /// @@ -120,12 +120,12 @@ public Color OnSecondary { get { - var color = (Color)this.GetValue(OnSecondaryProperty); + var color = (Color)GetValue(OnSecondaryProperty); - return color.IsDefault ? this.OnPrimary : color; + return color.IsDefault ? OnPrimary : color; } - set => this.SetValue(OnSecondaryProperty, value); + set => SetValue(OnSecondaryProperty, value); } /// @@ -133,8 +133,8 @@ public Color OnSecondary /// public Color OnSurface { - get => (Color)this.GetValue(OnSurfaceProperty); - set => this.SetValue(OnSurfaceProperty, value); + get => (Color)GetValue(OnSurfaceProperty); + set => SetValue(OnSurfaceProperty, value); } /// @@ -142,8 +142,8 @@ public Color OnSurface /// public Color Primary { - get => (Color)this.GetValue(PrimaryProperty); - set => this.SetValue(PrimaryProperty, value); + get => (Color)GetValue(PrimaryProperty); + set => SetValue(PrimaryProperty, value); } /// @@ -151,8 +151,8 @@ public Color Primary /// public Color PrimaryVariant { - get => (Color)this.GetValue(PrimaryVariantProperty); - set => this.SetValue(PrimaryVariantProperty, value); + get => (Color)GetValue(PrimaryVariantProperty); + set => SetValue(PrimaryVariantProperty, value); } /// @@ -163,16 +163,16 @@ public Color Secondary { get { - var color = (Color)this.GetValue(SecondaryProperty); + var color = (Color)GetValue(SecondaryProperty); - if (color.IsDefault && this.Primary.IsDefault) + if (color.IsDefault && Primary.IsDefault) { return Color.Accent; } - return color.IsDefault ? this.Primary : color; + return color.IsDefault ? Primary : color; } - set => this.SetValue(SecondaryProperty, value); + set => SetValue(SecondaryProperty, value); } /// @@ -180,8 +180,8 @@ public Color Secondary /// public Color SecondaryVariant { - get => (Color)this.GetValue(SecondaryVariantProperty); - set => this.SetValue(SecondaryVariantProperty, value); + get => (Color)GetValue(SecondaryVariantProperty); + set => SetValue(SecondaryVariantProperty, value); } /// @@ -189,8 +189,8 @@ public Color SecondaryVariant /// public Color Surface { - get => (Color)this.GetValue(SurfaceProperty); - set => this.SetValue(SurfaceProperty, value); + get => (Color)GetValue(SurfaceProperty); + set => SetValue(SurfaceProperty, value); } } } diff --git a/XF.Material/FormsResources/MaterialColors.xaml.cs b/XF.Material/FormsResources/MaterialColors.xaml.cs index de09ee3b..29ce1048 100644 --- a/XF.Material/FormsResources/MaterialColors.xaml.cs +++ b/XF.Material/FormsResources/MaterialColors.xaml.cs @@ -8,24 +8,24 @@ public partial class MaterialColors : ResourceDictionary { internal MaterialColors(MaterialColorConfiguration materialColor) { - this.InitializeComponent(); - this.SetColors(materialColor); + InitializeComponent(); + SetColors(materialColor); } private void SetColors(MaterialColorConfiguration materialColor) { - this.TryAddColorResource(MaterialConstants.Color.PRIMARY, materialColor.Primary); - this.TryAddColorResource(MaterialConstants.Color.PRIMARY_VARIANT, materialColor.PrimaryVariant); - this.TryAddColorResource(MaterialConstants.Color.ON_PRIMARY, materialColor.OnPrimary); - this.TryAddColorResource(MaterialConstants.Color.SECONDARY, materialColor.Secondary); - this.TryAddColorResource(MaterialConstants.Color.SECONDARY_VARIANT, materialColor.SecondaryVariant); - this.TryAddColorResource(MaterialConstants.Color.ON_SECONDARY, materialColor.OnSecondary); - this.TryAddColorResource(MaterialConstants.Color.BACKGROUND, materialColor.Background); - this.TryAddColorResource(MaterialConstants.Color.ON_BACKGROUND, materialColor.OnBackground); - this.TryAddColorResource(MaterialConstants.Color.SURFACE, materialColor.Surface); - this.TryAddColorResource(MaterialConstants.Color.ON_SURFACE, materialColor.OnSurface); - this.TryAddColorResource(MaterialConstants.Color.ERROR, materialColor.Error); - this.TryAddColorResource(MaterialConstants.Color.ON_ERROR, materialColor.OnError); + TryAddColorResource(MaterialConstants.Color.PRIMARY, materialColor.Primary); + TryAddColorResource(MaterialConstants.Color.PRIMARY_VARIANT, materialColor.PrimaryVariant); + TryAddColorResource(MaterialConstants.Color.ON_PRIMARY, materialColor.OnPrimary); + TryAddColorResource(MaterialConstants.Color.SECONDARY, materialColor.Secondary); + TryAddColorResource(MaterialConstants.Color.SECONDARY_VARIANT, materialColor.SecondaryVariant); + TryAddColorResource(MaterialConstants.Color.ON_SECONDARY, materialColor.OnSecondary); + TryAddColorResource(MaterialConstants.Color.BACKGROUND, materialColor.Background); + TryAddColorResource(MaterialConstants.Color.ON_BACKGROUND, materialColor.OnBackground); + TryAddColorResource(MaterialConstants.Color.SURFACE, materialColor.Surface); + TryAddColorResource(MaterialConstants.Color.ON_SURFACE, materialColor.OnSurface); + TryAddColorResource(MaterialConstants.Color.ERROR, materialColor.Error); + TryAddColorResource(MaterialConstants.Color.ON_ERROR, materialColor.OnError); } private void TryAddColorResource(string key, Color color) @@ -35,7 +35,7 @@ private void TryAddColorResource(string key, Color color) return; } - this.Add(key, color); + Add(key, color); } } } \ No newline at end of file diff --git a/XF.Material/FormsResources/MaterialConfiguration.cs b/XF.Material/FormsResources/MaterialConfiguration.cs index 00748edc..ccec9729 100644 --- a/XF.Material/FormsResources/MaterialConfiguration.cs +++ b/XF.Material/FormsResources/MaterialConfiguration.cs @@ -24,8 +24,8 @@ public class MaterialConfiguration : BindableObject /// public MaterialFontConfiguration FontConfiguration { - get => (MaterialFontConfiguration)this.GetValue(FontConfigurationProperty); - set => this.SetValue(FontConfigurationProperty, value); + get => (MaterialFontConfiguration)GetValue(FontConfigurationProperty); + set => SetValue(FontConfigurationProperty, value); } /// @@ -33,8 +33,8 @@ public MaterialFontConfiguration FontConfiguration /// public MaterialColorConfiguration ColorConfiguration { - get => (MaterialColorConfiguration)this.GetValue(ColorConfigurationProperty); - set => this.SetValue(ColorConfigurationProperty, value); + get => (MaterialColorConfiguration)GetValue(ColorConfigurationProperty); + set => SetValue(ColorConfigurationProperty, value); } } } diff --git a/XF.Material/FormsResources/MaterialSizes.xaml.cs b/XF.Material/FormsResources/MaterialSizes.xaml.cs index 1765b8f5..ea6e4abc 100644 --- a/XF.Material/FormsResources/MaterialSizes.xaml.cs +++ b/XF.Material/FormsResources/MaterialSizes.xaml.cs @@ -8,7 +8,7 @@ public partial class MaterialSizes : ResourceDictionary { public MaterialSizes() { - this.InitializeComponent(); + InitializeComponent(); } } } \ No newline at end of file diff --git a/XF.Material/FormsResources/Typography/MaterialFontConfiguration.cs b/XF.Material/FormsResources/Typography/MaterialFontConfiguration.cs index 49d3e88f..440b03d6 100644 --- a/XF.Material/FormsResources/Typography/MaterialFontConfiguration.cs +++ b/XF.Material/FormsResources/Typography/MaterialFontConfiguration.cs @@ -77,8 +77,8 @@ public sealed class MaterialFontConfiguration : BindableObject /// public string Body1 { - get => this.GetValue(Body1Property)?.ToString(); - set => this.SetValue(Body1Property, value); + get => GetValue(Body1Property)?.ToString(); + set => SetValue(Body1Property, value); } /// @@ -86,8 +86,8 @@ public string Body1 /// public string Body2 { - get => this.GetValue(H1Property)?.ToString(); - set => this.SetValue(H1Property, value); + get => GetValue(H1Property)?.ToString(); + set => SetValue(H1Property, value); } /// @@ -95,8 +95,8 @@ public string Body2 /// public string Button { - get => this.GetValue(ButtonProperty)?.ToString(); - set => this.SetValue(ButtonProperty, value); + get => GetValue(ButtonProperty)?.ToString(); + set => SetValue(ButtonProperty, value); } /// @@ -104,8 +104,8 @@ public string Button /// public string Caption { - get => this.GetValue(CaptionProperty)?.ToString(); - set => this.SetValue(CaptionProperty, value); + get => GetValue(CaptionProperty)?.ToString(); + set => SetValue(CaptionProperty, value); } /// @@ -113,8 +113,8 @@ public string Caption /// public string H1 { - get => this.GetValue(H1Property)?.ToString(); - set => this.SetValue(H1Property, value); + get => GetValue(H1Property)?.ToString(); + set => SetValue(H1Property, value); } /// @@ -122,8 +122,8 @@ public string H1 /// public string H2 { - get => this.GetValue(H2Property)?.ToString(); - set => this.SetValue(H2Property, value); + get => GetValue(H2Property)?.ToString(); + set => SetValue(H2Property, value); } /// @@ -131,8 +131,8 @@ public string H2 /// public string H3 { - get => this.GetValue(H3Property)?.ToString(); - set => this.SetValue(H3Property, value); + get => GetValue(H3Property)?.ToString(); + set => SetValue(H3Property, value); } /// @@ -140,8 +140,8 @@ public string H3 /// public string H4 { - get => this.GetValue(H4Property)?.ToString(); - set => this.SetValue(H4Property, value); + get => GetValue(H4Property)?.ToString(); + set => SetValue(H4Property, value); } /// @@ -149,8 +149,8 @@ public string H4 /// public string H5 { - get => this.GetValue(H5Property)?.ToString(); - set => this.SetValue(H5Property, value); + get => GetValue(H5Property)?.ToString(); + set => SetValue(H5Property, value); } /// @@ -158,8 +158,8 @@ public string H5 /// public string H6 { - get => this.GetValue(H6Property)?.ToString(); - set => this.SetValue(H6Property, value); + get => GetValue(H6Property)?.ToString(); + set => SetValue(H6Property, value); } /// @@ -167,8 +167,8 @@ public string H6 /// public string Overline { - get => this.GetValue(OverlineProperty)?.ToString(); - set => this.SetValue(OverlineProperty, value); + get => GetValue(OverlineProperty)?.ToString(); + set => SetValue(OverlineProperty, value); } /// @@ -176,8 +176,8 @@ public string Overline /// public string Subtitle1 { - get => this.GetValue(Subtitle1Property)?.ToString(); - set => this.SetValue(Subtitle1Property, value); + get => GetValue(Subtitle1Property)?.ToString(); + set => SetValue(Subtitle1Property, value); } /// @@ -185,8 +185,8 @@ public string Subtitle1 /// public string Subtitle2 { - get => this.GetValue(Subtitle2Property)?.ToString(); - set => this.SetValue(Subtitle2Property, value); + get => GetValue(Subtitle2Property)?.ToString(); + set => SetValue(Subtitle2Property, value); } } } \ No newline at end of file diff --git a/XF.Material/FormsResources/Typography/MaterialTypography.xaml.cs b/XF.Material/FormsResources/Typography/MaterialTypography.xaml.cs index 35823103..706615ab 100644 --- a/XF.Material/FormsResources/Typography/MaterialTypography.xaml.cs +++ b/XF.Material/FormsResources/Typography/MaterialTypography.xaml.cs @@ -8,27 +8,31 @@ public partial class MaterialTypography : ResourceDictionary { internal MaterialTypography(MaterialFontConfiguration fontFamily) { - this.InitializeComponent(); + InitializeComponent(); - if (fontFamily == null) return; - this.TryAddStringResource(MaterialConstants.FontFamily.H1, fontFamily.H1); - this.TryAddStringResource(MaterialConstants.FontFamily.H2, fontFamily.H2); - this.TryAddStringResource(MaterialConstants.FontFamily.H3, fontFamily.H3); - this.TryAddStringResource(MaterialConstants.FontFamily.H4, fontFamily.H4); - this.TryAddStringResource(MaterialConstants.FontFamily.H5, fontFamily.H5); - this.TryAddStringResource(MaterialConstants.FontFamily.H6, fontFamily.H6); - this.TryAddStringResource(MaterialConstants.FontFamily.SUBTITLE1, fontFamily.Subtitle1); - this.TryAddStringResource(MaterialConstants.FontFamily.SUBTITLE2, fontFamily.Subtitle2); - this.TryAddStringResource(MaterialConstants.FontFamily.BODY1, fontFamily.Body1); - this.TryAddStringResource(MaterialConstants.FontFamily.BODY2, fontFamily.Body2); - this.TryAddStringResource(MaterialConstants.FontFamily.BUTTON, fontFamily.Button); - this.TryAddStringResource(MaterialConstants.FontFamily.CAPTION, fontFamily.Caption); - this.TryAddStringResource(MaterialConstants.FontFamily.OVERLINE, fontFamily.Overline); + if (fontFamily == null) + { + return; + } + + TryAddStringResource(MaterialConstants.FontFamily.H1, fontFamily.H1); + TryAddStringResource(MaterialConstants.FontFamily.H2, fontFamily.H2); + TryAddStringResource(MaterialConstants.FontFamily.H3, fontFamily.H3); + TryAddStringResource(MaterialConstants.FontFamily.H4, fontFamily.H4); + TryAddStringResource(MaterialConstants.FontFamily.H5, fontFamily.H5); + TryAddStringResource(MaterialConstants.FontFamily.H6, fontFamily.H6); + TryAddStringResource(MaterialConstants.FontFamily.SUBTITLE1, fontFamily.Subtitle1); + TryAddStringResource(MaterialConstants.FontFamily.SUBTITLE2, fontFamily.Subtitle2); + TryAddStringResource(MaterialConstants.FontFamily.BODY1, fontFamily.Body1); + TryAddStringResource(MaterialConstants.FontFamily.BODY2, fontFamily.Body2); + TryAddStringResource(MaterialConstants.FontFamily.BUTTON, fontFamily.Button); + TryAddStringResource(MaterialConstants.FontFamily.CAPTION, fontFamily.Caption); + TryAddStringResource(MaterialConstants.FontFamily.OVERLINE, fontFamily.Overline); } private void TryAddStringResource(string key, string value) { - this.Add(key, value); + Add(key, value); } } } \ No newline at end of file diff --git a/XF.Material/Models/MaterialMenuResult.cs b/XF.Material/Models/MaterialMenuResult.cs index 9205f5c9..212ad4f4 100644 --- a/XF.Material/Models/MaterialMenuResult.cs +++ b/XF.Material/Models/MaterialMenuResult.cs @@ -17,8 +17,8 @@ public class MaterialMenuResult internal MaterialMenuResult(int index, object parameter) { - this.Index = index; - this.Parameter = parameter; + Index = index; + Parameter = parameter; } } } diff --git a/XF.Material/Platforms/Android/Renderers/Internals/MaterialBoxViewRenderer.cs b/XF.Material/Platforms/Android/Renderers/Internals/MaterialBoxViewRenderer.cs index 47a427b4..17abb5a0 100644 --- a/XF.Material/Platforms/Android/Renderers/Internals/MaterialBoxViewRenderer.cs +++ b/XF.Material/Platforms/Android/Renderers/Internals/MaterialBoxViewRenderer.cs @@ -19,8 +19,8 @@ public bool OnTouch(Android.Views.View v, MotionEvent e) { var percentageX = e.GetX() / v.Width; var percentageY = e.GetY() / v.Height; - var elementX = percentageX * this.Element.Width; - var elementY = percentageY * this.Element.Height; + var elementX = percentageX * Element.Width; + var elementY = percentageY * Element.Height; _boxView.OnTapped(elementX, elementY); @@ -31,10 +31,14 @@ protected override void OnElementChanged(ElementChangedEventArgs e) { base.OnElementChanged(e); - if (e?.NewElement == null) return; - _boxView = this.Element as MaterialBoxView; - this.ViewGroup.SetOnTouchListener(null); - this.ViewGroup.SetOnTouchListener(this); + if (e?.NewElement == null) + { + return; + } + + _boxView = Element as MaterialBoxView; + ViewGroup.SetOnTouchListener(null); + ViewGroup.SetOnTouchListener(this); } } } \ No newline at end of file diff --git a/XF.Material/Platforms/Android/Renderers/Internals/MaterialDatePickerRenderer.cs b/XF.Material/Platforms/Android/Renderers/Internals/MaterialDatePickerRenderer.cs index 6653cae9..5faee440 100644 --- a/XF.Material/Platforms/Android/Renderers/Internals/MaterialDatePickerRenderer.cs +++ b/XF.Material/Platforms/Android/Renderers/Internals/MaterialDatePickerRenderer.cs @@ -21,8 +21,8 @@ protected override void OnElementChanged(ElementChangedEventArgs e) if (e?.OldElement != null) { - (this.Element as IMaterialElementConfiguration)?.ElementChanged(false); + (Element as IMaterialElementConfiguration)?.ElementChanged(false); } if (e?.NewElement != null) { - (this.Element as IMaterialElementConfiguration)?.ElementChanged(true); + (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 3e7bf1f0..76a2bb1b 100644 --- a/XF.Material/Platforms/Android/Renderers/Internals/MaterialEntryRenderer.cs +++ b/XF.Material/Platforms/Android/Renderers/Internals/MaterialEntryRenderer.cs @@ -27,9 +27,9 @@ protected override void OnElementChanged(ElementChangedEventArgs e) if (e?.NewElement != null) { - this.ChangeCursorColor(); - _materialEntry = this.Element as MaterialEntry; - this.SetControl(); + ChangeCursorColor(); + _materialEntry = Element as MaterialEntry; + SetControl(); } } @@ -39,21 +39,21 @@ protected override void OnElementPropertyChanged(object sender, PropertyChangedE if (e?.PropertyName == nameof(MaterialEntry.TintColor)) { - this.ChangeCursorColor(); + ChangeCursorColor(); } } private void SetControl() { - if (this.Control == null) + if (Control == null) { return; } - this.Control.Background = new ColorDrawable(Color.Transparent.ToAndroid()); - this.Control.SetPadding(0, 0, 0, 0); - this.Control.SetIncludeFontPadding(false); - this.Control.SetMinimumHeight((int)MaterialHelper.ConvertToDp(20)); + Control.Background = new ColorDrawable(Color.Transparent.ToAndroid()); + Control.SetPadding(0, 0, 0, 0); + Control.SetIncludeFontPadding(false); + Control.SetMinimumHeight((int)MaterialHelper.ConvertToDp(20)); //// DEV HINT: This will be used for the future control `MaterialTextArea`. //// This removes the 'Next' button and shows a 'Done' button when the device's orientation is in landscape. @@ -64,7 +64,7 @@ private void SetControl() private void ChangeCursorColor() { - if (this.Control == null) + if (Control == null) { return; } @@ -73,15 +73,15 @@ private void ChangeCursorColor() { var field = Java.Lang.Class.FromType(typeof(Android.Widget.TextView)).GetDeclaredField("mCursorDrawableRes"); field.Accessible = true; - var resId = field.GetInt(this.Control); + var resId = field.GetInt(Control); field = Java.Lang.Class.FromType(typeof(Android.Widget.TextView)).GetDeclaredField("mEditor"); field.Accessible = true; - var cursorDrawable = ContextCompat.GetDrawable(this.Context, resId); - cursorDrawable.SetColorFilter(((MaterialEntry)this.Element).TintColor.ToAndroid(), Android.Graphics.PorterDuff.Mode.SrcIn); + var cursorDrawable = ContextCompat.GetDrawable(Context, resId); + cursorDrawable.SetColorFilter(((MaterialEntry)Element).TintColor.ToAndroid(), Android.Graphics.PorterDuff.Mode.SrcIn); - var editor = field.Get(this.Control); + var editor = field.Get(Control); field = editor.Class.GetDeclaredField("mCursorDrawable"); field.Accessible = true; field.Set(editor, new[] { cursorDrawable, cursorDrawable }); @@ -94,11 +94,11 @@ private void ChangeCursorColor() public bool OnEditorAction(TextView v, [GeneratedEnum] ImeAction actionId, KeyEvent e) { - var currentFocus = (this.Context as Activity).CurrentFocus; + var currentFocus = (Context as Activity).CurrentFocus; if (currentFocus != null) { - var inputMethodManager = (InputMethodManager)(this.Context as Activity).GetSystemService(Context.InputMethodService); + var inputMethodManager = (InputMethodManager)(Context as Activity).GetSystemService(Context.InputMethodService); inputMethodManager.HideSoftInputFromWindow(currentFocus.WindowToken, HideSoftInputFlags.None); } diff --git a/XF.Material/Platforms/Android/Renderers/MaterialButtonRenderer.cs b/XF.Material/Platforms/Android/Renderers/MaterialButtonRenderer.cs index 091a5050..2df1ec06 100644 --- a/XF.Material/Platforms/Android/Renderers/MaterialButtonRenderer.cs +++ b/XF.Material/Platforms/Android/Renderers/MaterialButtonRenderer.cs @@ -25,45 +25,55 @@ protected override void OnElementChanged(ElementChangedEventArgs