Пример #1
0
        public void HandleTag(bool opening, string tag, IEditable output, IXMLReader xmlReader)
        {
            if (tag.Equals("ul"))
            {
                parent = "ul";
            }
            else if (tag.Equals("ol"))
            {
                parent = "ol";
            }

            if (tag.Equals("li"))
            {
                char lastChar = '0';
                if (output.Length() > 0)
                {
                    lastChar = output.CharAt(output.Length() - 1);
                }
                if (parent.Equals("ul"))
                {
                    if (first)
                    {
                        if (lastChar == '\n')
                        {
                            output.Append("\t•  ");
                        }
                        else
                        {
                            output.Append("\n\t•  ");
                        }
                        first = false;
                    }
                    else
                    {
                        first = true;
                    }
                }
                else
                {
                    if (first)
                    {
                        if (lastChar == '\n')
                        {
                            output.Append("\t" + index + ". ");
                        }
                        else
                        {
                            output.Append("\n\t" + index + ". ");
                        }
                        first = false;
                        index++;
                    }
                    else
                    {
                        first = true;
                    }
                }
            }
        }
Пример #2
0
        public void HandleTag(bool opening, string tag, IEditable output, IXMLReader xmlReader)
        {
            if (tag.Equals("ulc"))
            {
                _parent = "ulc";
                _index  = 1;
            }
            else if (tag.Equals("olc"))
            {
                _parent = "olc";
                _index  = 1;
            }

            if (!tag.Equals("lic"))
            {
                return;
            }

            var lastChar = (char)0;

            if (output.Length() > 0)
            {
                lastChar = output.CharAt(output.Length() - 1);
            }

            if (_parent.Equals("ulc"))
            {
                if (_first)
                {
                    output.Append(lastChar == '\n' ? "\t•  " : "\n\t•  ");
                    _first = false;
                }
                else
                {
                    _first = true;
                }
            }
            else
            {
                if (_first)
                {
                    if (lastChar == '\n')
                    {
                        output.Append("\t" + _index + ". ");
                    }
                    else
                    {
                        output.Append("\n\t" + _index + ". ");
                    }
                    _first = false;
                    _index++;
                }
                else
                {
                    _first = true;
                }
            }
        }
Пример #3
0
 public void AfterTextChanged(IEditable s)
 {
     // Remove spacing char
     if (s.Length() > 0 && (s.Length() % 5) == 0) {
         char c = s.CharAt(s.Length() - 1);
         if (space == c) {
             s.Delete(s.Length() - 1, s.Length());
         }
     }
     // Insert char where needed.
     if (s.Length() > 0 && (s.Length() % 5) == 0) {
         char c = s.CharAt(s.Length() - 1);
         // Only if its a digit where there should be a space we insert a space
         if (Character.IsDigit(c) && TextUtils.Split(s.ToString(), space.ToString()).Length <= 3) {
             s.Insert(s.Length() - 1, space.ToString());
         }
     }
 }
        private static void EnsureParagraphBoundary(IEditable output)
        {
            if (output.Length() == 0)
            {
                return;
            }
            char lastChar = output.CharAt(output.Length() - 1);

            if (lastChar != '\n')
            {
                output.Append('\n');
            }
        }
Пример #5
0
        private static void EnsureParagraphBoundary(IEditable output)
        {
            if (output.Length() == 0)
            {
                return;
            }

            var lastChar = output.CharAt(output.Length() - 1);

            if (lastChar != '\n')
            {
                _ = output.Append('\n').Append('\n');                 // Append an additional new line to create space between each item in list
            }
        }
Пример #6
0
        protected virtual void AppendNewLine(IEditable text)
        {
            if (text.Length() <= 0)
            {
                return;
            }

            if (text.CharAt(text.Length() - 1).Equals(Environment.NewLine))
            {
                return;
            }

            text.Append(Environment.NewLine);
        }
Пример #7
0
        public void AfterTextChanged(IEditable s)
        {
            // ensure a blank space at the end of each label.text
            // because the italic font is cut off at the right border

            if (s == null)
            {
                return;
            }
            if (s.Length() < 1)
            {
                return;
            }
            if (s.CharAt(s.Length() - 1).CompareTo(' ') == 0)
            {
                return;
            }

            s.Append(' ');
        }
		private void Format(IEditable text)
		{
			if (text.Length() > 0)
			{
				for (int i = text.Length(); i > 0; i--)
				{
					if (!Character.IsDigit(text.CharAt(i - 1)) || ((deleting && i == start) && (isFormatChar(i))))
					{
						text.Delete(i - 1, i);
					}
				}

				for (int i = 0; i < GetStringEnd(text); i++)
				{
					if (isFormatChar(i))
					{
						text.Insert(i, Java.Lang.String.ValueOf(format[i]));
					}
				}
			}
		}