public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { itemNode = listItems[position]; if (itemNode.GetItemType() == 0) { group = itemNode as UserProfileGroupData; groupHolder = holder as UserProfileExpandableGroupHolder; if (position == 0) { groupHolder.headerRL.Visibility = ViewStates.Visible; groupHolder.itemRL.Visibility = ViewStates.Gone; //if (image_url != null) //{ Thread backgroundThread = new Thread(new ThreadStart(() => { Glide.Get(Application.Context).ClearDiskCache(); })); backgroundThread.IsBackground = true; backgroundThread.Start(); Glide.Get(context).ClearMemory(); Glide.With(Application.Context) .Load("https://api.iamnearby.net/" + group.avatarUrl) .Apply(new Com.Bumptech.Glide.Request.RequestOptions() .SkipMemoryCache(true)) //.Placeholder(Resource.Drawable.specialization_imageIV) .Into(groupHolder.profile_imageIV); //} if (uri != null) { groupHolder.profile_imageIV.SetImageURI(uri); } if (bitmap != null) { groupHolder.profile_imageIV.SetImageBitmap(bitmap); } if (group.online) { groupHolder.onlyWithReviewsS.Checked = true; groupHolder.onlineValueTV.Text = context.GetString(Resource.String.online_text); groupHolder.onlineValueTV.SetTextColor(Color.Green); } else { groupHolder.onlyWithReviewsS.Checked = false; groupHolder.onlineValueTV.Text = context.GetString(Resource.String.offline_text); groupHolder.onlineValueTV.SetTextColor(Color.Red); } try { char[] chars = { ' ' }; string[] split = group.expert_name.Split(chars); groupHolder.expert_nameTV.Text = split[0]; } catch { groupHolder.expert_nameTV.Text = group.expert_name; } try { groupHolder.reviewCountTV.Text = group.review_count + " отзывов"; groupHolder.rating_valueTV.Text = group.rating.ToString(); double rating_value = 0; try { rating_value = Convert.ToDouble(group.rating, (CultureInfo.InvariantCulture)); if (rating_value >= 1) { groupHolder.star1IV.SetBackgroundResource(Resource.Drawable.active_star); if (rating_value >= 2) { groupHolder.star2IV.SetBackgroundResource(Resource.Drawable.active_star); if (rating_value >= 3) { groupHolder.star3IV.SetBackgroundResource(Resource.Drawable.active_star); if (rating_value >= 4) { groupHolder.star4IV.SetBackgroundResource(Resource.Drawable.active_star); if (rating_value >= 5) { groupHolder.star5IV.SetBackgroundResource(Resource.Drawable.active_star); } } } } } } catch { } } catch { } } else { groupHolder.headerRL.Visibility = ViewStates.Gone; groupHolder.itemRL.Visibility = ViewStates.Visible; } groupHolder.skillNameTV.Text = group.skill_name; groupHolder.skillNameTV.SetTypeface(tf, TypefaceStyle.Bold); groupHolder.expert_nameTV.SetTypeface(tf, TypefaceStyle.Bold); groupHolder.reviewCountTV.SetTypeface(tf, TypefaceStyle.Normal); groupHolder.rating_valueTV.SetTypeface(tf, TypefaceStyle.Normal); groupHolder.expert_nameTV.SetTypeface(tf, TypefaceStyle.Bold); groupHolder.onlineValueTV.SetTypeface(tf, TypefaceStyle.Normal); groupHolder.dsadas.SetTypeface(tf, TypefaceStyle.Normal); groupHolder.sdsddsddddwww.SetTypeface(tf, TypefaceStyle.Normal); groupHolder.sdsddsddddwwwwww.SetTypeface(tf, TypefaceStyle.Normal); if (position != listItems.Count - 1) { groupHolder.bottom_separatorLL.Visibility = ViewStates.Gone; } else { groupHolder.bottom_separatorLL.Visibility = ViewStates.Visible; } } else if (itemNode.GetItemType() == 1) { entry = itemNode as UserProfileEntryData; holderEntry = holder as UserProfileExpandableItemHolder; holderEntry.skillNameTV.SetTypeface(tf, TypefaceStyle.Normal); holderEntry.skillNameTV.Text = entry.entryName; } }
public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { IExpertProfileDataType itemNode = listItems[position]; if (itemNode.GetItemType() == 0) { ExpertGroupData group = itemNode as ExpertGroupData; GroupExpertThreeLevelHolder groupHolder = holder as GroupExpertThreeLevelHolder; if (position == 0) { AboutExpertActivity.InfoText = group.aboutExpertInfo; groupHolder.headerRL.Visibility = ViewStates.Visible; groupHolder.itemRL.Visibility = ViewStates.Gone; groupHolder.expertNameTV.SetTypeface(tf, TypefaceStyle.Bold); groupHolder.expertSurnameTV.SetTypeface(tf, TypefaceStyle.Bold); groupHolder.expert_phoneTV.SetTypeface(tf, TypefaceStyle.Normal); groupHolder.aboutExpertTitle.SetTypeface(tf, TypefaceStyle.Bold); groupHolder.aboutExpertInfo.SetTypeface(tf, TypefaceStyle.Normal); groupHolder.writeTV.SetTypeface(tf, TypefaceStyle.Bold); groupHolder.callTV.SetTypeface(tf, TypefaceStyle.Bold); groupHolder.cityTV.SetTypeface(tf, TypefaceStyle.Normal); groupHolder.nowTitle.SetTypeface(tf, TypefaceStyle.Bold); groupHolder.distanceTV.SetTypeface(tf, TypefaceStyle.Normal); groupHolder.rating_valueTV.SetTypeface(tf, TypefaceStyle.Bold); groupHolder.expert_phoneTV.Text = group.expert_phone; char[] chars = { ' ' }; string[] split = group.expertName.Split(chars); try { string name = split[0]; string middlename = split[1]; groupHolder.expertNameTV.Text = name + " " + middlename; groupHolder.expertSurnameTV.Text = split[2]; } catch { groupHolder.expertNameTV.Text = group.expertName; groupHolder.expertNameTV.Visibility = ViewStates.Visible; } Thread backgroundThread = new Thread(new ThreadStart(() => { Glide.Get(Application.Context).ClearDiskCache(); })); backgroundThread.IsBackground = true; backgroundThread.Start(); Glide.Get(context).ClearMemory(); Glide.With(Application.Context) .Load("https://api.iamnearby.net/" + group.profile_image) .Apply(new Com.Bumptech.Glide.Request.RequestOptions() .SkipMemoryCache(true)) //.Placeholder(Resource.Drawable.specialization_imageIV) .Into(groupHolder.profile_image); groupHolder.cityTV.Text = group.city; if (group.online) { groupHolder.onlineIV.Visibility = ViewStates.Visible; } else { groupHolder.onlineIV.Visibility = ViewStates.Gone; } double distance_in_km; bool distance_in_km_parsed = Double.TryParse(group.distance, out distance_in_km); if (distance_in_km > 999) { distance_in_km = distance_in_km / 1000; var final_dist = Math.Round(distance_in_km, 2).ToString().Replace(',', '.'); groupHolder.distanceTV.Text = final_dist + " км"; } else { groupHolder.distanceTV.Text = group.distance + " м"; } if (!String.IsNullOrEmpty(group.aboutExpertInfo)) { groupHolder.aboutExpertRL.Visibility = ViewStates.Visible; groupHolder.aboutExpertInfo.Text = group.aboutExpertInfo; } else { groupHolder.aboutExpertRL.Visibility = ViewStates.Gone; } groupHolder.rating_valueTV.Text = "(" + group.rating_value.ToString() + ")"; double rating_value = 0; try { rating_value = Convert.ToDouble(group.rating_value, (CultureInfo.InvariantCulture)); if (rating_value >= 1) { groupHolder.star1IV.SetBackgroundResource(Resource.Drawable.active_star); if (rating_value >= 2) { groupHolder.star2IV.SetBackgroundResource(Resource.Drawable.active_star); if (rating_value >= 3) { groupHolder.star3IV.SetBackgroundResource(Resource.Drawable.active_star); if (rating_value >= 4) { groupHolder.star4IV.SetBackgroundResource(Resource.Drawable.active_star); if (rating_value >= 5) { groupHolder.star5IV.SetBackgroundResource(Resource.Drawable.active_star); } } } } } } catch { } } else { groupHolder.headerRL.Visibility = ViewStates.Gone; groupHolder.itemRL.Visibility = ViewStates.Visible; groupHolder.skillNameTV.Text = group.upper_categ; groupHolder.skillNameTV.SetTypeface(tf, TypefaceStyle.Bold); } } else if (itemNode.GetItemType() == 1) { ExpertEntryData entry = itemNode as ExpertEntryData; holderEntry = holder as EntryHolder; holderEntry.descriptionTitleTV.SetTypeface(tf, TypefaceStyle.Bold); holderEntry.description_text_dataTV.SetTypeface(tf, TypefaceStyle.Normal); holderEntry.services_and_pricesTV.SetTypeface(tf, TypefaceStyle.Bold); holderEntry.portfolioTitleTV.SetTypeface(tf, TypefaceStyle.Bold); if (!String.IsNullOrEmpty(entry.description)) { holderEntry.description_text_dataTV.Text = entry.description; } else { holderEntry.description_text_dataTV.Text = _context.GetString(Resource.String.no_data); } holderEntry.layoutManager_services = new LinearLayoutManager(this.context, LinearLayoutManager.Vertical, false); holderEntry.recyclerViewServices.SetLayoutManager(holderEntry.layoutManager_services); var serv_temp_list = new List <ServiceData>(); if (entry.services != null) { holderEntry.recyclerViewServices.Visibility = ViewStates.Visible; holderEntry.services_and_pricesTV.Visibility = ViewStates.Visible; foreach (var d in entry.services) { serv_temp_list.Add(new ServiceData() { name = d.name, price = d.price }); } } else { holderEntry.recyclerViewServices.Visibility = ViewStates.Gone; holderEntry.services_and_pricesTV.Visibility = ViewStates.Gone; } var services_and_pricesAdapter = new ServicesAndPricesForExpertAdapter(serv_temp_list, _context, tf); holderEntry.recyclerViewServices.SetAdapter(services_and_pricesAdapter); holderEntry.portfolio_layoutManager = new LinearLayoutManager(this.context, LinearLayoutManager.Horizontal, false); holderEntry.portfolio_recyclerView.SetLayoutManager(holderEntry.portfolio_layoutManager); try { var image_list = new List <string>(); int count_ = 0; if (entry.photos == null) { count_ = 0; } else { count_ = entry.photos.Count; int i = 0; foreach (var img in entry.photos) { var current_img = JsonConvert.DeserializeObject <CategoryImage>(entry.photos[i].ToString()); image_list.Add(current_img.imageUrl); i++; if (i == count_) { break; } } } var portfolioAdapter = new PortfolioExpertAdapter(image_list, _context); holderEntry.portfolio_recyclerView.SetAdapter(portfolioAdapter); if (count_ < 1) { holderEntry.portfolioTitleTV.Visibility = ViewStates.Gone; holderEntry.portfolio_recyclerView.Visibility = ViewStates.Gone; } else { holderEntry.portfolioTitleTV.Visibility = ViewStates.Visible; holderEntry.portfolio_recyclerView.Visibility = ViewStates.Visible; } } catch { holderEntry.portfolioTitleTV.Visibility = ViewStates.Gone; holderEntry.portfolio_recyclerView.Visibility = ViewStates.Gone; } } else if (itemNode.GetItemType() == 2) { ExpertGroupData2 group2 = itemNode as ExpertGroupData2; GroupExpertThreeLevelHolder2 groupHolder2 = holder as GroupExpertThreeLevelHolder2; groupHolder2.itemRL.Visibility = ViewStates.Visible; groupHolder2.skillNameTV.Text = group2.subcategory; groupHolder2.skillNameTV.SetTypeface(tf, TypefaceStyle.Normal); } }