Esempio n. 1
0
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            CImage item   = null;
            string layout = "";

            if (items != null)
            {
                item = items[0];
            }
            View view = null;

            if (item != null)
            {
                view = activity.LayoutInflater.Inflate(Resource.Layout.image_view_holder, null);
                LinearLayout.LayoutParams LLParams = new LinearLayout.LayoutParams(LinearLayout.LayoutParams.MatchParent,
                                                                                   LinearLayout.LayoutParams.WrapContent);
                view.LayoutParameters = LLParams;
            }

            RecyclerViewHolder vh = new RecyclerViewHolder(view, activity, OnClick);

            return(vh);
        }
Esempio n. 2
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            var item = items[position];
            RecyclerViewHolder vh = holder as RecyclerViewHolder;

            vh.Naslov.Text = "";
            if (App.preferences.language == LangEnum.Latinica)
            {
                if (item.SolvedLatin)
                {
                    vh.Naslov.Text          = item.SolutionLatin.ToUpper();
                    vh.grayLayer.Visibility = ViewStates.Gone;
                }
                else
                {
                    for (int i = 0; i < item.SolutionLatin.Length; i++)
                    {
                        vh.Naslov.Text += "__ ";
                    }
                    vh.grayLayer.Visibility = ViewStates.Visible;
                }
            }
            else
            {
                if (item.SolvedCyrilic)
                {
                    vh.Naslov.Text          = item.SolutionCyrilic.ToUpper();
                    vh.grayLayer.Visibility = ViewStates.Gone;
                }
                else
                {
                    for (int i = 0; i < item.SolutionCyrilic.Length; i++)
                    {
                        vh.Naslov.Text         += "__ ";
                        vh.grayLayer.Visibility = ViewStates.Visible;
                    }
                }
            }

            vh.Slika.SetImageResource(activity.Resources.GetIdentifier(item.Name, "drawable", activity.PackageName));
            vh.Slika.TransitionName = item.Name;

            if (item.Id < 70)
            {
                vh.Star1.SetImageResource(Resource.Drawable.ic_star_g);
                vh.Star2.SetImageResource(Resource.Drawable.ic_star);
                vh.Star3.SetImageResource(Resource.Drawable.ic_star);
            }
            else if (item.Id < 150)
            {
                vh.Star1.SetImageResource(Resource.Drawable.ic_star_g);
                vh.Star2.SetImageResource(Resource.Drawable.ic_star_g);
                vh.Star3.SetImageResource(Resource.Drawable.ic_star);
            }
            else
            {
                vh.Star1.SetImageResource(Resource.Drawable.ic_star_g);
                vh.Star2.SetImageResource(Resource.Drawable.ic_star_g);
                vh.Star3.SetImageResource(Resource.Drawable.ic_star_g);
            }
        }