private void UpdateVideoAsset(PHAsset asset) { _gradientView.Hidden = false; _gradientView.Image = UIImageExtensions.FromBundle(BundleAssets.Gradient) .CreateResizableImage(UIEdgeInsets.Zero, UIImageResizingMode.Stretch); _iconView.Hidden = false; _durationLabel.Hidden = false; _iconView.Image = UIImageExtensions.FromBundle(BundleAssets.IconBadgeVideo); _durationLabel.Text = _durationFormatter.StringFromTimeInterval(asset.Duration); }
private void UpdateImageAsset(PHAsset asset) { if (asset.MediaSubtypes == PHAssetMediaSubtype.PhotoLive) { _gradientView.Hidden = false; _gradientView.Image = UIImageExtensions.FromBundle(BundleAssets.Gradient); _iconView.Hidden = false; _durationLabel.Hidden = true; _iconView.Image = UIImageExtensions.FromBundle(BundleAssets.IconBadgeLivePhoto); } else { _gradientView.Hidden = true; _iconView.Hidden = true; _durationLabel.Hidden = true; } }
public void Update(int index, LayoutConfiguration layoutConfiguration) { var layoutModel = new LayoutModel(layoutConfiguration, 0); var actionCount = layoutModel.NumberOfItems(layoutConfiguration.SectionIndexForActions); TitleLabel.TextColor = UIColor.Black; if (index == 0) { TitleLabel.Text = layoutConfiguration.FirstNameOfActionItem; ImageView.Image = UIImageExtensions.FromBundle(BundleAssets.ButtonCamera); } else if (index == 1) { TitleLabel.Text = layoutConfiguration.SecondNameOfActionItem; ImageView.Image = UIImageExtensions.FromBundle(BundleAssets.ButtonPhotoLibrary); } var isFirst = index == 0; var isLast = index == actionCount - 1; switch (layoutConfiguration.ScrollDirection) { case UICollectionViewScrollDirection.Horizontal: TopOffset.Constant = isFirst ? 10 : 5; BottomOffset.Constant = isLast ? 10 : 5; LeadingOffset.Constant = 5; TrailingOffset.Constant = 5; break; case UICollectionViewScrollDirection.Vertical: TopOffset.Constant = 5; BottomOffset.Constant = 5; LeadingOffset.Constant = isFirst ? 10 : 5; TrailingOffset.Constant = isLast ? 10 : 5; break; default: throw new ArgumentOutOfRangeException(); } }
public override void WillDisplayActionItem(ImagePickerController controller, UICollectionViewCell cell, int index) { if (cell is IconWithTextCell iconWithTextCell) { iconWithTextCell.TitleLabel.TextColor = UIColor.Black; switch (index) { case 0: iconWithTextCell.TitleLabel.Text = "Camera"; iconWithTextCell.ImageView.Image = UIImageExtensions.FromBundle(BundleAssets.ButtonCamera); break; case 1: iconWithTextCell.TitleLabel.Text = "Photos"; iconWithTextCell.ImageView.Image = UIImageExtensions.FromBundle(BundleAssets.ButtonPhotoLibrary); break; } } }