mirror of
https://github.com/Nioux/AideDeJeu.git
synced 2025-12-22 18:13:23 +00:00
Premier test pdf ok
This commit is contained in:
parent
6ed9f0ebb7
commit
96d7c1c597
16 changed files with 2914 additions and 2502 deletions
|
|
@ -89,12 +89,18 @@
|
|||
<PackageReference Include="System.Memory">
|
||||
<Version>4.5.2</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Essentials">
|
||||
<Version>1.1.0</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Forms">
|
||||
<Version>4.0.0.346134-pre9</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Xamarin.Forms.Visual.Material">
|
||||
<Version>4.0.0.346134-pre9</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="XamiTextSharpLGPLv2">
|
||||
<Version>1.0.0</Version>
|
||||
</PackageReference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="MainActivity.cs" />
|
||||
|
|
|
|||
|
|
@ -19,6 +19,10 @@ namespace AideDeJeu.Droid
|
|||
ToolbarResource = Resource.Layout.Toolbar;
|
||||
|
||||
base.OnCreate(bundle);
|
||||
Xamarin.Essentials.Platform.Init(this, bundle);
|
||||
Xamarin.Essentials.ExperimentalFeatures.Enable(Xamarin.Essentials.ExperimentalFeatures.ShareFileRequest);
|
||||
//StrictMode.VmPolicy.Builder builder = new StrictMode.VmPolicy.Builder();
|
||||
//StrictMode.SetVmPolicy(builder.Build());
|
||||
|
||||
Rg.Plugins.Popup.Popup.Init(this, bundle);
|
||||
|
||||
|
|
@ -43,6 +47,13 @@ namespace AideDeJeu.Droid
|
|||
// Do something if there are not any pages in the `PopupStack`
|
||||
}
|
||||
}
|
||||
|
||||
public override void OnRequestPermissionsResult(int requestCode, string[] permissions, [GeneratedEnum] Android.Content.PM.Permission[] grantResults)
|
||||
{
|
||||
Xamarin.Essentials.Platform.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
|
||||
base.OnRequestPermissionsResult(requestCode, permissions, grantResults);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
using AideDeJeu.Tools;
|
||||
using Android.Content;
|
||||
using Android.Content.PM;
|
||||
using System.IO;
|
||||
using System.Threading.Tasks;
|
||||
|
|
@ -92,5 +93,107 @@ namespace AideDeJeu.Droid
|
|||
}
|
||||
return newVersion > oldVersion;
|
||||
}
|
||||
|
||||
public async Task SaveStreamAsync(string filename, Stream stream)
|
||||
{
|
||||
using (var outStream = CreateStream(filename))
|
||||
{
|
||||
await stream.CopyToAsync(outStream);
|
||||
}
|
||||
}
|
||||
|
||||
public Stream CreateStream(string filename)
|
||||
{
|
||||
var documentsDirectoryPath = Android.App.Application.Context.CacheDir.AbsolutePath;
|
||||
var filepath = Path.Combine(documentsDirectoryPath, filename);
|
||||
return new FileStream(filepath, FileMode.Create);
|
||||
}
|
||||
|
||||
|
||||
//public void OpenFileByName(string fileName)
|
||||
//{
|
||||
// //try
|
||||
// //{
|
||||
// var documentsPath = Android.App.Application.Context.CacheDir.AbsolutePath; ;// System.Environment.GetFolderPath(System.Environment.SpecialFolder.Personal);
|
||||
// var filePath = Path.Combine(documentsPath, fileName);
|
||||
|
||||
// var bytes = File.ReadAllBytes(filePath);
|
||||
|
||||
// //Copy the private file's data to the EXTERNAL PUBLIC location
|
||||
// string externalStorageState = global::Android.OS.Environment.ExternalStorageState;
|
||||
// var externalPath = global::Android.OS.Environment.ExternalStorageDirectory.Path + "/" + global::Android.OS.Environment.DirectoryDownloads + "/" + fileName;
|
||||
// File.WriteAllBytes(externalPath, bytes);
|
||||
|
||||
// Java.IO.File file = new Java.IO.File(externalPath);
|
||||
// file.SetReadable(true);
|
||||
|
||||
// string application = "";
|
||||
// string extension = Path.GetExtension(filePath);
|
||||
|
||||
// // get mimeTye
|
||||
// switch (extension.ToLower())
|
||||
// {
|
||||
// case ".txt":
|
||||
// application = "text/plain";
|
||||
// break;
|
||||
// case ".doc":
|
||||
// case ".docx":
|
||||
// application = "application/msword";
|
||||
// break;
|
||||
// case ".pdf":
|
||||
// application = "application/pdf";
|
||||
// break;
|
||||
// case ".xls":
|
||||
// case ".xlsx":
|
||||
// application = "application/vnd.ms-excel";
|
||||
// break;
|
||||
// case ".jpg":
|
||||
// case ".jpeg":
|
||||
// case ".png":
|
||||
// application = "image/jpeg";
|
||||
// break;
|
||||
// default:
|
||||
// application = "*/*";
|
||||
// break;
|
||||
// }
|
||||
|
||||
// //Android.Net.Uri uri = Android.Net.Uri.Parse("file://" + filePath);
|
||||
// Android.Net.Uri uri = Android.Net.Uri.FromFile(file);
|
||||
// Intent intent = new Intent(Intent.ActionView);
|
||||
// intent.SetDataAndType(uri, application);
|
||||
// intent.SetFlags(ActivityFlags.ClearWhenTaskReset | ActivityFlags.NewTask);
|
||||
|
||||
// Xamarin.Forms.Forms.Context.StartActivity(intent);
|
||||
|
||||
|
||||
// //}
|
||||
// //catch (Exception ex)
|
||||
// //{
|
||||
// // Console.WriteLine(ex.Message);
|
||||
// //}
|
||||
//}
|
||||
|
||||
//static Task PlatformRequestAsync(Xamarin.Essentials.ShareFileRequest request)
|
||||
//{
|
||||
// var contentUri = Platform.GetShareableFileUri(request.File.FullPath);
|
||||
|
||||
// var intent = new Intent(Intent.ActionSend);
|
||||
// intent.SetType(request.File.ContentType);
|
||||
// intent.SetFlags(ActivityFlags.GrantReadUriPermission);
|
||||
// intent.PutExtra(Intent.ExtraStream, contentUri);
|
||||
|
||||
// if (!string.IsNullOrEmpty(request.Title))
|
||||
// {
|
||||
// intent.PutExtra(Intent.ExtraTitle, request.Title);
|
||||
// }
|
||||
|
||||
// var chooserIntent = Intent.CreateChooser(intent, request.Title ?? string.Empty);
|
||||
// chooserIntent.SetFlags(ActivityFlags.ClearTop);
|
||||
// chooserIntent.SetFlags(ActivityFlags.NewTask);
|
||||
// Platform.AppContext.StartActivity(chooserIntent);
|
||||
|
||||
// return Task.CompletedTask;
|
||||
//}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
5194
AideDeJeu/AideDeJeu.Android/Resources/Resource.designer.cs
generated
5194
AideDeJeu/AideDeJeu.Android/Resources/Resource.designer.cs
generated
File diff suppressed because it is too large
Load diff
Loading…
Add table
Add a link
Reference in a new issue