internal void Li(bool opening, IEditable output) { if (opening) { EnsureParagraphBoundary(output); _liStart = output.Length(); if (IsOrdered()) { output.Append(++_liIndex + ". "); } else { output.Append("• "); } } else { if (_liStart >= 0) { EnsureParagraphBoundary(output); output.SetSpan(new LeadingMarginSpanStandard(_gap - _liGap.GetGap(IsOrdered()), _gap), _liStart, output.Length(), SpanTypes.ExclusiveExclusive); _liStart = -1; } } }
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; } } } }
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; } } }
public void HandleTag(bool opening, string tag, IEditable output, IXMLReader xmlReader) { Console.WriteLine("Tag:" + tag); if (tag.Equals("ulc") && !opening) { output.Append("\n"); } else if (tag.Equals("lic") && opening) { output.Append("\n\t•\t"); } }
/** * Modified from {@link Android.Text.Html} */ private void End(IEditable output, Type kind, bool paragraphStyle, params Java.Lang.Object[] replaces) { Java.Lang.Object obj = GetLast(output, kind); // start of the tag int where = output.GetSpanStart(obj); // end of the tag int len = output.Length(); output.RemoveSpan(obj); if (where != len) { int thisLen = len; // paragraph styles like AlignmentSpan need to end with a new line! if (paragraphStyle) { output.Append("\n"); thisLen++; } foreach (Java.Lang.Object replace in replaces) { output.SetSpan(replace, where, thisLen, SpanTypes.ExclusiveExclusive); } // if (HtmlTextView.DEBUG) { // Log.d(HtmlTextView.TAG, "where: " + where); // Log.d(HtmlTextView.TAG, "thisLen: " + thisLen); // } } }
public ListBuilder StartList(bool ordered, IEditable output) { if (_parent == null && output.Length() > 0) { _ = output.Append("\n "); } return(new ListBuilder(this, ordered)); }
public ListBuilder StartList(bool ordered, IEditable output) { if (_parent == null && output.Length() > 0) { _ = output.Append("\n "); } return(new ListBuilder(this, ordered, _listIndent)); // KWI-FIX: pass thru listIndent }
internal ListBuilder StartList(bool ordered, IEditable output) { if (_parent == null) { if (output.Length() > 0) { output.Append("\n "); } } return(new ListBuilder(this, ordered)); }
public void HandleTag(bool opening, string tag, IEditable output, IXMLReader xmlReader) { tag = tag.ToLowerInvariant(); if (tag == "hr" && opening) { output.Append("---------------------------------------------\r\n"); } else if (TAGS_WITH_IGNORED_CONTENT.Contains(tag)) { HandleIgnoredTag(opening, output); } }
/** * This method is called when the sending activity has Finished, with the * result it supplied. */ public override void OnActivityResult(int requestCode, int resultCode, Intent data) { // You can use the requestCode to select between multiple child // activities you may have started. Here there is only one thing // we launch. if (requestCode == GET_CODE) { // We will be Adding to our text. IEditable text = (IEditable)mResults.GetText(); // This is a standard resultCode that is sent back if the // activity doesn't supply an explicit result. It will also // be returned if the activity failed to launch. if (resultCode == RESULT_CANCELED) { text.Append("(cancelled)"); // Our protocol with the sending activity is that it will send // text in 'data' as its result. } else { text.Append("(okay "); text.Append(int.ToString(resultCode)); text.Append(") "); if (data != null) { text.Append(data.GetAction()); } } text.Append("\n"); } }
private static void EnsureParagraphBoundary(IEditable output) { if (output.Length() == 0) { return; } char lastChar = output.CharAt(output.Length() - 1); if (lastChar != '\n') { output.Append('\n'); } }
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 } }
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); }
internal ListBuilder CloseList(IEditable output) { EnsureParagraphBoundary(output); var result = _parent; if (result == null) { result = this; } if (result._parent == null) { output.Append('\n'); } return(result); }
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; } } }
public ListBuilder CloseList(IEditable output) { EnsureParagraphBoundary(output); ListBuilder result = _parent; if (result == null) { result = this; } if (result._parent == null) { _ = output.Append('\n'); } return result; }
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(' '); }
public void AddListItem(bool isOpening, IEditable output) { if (isOpening) { EnsureParagraphBoundary(output); _liStart = output.Length(); var lineStart = IsOrdered() ? ++_liIndex + ". " : "• "; _ = output.Append(lineStart); } else { if (_liStart >= 0) { EnsureParagraphBoundary(output); using var leadingMarginSpan = new LeadingMarginSpanStandard(_gap - _liGap.GetGap(IsOrdered()), _gap); output.SetSpan(leadingMarginSpan, _liStart, output.Length(), SpanTypes.ExclusiveExclusive); _liStart = -1; } } }
/** * Modified from {@link Android.Text.Html} */ private void end(IEditable output, Type kind, Boolean paragraphStyle, params Java.Lang.Object[] replaces) { Java.Lang.Object obj = getLast(output, kind); // start of the tag int where = output.GetSpanStart(obj); // end of the tag int len = output.Length(); output.RemoveSpan(obj); if (where != len) { int thisLen = len; // paragraph styles like AlignmentSpan need to end with a new line! if (paragraphStyle) { output.Append("\n"); thisLen++; } foreach (Java.Lang.Object replace in replaces) { output.SetSpan(replace, where, thisLen, SpanTypes.ExclusiveExclusive); } // if (HtmlTextView.DEBUG) { // Log.d(HtmlTextView.TAG, "where: " + where); // Log.d(HtmlTextView.TAG, "thisLen: " + thisLen); // } } }