public override View GetView(int position, View convertView, ViewGroup parent)
        {
            ViewHolder holder;

            if (convertView == null)
            {
                convertView        = inflater.Inflate(Resource.Layout.list_item_stat_color, parent, false);
                holder             = new ViewHolder();
                holder.scoreLayout = convertView.FindViewById <LinearLayout> (Resource.Id.scoreLayout);
                holder.pointViews.Add("Nutrition", convertView.FindViewById <TextView> (Resource.Id.nutritionScore));
                holder.pointViews.Add("Workout", convertView.FindViewById <TextView> (Resource.Id.workoutScore));
                holder.pointViews.Add("Mobilize", convertView.FindViewById <TextView> (Resource.Id.mobilizeScore));
                holder.pointViews.Add("Reflection", convertView.FindViewById <TextView> (Resource.Id.reflectionScore));
                holder.pointViews.Add("Supplement", convertView.FindViewById <TextView> (Resource.Id.supplementScore));
                holder.pointViews.Add("Water", convertView.FindViewById <TextView> (Resource.Id.waterScore));
                holder.pointViews.Add("Lifestyle", convertView.FindViewById <TextView> (Resource.Id.lifestyleScore));

                convertView.Tag = holder;
            }
            else
            {
                holder = (ViewHolder)convertView.Tag;
            }

            stat = Stats [position];

            //point = stat.Points ["Total"];//stat.Points.TryGetValue ("Total", out point);

            stat.Points.TryGetValue("Bonus", out point);
            point += stat.Points ["Total"];
            //holder.scoreLayout.RemoveAllViews ();
            foreach (var score in stat.Points)
            {
                if (!score.Key.Equals("Total") && !score.Key.Equals("Reflections Written"))
                {
                    int categoryColor = -1;
                    CategoryColors.TryGetValue(score.Key, out categoryColor);
                    int categoryId = -1;
                    CategoryResourceIds.TryGetValue(score.Key, out categoryId);
                    convertView.FindViewById <RelativeLayout>(categoryId).SetBackgroundResource(Resource.Drawable.bg_layout);
                    if (categoryColor != -1 && categoryId != -1)
                    {
                        holder.pointViews [score.Key].Text = score.Value.ToString();
                        holder.pointViews [score.Key].SetTextColor(Android.Graphics.Color.LightGray);
                        if (score.Value > 0)
                        {
                            holder.pointViews [score.Key].SetTextColor(Android.Graphics.Color.White);
                            convertView.FindViewById <RelativeLayout>(categoryId).SetBackgroundResource(categoryColor);
                            if (score.Value != 5 && "Nutrition".Equals(score.Key, StringComparison.OrdinalIgnoreCase))
                            {
                                convertView.FindViewById <RelativeLayout>(categoryId).SetBackgroundResource(Resource.Drawable.bg_nutrition_partial);
                            }
                        }
                    }
                }
            }

            return(convertView);
        }
Пример #2
0
 /// <summary>
 /// Builder that defines the default color range of the group
 /// </summary>
 /// <param name="color">Default color for the group</param>
 public CategoryColorSettings(CategoryColors color)
 {
     this.backColor               = this.defBackColor[(int)color];
     this.borderColor             = this.defBorderColor[(int)color];
     this.categoryButtonOverColor = this.defCategoryButtonOverColor[(int)color];
     this.categoryButtonDownColor = this.defCategoryButtonDownColor[(int)color];
     this.actionButtonOverColor   = this.defActionButtonOverColor[(int)color];
 }
Пример #3
0
 public NetworkGraphConfig Copy()
 {
     return(new NetworkGraphConfig {
         BackgroundColor = BackgroundColor,
         CategoryColors = CategoryColors.ToArray(),
         LayoutSeed = LayoutSeed,
         LinkColor = LinkColor,
         LabelColor = LabelColor,
         SelectedCol = SelectedCol,
         MaxNodeScale = MaxNodeScale,
         MinNodeScale = MinNodeScale,
         TimeToStabilize = TimeToStabilize,
         SubsamplesPerTimestep = SubsamplesPerTimestep,
         UseWeightsToScaleLinkAttractionForces = UseWeightsToScaleLinkAttractionForces,
         TextScale = TextScale,
         LabelDisplayMode = LabelDisplayMode,
         LabelScaleMode = LabelScaleMode,
         SelectedLabelCol = SelectedLabelCol,
         MaxSimulationTimePerFrame = MaxSimulationTimePerFrame
     });
 }
Пример #4
0
 private Category(string name, CategoryColors color)
 {
     this.name        = name;
     this.label       = Categories.ResourceManager.GetString(name);
     this.guiSettings = new CategoryColorSettings(color);
 }