Skip to content

Commit

Permalink
dotnet format
Browse files Browse the repository at this point in the history
  • Loading branch information
brminnick committed Dec 18, 2024
1 parent 2a66903 commit 6d726d0
Show file tree
Hide file tree
Showing 17 changed files with 124 additions and 55 deletions.
16 changes: 8 additions & 8 deletions samples/CommunityToolkit.Maui.Sample/MauiProgram.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ namespace CommunityToolkit.Maui.Sample;

public static class MauiProgram
{
[RequiresUnreferencedCode($"{nameof(CommunityToolkit.Maui.Views.Expander)} and {nameof(TouchBehaviorCollectionViewMultipleSelectionPage)} are not type safe")]
public static MauiApp CreateMauiApp()
[RequiresUnreferencedCode($"{nameof(CommunityToolkit.Maui.Views.Expander)} and {nameof(TouchBehaviorCollectionViewMultipleSelectionPage)} are not type safe")]
public static MauiApp CreateMauiApp()
{
var builder = MauiApp.CreateBuilder()
#if DEBUG
Expand All @@ -69,13 +69,13 @@ public static MauiApp CreateMauiApp()
.UseMauiCommunityToolkitCamera()
.UseMauiCommunityToolkitMediaElement()

.ConfigureMauiHandlers(handlers =>
{
.ConfigureMauiHandlers(handlers =>
{
#if IOS || MACCATALYST
handlers.AddHandler<CollectionView, Microsoft.Maui.Controls.Handlers.Items2.CollectionViewHandler2>();
handlers.AddHandler<CarouselView, Microsoft.Maui.Controls.Handlers.Items2.CarouselViewHandler2>();
handlers.AddHandler<CarouselView, Microsoft.Maui.Controls.Handlers.Items2.CarouselViewHandler2>();
#endif
})
})

#if WINDOWS
.UseMauiCommunityToolkitMaps("KEY") // You should add your own key here from https://bingmapsportal.com
Expand Down Expand Up @@ -134,8 +134,8 @@ public static MauiApp CreateMauiApp()
return builder.Build();
}

[RequiresUnreferencedCode("Calls CommunityToolkit.Maui.Sample.MauiProgram.AddTransientWithShellRoute<TPage, TViewModel>()")]
static void RegisterViewsAndViewModels(in IServiceCollection services)
[RequiresUnreferencedCode("Calls CommunityToolkit.Maui.Sample.MauiProgram.AddTransientWithShellRoute<TPage, TViewModel>()")]
static void RegisterViewsAndViewModels(in IServiceCollection services)
{
// Add Gallery Pages + ViewModels
services.AddTransient<AlertsGalleryPage, AlertsGalleryViewModel>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ async void HandleSelectionChanged(object? sender, SelectionChangedEventArgs e)
[RequiresUnreferencedCode("Calls CommunityToolkit.Maui.Markup.BindableObjectExtensions.Bind<TBindable>(BindableProperty, String, BindingMode, IValueConverter, Object, String, Object, Object, Object)")]
sealed class CreatorsDataTemplate(TouchBehaviorCollectionViewMultipleSelectionViewModel viewModel) : DataTemplate(() => CreateLayout(viewModel))
{
[RequiresUnreferencedCode("Calls CommunityToolkit.Maui.Markup.BindableObjectExtensions.Bind<TBindable>(BindableProperty, String, BindingMode, IValueConverter, Object, String, Object, Object, Object)")]
static VerticalStackLayout CreateLayout(TouchBehaviorCollectionViewMultipleSelectionViewModel viewModel) => new VerticalStackLayout
[RequiresUnreferencedCode("Calls CommunityToolkit.Maui.Markup.BindableObjectExtensions.Bind<TBindable>(BindableProperty, String, BindingMode, IValueConverter, Object, String, Object, Object, Object)")]
static VerticalStackLayout CreateLayout(TouchBehaviorCollectionViewMultipleSelectionViewModel viewModel) => new VerticalStackLayout
{
Children =
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,5 @@ public class AppDelegate : MauiUIApplicationDelegate
#pragma warning disable IL2046
[RequiresUnreferencedCode($"{nameof(MauiProgram.CreateMauiApp)} requires unreferenced code")]
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
#pragma warning restore IL2046
#pragma warning restore IL2046
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ public partial class IconTintColorBehaviorViewModel : BaseViewModel
public partial string ToggleableImageSource { get; private set; } = shieldImageFileName;

[ObservableProperty]
public partial Color? ToggleableIconTintColor { get; private set; } = toggleableColorsEnumerator.Current;
public partial Color? ToggleableIconTintColor { get; private set; } = toggleableColorsEnumerator.Current;

[RelayCommand]
void ToggleImageButton()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@ public partial class StatusBarBehaviorViewModel : BaseViewModel
[NotifyPropertyChangedFor(nameof(StatusBarColor))]
public partial double RedSliderValue { get; set; }

[ObservableProperty]
[NotifyPropertyChangedFor(nameof(StatusBarColor))]
public partial double GreenSliderValue { get; set; }
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(StatusBarColor))]
public partial double GreenSliderValue { get; set; }

[ObservableProperty]
[NotifyPropertyChangedFor(nameof(StatusBarColor))]
public partial double BlueSliderValue { get; set; }
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(StatusBarColor))]
public partial double BlueSliderValue { get; set; }

