2024-06-14 07:20:04 +00:00
|
|
|
|
|
|
|
|
|
using Android.App;
|
|
|
|
|
using Android.Content;
|
2024-05-30 01:06:08 +00:00
|
|
|
|
using Android.Content.PM;
|
|
|
|
|
using Android.OS;
|
2024-06-14 07:20:04 +00:00
|
|
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
|
using Neighbourhood.omg.lol.Models;
|
2024-05-30 01:06:08 +00:00
|
|
|
|
|
|
|
|
|
namespace Neighbourhood.omg.lol {
|
2024-06-14 07:20:04 +00:00
|
|
|
|
[Activity(Theme = "@style/Maui.SplashTheme", LaunchMode = LaunchMode.SingleTop, MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation | ConfigChanges.UiMode | ConfigChanges.ScreenLayout | ConfigChanges.SmallestScreenSize | ConfigChanges.Density)]
|
|
|
|
|
[IntentFilter([Intent.ActionSend], Categories = [Intent.CategoryDefault], DataMimeType = "text/plain")]
|
|
|
|
|
[IntentFilter([Intent.ActionSend], Categories = [Intent.CategoryDefault], DataMimeType = "*/*")]
|
2024-05-30 01:06:08 +00:00
|
|
|
|
public class MainActivity : MauiAppCompatActivity {
|
2024-06-14 07:20:04 +00:00
|
|
|
|
|
|
|
|
|
protected override void OnCreate(Bundle savedInstanceState) {
|
|
|
|
|
base.OnCreate(savedInstanceState);
|
|
|
|
|
|
|
|
|
|
// In case the app was opened (on first load) with an `ActionView` intent
|
|
|
|
|
OnNewIntent(this.Intent);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
protected override void OnNewIntent(Intent? intent) {
|
|
|
|
|
base.OnNewIntent(intent);
|
|
|
|
|
if (intent != null && intent.Type != null) {
|
|
|
|
|
if (intent.Type.StartsWith("text/")) //string
|
|
|
|
|
{
|
|
|
|
|
string? shareString = intent.GetStringExtra(Intent.ExtraText);
|
|
|
|
|
if (!string.IsNullOrWhiteSpace(shareString)) {
|
|
|
|
|
State state = IPlatformApplication.Current!.Services.GetService<State>()!;
|
|
|
|
|
state.ShareString = shareString;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
else if (intent.Type.StartsWith("image/")) //image
|
|
|
|
|
{
|
|
|
|
|
var uri = intent.GetParcelableExtra(Intent.ExtraStream);
|
|
|
|
|
}
|
|
|
|
|
else if (intent.Type.Equals(Intent.ActionSendMultiple)) //Multiple file
|
|
|
|
|
{
|
|
|
|
|
var uriList = intent.GetParcelableArrayListExtra(Intent.ExtraStream);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
2024-05-30 01:06:08 +00:00
|
|
|
|
}
|
|
|
|
|
}
|