private void RebindDescriptionTextView(Context ctx)
            {
                String text;
                int    taskLength        = 0;
                int    descriptionLength = 0;
                var    mode = SpanTypes.InclusiveExclusive;

                if (String.IsNullOrWhiteSpace(DataSource.Description))
                {
                    text = ctx.GetString(Resource.String.RecentTimeEntryNoDescription);
                    descriptionLength = text.Length;
                }
                else
                {
                    text = DataSource.Description;
                    descriptionLength = DataSource.Description.Length;
                }

                if (DataSource.Task != null && !String.IsNullOrEmpty(DataSource.Task.Name))
                {
                    taskLength = DataSource.Task.Name.Length;
                    text       = String.Concat(DataSource.Task.Name, "  ", text);
                }

                var spannable = new SpannableString(text);
                var start     = 0;
                var end       = taskLength;

                if (taskLength > 0)
                {
                    spannable.SetSpan(new FontSpan(Font.Roboto), start, end, mode);
                }

                start = taskLength > 0 ? taskLength + 2 : 0;
                end   = start + descriptionLength;
                spannable.SetSpan(new FontSpan(Font.RobotoLight), start, end, mode);

                DescriptionTextView.SetText(spannable, TextView.BufferType.Spannable);
            }
Пример #2
0
 protected override void Rebind()
 {
     TitleTextView.SetText(DataSource.TitleResId);
     DescriptionTextView.SetText(DataSource.DescriptionResId);
     CheckBox.Checked = DataSource.IsChecked;
 }