本文整理汇总了C#中ICharSequence类的典型用法代码示例。如果您正苦于以下问题:C# ICharSequence类的具体用法?C# ICharSequence怎么用?C# ICharSequence使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ICharSequence类属于命名空间,在下文中一共展示了ICharSequence类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InnerToken
/// <summary>
/// A method for getting tokens containing mutible words
/// </summary>
private ICharSequence InnerToken(ICharSequence text)
{
int i = text.Length();
// Find the first space in the Token, going backwards
while (i > 0 && text.CharAt(i - 1) == ' ')
{
i--;
}
if (i > 0 && text.CharAt(i - 1) == ' ')
{
return text;
}
else
{
if (text.GetType().IsInstanceOfType(typeof(ISpanned)))
{
SpannableString sp = new SpannableString(text + " ");
TextUtils.CopySpansFrom((ISpanned)text, 0, text.Length(), Java.Lang.Class.FromType(typeof(Java.Lang.Object)), sp, 0);
return sp;
}
else
{
return new Java.Lang.String(text + " ");
}
}
}
示例2: FuzzyQueryNode
/// <summary>
///
/// </summary>
/// <param name="field">Name of the field query will use.</param>
/// <param name="term">Term token to use for building term for the query</param>
/// <param name="minSimilarity">similarity value</param>
/// <param name="begin">position in the query string</param>
/// <param name="end">position in the query string</param>
public FuzzyQueryNode(string field, ICharSequence term,
float minSimilarity, int begin, int end)
: base(field, term, begin, end)
{
this.similarity = minSimilarity;
IsLeaf = true;
}
示例3: BeforeTextChanged
void ITextWatcher.BeforeTextChanged(ICharSequence s, int start, int count, int after)
{
if (BeforeTextChanged != null)
{
BeforeTextChanged(s, start, count, after);
}
}
示例4: EscapeChar
private static ICharSequence EscapeChar(ICharSequence str, CultureInfo locale)
{
if (str == null || str.Length == 0)
return str;
ICharSequence buffer = str;
// regular escapable Char for terms
for (int i = 0; i < escapableTermChars.Length; i++)
{
buffer = ReplaceIgnoreCase(buffer, escapableTermChars[i].ToLower(locale),
"\\", locale);
}
// First Character of a term as more escaping chars
for (int i = 0; i < escapableTermExtraFirstChars.Length; i++)
{
if (buffer[0] == escapableTermExtraFirstChars[i][0])
{
buffer = new StringCharSequenceWrapper("\\" + buffer[0]
+ buffer.SubSequence(1, buffer.Length).ToString());
break;
}
}
return buffer;
}
示例5: SimpleMenuItem
public SimpleMenuItem (SimpleMenu menu, int id, int order, ICharSequence title)
{
mMenu = menu;
mId = id;
mOrder = order;
mTitle = title;
}
示例6: Parse
public static ICharSequence Parse(Context context, IList<IconFontDescriptorWrapper> iconFontDescriptors,
ICharSequence text, TextView target)
{
context = context.ApplicationContext;
// Analyse the text and replace {} blocks With the appropriate character
// Retain all transformations in the accumulator
var spannableBuilder = new SpannableStringBuilder(text);
RecursivePrepareSpannableIndexes(context, text.ToString(), spannableBuilder, iconFontDescriptors, 0);
var isAnimated = HasAnimatedSpans(spannableBuilder);
// If animated, periodically invalidate the TextView so that the
// CustomTypefaceSpan can redraw itself
if (isAnimated)
{
if (target == null)
{
throw new ArgumentException("You can't use \"spin\" without providing the target TextView.");
}
if (!(target is IHasOnViewAttachListener))
{
throw new ArgumentException(target.GetType().Name + " does not implement " +
"HasOnViewAttachListener. Please use IconTextView, IconButton or IconToggleButton.");
}
((IHasOnViewAttachListener) target).OnViewAttachListener =
new OnViewAttachListenerOnViewAttachListenerAnonymousInnerClassHelper(target);
}
else if (target is IHasOnViewAttachListener)
{
((IHasOnViewAttachListener) target).OnViewAttachListener = null;
}
return spannableBuilder;
}
示例7: NewInstance
/**
* Create a new instance of MyFragment that will be initialized
* with the given arguments.
*/
internal static MyFragment NewInstance(ICharSequence label) {
MyFragment f = new MyFragment();
Bundle b = new Bundle();
b.PutCharSequence("label", label);
f.SetArguments(b);
return f;
}
示例8: OnTextChanged
void ITextWatcher.OnTextChanged(ICharSequence s, int start, int before, int count)
{
if (OnTextChanged != null)
{
OnTextChanged(new TextChangedEventArgs(s, start, before, count));
}
}
示例9: PerformFiltering
protected override FilterResults PerformFiltering(ICharSequence constraint)
{
var results = performFilteringHandler(constraint.ToString());
return new FilterResults
{
Count = results.Size(),
Values = results
};
}
示例10: PerformFiltering
protected override FilterResults PerformFiltering (ICharSequence constraint)
{
if (filterResults == null) {
filterResults = new FilterResults ();
}
Task.Run (async () => await SearchWithStringAsync (constraint));
return filterResults;
}
示例11: UnescapedCharSequence
/// <summary>
/// Create a non-escaped <see cref="ICharSequence"/>
/// </summary>
public UnescapedCharSequence(ICharSequence text)
{
this.chars = new char[text.Length];
this.wasEscaped = new bool[text.Length];
for (int i = 0; i < text.Length; i++)
{
this.chars[i] = text[i];
this.wasEscaped[i] = false;
}
}
示例12: PerformFiltering
protected override FilterResults PerformFiltering(ICharSequence constraint)
{
var stringConstraint = constraint == null ? string.Empty : constraint.ToString();
var count = _owner.SetConstraintAndWaitForDataChange(stringConstraint);
return new FilterResults
{
Count = count
};
}
示例13: FilterFormatted
public ICharSequence FilterFormatted(ICharSequence source, int start, int end, ISpanned dest, int dstart, int dend)
{
for (int i = start; i < end; ++i)
{
if (!Character.IsDigit(source.CharAt(i)) && !backgroundHintTextView.IsCharInFilter(source.CharAt(i)))
{
return new Java.Lang.String("");
}
}
return null;
}
示例14: SearchWithStringAsync
async Task SearchWithStringAsync (ICharSequence constraint)
{
var searchString = constraint?.ToString ();
if (searchString == null) {
LocationResults = new List<WuAcLocation> ();
ResultStrings = new List<SpannableString> ();
return;
}
bool canceled = false;
try {
ResultStrings = new List<SpannableString> ();
if (!string.IsNullOrWhiteSpace (searchString)) {
LocationResults = await WuAcClient.GetAsync (searchString);
Java.Lang.Object [] matchObjects = new Java.Lang.Object [LocationResults.Count];
for (int i = 0; i < LocationResults.Count; i++) {
var name = LocationResults [i].name;
ResultStrings.Add (name.GetSearchResultSpannableString (searchString));
matchObjects [i] = new Java.Lang.String (name);
}
filterResults.Values = matchObjects;
filterResults.Count = LocationResults.Count;
} else {
LocationResults = new List<WuAcLocation> ();
}
} catch (System.Exception ex) {
System.Diagnostics.Debug.WriteLine (ex.Message);
canceled = true;
} finally {
if (!canceled) {
publish = true;
Activity.RunOnUiThread (() => PublishResults (constraint, filterResults));
}
}
}
示例15: Draw
public override void Draw(Canvas canvas, ICharSequence text, int start, int end, float x, int top, int y, int bottom, Paint paint)
{
PrepView();
canvas.Save();
//Centering the token looks like a better strategy that aligning the bottom
int padding = (bottom - top - View.Bottom) / 2;
canvas.Translate(x, bottom - View.Bottom - padding);
View.Draw(canvas);
canvas.Restore();
}