Esempio n. 1
0
 public static void Free(VerseViewHolder @this)
 {
     foreach (var span in @this.SpanObjects)
     {
         span.Free();
     }
     @this.SpanObjects.Clear();
 }
Esempio n. 2
0
        private static void ApplyChapterText(this VerseViewHolder @this)
        {
            string chapterText = null;

            if (@this.Location.Verse == 1)
            {
                chapterText = @this.Location.ChapterHeadingText;
            }

            @this.ChapterHeaderView.Visibility = chapterText == null ? ViewStates.Gone : ViewStates.Visible;
            @this.HorizontalLine.Visibility    = chapterText == null ? ViewStates.Gone : ViewStates.Visible;
            if (chapterText != null)
            {
                @this.ChapterHeaderView.Text = chapterText;
            }
        }
Esempio n. 3
0
        public static void ApplyFormattedText(VerseViewHolder @this)
        {
            @this.ApplyChapterText();

            var prefix         = @this.Location.Verse + " ";
            var formattedVerse = Bible.FormattedVerse(@this.Location.AbsoluteVerseNumber);
            var formattedText  = new SpannableString(prefix + formattedVerse.Text);

            formattedText.SetSpan(BoldStyleSpanCache.Alloc().AddTo(@this.SpanObjects), 0, prefix.Length, SpanTypes.InclusiveExclusive);
            formattedText.SetSpan(SansSerifTypespaceSpanCache.Alloc().AddTo(@this.SpanObjects), 0, prefix.Length, SpanTypes.InclusiveExclusive);

            foreach (var textSpan in formattedVerse.Spans)
            {
                var span =
                    textSpan.Type == FormattedVerse.SpanType.Italics ? ItalicsStyleSpanCache.Alloc().AddTo(@this.SpanObjects) :
                    textSpan.Type == FormattedVerse.SpanType.Colophon ? SmallerRelativeSizeSpanCache.Alloc().AddTo(@this.SpanObjects) :
                    throw new InvalidOperationException($"Unknown span type {textSpan.Type}");
                formattedText.SetSpan(span, textSpan.Begin + prefix.Length, textSpan.End + prefix.Length, SpanTypes.InclusiveExclusive);
            }

            @this.View.TextFormatted = formattedText;
        }