Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Upd sample #130

Merged
merged 2 commits into from
Oct 31, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion Sample/App.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:windows="clr-namespace:Microsoft.Maui.Controls.PlatformConfiguration.WindowsSpecific;assembly=Microsoft.Maui.Controls"
x:Class="Sample.Maui.App"
x:Class="Sample.App"
windows:Application.ImageDirectory="Assets">
<Application.Resources>
<ResourceDictionary>
Expand Down
6 changes: 3 additions & 3 deletions Sample/App.xaml.cs
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
using Sample.Maui.ViewModels;
using Sample.Maui.Views;
using Sample.ViewModels;
using Sample.Views;

namespace Sample.Maui;
namespace Sample;

public partial class App
{
Expand Down
8 changes: 4 additions & 4 deletions Sample/Helpers/BaseNotifier.cs
Original file line number Diff line number Diff line change
@@ -1,16 +1,16 @@
using System.ComponentModel;
using System.Runtime.CompilerServices;

namespace Sample.Maui.Helpers;
namespace Sample.Helpers;

public class BaseNotifier : INotifyPropertyChanged
{
public event PropertyChangedEventHandler PropertyChanged;
public event PropertyChangedEventHandler? PropertyChanged;

protected virtual void OnPropertyChanged([CallerMemberName] string propertyName = null)
protected virtual void OnPropertyChanged([CallerMemberName] string? propertyName = null)
=> OnPropertiesChanged(propertyName);

protected virtual void OnPropertiesChanged(params string[] propertiesNames)
protected virtual void OnPropertiesChanged(params string?[] propertiesNames)
{
if (propertiesNames?.Length > 0)
foreach(var name in propertiesNames)
Expand Down
8 changes: 4 additions & 4 deletions Sample/Helpers/EmbeddedResourceProvider.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System.Reflection;

namespace Sample.Maui.Helpers;
namespace Sample.Helpers;

public static class EmbeddedMedia
{
Expand All @@ -15,7 +15,7 @@ public static class EmbeddedResourceProvider
static readonly Assembly assembly = typeof(EmbeddedResourceProvider).GetTypeInfo().Assembly;
static readonly string[] resources = assembly.GetManifestResourceNames();

public static Stream Load(string name)
public static Stream? Load(string? name)
{
name = GetFullName(name);

Expand All @@ -25,7 +25,7 @@ public static Stream Load(string name)
return assembly.GetManifestResourceStream(name);
}

public static ImageSource GetImageSource(string name)
public static ImageSource? GetImageSource(string? name)
{
name = GetFullName(name);

Expand All @@ -35,6 +35,6 @@ public static ImageSource GetImageSource(string name)
return ImageSource.FromResource(name, assembly);
}

static string GetFullName(string name)
static string? GetFullName(string? name)
=> resources.FirstOrDefault(n => n.EndsWith($".TestResources.{name}"));
}
2 changes: 1 addition & 1 deletion Sample/Helpers/FilesHelper.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Sample.Maui.Helpers;
namespace Sample.Helpers;

public static class FilesHelper
{
Expand Down
23 changes: 0 additions & 23 deletions Sample/Helpers/PermissionHelper.cs

This file was deleted.

2 changes: 1 addition & 1 deletion Sample/Helpers/ViewHelpers.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
namespace Sample.Maui.Helpers;
namespace Sample.Helpers;

public static class ViewHelpers
{
Expand Down
2 changes: 1 addition & 1 deletion Sample/MauiProgram.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Microsoft.Extensions.Logging;

namespace Sample.Maui;
namespace Sample;

public static class MauiProgram
{
Expand Down
23 changes: 21 additions & 2 deletions Sample/Platforms/Android/MainActivity.cs
Original file line number Diff line number Diff line change
@@ -1,9 +1,28 @@
using Android.App;
using Android.Content;
using Android.Content.PM;
using Android.OS;

namespace Sample.Maui;
namespace Sample;

[Activity(Theme = "@style/Maui.SplashTheme", MainLauncher = true, LaunchMode = LaunchMode.SingleTop, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
[Activity(
Theme = "@style/Maui.SplashTheme",
MainLauncher = true,
LaunchMode = LaunchMode.SingleTop,
ConfigurationChanges = ConfigChanges.ScreenSize)]
public class MainActivity : MauiAppCompatActivity
{
protected override void OnCreate(Bundle? savedInstanceState)
{
base.OnCreate(savedInstanceState);
NativeMedia.Platform.Init(this, savedInstanceState);
}

protected override void OnActivityResult(int requestCode, Result resultCode, Intent? intent)
{
if (NativeMedia.Platform.CheckCanProcessResult(requestCode, resultCode, intent))
NativeMedia.Platform.OnActivityResult(requestCode, resultCode, intent);

base.OnActivityResult(requestCode, resultCode, intent);
}
}
11 changes: 3 additions & 8 deletions Sample/Platforms/Android/MainApplication.cs
Original file line number Diff line number Diff line change
@@ -1,15 +1,10 @@
using Android.App;
using Android.Runtime;

namespace Sample.Maui;
namespace Sample;

[Application]
public class MainApplication : MauiApplication
public class MainApplication(IntPtr handle, JniHandleOwnership ownership) : MauiApplication(handle, ownership)
{
public MainApplication(IntPtr handle, JniHandleOwnership ownership)
: base(handle, ownership)
{
}

protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
protected override MauiApp CreateMauiApp() => MauiProgram.CreateMauiApp();
}
2 changes: 1 addition & 1 deletion Sample/Platforms/iOS/AppDelegate.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using Foundation;

namespace Sample.Maui;
namespace Sample;

[Register("AppDelegate")]
public class AppDelegate : MauiUIApplicationDelegate
Expand Down
11 changes: 3 additions & 8 deletions Sample/Platforms/iOS/Program.cs
Original file line number Diff line number Diff line change
@@ -1,14 +1,9 @@
using UIKit;

namespace Sample.Maui;
namespace Sample;

public class Program
{
// This is the main entry point of the application.
static void Main(string[] args)
{
// if you want to use a different Application Delegate class from "AppDelegate"
// you can specify it here.
UIApplication.Main(args, null, typeof(AppDelegate));
}
static void Main(string[] args) =>
UIApplication.Main(args, null, typeof(AppDelegate));
}
13 changes: 8 additions & 5 deletions Sample/Resources/AppIcon/appiconfg.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
1 change: 0 additions & 1 deletion Sample/Resources/appiconforeground.svg

This file was deleted.

62 changes: 0 additions & 62 deletions Sample/Sample.Maui.csproj

This file was deleted.

Loading