Пример #1
0
        public override void OnBindSectionViewHolder(RecyclerView.ViewHolder holder, int sectionIndex)
        {
            var viewHolder = (holder as SectionViewHolder);

            HenspeSectionModel henspeSectionModel = this.itemList.ElementAt(sectionIndex).Key;

            // Description
            if (viewHolder.description != null)
            {
                viewHolder.description.SetText(henspeSectionModel.description, TextView.BufferType.Normal);
            }

            // Header
            if (viewHolder.header != null)
            {
                viewHolder.header.Text = viewHolder.description.Text[0].ToString();
            }

            Color t;

            if (IsOdd(sectionIndex))
            {
                t = new Color(ContextCompat.GetColor(activity, Resource.Color.evenrow));
            }
            else
            {
                t = new Color(ContextCompat.GetColor(activity, Resource.Color.oddrow));
            }

            viewHolder.layout.SetBackgroundColor(t);
        }
Пример #2
0
        public override void OnBindItemViewHolder(RecyclerView.ViewHolder holder, IndexPath indexPath)
        {
            HenspeRowModel henspeRowModel = this.GetItem(indexPath);

            Color t;

            if (IsOdd(indexPath.SectionIndex))
            {
                t = new Color(ContextCompat.GetColor(activity, Resource.Color.evenrow));
            }
            else
            {
                t = new Color(ContextCompat.GetColor(activity, Resource.Color.oddrow));
            }

            if (indexPath.SubType == 2)
            {
                var viewHolder2 = (holder as AdressItemViewHolder);
            }
            else if (indexPath.SubType == 3)
            {
                var positionViewHolder = (holder as PositionViewHolder);
                positionViewHolder.description.Visibility = ViewStates.Gone;

                positionViewHolder.layout.SetBackgroundColor(t);

                positionViewHolder.info.Text       = Henspe.Current.coordinatesText;
                positionViewHolder.info.Visibility = ViewStates.Visible;

                positionViewHolder.infoHelper.Text       = "";
                positionViewHolder.infoHelper.Visibility = ViewStates.Visible;

                lastPositionText = FlashTextUtil.FlashChangedText(activity, activity.ApplicationContext, lastPositionText, Henspe.Current.coordinatesText, positionViewHolder.infoHelper, FlashTextUtil.Type.LatText, Resource.Animator.abc_fade_out);

                positionViewHolder.description2.Visibility = ViewStates.Gone;

                positionViewHolder.info2.Text       = Henspe.Current.addressText;
                positionViewHolder.info2.Visibility = ViewStates.Visible;

                positionViewHolder.infoHelper2.Text       = "";
                positionViewHolder.infoHelper2.Visibility = ViewStates.Visible;
                lastAddressText = FlashTextUtil.FlashChangedText(activity, activity.ApplicationContext, lastAddressText, Henspe.Current.addressText, positionViewHolder.infoHelper2, FlashTextUtil.Type.LatText, Resource.Animator.abc_fade_out);

                positionViewHolder.image.SetImageResource(Resource.Drawable.ic_posisjon);
                positionViewHolder.image2.SetImageResource(Resource.Drawable.ic_adresse);
                Color tt = new Android.Graphics.Color(ContextCompat.GetColor(activity, Resource.Color.icon_color));
                positionViewHolder.image.SetColorFilter(tt);
                positionViewHolder.image2.SetColorFilter(tt);
            }
            else
            {
                var viewHolder = (holder as ItemViewHolder);


                viewHolder.layout.SetBackgroundColor(t);

                // description
                viewHolder.description.Text = henspeRowModel.description;

                // info
                if (henspeRowModel.elementType == StructureElementDto.ElementType.Normal)
                {
                    viewHolder.image.Visibility       = ViewStates.Visible;
                    viewHolder.description.Visibility = ViewStates.Visible;
                }

                else if (henspeRowModel.elementType == StructureElementDto.ElementType.Address)
                {
                }

                var resourceId = (int)typeof(Resource.Drawable).GetField(henspeRowModel.image).GetValue(null);
                viewHolder.image.SetImageResource(resourceId);
                Color tt = new Android.Graphics.Color(ContextCompat.GetColor(activity, Resource.Color.icon_color));
                viewHolder.image.SetColorFilter(tt);
            }
        }