private void Initialize(NearbyShopsAdapterViewHolder holder, NearbyShopsDataObject item)
        {
            try
            {
                switch (item.Product?.ProductClass?.Images?.Count)
                {
                case > 0 when item.Product?.ProductClass != null && item.Product.Value.ProductClass.Images[0].Image.Contains("http"):
                    GlideImageLoader.LoadImage(ActivityContext, item.Product?.ProductClass?.Images?[0]?.Image, holder.Thumbnail, ImageStyle.CenterCrop, ImagePlaceholders.Drawable);
                    break;

                case > 0:
                    Glide.With(ActivityContext).Load(new File(item.Product?.ProductClass?.Images?[0]?.Image)).Apply(new RequestOptions().CenterCrop().Placeholder(Resource.Drawable.ImagePlacholder).Error(Resource.Drawable.ImagePlacholder)).Into(holder.Thumbnail);
                    break;
                }

                GlideImageLoader.LoadImage(ActivityContext, item.Product?.ProductClass?.Seller?.Avatar, holder.Userprofilepic, ImageStyle.CircleCrop, ImagePlaceholders.Color);



                holder.Title.Text = Methods.FunString.DecodeString(item.Product?.ProductClass?.Name);

                holder.UserName.Text = WoWonderTools.GetNameFinal(item.Product?.ProductClass?.Seller);
                holder.Time.Text     = item.Product?.ProductClass?.TimeText;

                var(currency, currencyIcon) = WoWonderTools.GetCurrency(item.Product?.ProductClass?.Currency);
                Console.WriteLine(currency);

                holder.TxtPrice.Text     = item.Product?.ProductClass?.Price + " " + currencyIcon;
                holder.LocationText.Text = !string.IsNullOrEmpty(item.Product?.ProductClass?.Location) ? item.Product?.ProductClass?.Location : ActivityContext.GetText(Resource.String.Lbl_Unknown);
            }
            catch (Exception e)
            {
                Methods.DisplayReportResultTrack(e);
            }
        }
Ejemplo n.º 2
0
 // 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 NearbyShopsAdapterViewHolder(itemView, Click, LongClick);
         return(vh);
     }
     catch (Exception exception)
     {
         Methods.DisplayReportResultTrack(exception);
         return(null !);
     }
 }