42 lines
1.4 KiB
C#
42 lines
1.4 KiB
C#
using Android.App;
|
|
using Android.Content;
|
|
using Android.Content.PM;
|
|
using Android.Runtime;
|
|
using Avalonia;
|
|
using Avalonia.Android;
|
|
using Avalonia.ReactiveUI;
|
|
using Tesses.VirtualFilesystem.Filesystems;
|
|
|
|
namespace Tesses.CMS.Avalonia.Android;
|
|
|
|
[Activity(
|
|
Label = "Tesses CMS",
|
|
Theme = "@style/MyTheme.NoActionBar",
|
|
Icon = "@drawable/icon",
|
|
MainLauncher = true,
|
|
ConfigurationChanges = ConfigChanges.Orientation | ConfigChanges.ScreenSize | ConfigChanges.UiMode)]
|
|
public class MainActivity : AvaloniaMainActivity<App>
|
|
{
|
|
protected override AppBuilder CustomizeAppBuilder(AppBuilder builder)
|
|
{
|
|
App.Platform = new MobilePlatform(this);
|
|
return base.CustomizeAppBuilder(builder)
|
|
.WithInterFont()
|
|
.UseReactiveUI();
|
|
}
|
|
protected override void OnActivityResult(int requestCode, [GeneratedEnum] Result resultCode, Intent? data)
|
|
{
|
|
if(requestCode == SAFFileSystem.RequestCode && resultCode == Result.Ok)
|
|
{
|
|
var res=SAFFileSystem.GetSAFFromResponsePresistant(this,data,MobilePlatform.MySAFKey);
|
|
if(res != null)
|
|
{
|
|
var appPlatform = App.Platform as MobilePlatform;
|
|
if(appPlatform != null)
|
|
appPlatform.virtualFilesystem = res;
|
|
App.Log("Openned dir");
|
|
}
|
|
}
|
|
}
|
|
}
|