private float GetImageProportionalWidth() { if (_largeImageHelper.ImageUrl != null && ThumbImageView.HasImage() && IsExpanded) { var imageSize = ThumbImageView.Image.Size; var width = Math.Min( (float)(1.0 * imageSize.Width * ImageLargeHeight / imageSize.Height), GetTitleBlockWidth(Frame.Width, DataContext.Show)); return(width); } return(ImageLargeHeight); }
public VenueShowCell(IntPtr handle) : base(handle) { BackgroundView = new UIView { BackgroundColor = ThemeColors.ContentLightBackground }; _smallImageHelper = new MvxResizedImageViewLoader( () => ThumbImageView, () => ThumbImageView.Bounds, state => { if (_smallImageHelper.ImageUrl != null && ThumbImageView.ProgressEnded(state)) { if (ThumbImageView.HasImage(state)) { ThumbImageView.SetHidden(false, _smallImageAnimationDelay.Animate); } else { // showing abbr if image couldn't be loaded ThumbImageView.Image = ThemeIcons.Circle; ThumbLabel.SetHidden(false, false); } } }) { UseRoundClip = true }; _largeImageHelper = new MvxImageViewLoader( () => ThumbImageView, () => { if (_largeImageHelper.ImageUrl != null && ThumbImageView.HasImage()) { ThumbImageView.SetHidden(false, _largeImageAnimationDelay.Animate); UpdateConstraintConstants(false); } }); _largeImageHelper.DefaultImagePath = Theme.DefaultImagePath; _largeImageHelper.ErrorImagePath = Theme.ErrorImagePath; }