Example #1
0
        public override Android.Support.V7.Widget.RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            View itemView;

            if (viewType == IMAGE)
            {
                itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.ImageDetailImageCardView, parent, false);
                ImageDetailImageViewHolder viewHolder = new ImageDetailImageViewHolder(itemView, OnClick);
                return(viewHolder);
            }
            else if (viewType == DETECTED)
            {
                itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.ImageDetailDetectedCardView, parent, false);
                ImageDetailDetectedViewHolder viewHolder = new ImageDetailDetectedViewHolder(itemView, OnClick);
                return(viewHolder);
            }
            else
            {
                itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.ImageDetailCaptionCardView, parent, false);
                ImageDetailCaptionViewHolder viewHolder = new ImageDetailCaptionViewHolder(itemView, OnClick);
                return(viewHolder);
            }
        }
Example #2
0
        public override void OnBindViewHolder(Android.Support.V7.Widget.RecyclerView.ViewHolder holder, int position)
        {
            if (holder.ItemViewType == IMAGE)
            {
                var imagePath   = imageDetail[0].ImagePath + "/" + imageDetail[0].ImageName;
                var imageBitmap = ImageHelper.GetImageBitmapFromFilePath(imagePath, imageDetail[0].ImageWidth, imageDetail[0].ImageHeight);

                ImageDetailImageViewHolder viewHolder = holder as ImageDetailImageViewHolder;
                viewHolder.imageView.SetImageBitmap(imageBitmap);
            }
            else if (holder.ItemViewType == DETECTED)
            {
                ImageDetailDetectedViewHolder viewHolder = holder as ImageDetailDetectedViewHolder;

                viewHolder.headingText.Text = "Detected Text";

                if (imageDetail[0].TextDetected == 1)
                {
                    viewHolder.detectedText.Text = imageDetail[0].Text1;
                }
                else
                {
                    viewHolder.headingText.Text  = "";
                    viewHolder.detectedText.Text = "Tap to Detect Text";
                }
            }
            else
            {
                ImageDetailCaptionViewHolder viewHolder = holder as ImageDetailCaptionViewHolder;
                if (!String.IsNullOrEmpty(imageDetail[0].Caption))
                {
                    viewHolder.captionEditView.Text = imageDetail[0].Caption;
                }

                viewHolder.saveBtn.Click += SaveBtn_Click;
            }
        }