diff --git a/.editorconfig b/.editorconfig
index 0676743..697191c 100644
--- a/.editorconfig
+++ b/.editorconfig
@@ -28,3 +28,13 @@ dotnet_diagnostic.CA1826.severity = none
dotnet_diagnostic.CA2008.severity = none
dotnet_diagnostic.CA1829.severity = none
dotnet_diagnostic.CA2213.severity = none
+
+[{src/LageBuch.App.Android/*.cs,src/LageBuch.App.Android/**/*.cs}]
+# Java-managed objects (Intent, Java.IO.File, ActivityResultLauncher, ActivityResultContracts.*)
+# have their lifetime owned by the Android runtime: they must survive past the C# call that hands
+# them to the platform (StartActivity / RegisterForActivityResult), so "dispose" here would break
+# the OS callbacks. MimeTypeOf likewise deliberately produces lowercase MIME values, which
+# Intent.SetDataAndType expects — ToUpperInvariant (CA1308) would violate that contract.
+dotnet_diagnostic.CA1308.severity = none
+dotnet_diagnostic.CA2000.severity = none
+dotnet_diagnostic.CA2213.severity = none
diff --git a/Directory.Build.props b/Directory.Build.props
index a2ad604..7f9446a 100644
--- a/Directory.Build.props
+++ b/Directory.Build.props
@@ -5,6 +5,7 @@
enable
enable
true
+ All
true
diff --git a/src/LageBuch.App.Android/MainActivity.cs b/src/LageBuch.App.Android/MainActivity.cs
index 21d06b6..eb928bc 100644
--- a/src/LageBuch.App.Android/MainActivity.cs
+++ b/src/LageBuch.App.Android/MainActivity.cs
@@ -21,6 +21,11 @@ namespace LageBuch.App.Android;
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)]
public class MainActivity : AvaloniaMainActivity
{
+ // OpenDocument (rather than GetContent) accepts multiple MIME types on Launch, needed
+ // since an attachment can be any of several image types or a PDF.
+ private static readonly string[] AttachmentMimeTypes =
+ ["image/jpeg", "image/png", "image/gif", "image/webp", "application/pdf"];
+
private ActivityResultLauncher? _importLauncher;
private ActivityResultLauncher? _attachmentLauncher;
private AndroidFileDialogService? _dialogs;
@@ -51,8 +56,7 @@ protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
{
_dialogs = new AndroidFileDialogService(this);
_dialogs.OnLaunchImportPicker = () => _importLauncher!.Launch("application/json");
- _dialogs.OnLaunchAttachmentPicker = () => _attachmentLauncher!.Launch(
- new[] { "image/jpeg", "image/png", "image/gif", "image/webp", "application/pdf" });
+ _dialogs.OnLaunchAttachmentPicker = () => _attachmentLauncher!.Launch(AttachmentMimeTypes);
SharedApp.CreateMainViewModel = () => CompositionRoot.CreateMainWindowViewModel(
new IncidentStore(),
new MasterDataProvider(AndroidAppPaths.MasterDataDbPath(this)),