Exemplo n.º 1
0
            public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
            {
                View           itemView = inflater.Inflate(Resource.Layout.single_grid_home_page_item, parent, false);
                IconViewHolder vh       = new IconViewHolder(itemView, OnClick);

                return(vh);
            }
        /// <summary>
        /// Gets the icon view.
        /// </summary>
        /// <returns>The icon view.</returns>
        /// <param name="item">Item.</param>
        /// <param name="position">Position.</param>
        /// <param name="convert">Convert.</param>
        /// <param name="parent">Parent.</param>
        private View GetIconView(NavigationIconItem item, int position, View convert, ViewGroup parent)
        {
            var            res = parent.Context.Resources;
            IconViewHolder vh  = convert?.Tag as IconViewHolder;

            if (convert == null || vh == null)
            {
                convert     = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.navigation_icon_item, parent, false);
                convert.Tag = vh = new IconViewHolder();

                vh.title = convert.FindViewById <TextView>(Resource.Id.title);
                vh.title.SetTextSize(Android.Util.ComplexUnitType.Px, res.GetDimension(Resource.Dimension.text_size_large));
                vh.title.SetTextColor(Resource.Color.white.AsResourceColor(parent.Context));

                vh.icon = convert.FindViewById <ImageView>(Resource.Id.icon);
            }
            else
            {
                vh = (IconViewHolder)convert.Tag;
            }

            vh.title.Text = item.title;
            vh.icon.SetImageBitmap(cache.GetBitmap(item.icon));
            vh.icon.SetColorFilter(Resource.Color.gray.AsResourceColor(parent.Context), PorterDuff.Mode.SrcAtop);

            return(convert);
        }
Exemplo n.º 3
0
            public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
            {
                IconViewHolder vh = holder as IconViewHolder;

                Glide.With(this.context).Load(this.iconList[position]).Into(vh.icon);
                // vh.icon.SetImageResource(iconList[position]);
                vh.iconName.Text = iconNameList[position];
            }
Exemplo n.º 4
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            Icon           icon           = icons [icons.ElementAt(position).Key].First();
            IconViewHolder iconViewHolder = holder as IconViewHolder;

            if (iconViewHolder == null)
            {
                return;
            }
            iconViewHolder.Icon.Text = "{" + icon.Key + "}";
            iconViewHolder.Name.Text = icon.Key;
        }