示例#1
0
        /// <summary>
        /// Handles a custom tag
        /// </summary>
        /// <returns>void</returns>
        /// <param name="opening">bool</param>
        /// <param name="tag">string</param>
        /// <param name="output">IEditable</param>
        /// <param name="xmlReader">IXMLReader</param>
        public void HandleTag(bool opening, string tag, IEditable output, Org.Xml.Sax.IXMLReader xmlReader)
        {
            TextStyleParameters style = _styles.ContainsKey(tag) ? _styles [tag] : null;

            // Body overwrites the inline styles so we set that at the textview level
            if (style != null)
            {
                var text = output as SpannableStringBuilder;

                if (opening)
                {
                    Start(text, new TextStylesObject());
                }
                else
                {
                    // Retrieve font
                    Typeface font = null;
                    if (!string.IsNullOrEmpty(style.Font))
                    {
                        _instance._typeFaces.TryGetValue(style.Font, out font);
                    }

                    var customSpan = new CustomTypefaceSpan("", font, style);
                    End(style, text, Class.FromType(typeof(TextStylesObject)), customSpan);
                }
            }
        }
示例#2
0
 public void HandleTag(bool opening, string tag, IEditable output, Org.Xml.Sax.IXMLReader xmlReader)
 {
     if (tag == "li")
     {
         if (first)
         {
             output.Append("\n\t" + index + ". ");
             first = false;
             index++;
         }
         else
         {
             first = true;
         }
     }
 }