コード例 #1
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            ViewHolder holder;

            if (convertView == null)
            {
                holder = new ViewHolder();
                LayoutInflater inflater = LayoutInflater.From(activity);
                convertView         = inflater.Inflate(Resource.Layout.AddCoHostItem, parent, false);
                holder.ivCoHostPic  = convertView.FindViewById <ImageView>(Resource.Id.ivCHFICoHostItemImage);
                holder.tvCoHostName = convertView.FindViewById <TextView>(Resource.Id.tvCHFICoHostName);
                holder.chkCoHost    = convertView.FindViewById <CheckBox>(Resource.Id.chkCHFICoHost);
                convertView.Tag     = (holder);
                convertView.SetTag(Resource.Id.ivCHFICoHostItemImage, holder.ivCoHostPic);
                convertView.SetTag(Resource.Id.tvCHFICoHostName, holder.tvCoHostName);
                convertView.SetTag(Resource.Id.chkCHFICoHost, holder.chkCoHost);

                if (coHostList[position].ID != 0)
                {
                    holder.chkCoHost.SetOnCheckedChangeListener(new CheckChangeListner(coHostList, convertView, this));
                }
            }
            else
            {
                holder = (ViewHolder)convertView.Tag;
            }
            holder.chkCoHost.Tag        = position;
            holder.chkCoHost.Visibility = ViewStates.Visible;

            holder.tvCoHostName.Text = coHostList[position].CoHostName;

            if (string.IsNullOrEmpty(coHostList[position].CoHostProfilePic))
            {
                Picasso.With(activity).Load(Resource.Drawable.contact_withoutphoto).Placeholder(Resource.Drawable.contact_withoutphoto)
                .Resize(80, 80).Transform(new CircleTransformation()).Into(holder.ivCoHostPic);
            }
            else
            {
                Picasso.With(activity).Load(coHostList[position].CoHostProfilePic).Placeholder(Resource.Drawable.contact_withoutphoto)
                .Resize(80, 80).Transform(new CircleTransformation()).Into(holder.ivCoHostPic);
            }

            if (coHostList[position].ID == 0)
            {
                Picasso.With(activity).Load(Resource.Drawable.Share24).Resize(30, 30).CenterInside().Into(holder.ivCoHostPic);
                holder.chkCoHost.Visibility = ViewStates.Gone;
            }
            holder.chkCoHost.Checked = (coHostList[position].isSelected());
            return(convertView);
        }
コード例 #2
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            ViewHolder holder;
            var        item = selectedImage[position];

            if (convertView == null)
            {
                convertView         = activity.LayoutInflater.Inflate(Resource.Layout.SelectImageItem, parent, false);
                holder              = new ViewHolder();
                holder.ivEventPhoto = convertView.FindViewById <ImageView>(Resource.Id.ivSelectedItemEventPhoto);
                holder.ivEventVideo = convertView.FindViewById <ImageView>(Resource.Id.ivSelectItem_video);
                convertView.Tag     = holder;
            }
            else
            {
                holder = convertView.Tag as ViewHolder;
            }
            Bitmap thumb = null;

            holder.ivEventPhoto.SetImageResource(0);

            if (type == 1)
            {
                holder.ivEventVideo.Visibility = ViewStates.Visible;
                thumb = ThumbnailUtils.CreateVideoThumbnail(item, Android.Provider.ThumbnailKind.MiniKind);
                if (thumb != null)
                {
                    holder.ivEventPhoto.SetImageBitmap(thumb);
                }
            }
            else
            {
                Picasso.With(activity).Load(new Java.IO.File(item)).Placeholder(Resource.Drawable.default_event_back)
                .Transform(new RoundedTransformation())
                .Resize(150, 150).Into(holder.ivEventPhoto);
                holder.ivEventVideo.Visibility = ViewStates.Gone;
            }
            // Dispose of the Java side bitmap.
            return(convertView);
        }
