private void Initialize(MarketAdapterViewHolder holder, ProductDataObject item) { try { if (item.Images?.Count > 0) { if (item.Images[0].Image.Contains("http")) { GlideImageLoader.LoadImage(ActivityContext, item.Images?[0]?.Image, holder.Thumbnail, ImageStyle.CenterCrop, ImagePlaceholders.Drawable); } else { Glide.With(ActivityContext).Load(new File(item.Images?[0]?.Image)).Apply(new RequestOptions().CenterCrop().Placeholder(Resource.Drawable.ImagePlacholder).Error(Resource.Drawable.ImagePlacholder)).Into(holder.Thumbnail); } } GlideImageLoader.LoadImage(ActivityContext, item.Seller?.Avatar, holder.Userprofilepic, ImageStyle.CircleCrop, ImagePlaceholders.Color); holder.Title.Text = Methods.FunString.DecodeString(item.Name); holder.UserName.Text = WoWonderTools.GetNameFinal(item.Seller); holder.Time.Text = item.TimeText; var(currency, currencyIcon) = WoWonderTools.GetCurrency(item.Currency); Console.WriteLine(currency); holder.TxtPrice.Text = currencyIcon + " " + item.Price; holder.LocationText.Text = !string.IsNullOrEmpty(item.Location) ? item.Location : ActivityContext.GetText(Resource.String.Lbl_Unknown); } catch (Exception e) { Console.WriteLine(e); } }
// Create new views (invoked by the layout manager) public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType) { try { //Setup your layout here >> Style_Market_view var itemView = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.Style_Market_view, parent, false); var vh = new MarketAdapterViewHolder(itemView, Click, LongClick); return(vh); } catch (Exception exception) { Console.WriteLine(exception); return(null); } }
public void Initialize(MarketAdapterViewHolder holder, Get_Products_Object.Product item) { try { if (holder.Thumbnail.Tag?.ToString() != "loaded") { ImageCacheLoader.LoadImage(item.images[0].image, holder.Thumbnail, false, false); holder.Thumbnail.Tag = "loaded"; } if (holder.Userprofilepic.Tag?.ToString() != "loaded") { var AvatarSplit = item.seller.avatar.Split('/').Last(); var getImage_Avatar = IMethods.MultiMedia.GetMediaFrom_Disk(IMethods.IPath.FolderDiskImage, AvatarSplit); if (getImage_Avatar != "File Dont Exists") { ImageServiceLoader.Load_Image(holder.Userprofilepic, "no_profile_image.png", getImage_Avatar, 1); holder.Userprofilepic.Tag = "loaded"; } else { IMethods.MultiMedia.DownloadMediaTo_DiskAsync(IMethods.IPath.FolderDiskImage, item.seller.avatar); ImageServiceLoader.Load_Image(holder.Userprofilepic, "no_profile_image.png", item.seller.avatar, 1); holder.Userprofilepic.Tag = "loaded"; } } if (holder.mappinIcon.Text != IonIcons_Fonts.IosLocation) { IMethods.Set_TextViewIcon("1", holder.mappinIcon, IonIcons_Fonts.IosLocation); } if (holder.Title.Tag?.ToString() != "true") { holder.Title.Tag = "true"; holder.Title.Text = IMethods.Fun_String.DecodeString(IMethods.Fun_String.DecodeStringWithEnter(item.name)); } if (holder.User_name.Tag?.ToString() != "true") { holder.User_name.Tag = "true"; string name = IMethods.Fun_String.DecodeString(IMethods.Fun_String.DecodeStringWithEnter(item.seller.name)); holder.User_name.Text = name; } if (holder.time.Tag?.ToString() != "true") { holder.time.Tag = "true"; holder.time.Text = item.time_text; } if (holder.Txt_price.Tag?.ToString() != "true") { holder.Txt_price.Tag = "true"; holder.Txt_price.Text = item.price + " " + Settings.Market_curency; } if (holder.LocationText.Tag?.ToString() != "true") { if (!string.IsNullOrEmpty(item.location)) { holder.LocationText.Text = item.location; } else { holder.LocationText.Text = Activity_Context.GetText(Resource.String.Lbl_Unknown); } holder.LocationText.Tag = "true"; } } catch (Exception e) { Crashes.TrackError(e); } }