void ReleaseDesignerOutlets()
        {
            if (AttachmentImageView != null)
            {
                AttachmentImageView.Dispose();
                AttachmentImageView = null;
            }

            if (AttahmentImageButton != null)
            {
                AttahmentImageButton.Dispose();
                AttahmentImageButton = null;
            }

            if (BackgroundImageView != null)
            {
                BackgroundImageView.Dispose();
                BackgroundImageView = null;
            }

            if (lblMessage != null)
            {
                lblMessage.Dispose();
                lblMessage = null;
            }

            if (lblSenderName != null)
            {
                lblSenderName.Dispose();
                lblSenderName = null;
            }

            if (lblTime != null)
            {
                lblTime.Dispose();
                lblTime = null;
            }

            if (StatusTick != null)
            {
                StatusTick.Dispose();
                StatusTick = null;
            }
        }
        public ConversationViewHolder(
            View itemView,
            bool isIncomingMessageViewType,
            IItemActionHandler <ChatMessageViewModel> actionHandler)
            : base(itemView)
        {
            _isIncomingMessageViewType = isIncomingMessageViewType;
            _actionHandler             = actionHandler;

            MessageContainer           = itemView.FindViewById <LinearLayout>(Resource.Id.ll_message_container);
            MessageBodyTextView        = itemView.FindViewById <TextView>(Resource.Id.tv_message_body);
            MessageDateTimeTextView    = itemView.FindViewById <TextView>(Resource.Id.tv_message_date_time);
            AttachmentImageView        = itemView.FindViewById <MvxCachedImageView>(Resource.Id.iv_message_attachment);
            AttachmentImageView.Click += OnMessageImageClicked;

            AttachmentImageView.SetAdjustViewBounds(true);
            AttachmentImageView.SetScaleType(ImageView.ScaleType.CenterCrop);

            var resourceId = _isIncomingMessageViewType
                ? StyleHelper.Style.IncomingMessageBg
                : StyleHelper.Style.OutcomingMessageBg;

            var imageBg = itemView.FindViewById <ImageView>(Resource.Id.item_chat_conversation_bg);

            imageBg.SetBackgroundResource(resourceId);

            // setup ViewHolder for in/outcoming messages

            if (_isIncomingMessageViewType)
            {
                SenderPhotoImageView = itemView.FindViewById <MvxCachedImageView>(Resource.Id.iv_sender_photo);
            }
            else
            {
                _messageLongClickSubscription = new WeakEventSubscription <LinearLayout, View.LongClickEventArgs>(
                    MessageContainer, nameof(MessageContainer.LongClick), MessageContainerLongClickHandler);

                MessageStatusView = itemView.FindViewById <ImageView>(Resource.Id.iv_message_status);
            }
        }
        public override void BindViewModel(ChatMessageViewModel viewModel)
        {
            _viewModelRef = WeakReferenceEx.Create(viewModel);

            Bindings.Add(this.SetBinding(() => _viewModelRef.Target.Body).WhenSourceChanges(() =>
            {
                // TODO: check
                Execute.OnUIThread(() =>
                {
                    var hideMessageBody            = string.IsNullOrEmpty(_viewModelRef.Target.Body) && _viewModelRef.Target.HasAttachment;
                    MessageBodyTextView.Visibility = BoolToViewStateConverter.ConvertGone(hideMessageBody == false);
                    MessageBodyTextView.Text       = _viewModelRef.Target.Body;
                });
            }));
            Bindings.Add(this.SetBinding(() => _viewModelRef.Target.TextDateTime).WhenSourceChanges(() =>
            {
                // TODO: check
                Execute.OnUIThread(() =>
                {
                    MessageDateTimeTextView.Text = _viewModelRef.Target.TextDateTime;
                });
            }));

            if (_viewModelRef.Target.HasAttachment)
            {
                var model = _viewModelRef.Target.Model;
                var expr  = default(TaskParameter);

                AttachmentImageView.SetImageResource(StyleHelper.Style.AttachmentImagePlaceholder);
                UpdateAttachmentImageViewSizeAndVisibility();

                if (!string.IsNullOrEmpty(model.ImageCacheKey))
                {
                    expr = ImageService.Instance.LoadFile(model.ImageCacheKey);
                }
                else if (!string.IsNullOrEmpty(model.ImageRemoteUrl))
                {
                    expr = ImageService.Instance.LoadUrl(model.ImageRemoteUrl);
                }

                if (expr == null)
                {
                    return;
                }

                _downloadAttachTask = expr.DownSampleInDip(90, 90)
                                      .Finish(x =>
                {
                    Execute.BeginOnUIThread(UpdateAttachmentImageViewSizeAndVisibility);
                });
                _downloadAttachTask.IntoAsync(AttachmentImageView);
            }
            else
            {
                _downloadAttachTask?.Dispose();
                AttachmentImageView.SetImageDrawable(null);
                AttachmentImageView.Visibility = ViewStates.Gone;
            }

            if (_isIncomingMessageViewType && SenderPhotoImageView != null)
            {
                SenderPhotoImageView.LoadImageWithTextPlaceholder(
                    _viewModelRef.Target.SenderPhotoUrl,
                    _viewModelRef.Target.SenderName,
                    new WhiteLabel.Droid.Controls.AvatarPlaceholderDrawable.AvatarStyles
                {
                    BackgroundHexColors = StyleHelper.Style.ChatAvatarStyles.BackgroundHexColors,
                    Size = new System.Drawing.Size(35, 35)
                },
                    x => x.Transform(new CircleTransformation()));
            }

            if (!_isIncomingMessageViewType && MessageStatusView != null)
            {
                Bindings.Add(this.SetBinding(() => _viewModelRef.Target.Status).WhenSourceChanges(() =>
                {
                    // TODO: check
                    Execute.OnUIThread(() =>
                    {
                        if (_viewModelRef.Target == null)
                        {
                            return;
                        }

                        ChangeMessageViewStatus(_viewModelRef.Target.Status);
                    });
                }));
            }
        }