Exemplo n.º 1
0
        public static void DataTemplate(IMerchItem item, IMerchItemHolderYahoo holder, int position)
        {
            var yahooItem = (YahooItem)item.Item;

            MerchItemHolderTemplate.CommonFeedItemTemplate(item, holder);

            holder.Title.Text = item.Item.Name;
            holder.DetailBids.SetText(GetYahooItemLabel("Bids:", yahooItem.BidsCount.ToString()),
                                      TextView.BufferType.Spannable);
            holder.DetailEndsIn.SetText(GetYahooItemLabel("Ends in:", SharedUtil.TimeDiffToString((DateTime.UtcNow - yahooItem.EndTime).Duration())),
                                        TextView.BufferType.Spannable);
            holder.DetailCondition.SetText(GetYahooItemLabel("Condition:", yahooItem.Condition.ToString()),
                                           TextView.BufferType.Spannable);

            //if (yahooItem.BuyoutPrice != 0)
            //{
            //    holder.PriceSubtitle.Text = $"{yahooItem.BuyoutPrice}¥";
            //}

            if (yahooItem.Tax == 0)
            {
                holder.DetailsTax.Visibility = ViewStates.Gone;
            }
            else
            {
                holder.DetailsTax.Visibility = ViewStates.Visible;
                holder.DetailsTax.SetText(GetYahooItemLabel("Tax:", $"+{yahooItem.Tax}%"),
                                          TextView.BufferType.Spannable);
            }

            holder.DetailShipping.Visibility = BindingConverters.BoolToVisibility(yahooItem.IsShippingFree);
        }
Exemplo n.º 2
0
        public static void DataTemplate(IMerchItem item, IMerchItemHolderGeneral holder, int position)
        {
            CommonFeedItemTemplate(item, holder);

            if (item.Item is SurugayaItem surugayaItem)
            {
                holder.Title.Text        = surugayaItem.Category;
                holder.Detail.Text       = surugayaItem.Name;
                holder.Detail.Visibility = ViewStates.Visible;
                holder.Subtitle.Text     = surugayaItem.Brand;
                holder.StoreIcon.SetImageResource(Resource.Drawable.surugaya);
            }
            else if (item.Item is MandarakeItem mandarakeItem)
            {
                holder.Title.Text        = mandarakeItem.Name;
                holder.Detail.Visibility = ViewStates.Gone;
                holder.Subtitle.Text     = mandarakeItem.Shop;
                holder.StoreIcon.SetImageResource(Resource.Drawable.mandarake);
            }
            else if (item.Item is MercariItem mercariItem)
            {
                holder.Title.Text        = mercariItem.Name;
                holder.Detail.Visibility = ViewStates.Gone;
                holder.Subtitle.Text     = String.Empty;
                holder.StoreIcon.SetImageResource(Resource.Drawable.mercari);
            }
            else if (item.Item is LashinbangItem lashinbangItem)
            {
                holder.Title.Text        = lashinbangItem.Name;
                holder.Detail.Visibility = ViewStates.Gone;
                holder.Subtitle.Text     = String.Empty;
                holder.StoreIcon.SetImageResource(Resource.Drawable.lashinbang);
            }
        }
Exemplo n.º 3
0
        internal static void CommonFeedItemTemplate(IMerchItem item, IMerchItemHolder holder)
        {
            holder.Price.Text = item.Item.Price + "¥";
            ImageService.Instance.LoadUrl(item.Item.ImageUrl).Retry(2, 1000).Into(holder.ImageLeft);

            if (item is FeedItemViewModel feedViewModel)
            {
                holder.NewAlertSection.Visibility = BindingConverters.BoolToVisibility(feedViewModel.IsNew);
                switch (feedViewModel.PriceChange)
                {
                case PriceChange.Stale:
                    holder.PriceTrendIcon.Visibility = ViewStates.Gone;
                    holder.PriceSubtitle.Visibility  = ViewStates.Gone;
                    break;

                case PriceChange.Decrease:
                    holder.PriceSubtitle.Text        = $"({feedViewModel.PriceDifference:N0}¥)";
                    holder.PriceTrendIcon.Visibility = ViewStates.Visible;
                    holder.PriceSubtitle.Visibility  = ViewStates.Visible;
                    holder.PriceTrendIcon.SetImageResource(Resource.Drawable.icon_chevron_triple_down);
                    holder.PriceTrendIcon.ImageTintList = ColorStateList.ValueOf(ThemeManager.LimeColour);
                    break;

                case PriceChange.Increase:
                    holder.PriceSubtitle.Text        = $"(+{feedViewModel.PriceDifference:N0}¥)";
                    holder.PriceTrendIcon.Visibility = ViewStates.Visible;
                    holder.PriceSubtitle.Visibility  = ViewStates.Visible;
                    holder.PriceTrendIcon.SetImageResource(Resource.Drawable.icon_chevron_triple_up);
                    holder.PriceTrendIcon.ImageTintList = ColorStateList.ValueOf(ThemeManager.RedColour);
                    break;
                }
            }
            else
            {
                holder.NewAlertSection.Visibility = ViewStates.Gone;
                holder.PriceTrendIcon.Visibility  = ViewStates.Gone;
                holder.PriceSubtitle.Visibility   = ViewStates.Gone;
            }
        }