//JAVA TO C# CONVERTER WARNING: 'final' parameters are not available in .NET: //ORIGINAL LINE: public static CharSequence parse(android.content.Context context, java.util.List<IconFontDescriptorWrapper> iconFontDescriptors, CharSequence text, final android.widget.TextView target) public static CharSequence parse(Context context, IList<IconFontDescriptorWrapper> iconFontDescriptors, CharSequence text, TextView target) { context = context.ApplicationContext; // Analyse the text and replace {} blocks with the appropriate character // Retain all transformations in the accumulator //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final android.text.SpannableStringBuilder spannableBuilder = new android.text.SpannableStringBuilder(text); SpannableStringBuilder spannableBuilder = new SpannableStringBuilder(text); recursivePrepareSpannableIndexes(context, text.ToString(), spannableBuilder, iconFontDescriptors, 0); bool isAnimated = hasAnimatedSpans(spannableBuilder); // If animated, periodically invalidate the TextView so that the // CustomTypefaceSpan can redraw itself if (isAnimated) { if (target == null) { throw new System.ArgumentException("You can't use \"spin\" without providing the target TextView."); } if (!(target is HasOnViewAttachListener)) { throw new System.ArgumentException(target.GetType().Name + " does not implement " + "HasOnViewAttachListener. Please use IconTextView, IconButton or IconToggleButton."); } ((HasOnViewAttachListener) target).OnViewAttachListener = new HasOnViewAttachListener_OnViewAttachListenerAnonymousInnerClassHelper(target); } else if (target is HasOnViewAttachListener) { ((HasOnViewAttachListener) target).OnViewAttachListener = null; } return spannableBuilder; }
public override Appendable append(CharSequence csq, int start, int end) { reserve(end - start); for (int i = start; i < end; i++) { unsafeWrite(csq.charAt(i)); } return this; }
/// <summary>Returns a string containing the tokens joined by delimiters.</summary> /// <remarks>Returns a string containing the tokens joined by delimiters.</remarks> /// <param name="tokens"> /// an array objects to be joined. Strings will be formed from /// the objects by calling object.toString(). /// </param> public static string join (CharSequence delimiter, Iterable<CharSequence> tokens) { StringBuilder sb = new StringBuilder (); bool firstTime = true; foreach (object token in Sharpen.IterableProxy.Create(tokens)) { if (firstTime) { firstTime = false; } else { sb.append (delimiter); } sb.append (token); } return sb.ToString (); }
private float AddToCache(CharSequence str, float x, float y, int start, int end) { float startX = x; BitmapFont font = Font; Glyph lastGlyph = null; BitmapFontData data = font.Data; if (data.ScaleX == 1 && data.ScaleY == 1) { while (start < end) { lastGlyph = data[str[start++]]; if (lastGlyph != null) { AddGlyph(lastGlyph, x + lastGlyph.XOffset, y + lastGlyph.YOffset, lastGlyph.Width, lastGlyph.Height); x += lastGlyph.XAdvance; break; } } while (start < end) { char ch = str[start++]; Glyph g = data[ch]; if (g != null) { x += lastGlyph.GetKerning(ch); lastGlyph = g; AddGlyph(lastGlyph, x + g.XOffset, y + g.YOffset, g.Width, g.Height); x += g.XAdvance; } } } else { float scaleX = data.ScaleX; float scaleY = data.ScaleY; while (start < end) { lastGlyph = data[str[start++]]; if (lastGlyph != null) { AddGlyph(lastGlyph, x + lastGlyph.XOffset * scaleX, y + lastGlyph.YOffset * scaleY, lastGlyph.Width * scaleX, lastGlyph.Height * scaleY); x += lastGlyph.XAdvance * scaleX; } } while (start < end) { char ch = str[start++]; Glyph g = data[ch]; if (g != null) { x += lastGlyph.GetKerning(ch) * scaleX; lastGlyph = g; AddGlyph(lastGlyph, x + g.XOffset * scaleX, y + g.YOffset * scaleY, lastGlyph.Width * scaleX, lastGlyph.Height * scaleY); x += g.XAdvance * scaleX; } } } return x - startX; }
public TextBounds SetText(CharSequence str, float x, float y, int start, int end) { Clear(); return AddText(str, x, y, start, end); }
public TextBounds SetMultiLineText(CharSequence str, float x, float y, float alignmentWidth, HAlignment alignment) { Clear(); return AddMultiLineText(str, x, y, alignmentWidth, alignment); }
public TextBounds AddWrappedText(CharSequence str, float x, float y, float wrapWidth, HAlignment alignment) { BitmapFont font = Font; int length = str.Length; Require(length); y += font.Data.Ascent; float down = font.Data.Down; if (wrapWidth <= 0) wrapWidth = int.MaxValue; float maxWidth = 0; int start = 0; int numLines = 0; while (start < length) { int newLine = BitmapFont.IndexOf(str, '\n', start); while (start < newLine) { if (!BitmapFont.IsWhitespace(str[start])) break; start++; } int lineEnd = start + font.ComputeVisibleGlyphs(str, start, newLine, wrapWidth); int nextStart = lineEnd + 1; if (lineEnd < newLine) { while (lineEnd > start) { if (BitmapFont.IsWhitespace(str[lineEnd])) break; lineEnd--; } if (lineEnd == start) { if (nextStart > start + 1) nextStart--; lineEnd = nextStart; } else { nextStart = lineEnd; while (lineEnd > start) { if (!BitmapFont.IsWhitespace(str[lineEnd - 1])) break; lineEnd--; } } } if (lineEnd > start) { float xOffset = 0; float lineWidth = 0; if (alignment != HAlignment.Left) { lineWidth = font.GetBounds(str, start, lineEnd).Width; xOffset = wrapWidth - lineWidth; if (alignment == HAlignment.Center) xOffset /= 2; } lineWidth = AddToCache(str, x + xOffset, y, start, lineEnd); maxWidth = Math.Max(maxWidth, lineWidth); } start = nextStart; y += down; numLines++; } return Bounds = new TextBounds() { Width = maxWidth, Height = font.Data.CapHeight + (numLines - 1) * font.Data.LineHeight, }; }
public TextBounds AddText(CharSequence str, float x, float y, int start, int end) { Require(end - start); y += Font.Data.Ascent; return Bounds = new TextBounds() { Width = AddToCache(str, x, y, start, end), Height = Font.Data.CapHeight, }; }
public TextBounds AddMultiLineText(CharSequence str, float x, float y, float alignmentWidth, HAlignment alignment) { BitmapFont font = Font; int length = str.Length; Require(length); y += Font.Data.Ascent; float down = font.Data.Down; float maxWidth = 0; float startY = y; int start = 0; int numLines = 0; while (start < length) { int lineEnd = BitmapFont.IndexOf(str, '\n', start); float xOffset = 0; float lineWidth = 0; if (alignment != HAlignment.Left) { lineWidth = font.GetBounds(str, start, lineEnd).Width; xOffset = alignmentWidth - lineWidth; if (alignment == HAlignment.Center) xOffset /= 2; } lineWidth = AddToCache(str, x + xOffset, y, start, lineEnd); maxWidth = Math.Max(maxWidth, lineWidth); start = lineEnd + 1; y += down; numLines++; } return Bounds = new TextBounds() { Width = maxWidth, Height = font.Data.CapHeight + (numLines - 1) * font.Data.LineHeight, }; }
public void setText(CharSequence str, float x, float y, float targetWidth, int horizontalAlign, bool wrap) { clear(); addText(str, x, y, targetWidth, horizontalAlign, wrap); }
public new PrintWriter append(CharSequence arg0) { return Instance.CallMethod<PrintWriter>("append", "(Ljava/lang/CharSequence;)Ljava/io/PrintWriter;", arg0); }
public CharSequenceHashCodeBenchmarks() { _strings = Enumerable.Range(0, StrCount).Select(i => StringGenerator.GenString(StrLength)).ToArray(); _2bStrings = _strings.Select(s => CharSequence.FromValue(s)).ToArray(); }
public void addText(CharSequence str, float x, float y) { Vector2 v2 = _gameFont._spriteFont.MeasureString(str.toString()); addText(str, x, y, v2.X, v2.Y, Align.LEFT_, true); }
public void addText(CharSequence str, float x, float y, float targetWidth, int horizontalAlign, bool wrap) { Vector2 v2 = _gameFont._spriteFont.MeasureString(str.toString()); addText(str, x, y, targetWidth, v2.Y, horizontalAlign, wrap); }
public virtual void beforeTextChanged(CharSequence s, int start, int count, int after) { }
protected internal void append0(CharSequence s, int start, int end) { if (s == null) { s = new StringJ("null"); //$NON-NLS-1$ } if (start < 0 || end < 0 || start > end || end > s.length()) { throw new IndexOutOfBoundsException(); } append0(s.subSequence(start, end).toString()); }
/// <summary> /// Adds an input string and it's stemmer override output to this builder. /// </summary> /// <param name="input"> the input char sequence </param> /// <param name="output"> the stemmer override output char sequence </param> /// <returns> <code>false</code> iff the input has already been added to this builder otherwise <code>true</code>. </returns> public virtual bool add(CharSequence input, CharSequence output) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int length = input.length(); int length = input.length(); if (ignoreCase) { // convert on the fly to lowercase charsSpare.grow(length); //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final char[] buffer = charsSpare.chars; char[] buffer = charsSpare.chars; for (int i = 0; i < length;) { i += char.toChars(char.ToLower(char.codePointAt(input, i)), buffer, i); } UnicodeUtil.UTF16toUTF8(buffer, 0, length, spare); } else { UnicodeUtil.UTF16toUTF8(input, 0, length, spare); } if (hash.add(spare) >= 0) { outputValues.Add(output); return true; } return false; }
Appendable Appendable.append(CharSequence arg0) { return Instance.CallMethod<Appendable>("append", "(Ljava/lang/CharSequence;)Ljava/lang/Appendable;", arg0); }
Appendable Appendable.append(CharSequence arg0, int arg1, int arg2) { return Instance.CallMethod<Appendable>("append", "(Ljava/lang/CharSequence;II)Ljava/lang/Appendable;", arg0, arg1, arg2); }
public TextBounds AddText(CharSequence str, float x, float y) { return AddText(str, x, y, 0, str.Length); }
public StringBuilder insert(int arg0, CharSequence arg1, int arg2, int arg3) { return Instance.CallMethod<StringBuilder>("insert", "(ILjava/lang/CharSequence;II)Ljava/lang/StringBuilder;", arg0, arg1, arg2, arg3); }
public TextBounds AddWrappedText(CharSequence str, float x, float y, float wrapWidth) { return AddWrappedText(str, x, y, wrapWidth, HAlignment.Left); }
public StringBuilder(CharSequence arg0) : base(ProxyCtor.I) { Instance.CallConstructor("(Ljava/lang/CharSequence;)V", arg0); }
public TextBounds SetMultiLineText(CharSequence str, float x, float y) { Clear(); return AddMultiLineText(str, x, y, 0, HAlignment.Left); }
public StringBuilder append(CharSequence arg0) { return Instance.CallMethod<StringBuilder>("append", "(Ljava/lang/CharSequence;)Ljava/lang/StringBuilder;", arg0); }
public TextBounds SetText(CharSequence str, float x, float y) { Clear(); return AddText(str, x, y, 0, str.Length); }
public override void setText(CharSequence text, BufferType type) { base.setText(Iconify.compute(Context, text, this), type); }
public TextBounds SetWrappedText(CharSequence str, float x, float y, float wrapWidth, HAlignment alignment) { Clear(); return AddWrappedText(str, x, y, wrapWidth, alignment); }
public override void onTextChanged(CharSequence s, int start, int before, int count) { string str = input.Text.ToString(); if (mCheck.Checked) { if (str.Length == 1 && str.IndexOf(SchordManager.SECURE_PREFIX) != 0) { str = SchordManager.SECURE_PREFIX + str; input.Text = str; input.Selection = input.length(); if (!outerInstance.checkChannelName(str, mCheck.Checked)) { Toast.makeText(ApplicationContext, "channelName should always begin with an alphanumeric character", Toast.LENGTH_SHORT).show(); } } else if (str.Length > 1 && str.IndexOf(SchordManager.SECURE_PREFIX) != 0) { mCheck.Checked = false; input.Text = str; input.Selection = input.length(); } else if (str.Length > 1 && !outerInstance.checkChannelName(str, mCheck.Checked)) { Toast.makeText(ApplicationContext, "channelName should always begin with an alphanumeric character", Toast.LENGTH_SHORT).show(); } } else { if (str.IndexOf(SchordManager.SECURE_PREFIX) == 0) { mCheck.Checked = true; input.Text = str; input.Selection = input.length(); } else if (str.Length >= 1 && !outerInstance.checkChannelName(str, mCheck.Checked)) { Toast.makeText(ApplicationContext, "channelName should always begin with an alphanumeric character", Toast.LENGTH_SHORT).show(); } } }
internal static int[] toCodePoints(CharSequence s) { //JAVA TO C# CONVERTER WARNING: The original Java variable was marked 'final': //ORIGINAL LINE: final int[] codePoints = new int[Character.codePointCount(s, 0, s.length())]; int[] codePoints = new int[char.codePointCount(s, 0, s.length())]; for (int i = 0, j = 0; i < s.length(); ++j) { codePoints[j] = char.codePointAt(s, i); i += char.charCount(codePoints[j]); } return codePoints; }
public override void beforeTextChanged(CharSequence s, int start, int count, int after) { }
public virtual void onTextChanged(CharSequence s, int start, int before, int count) { int chars_left = outerInstance.maxTextLength - s.length(); outerInstance.mMsgCharsView.Text = (outerInstance.maxTextLength - s.length()).ToString(); if (chars_left < 10) { outerInstance.mMsgCharsView.TextColor = Color.RED; } }
public override Appendable append(CharSequence csq) { return append(csq, 0, csq.length()); }
protected internal void insert0(int index, CharSequence s, int start, int end) { if (s == null) { s = new StringJ("null"); //$NON-NLS-1$ } if (index < 0 || index > count || start < 0 || end < 0 || start > end || end > s.length()) { throw new IndexOutOfBoundsException(); } insert0(index, s.subSequence(start, end).toString()); }
public void setText(CharSequence str, float x, float y) { clear(); addText(str, x, y); }