public GalleryImageAdapter(Context context, List <GalleryDirectory> galleries, int position, IGalleryPickerSelected galleryPickerSelected) : base(context, Resource.Layout.adapter_photosfolder) { this.galleryDirectories = galleries; this.context = context; this.Position = position; this.IGalleryPickerSelected = galleryPickerSelected; }
public GalleryCollectionSource(List <PhotoSetNative> assets, IGalleryPickerSelected IGalleryPickerSelected) { this.assets = assets; this.IGalleryPickerSelected = IGalleryPickerSelected; }
public void BindDataToCell(PhotoSetNative photoSetNative, IGalleryPickerSelected action, int index, bool IsCamera) { imgIcon.ClipsToBounds = true; bttClick.Hidden = false; if (IsCamera) { imgIcon.Image = UIImage.FromBundle("camera").ImageWithRenderingMode(UIImageRenderingMode.AlwaysOriginal); imgIcon.ContentMode = UIViewContentMode.ScaleAspectFit; CheckBox.Hidden = true; bttClick.Tag = index; if (ActionClick == null) { ActionClick = delegate { action.IF_CameraSelected((int)CheckBox.Tag); }; bttClick.TouchUpInside += (sender, e) => { ActionClick(); }; } } else { imgIcon.ContentMode = UIViewContentMode.ScaleAspectFill; CheckBox.Hidden = false; CheckBox.Checked = photoSetNative.galleryImageXF.Checked; CheckBox.Tag = index; if (photoSetNative.galleryImageXF.Checked) { bttClick.BackgroundColor = UIColor.DarkGray.ColorWithAlpha(0.5f); } else { bttClick.BackgroundColor = UIColor.Clear; } var options = new PHImageRequestOptions { Synchronous = true, DeliveryMode = PHImageRequestOptionsDeliveryMode.FastFormat }; PHImageManager.DefaultManager.RequestImageForAsset(photoSetNative.Image, Bounds.Size, PHImageContentMode.AspectFit, options, (result, info) => { imgIcon.Image = result; }); if (ActionClick == null) { ActionClick = delegate { var stream = imgIcon.Image.AsJPEG().AsStream().ToByteArray(); action.IF_ImageSelected(0, (int)CheckBox.Tag, ImageSource.FromStream(() => new System.IO.MemoryStream(stream)), null); }; CheckBox.TouchUpInside += (sender, e) => { ActionClick(); }; } } }