protected override void OnActivityResult(int requestCode, Result resultCode, Android.Content.Intent data)
        {
            const int    IMAGE_PICKER_REQUEST_CODE     = 100;
            const String IMAGE_PICKER_ARRAY_LIST_EXTRA = "ImagePickerImages";

            if (resultCode == Result.Ok && requestCode == IMAGE_PICKER_REQUEST_CODE)
            {
                var pickedImages = data.GetParcelableArrayListExtra(IMAGE_PICKER_ARRAY_LIST_EXTRA);

                if (imagePickerThumbnail)
                {
                    ImageView thumbnail = FindViewById <ImageView>(Resource.Id.thumbnail);
                    String    imagePath = ((Com.Nguyenhoanglam.Imagepicker.Model.Image)pickedImages[0]).Path;
                    thumbnail.SetImageURI(Android.Net.Uri.Parse(imagePath));
                }
                else
                {
                    UserPhotoFragment addPhoto = new UserPhotoFragment();
                    addPhoto.PhotoPath        = ((Com.Nguyenhoanglam.Imagepicker.Model.Image)pickedImages[0]).Path;
                    addPhoto.AddPhotoFragment = false;
                    addPhoto.UserPhotoClick   = this;
                    userPhotosAdapter.UserPhotosFragments.Add(addPhoto);
                    userPhotosAdapter.NotifyDataSetChanged();
                }
            }
        }
示例#2
0
        public static List <string> GetResult(ContentResolver resolver, Intent data)
        {
            List <Uri>    uris  = data.GetParcelableArrayListExtra(ImageSelectActivity.EXTRA_RESULT_SELECTION) as List <Uri>;
            List <string> paths = new List <string>();

            if (uris == null)
            {
                return(paths);
            }
            foreach (Uri uri in uris)
            {
                paths.Add(PhotoMetadataUtils.GetPath(resolver, uri));
            }
            return(paths);
        }
示例#3
0
 protected override void OnActivityResult(int requestCode, Result resultCode, Android.Content.Intent data)
 {
     if (requestCode == Config.RcPickImages && (int)resultCode == -1 && data != null)
     {
         var list = data.GetParcelableArrayListExtra(Config.ExtraImages);
         if (list != null)
         {
             foreach (var item in list)
             {
                 var img = (Image)item;
                 if (!mImageAdapter.mImageViewer.Existed(img.Path))
                 {
                     mImageAdapter.mImageViewer.AddPath(img.Path);
                 }
             }
             mImageAdapter.NotifyDataSetChanged();
         }
         // adapter.setData( images );
     }
     base.OnActivityResult(requestCode, resultCode, data);
 }
示例#4
0
文件: Util.cs 项目: pythe/wristpass
        public static string GetFilenameFromInternalFileChooser(Intent data, Context ctx)
        {
            #if !EXCLUDE_FILECHOOSER
            string EXTRA_RESULTS = "group.pals.android.lib.ui.filechooser.FileChooserActivity.results";
            if (data.HasExtra(EXTRA_RESULTS))
            {
                IList uris = data.GetParcelableArrayListExtra(EXTRA_RESULTS);
                Uri uri = (Uri) uris[0];
                {
                    return Group.Pals.Android.Lib.UI.Filechooser.Providers.BaseFileProviderUtils.GetRealUri(ctx, uri).ToString();
                }
            }

            #endif
            return null;
        }
示例#5
0
 public static List <Uri> GetResult(Intent data)
 {
     return(data.GetParcelableArrayListExtra(ImageSelectActivity.EXTRA_RESULT_SELECTION) as List <Uri>);
 }
示例#6
0
        public static Uri GetSingleResult(Intent data)
        {
            var urls = data.GetParcelableArrayListExtra(ImageSelectActivity.EXTRA_RESULT_SELECTION) as List <Uri>;

            return(urls?.FirstOrDefault());
        }