public virtual java.lang.CharSequence filter(java.lang.CharSequence source, int start , int end, android.text.Spanned dest, int dstart, int dend) { { for (int i = start; i < end; i++) { if (System.Char.IsLower(source[i])) { char[] v = new char[end - start]; android.text.TextUtils.getChars(source, start, end, v, 0); string s = new string(v).ToUpper(); if (source is android.text.Spanned) { android.text.SpannableString sp = new android.text.SpannableString(java.lang.CharSequenceProxy.Wrap (s)); android.text.TextUtils.copySpansFrom((android.text.Spanned)source, start, end, null , sp, 0); return(sp); } else { return(java.lang.CharSequenceProxy.Wrap(s)); } } } } return(null); }
public virtual java.lang.CharSequence filter(java.lang.CharSequence source, int start , int end, android.text.Spanned dest, int dstart, int dend) { { for (int i = start; i < end; i++) { if (System.Char.IsLower(source[i])) { char[] v = new char[end - start]; android.text.TextUtils.getChars(source, start, end, v, 0); string s = new string(v).ToUpper(); if (source is android.text.Spanned) { android.text.SpannableString sp = new android.text.SpannableString(java.lang.CharSequenceProxy.Wrap (s)); android.text.TextUtils.copySpansFrom((android.text.Spanned)source, start, end, null , sp, 0); return sp; } else { return java.lang.CharSequenceProxy.Wrap(s); } } } } return null; }
public virtual java.lang.CharSequence terminateToken(java.lang.CharSequence text) { int i = text.Length; while (i > 0 && text[i - 1] == ' ') { i--; } if (i > 0 && text[i - 1] == ',') { return(text); } else { if (text is android.text.Spanned) { android.text.SpannableString sp = new android.text.SpannableString(java.lang.CharSequenceProxy.Wrap (text + ", ")); android.text.TextUtils.copySpansFrom((android.text.Spanned)text, 0, text.Length, typeof(object), sp, 0); return(sp); } else { return(java.lang.CharSequenceProxy.Wrap(text + ", ")); } } }
private java.lang.CharSequence formatUrl(java.lang.CharSequence url) { if (mUrlColor == null) { // Lazily get the URL color from the current theme. android.util.TypedValue colorValue = new android.util.TypedValue(); mContext.getTheme().resolveAttribute([email protected], colorValue, true); mUrlColor = mContext.getResources().getColorStateList(colorValue.resourceId); } android.text.SpannableString text = new android.text.SpannableString(url); text.setSpan(new android.text.style.TextAppearanceSpan(null, 0, 0, mUrlColor, null ), 0, url.Length, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); return(text); }
public virtual java.lang.CharSequence terminateToken(java.lang.CharSequence text) { int i = text.Length; while (i > 0 && text[i - 1] == ' ') { i--; } if (i > 0 && text[i - 1] == ',') { return text; } else { if (text is android.text.Spanned) { android.text.SpannableString sp = new android.text.SpannableString(java.lang.CharSequenceProxy.Wrap (text + ", ")); android.text.TextUtils.copySpansFrom((android.text.Spanned)text, 0, text.Length, typeof(object), sp, 0); return sp; } else { return java.lang.CharSequenceProxy.Wrap(text + ", "); } } }
internal java.lang.CharSequence applyStyles(string str, int[] style, android.content.res.StringBlock .StyleIDs ids) { if (style.Length == 0) { return java.lang.CharSequenceProxy.Wrap(str); } android.text.SpannableString buffer = new android.text.SpannableString(java.lang.CharSequenceProxy.Wrap (str)); int i = 0; while (i < style.Length) { int type = style[i]; if (type == ids.boldId) { buffer.setSpan(new android.text.style.StyleSpan(android.graphics.Typeface.BOLD), style[i + 1], style[i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE ); } else { if (type == ids.italicId) { buffer.setSpan(new android.text.style.StyleSpan(android.graphics.Typeface.ITALIC) , style[i + 1], style[i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE ); } else { if (type == ids.underlineId) { buffer.setSpan(new android.text.style.UnderlineSpan(), style[i + 1], style[i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } else { if (type == ids.ttId) { buffer.setSpan(new android.text.style.TypefaceSpan("monospace"), style[i + 1], style [i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } else { if (type == ids.bigId) { buffer.setSpan(new android.text.style.RelativeSizeSpan(1.25f), style[i + 1], style [i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } else { if (type == ids.smallId) { buffer.setSpan(new android.text.style.RelativeSizeSpan(0.8f), style[i + 1], style [i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } else { if (type == ids.subId) { buffer.setSpan(new android.text.style.SubscriptSpan(), style[i + 1], style[i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } else { if (type == ids.supId) { buffer.setSpan(new android.text.style.SuperscriptSpan(), style[i + 1], style[i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } else { if (type == ids.strikeId) { buffer.setSpan(new android.text.style.StrikethroughSpan(), style[i + 1], style[i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } else { if (type == ids.listItemId) { addParagraphSpan(buffer, new android.text.style.BulletSpan(10), style[i + 1], style [i + 2] + 1); } else { if (type == ids.marqueeId) { buffer.setSpan(android.text.TextUtils.TruncateAt.MARQUEE, style[i + 1], style[i + 2] + 1, android.text.SpannedClass.SPAN_INCLUSIVE_INCLUSIVE); } else { string tag = nativeGetString(mNative, type); if (tag.StartsWith("font;")) { string sub; sub = subtag(tag, ";height="); if (sub != null) { int size = System.Convert.ToInt32(sub); addParagraphSpan(buffer, new android.content.res.StringBlock.Height(size), style[ i + 1], style[i + 2] + 1); } sub = subtag(tag, ";size="); if (sub != null) { int size = System.Convert.ToInt32(sub); buffer.setSpan(new android.text.style.AbsoluteSizeSpan(size, true), style[i + 1], style[i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } sub = subtag(tag, ";fgcolor="); if (sub != null) { int color = [email protected](sub, -1); buffer.setSpan(new android.text.style.ForegroundColorSpan(color), style[i + 1], style [i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } sub = subtag(tag, ";bgcolor="); if (sub != null) { int color = [email protected](sub, -1); buffer.setSpan(new android.text.style.BackgroundColorSpan(color), style[i + 1], style [i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } } else { if (tag.StartsWith("a;")) { string sub; sub = subtag(tag, ";href="); if (sub != null) { buffer.setSpan(new android.text.style.URLSpan(sub), style[i + 1], style[i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } } else { if (tag.StartsWith("annotation;")) { int len = tag.Length; int next; { for (int t = tag.IndexOf(';'); t < len; t = next) { int eq = tag.IndexOf('=', t); if (eq < 0) { break; } next = tag.IndexOf(';', eq); if (next < 0) { next = len; } string key = Sharpen.StringHelper.Substring(tag, t + 1, eq); string value = Sharpen.StringHelper.Substring(tag, eq + 1, next); buffer.setSpan(new android.text.Annotation(key, value), style[i + 1], style[i + 2 ] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } } } } } } } } } } } } } } } } i += 3; } return new android.text.SpannedString(buffer); }
internal java.lang.CharSequence applyStyles(string str, int[] style, android.content.res.StringBlock .StyleIDs ids) { if (style.Length == 0) { return(java.lang.CharSequenceProxy.Wrap(str)); } android.text.SpannableString buffer = new android.text.SpannableString(java.lang.CharSequenceProxy.Wrap (str)); int i = 0; while (i < style.Length) { int type = style[i]; if (type == ids.boldId) { buffer.setSpan(new android.text.style.StyleSpan(android.graphics.Typeface.BOLD), style[i + 1], style[i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE ); } else { if (type == ids.italicId) { buffer.setSpan(new android.text.style.StyleSpan(android.graphics.Typeface.ITALIC) , style[i + 1], style[i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE ); } else { if (type == ids.underlineId) { buffer.setSpan(new android.text.style.UnderlineSpan(), style[i + 1], style[i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } else { if (type == ids.ttId) { buffer.setSpan(new android.text.style.TypefaceSpan("monospace"), style[i + 1], style [i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } else { if (type == ids.bigId) { buffer.setSpan(new android.text.style.RelativeSizeSpan(1.25f), style[i + 1], style [i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } else { if (type == ids.smallId) { buffer.setSpan(new android.text.style.RelativeSizeSpan(0.8f), style[i + 1], style [i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } else { if (type == ids.subId) { buffer.setSpan(new android.text.style.SubscriptSpan(), style[i + 1], style[i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } else { if (type == ids.supId) { buffer.setSpan(new android.text.style.SuperscriptSpan(), style[i + 1], style[i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } else { if (type == ids.strikeId) { buffer.setSpan(new android.text.style.StrikethroughSpan(), style[i + 1], style[i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } else { if (type == ids.listItemId) { addParagraphSpan(buffer, new android.text.style.BulletSpan(10), style[i + 1], style [i + 2] + 1); } else { if (type == ids.marqueeId) { buffer.setSpan(android.text.TextUtils.TruncateAt.MARQUEE, style[i + 1], style[i + 2] + 1, android.text.SpannedClass.SPAN_INCLUSIVE_INCLUSIVE); } else { string tag = nativeGetString(mNative, type); if (tag.StartsWith("font;")) { string sub; sub = subtag(tag, ";height="); if (sub != null) { int size = System.Convert.ToInt32(sub); addParagraphSpan(buffer, new android.content.res.StringBlock.Height(size), style[ i + 1], style[i + 2] + 1); } sub = subtag(tag, ";size="); if (sub != null) { int size = System.Convert.ToInt32(sub); buffer.setSpan(new android.text.style.AbsoluteSizeSpan(size, true), style[i + 1], style[i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } sub = subtag(tag, ";fgcolor="); if (sub != null) { int color = [email protected](sub, -1); buffer.setSpan(new android.text.style.ForegroundColorSpan(color), style[i + 1], style [i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } sub = subtag(tag, ";bgcolor="); if (sub != null) { int color = [email protected](sub, -1); buffer.setSpan(new android.text.style.BackgroundColorSpan(color), style[i + 1], style [i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } } else { if (tag.StartsWith("a;")) { string sub; sub = subtag(tag, ";href="); if (sub != null) { buffer.setSpan(new android.text.style.URLSpan(sub), style[i + 1], style[i + 2] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } } else { if (tag.StartsWith("annotation;")) { int len = tag.Length; int next; { for (int t = tag.IndexOf(';'); t < len; t = next) { int eq = tag.IndexOf('=', t); if (eq < 0) { break; } next = tag.IndexOf(';', eq); if (next < 0) { next = len; } string key = Sharpen.StringHelper.Substring(tag, t + 1, eq); string value = Sharpen.StringHelper.Substring(tag, eq + 1, next); buffer.setSpan(new android.text.Annotation(key, value), style[i + 1], style[i + 2 ] + 1, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); } } } } } } } } } } } } } } } } i += 3; } return(new android.text.SpannedString(buffer)); }
private java.lang.CharSequence formatUrl(java.lang.CharSequence url) { if (mUrlColor == null) { // Lazily get the URL color from the current theme. android.util.TypedValue colorValue = new android.util.TypedValue(); mContext.getTheme().resolveAttribute([email protected], colorValue, true); mUrlColor = mContext.getResources().getColorStateList(colorValue.resourceId); } android.text.SpannableString text = new android.text.SpannableString(url); text.setSpan(new android.text.style.TextAppearanceSpan(null, 0, 0, mUrlColor, null ), 0, url.Length, android.text.SpannedClass.SPAN_EXCLUSIVE_EXCLUSIVE); return text; }