Esempio n. 1
0
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            MyView myHolder = holder as MyView;

            myHolder.firstName.Text  = m_Candidates[position].FirstName;
            myHolder.secondName.Text = m_Candidates[position].SecondName;
            myHolder.thirdName.Text  = m_Candidates[position].ThirdName;
            myHolder.votes.Text      = "Голосов: " + m_Candidates[position].Votes;
            myHolder.percent.Text    = "Процент: " + m_Candidates[position].Percent + "%";
            myHolder.photo.SetImageBitmap(m_Candidates[position].Image);

            if (m_Candidates[position].IsVoiceSent == 1)
            {
                myHolder.checkbox.SetImageResource(Resource.Drawable.checkbox_full);
            }
            else
            {
                myHolder.checkbox.SetImageResource(Resource.Drawable.checkbox_empty);
            }

            myHolder.mainView.Click -= Candidate_Click;
            myHolder.mainView.Click += Candidate_Click;

            myHolder.checkbox.SetTag(Resource.Id.checkbox, position);
            myHolder.checkbox.Click -= CheckBox_Click;
            myHolder.checkbox.Click += CheckBox_Click;
        }
Esempio n. 2
0
        public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
        {
            View row = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.candidate_template, parent, false);

            var FirstName  = row.FindViewById <TextView>(Resource.Id.candidateFirstName);
            var SecondName = row.FindViewById <TextView>(Resource.Id.candidateSecondName);
            var ThirdName  = row.FindViewById <TextView>(Resource.Id.candidateThirdName);
            var Votes      = row.FindViewById <TextView>(Resource.Id.candidateVotes);
            var Percent    = row.FindViewById <TextView>(Resource.Id.candidatePercent);
            var Photo      = row.FindViewById <ImageView>(Resource.Id.candidatePhoto);
            var CheckBox   = row.FindViewById <ImageButton>(Resource.Id.checkbox);

            MyView view = new MyView(row)
            {
                firstName  = FirstName,
                secondName = SecondName,
                thirdName  = ThirdName,
                votes      = Votes,
                percent    = Percent,
                photo      = Photo,
                checkbox   = CheckBox
            };

            return(view);
        }