コード例 #3
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            ViewHolder holder;
            var        videoInfo = weClipdata[position];

            if (convertView == null)
            {
                convertView                 = activity.LayoutInflater.Inflate(Resource.Layout.WeClipSearchFragmentItem, parent, false);
                holder                      = new ViewHolder();
                holder.ivWeClipPhoto        = convertView.FindViewById <ImageView>(Resource.Id.ivWSFItemPhoto);
                holder.ivWeClipPhoto.Click += delegate
                {
                    var weclipVideo = new WeClipVideo
                    {
                        VideoFileName = videoInfo.Filename,
                        VideoFileUrl  = videoInfo.VideoFileUrl,
                        EventName     = videoInfo.EventName,
                        WeClipTitle   = videoInfo.WeClipTitle,
                        WeClipTag     = videoInfo.WeClipTag
                    };
                    var videoPlayerActivity = new Android.Content.Intent(activity, typeof(VideoPlayerActivity));
                    videoPlayerActivity.PutExtra("VideoUrl", JsonConvert.SerializeObject(weclipVideo));
                    activity.StartActivity(videoPlayerActivity);
                };

                holder.ivWeClipOverImage = convertView.FindViewById <ImageView>(Resource.Id.ivWSFItemPhoto);
                convertView.Tag          = holder;
            }
            else
            {
                holder = convertView.Tag as ViewHolder;
            }

            Picasso.With(activity).Load(weClipdata[position].ImageFileUrl).Placeholder(Resource.Drawable.default_event_back)
            .Transform(new RoundedTransformation())
            .Resize(150, 150).Into(holder.ivWeClipPhoto);
            return(convertView);
        }
コード例 #4
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            ViewHolder viewHolder;

            if (convertView == null)
            {
                viewHolder = new ViewHolder();
                LayoutInflater inflater = activity.LayoutInflater;
                convertView = inflater.Inflate(Resource.Layout.PeopleFragmentItem, parent, false);
                viewHolder.tvContactName = convertView.FindViewById <TextView>(Resource.Id.tvPFIuserName);
                viewHolder.ivContactPic  = convertView.FindViewById <ImageView>(Resource.Id.ivPFIUserPhoto);
                viewHolder.btnSendInvite = convertView.FindViewById <Button>(Resource.Id.btnPFIinvited);
                viewHolder.rvlItem       = convertView.FindViewById <RelativeLayout>(Resource.Id.rlPFItem);

                convertView.Tag = viewHolder;
            }
            else
            {
                viewHolder = convertView.Tag as ViewHolder;
            }

            viewHolder.tvContactName.Text = userdata[position].UserName;

            if (string.IsNullOrEmpty(userdata[position].UserPhoto))
            {
                viewHolder.ivContactPic.SetImageResource(Resource.Drawable.contact_withoutphoto);
            }
            else
            {
                Square.Picasso.Picasso.With(activity).Load(userdata[position].UserPhoto).Placeholder(Resource.Drawable.contact_withoutphoto)
                .Resize(150, 150).Transform(new Helper.CircleTransformation()).Into(viewHolder.ivContactPic);
            }

            if (userdata[position].UserId == Convert.ToInt64(GlobalClass.UserID))
            {
                viewHolder.btnSendInvite.Visibility = ViewStates.Gone;
            }

            if (userdata[position].isFriendRequestPending == true)
            {
                viewHolder.btnSendInvite.Text = "Request sent";
                viewHolder.btnSendInvite.SetBackgroundResource(Resource.Drawable.btn_round_green_border_fill_padding);
                viewHolder.btnSendInvite.SetTextColor(Color.ParseColor("#ffffff"));
            }
            else if (userdata[position].IsFriend)
            {
                viewHolder.btnSendInvite.Text = "Following";
                viewHolder.btnSendInvite.SetBackgroundResource(Resource.Drawable.btn_round_green_border_fill_padding);
                viewHolder.btnSendInvite.SetTextColor(Color.ParseColor("#ffffff"));
            }
            else
            {
                viewHolder.btnSendInvite.Text = "Follow";
                viewHolder.btnSendInvite.SetBackgroundResource(Resource.Drawable.btn_round_green_border_padding);
                viewHolder.btnSendInvite.SetTextColor(Color.ParseColor("#04c285"));
            }

            viewHolder.btnSendInvite.SetOnClickListener(new btnInviteClick(activity, userdata[position], viewHolder.btnSendInvite, this));

            return(convertView);
        }