public void SelectedImgsFromGallery(List <string> imgs) { activeSecond = true; var pager = second.FindViewById <ViewPager>(Resource.Id.newPostPager); PhotoAdapter adapter = new PhotoAdapter(this.Activity, imgs); pager.Adapter = adapter; Activity.SetContentView(second); var postBtn = second.FindViewById <ImageButton>(Resource.Id.postBtn); postBtn.Click += (sender, e) => AddNewPost(imgs); }
public override View GetView(int position, View convertView, ViewGroup parent) { var post = posts[position]; View view = convertView; if (view == null) // no view to re-use, create new { view = context.LayoutInflater.Inflate(Resource.Layout.Post, null); } var avtr = view.FindViewById <CircleImageView>(Resource.Id.userIcon); avtr.Click += (sender, e) => { listener(post.UserId); }; if (avtrs[position] != "") { Glide.With(context).Load(avtrs[position]).Into(avtr); } else { Glide.With(context).Load("https://st3.depositphotos.com/1156795/35622/v/600/depositphotos_356226476-stock-illustration-profile-placeholder-image-gray-silhouette.jpg").Into(avtr); } ViewPager viewPager = view.FindViewById <ViewPager>(Resource.Id.vwPager); if (viewPager == null) // no view to re-use, create new { view = context.Activity.LayoutInflater.Inflate(Resource.Layout.PhotoItem, null); } PhotoAdapter adapter = new PhotoAdapter(context.Activity, posts[position].Images); viewPager.Adapter = adapter; view.FindViewById <TextView>(Resource.Id.cmnt).Text = post.Comments.Count.ToString(); view.FindViewById <TextView>(Resource.Id.reactionUp).Text = post.Reactions.FindAll(r => r == Reaction.Positive).Count.ToString(); view.FindViewById <TextView>(Resource.Id.reactionDown).Text = post.Reactions.FindAll(r => r == Reaction.Negative).Count.ToString(); view.FindViewById <TextView>(Resource.Id.txtBelow).Text = post.TextBelow; view.FindViewById <TextView>(Resource.Id.userName).Text = nicks[position]; return(view); }