Java Code Examples for android.text.TextUtils.getChars()

The following are Jave code examples for showing how to use getChars() of the android.text.TextUtils class. You can vote up the examples you like. Your votes will be used in our system to get more good examples.
Example 1
Project: PeSanKita-android   File: EmojiFilter.java   Source Code and License Vote up 5 votes
@Override
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend)
{
  char[] v = new char[end - start];
  TextUtils.getChars(source, start, end, v, 0);

  Spannable emojified = EmojiProvider.getInstance(view.getContext()).emojify(new String(v), view);

  if (source instanceof Spanned && emojified != null) {
    TextUtils.copySpansFrom((Spanned) source, start, end, null, emojified, 0);
  }

  return emojified;
}
 
Example 2
Project: Nird2   File: EmojiFilter.java   Source Code and License Vote up 5 votes
@Nullable
@Override
public CharSequence filter(CharSequence source, int start, int end,
		Spanned dest, int dstart, int dend) {

	char[] v = new char[end - start];
	TextUtils.getChars(source, start, end, v, 0);
	Spannable emojified = EmojiProvider.getInstance(view.getContext())
			.emojify(new String(v), view);
	if (source instanceof Spanned && emojified != null) {
		TextUtils.copySpansFrom((Spanned) source, start, end, null,
				emojified, 0);
	}
	return emojified;
}
 
Example 3
Project: Nird2   File: EmojiFilter.java   Source Code and License Vote up 5 votes
@Nullable
@Override
public CharSequence filter(CharSequence source, int start, int end,
		Spanned dest, int dstart, int dend) {

	char[] v = new char[end - start];
	TextUtils.getChars(source, start, end, v, 0);
	Spannable emojified = EmojiProvider.getInstance(view.getContext())
			.emojify(new String(v), view);
	if (source instanceof Spanned && emojified != null) {
		TextUtils.copySpansFrom((Spanned) source, start, end, null,
				emojified, 0);
	}
	return emojified;
}
 
Example 4
Project: Cable-Android   File: EmojiFilter.java   Source Code and License Vote up 5 votes
@Override
public CharSequence filter(CharSequence source, int start, int end, Spanned dest, int dstart, int dend)
{
  char[] v = new char[end - start];
  TextUtils.getChars(source, start, end, v, 0);

  Spannable emojified = EmojiProvider.getInstance(view.getContext()).emojify(new String(v), view);

  if (source instanceof Spanned && emojified != null) {
    TextUtils.copySpansFrom((Spanned) source, start, end, null, emojified, 0);
  }

  return emojified;
}
 
Example 5
Project: FastTextView   File: TextMeasureUtil.java   Source Code and License Vote up 4 votes
public static void getTextBounds(Paint paint, CharSequence text, @IntRange(from = 0) int start, @IntRange(from = 0) int end, Rect rect) {
  char[] currentText = new char[end - start];
  TextUtils.getChars(text, start, end, currentText, 0);
  paint.getTextBounds(currentText, 0, end - start, rect);
}