Наследование: Java.Lang.Object
Пример #1
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            if (position < 0)
            {
                return(null);
            }

            var view = (convertView
                        ?? m_Context.LayoutInflater.Inflate(
                            Resource.Layout.CheckedListItem, parent, false)
                        );

            if (view == null)
            {
                return(null);
            }

            var wrapper = view.Tag as TaskAdapterWrapper;

            if (wrapper == null)
            {
                wrapper       = new TaskAdapterWrapper();
                wrapper.Title = view.FindViewById <CheckedTextView>(Android.Resource.Id.Text1);
                view.Tag      = wrapper;
            }

            var task = m_Tasks[position];

            wrapper.Title.Text = task.Task;

            if (task.Checked)
            {
                wrapper.Title.SetTextColor(m_CheckedColor);
                wrapper.Title.PaintFlags |= Android.Graphics.PaintFlags.StrikeThruText;
            }
            else
            {
                wrapper.Title.SetTextColor(m_UncheckedColor);
                wrapper.Title.PaintFlags &= ~Android.Graphics.PaintFlags.StrikeThruText;
            }


            return(view);
        }
Пример #2
0
        public override View GetView(int position, View convertView, ViewGroup parent)
        {
            if (position < 0)
                return null;

            var view = (convertView
                            ?? m_Context.LayoutInflater.Inflate(
                                    Resource.Layout.CheckedListItem, parent, false)
                        );

            if (view == null)
                return null;

            var wrapper = view.Tag as TaskAdapterWrapper;
            if (wrapper == null)
            {
                wrapper = new TaskAdapterWrapper();
                wrapper.Title = view.FindViewById<CheckedTextView>(Android.Resource.Id.Text1);
                view.Tag = wrapper;
            }

            var task = m_Tasks[position];

            wrapper.Title.Text = task.Task;

            if (task.Checked)
            {
                wrapper.Title.SetTextColor(m_CheckedColor);
                wrapper.Title.PaintFlags |= Android.Graphics.PaintFlags.StrikeThruText;
            }
            else
            {

                wrapper.Title.SetTextColor(m_UncheckedColor);
                wrapper.Title.PaintFlags &= ~Android.Graphics.PaintFlags.StrikeThruText;
            }

            return view;
        }