//Convert the code for the detected activity type, into the model including corresponding string and icon public static ActivityTypeRowModel ToActivityType(this int activityType) { ActivityTypeRowModel model = new ActivityTypeRowModel(); switch (activityType) { case 100: model.Name = "Vehicle"; model.Image = Resource.Drawable.vehicle; break; case 101: model.Name = "Bike"; model.Image = Resource.Drawable.bicycle; break; case 102: model.Name = "On Foot"; model.Image = Resource.Drawable.foot; break; case 103: model.Name = "Still"; model.Image = Resource.Drawable.still; break; case 104: model.Name = "Others"; model.Image = Resource.Drawable.others; break; case 105: model.Name = "Tilting"; model.Image = Resource.Drawable.vehicle; break; case 107: model.Name = "Walking"; model.Image = Resource.Drawable.walking; break; case 108: model.Name = "Running"; model.Image = Resource.Drawable.running; break; default: break; } return(model); }
public override View GetView(int position, View convertView, ViewGroup parent) { ActivityConversionData item = items[position]; View view = convertView; if (view == null) { view = context.LayoutInflater.Inflate(Resource.Layout.conversion_update_view, null); } view.SetBackgroundColor(item.ConversionType == 0 ? Color.ParseColor("#72C98A") : Color.ParseColor("#EC6A6A")); ActivityTypeRowModel itemDetail = item.ActivityType.ToActivityType(); view.FindViewById <TextView>(Resource.Id.txtActivityName).Text = itemDetail.Name; view.FindViewById <TextView>(Resource.Id.txtConversionType).Text = item.ConversionType.ToConversionTypeName(); view.FindViewById <ImageView>(Resource.Id.imgActivity).SetImageResource(itemDetail.Image); return(view); }