コード例 #1
0
ファイル: ProgrammFragment.cs プロジェクト: crejer/HOApp_2017
        public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
        {
            ProgramItemVO pi = ProgramItems[position];

            if (holder is ProgrammDayViewHolder)
            {
                ProgrammDayViewHolder vh = holder as ProgrammDayViewHolder;
                vh.lblDay.Text = pi.Title;
            }
            else
            {
                ProgrammItemViewHolder vh = holder as ProgrammItemViewHolder;
                vh.lblHour.Text = pi.StartTime + ((pi.StartTime != null && pi.EndTime != null) ? " - ":"") + pi.EndTime;
                if (pi.Location != null)
                {
                    vh.lblLocation.Text = pi.Location.Name;
                }
                vh.lblContent.Text = pi.Title;
                if (pi.HasParentProgramItems)
                {
                    vh.vwInset.Visibility = ViewStates.Visible;
                    var lp = vh.lblHour.LayoutParameters as RelativeLayout.LayoutParams;
                    lp.LeftMargin = (int)convertDpToPixel(30, vh.lblHour.Context);
                    vh.lblHour.LayoutParameters = lp;
                }
                else
                {
                    vh.vwInset.Visibility = ViewStates.Gone;
                    var lp = vh.lblHour.LayoutParameters as RelativeLayout.LayoutParams;
                    lp.LeftMargin = (int)convertDpToPixel(20, vh.lblHour.Context);
                    vh.lblHour.LayoutParameters = lp;
                }
            }
        }
コード例 #2
0
ファイル: ProgrammFragment.cs プロジェクト: crejer/HOApp_2017
 public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
 {
     if (viewType == 1)
     {
         View itemView            = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.cell_program_ay_layout, parent, false);
         ProgrammDayViewHolder vh = new ProgrammDayViewHolder(itemView);
         return(vh);
     }
     else
     {
         View itemView             = LayoutInflater.From(parent.Context).Inflate(Resource.Layout.cell_programItem_Layout, parent, false);
         ProgrammItemViewHolder vh = new ProgrammItemViewHolder(itemView);
         return(vh);
     }
 }