Example #1
0
            public override RecyclerView.ViewHolder OnCreateViewHolder(ViewGroup parent, int viewType)
            {
                View itemView = LayoutInflater.From(parent.Context).
                                Inflate(Resource.Layout.BedView, parent, false);
                BedViewHolder vh = new BedViewHolder(itemView, OnClick, OnWaterClick, OnWeedClick, OnPileUpClick, OnFertilizeClick, OnLongClick);

                return(vh);
            }
Example #2
0
            public override void OnBindViewHolder(RecyclerView.ViewHolder holder, int position)
            {
                BedViewHolder vh = holder as BedViewHolder;

                vh.TypeName.Text = Beds[position].Plant.TypeName;
                vh.SortName.Text = Beds[position].Plant.SortName;

                Color falseColor = Color.OrangeRed;
                Color trueColor  = new Color(0x8B, 0xC3, 0x4A);

                vh.Button1.SetColorFilter(new PorterDuffColorFilter(
                                              Utilities.CheckActionNeed(Beds[position].WaterDate, DateTime.Now, Beds[position].WaterPeriod) ? falseColor : trueColor,
                                              PorterDuff.Mode.DstAtop));
                vh.Button2.SetColorFilter(new PorterDuffColorFilter(
                                              Utilities.CheckActionNeed(Beds[position].WeedDate, DateTime.Now, Beds[position].WeedPeriod) ? falseColor : trueColor,
                                              PorterDuff.Mode.DstAtop));
                vh.Button3.SetColorFilter(new PorterDuffColorFilter(
                                              Utilities.CheckActionNeed(Beds[position].PileUpDate, DateTime.Now, Beds[position].PileUpPeriod) ? falseColor : trueColor,
                                              PorterDuff.Mode.DstAtop));
                vh.Button4.SetColorFilter(new PorterDuffColorFilter(
                                              Utilities.CheckActionNeed(Beds[position].FertilizeDate, DateTime.Now, Beds[position].FertilizePeriod) ? falseColor : trueColor,
                                              PorterDuff.Mode.DstAtop));
            }