OnBindViewHolder(RecyclerView.ViewHolder holder, int position) { NearbyDeviceHolder vh = holder as NearbyDeviceHolder; var device = _devices[position]; int icon = Resource.Drawable.disabled_circle; if (device.Online) { icon = Resource.Drawable.enabled_circle; } vh.StateLayout.SetBackgroundResource(icon); switch (device.DeviceType) { case "SmartBulb": case "ButtonSensor": vh.DeviceTypeImage.SetImageResource(Resource.Drawable.power); break; case "SoundSensor": vh.DeviceTypeImage.SetImageResource(Resource.Drawable.lines); break; } vh.Caption.Text = device.Name; vh.DeviceId = device.DeviceId; }
OnCreateViewHolder(ViewGroup parent, int viewType) { View itemView = LayoutInflater.From(parent.Context). Inflate(Resource.Layout.nearby_device_item_view, parent, false); NearbyDeviceHolder vh = new NearbyDeviceHolder(itemView, _action); return(vh); }