/// <summary> /// Picks the image from gallery. /// </summary> /// <param name="onSuccess">On success callback. Image is received as callback parameter</param> /// <param name="onError">On error callback.</param> /// <param name="maxSize">Max image size. If provided image will be downscaled.</param> /// <param name="shouldGenerateThumbnails">Whether thumbnail images will be generated. Used to show small previews of image.</param> public static void PickImageFromGallery(Action <ImagePickResult> onSuccess, Action <string> onError, ImageResultSize maxSize = ImageResultSize.Original, bool shouldGenerateThumbnails = true) { if (AGUtils.IsNotAndroidCheck()) { return; } Check.Argument.IsNotNull(onSuccess, "onSuccess"); _onSuccessAction = onSuccess; _onCancelAction = onError; AGActivityUtils.PickPhotoFromGallery(maxSize, shouldGenerateThumbnails); }
/// <summary> /// Picks the image from gallery. /// </summary> /// <param name="onSuccess">On success callback. Image is received as callback parameter</param> /// <param name="onCancel">On cancel callback.</param> /// <param name="imageFormat">Image format.</param> /// <param name="maxSize">Max image size. If provided image will be downscaled.</param> public static void PickImageFromGallery(Action <ImagePickResult> onSuccess, Action onCancel, ImageFormat imageFormat = ImageFormat.PNG, ImageResultSize maxSize = ImageResultSize.Original) { if (AGUtils.IsNotAndroidCheck()) { return; } if (onSuccess == null) { throw new ArgumentNullException("onSuccess", "Success callback cannot be null"); } AGUtils.RunOnUiThread( () => AGActivityUtils.PickPhotoFromGallery( new AGActivityUtils.OnPickPhotoListener(onSuccess, onCancel), imageFormat, maxSize)); }