This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<AbsoluteLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand"> | |
<local:VideoPlayerView HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand" | |
AbsoluteLayout.LayoutBounds="0, 0, 1, 0.9" x:Name="videoPlayer" | |
AbsoluteLayout.LayoutFlags="All" /> | |
<StackLayout HorizontalOptions="FillAndExpand" | |
VerticalOptions="FillAndExpand" | |
AbsoluteLayout.LayoutBounds="0, 0, 1, 0.9" | |
AbsoluteLayout.LayoutFlags="All" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="UTF-8"?> | |
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" | |
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" | |
x:Class="SelectMultiIpleImagesApp.MainPage" | |
xmlns:flv="clr-namespace:DLToolkit.Forms.Controls;assembly=DLToolkit.Forms.Controls.FlowListView" | |
xmlns:ffimageloading="clr-namespace:FFImageLoading.Forms;assembly=FFImageLoading.Forms"> | |
<ContentPage.Content> | |
<StackLayout Padding="20"> | |
<Button TextColor="White" BackgroundColor="Blue" Text="Select From Gallery" Clicked="Handle_Clicked"/> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public partial class MainPage : ContentPage | |
{ | |
List<string> _images = new List<string>(); | |
public MainPage() | |
{ | |
InitializeComponent(); | |
//Remember to remove the temporal files | |
//DependencyService.Get<IMediaService>().ClearFiles(_images); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
await DependencyService.Get<IMediaService>().OpenGallery(); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public interface IMediaService | |
{ | |
Task OpenGallery(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[assembly: Xamarin.Forms.Dependency(typeof(MediaService))] | |
namespace SelectMultiIpleImagesApp.Droid | |
{ | |
public class MediaService : Java.Lang.Object, IMediaService | |
{ | |
public async Task OpenGallery() | |
{ | |
try | |
{ | |
var status = await CrossPermissions.Current.CheckPermissionStatusAsync(Plugin.Permissions.Abstractions.Permission.Storage); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?xml version="1.0" encoding="utf-8"?> | |
<manifest xmlns:android="http://schemas.android.com/apk/res/android" android:versionCode="1" android:versionName="1.0" package="com.companyname.selectmultiipleimagesapp"> | |
<uses-sdk android:minSdkVersion="15" /> | |
<application android:label="SelectMultiIpleImagesApp"> | |
</application> | |
<uses-permission android:name="android.permission.READ_EXTERNAL_STORAGE" /> | |
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" /> | |
</manifest> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
protected override void OnActivityResult(int requestCode, Result resultCode, Intent data) | |
{ | |
base.OnActivityResult(requestCode, resultCode, data); | |
if (requestCode == OPENGALLERYCODE && resultCode == Result.Ok) | |
{ | |
List<string> images = new List<string>(); | |
if (data != null) | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class ImageHelpers | |
{ | |
public static string SaveFile(string collectionName, byte[] imageByte, string fileName) | |
{ | |
var fileDir = new Java.IO.File(Android.OS.Environment.GetExternalStoragePublicDirectory(Android.OS.Environment.DirectoryPictures), collectionName); | |
if (!fileDir.Exists()) | |
{ | |
fileDir.Mkdirs(); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
void IMediaService.ClearFiles(List<string> filePaths) | |
{ | |
foreach (var p in filePaths) | |
{ | |
if (Directory.Exists(p)) | |
{ | |
File.Delete(p); | |
} | |
} | |
} |
OlderNewer