[ObservableProperty]
[NotifyPropertyChangedFor(nameof(StatusBarColor))]
Expand All @@ -28,9 +28,9 @@ public partial class StatusBarBehaviorViewModel : BaseViewModel
[NotifyPropertyChangedFor(nameof(StatusBarStyle))]
public partial bool IsDarkContentChecked { get; set; } = true;

[ObservableProperty]
[NotifyPropertyChangedFor(nameof(StatusBarStyle))]
public partial bool IsDefaultChecked { get; set; } = true;
[ObservableProperty]
[NotifyPropertyChangedFor(nameof(StatusBarStyle))]
public partial bool IsDefaultChecked { get; set; } = true;

public Color StatusBarColor => Color.FromRgba(RedSliderValue, GreenSliderValue, BlueSliderValue, AlphaSliderValue);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,46 +5,46 @@ namespace CommunityToolkit.Maui.Sample.ViewModels.PlatformSpecific;

public partial class NavigationBarAndroidViewModel : BaseViewModel
{
[ObservableProperty, NotifyPropertyChangedFor(nameof(NavigationBarColor))]
public partial int RedSliderValue { get; set; }
[ObservableProperty, NotifyPropertyChangedFor(nameof(NavigationBarColor))]
public partial int RedSliderValue { get; set; }

[ObservableProperty, NotifyPropertyChangedFor(nameof(NavigationBarColor))]
public partial int GreenSliderValue { get; set; }
[ObservableProperty, NotifyPropertyChangedFor(nameof(NavigationBarColor))]
public partial int GreenSliderValue { get; set; }

[ObservableProperty, NotifyPropertyChangedFor(nameof(NavigationBarColor))]
public partial int BlueSliderValue { get; set; }
[ObservableProperty, NotifyPropertyChangedFor(nameof(NavigationBarColor))]
public partial int BlueSliderValue { get; set; }

[ObservableProperty, NotifyPropertyChangedFor(nameof(NavigationBarStyle))]
public partial bool IsLightContentChecked { get; set; }
[ObservableProperty, NotifyPropertyChangedFor(nameof(NavigationBarStyle))]
public partial bool IsLightContentChecked { get; set; }

[ObservableProperty, NotifyPropertyChangedFor(nameof(NavigationBarStyle))]
public partial bool IsDarkContentChecked { get; set; }
[ObservableProperty, NotifyPropertyChangedFor(nameof(NavigationBarStyle))]
public partial bool IsDarkContentChecked { get; set; }

[ObservableProperty, NotifyPropertyChangedFor(nameof(NavigationBarStyle))]
public partial bool IsDefaultChecked { get; set; } = true;
[ObservableProperty, NotifyPropertyChangedFor(nameof(NavigationBarStyle))]
public partial bool IsDefaultChecked { get; set; } = true;

public Color NavigationBarColor => Color.FromRgb(RedSliderValue, GreenSliderValue, BlueSliderValue);
public Color NavigationBarColor => Color.FromRgb(RedSliderValue, GreenSliderValue, BlueSliderValue);

public NavigationBarStyle NavigationBarStyle
{
get
{
if (IsDefaultChecked)
{
return NavigationBarStyle.Default;
}
public NavigationBarStyle NavigationBarStyle
{
get
{
if (IsDefaultChecked)
{
return NavigationBarStyle.Default;
}

if (IsLightContentChecked)
{
return NavigationBarStyle.LightContent;
}
if (IsLightContentChecked)
{
return NavigationBarStyle.LightContent;
}

if (IsDarkContentChecked)
{
return NavigationBarStyle.DarkContent;
}
if (IsDarkContentChecked)
{
return NavigationBarStyle.DarkContent;
}

throw new NotSupportedException($"{nameof(NavigationBarStyle)} {NavigationBarStyle} is not supported.");
}
}
throw new NotSupportedException($"{nameof(NavigationBarStyle)} {NavigationBarStyle} is not supported.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ static void CreateNotificationChannel(NotificationManager notificationMnaManager
[MemberNotNull(nameof(mediaSession))]
[MemberNotNull(nameof(token))]
[MemberNotNull(nameof(receiveUpdates))]
[Obsolete]
ValueTask StartForegroundService(Intent mediaManagerIntent, CancellationToken cancellationToken = default)
{
ArgumentNullException.ThrowIfNull(mediaManagerIntent);
Expand Down Expand Up @@ -223,6 +224,8 @@ public override void OnDestroy()
Platform.CurrentActivity?.StopService(new Intent(Platform.AppContext, typeof(MediaControlsService)));
base.OnDestroy();
}

[Obsolete]
static void BroadcastUpdate(string receiver, string action)
{
if (Build.VERSION.SdkInt >= BuildVersionCodes.Tiramisu)
Expand All @@ -234,6 +237,7 @@ static void BroadcastUpdate(string receiver, string action)
LocalBroadcastManager.GetInstance(Platform.AppContext).SendBroadcast(intent);
}

[Obsolete]
protected override void Dispose(bool disposing)
{
if (!isDisposed)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ namespace CommunityToolkit.Maui.Core.Views;
/// </summary>
public class MauiMediaElement : CoordinatorLayout
{
[Obsolete]
readonly StyledPlayerView playerView;
int defaultSystemUiVisibility;
bool isSystemBarVisible;
Expand All @@ -35,6 +36,7 @@ public MauiMediaElement(nint ptr, JniHandleOwnership jni) : base(Platform.AppCon
/// </summary>
/// <param name="context">The application's <see cref="Context"/>.</param>
/// <param name="playerView">The <see cref="StyledPlayerView"/> that acts as the platform media player.</param>
[Obsolete]
public MauiMediaElement(Context context, StyledPlayerView playerView) : base(context)
{
this.playerView = playerView;
Expand All @@ -55,6 +57,7 @@ public MauiMediaElement(Context context, StyledPlayerView playerView) : base(con
AddView(relativeLayout);
}

[Obsolete]
public override void OnDetachedFromWindow()
{
if (isFullScreen)
Expand Down Expand Up @@ -102,6 +105,7 @@ protected override void Dispose(bool disposing)
base.Dispose(disposing);
}

[Obsolete]
void OnFullscreenButtonClick(object? sender, StyledPlayerView.FullscreenButtonClickEventArgs e)
{
// Ensure there is a player view
Expand Down
Loading

0 comments on commit 6d726d0

Please sign in to comment.