Esempio n. 1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:TextStyles.Android.CustomHtmlParser"/> class.
        /// </summary>
        /// <param name="source">Source.</param>
        /// <param name="textStyles">Text styles.</param>
        /// <param name="defaultStyleID">Default style identifier.</param>
        public CustomHtmlParser(string source, Dictionary <string, TextStyleParameters> textStyles, string defaultStyleID = null)
        {
            _htmlSource   = source;
            _styles       = textStyles;
            _defaultStyle = String.IsNullOrEmpty(defaultStyleID) ? null : _styles [defaultStyleID];

            _spannableStringBuilder = new SpannableStringBuilder();
            _reader      = XMLReaderFactory.CreateXMLReader("org.ccil.cowan.tagsoup.Parser");
            _imageGetter = null;
            _tagHandler  = new CustomTagHandler(textStyles);
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="T:TextStyles.Android.CustomHtmlParser"/> class.
        /// </summary>
        /// <param name="source">Source.</param>
        /// <param name="textStyles">Text styles.</param>
        /// <param name="defaultStyleID">Default style identifier.</param>
        public CustomHtmlParser(TextStyle instance, string source, Dictionary <string, TextStyleParameters> textStyles, string defaultStyleID = null)
        {
            _instance   = instance;
            _htmlSource = source;
            _styles     = textStyles;

            if (!String.IsNullOrEmpty(defaultStyleID) && _styles.ContainsKey(defaultStyleID))
            {
                _defaultStyle = _styles [defaultStyleID];
            }

            _spannableStringBuilder = new SpannableStringBuilder();
            _reader      = XMLReaderFactory.CreateXMLReader("org.ccil.cowan.tagsoup.Parser");
            _imageGetter = null;
            _tagHandler  = new CustomTagHandler(_instance, _styles);
        }