Esempio n. 1
0
        /// <summary>
        /// Transforms the text case within the given range.
        /// </summary>
        /// <returns>The text range.</returns>
        /// <param name="text">Text.</param>
        /// <param name="style">Style.</param>
        /// <param name="startIndex">Start index.</param>
        /// <param name="endIndex">End index.</param>
        void TransformTextRange(SpannableStringBuilder text, TextStyleParameters style, int startIndex, int endIndex)

        {
            if (startIndex == endIndex)
            {
                return;
            }

            var transformed = TextStyle.ParseString(style, text.SubSequence(startIndex, endIndex));

            text.Replace(startIndex, endIndex, transformed);
        }
Esempio n. 2
0
        public void UpdateText(string value = null)
        {
            if (!String.IsNullOrEmpty(value))
            {
                _rawText     = value;
                ContainsHtml = (!String.IsNullOrEmpty(value) && Common.MatchHtmlTags.IsMatch(value));
            }
            else
            {
                return;
            }

            var style = _instance.GetStyle(StyleID);

            TextValue = TextStyle.ParseString(style, _rawText);

            AttributedValue = ContainsHtml ? _instance.CreateHtmlString(TextValue, StyleID, CustomTags) : _instance.CreateStyledString(style, TextValue);
        }
Esempio n. 3
0
        /// <summary>
        /// End the specified tag
        /// </summary>
        /// <param name="style">TextStyleParameters</param>
        /// <param name="text">SpannableStringBuilder</param>
        /// <param name="kind">Class</param>
        /// <param name="newSpan">Java.Lang.Object</param>
        static void End(TextStyleParameters style, SpannableStringBuilder text, Class kind, Java.Lang.Object newSpan)
        {
            var length = text.Length();
            var span   = GetLast(text, kind);
            var start  = text.GetSpanStart(span);

            text.RemoveSpan(span);

            // Parse the text in the span
            var parsedString = TextStyle.ParseString(style, text.SubSequence(start, length));               // Note this hardcodes the text this way and only works on parsed tags!

            text.Replace(start, length, parsedString);

            if (start != length)
            {
                text.SetSpan(newSpan, start, length, SpanTypes.InclusiveExclusive);
            }
        }