Codota Logo
SpannableStringBuilder.charAt
Code IndexAdd Codota to your IDE (free)

How to use
charAt
method
in
android.text.SpannableStringBuilder

Best Java code snippets using android.text.SpannableStringBuilder.charAt (Showing top 20 results out of 315)

  • Common ways to obtain SpannableStringBuilder
private void myMethod () {
SpannableStringBuilder s =
  • Codota Iconnew SpannableStringBuilder()
  • Codota IconCharSequence text;new SpannableStringBuilder(text)
  • Smart code suggestions by Codota
}
origin: google/ExoPlayer

/**
 * Called when the end of a paragraph is encountered. Adds a newline if there are one or more
 * non-space characters since the previous newline.
 *
 * @param builder The builder.
 */
/* package */ static void endParagraph(SpannableStringBuilder builder) {
 int position = builder.length() - 1;
 while (position >= 0 && builder.charAt(position) == ' ') {
  position--;
 }
 if (position >= 0 && builder.charAt(position) != '\n') {
  builder.append('\n');
 }
}
origin: google/ExoPlayer

 if (builder.charAt(i) == ' ') {
  int j = i + 1;
  while (j < builder.length() && builder.charAt(j) == ' ') {
   j++;
if (builderLength > 0 && builder.charAt(0) == ' ') {
 builder.delete(0, 1);
 builderLength--;
 if (builder.charAt(i) == '\n' && builder.charAt(i + 1) == ' ') {
  builder.delete(i + 1, i + 2);
  builderLength--;
if (builderLength > 0 && builder.charAt(builderLength - 1) == ' ') {
 builder.delete(builderLength - 1, builderLength);
 builderLength--;
 if (builder.charAt(i) == ' ' && builder.charAt(i + 1) == '\n') {
  builder.delete(i, i + 1);
  builderLength--;
if (builderLength > 0 && builder.charAt(builderLength - 1) == '\n') {
 builder.delete(builderLength - 1, builderLength);
origin: stackoverflow.com

 private static void handleP(SpannableStringBuilder text) {
  int len = text.length();

  if (len >= 1 && text.charAt(len - 1) == '\n') {
    if (len >= 2 && text.charAt(len - 2) == '\n') {
      return;
    }

    text.append("\n");
    return;
  }

  if (len != 0) {
    text.append("\n\n");
  }
}
origin: seven332/EhViewer

private static void handleP(SpannableStringBuilder text) {
  int len = text.length();
  if (len >= 1 && text.charAt(len - 1) == '\n') {
    if (len >= 2 && text.charAt(len - 2) == '\n') {
      return;
    }
    text.append("\n");
    return;
  }
  if (len != 0) {
    text.append("\n\n");
  }
}
origin: seven332/EhViewer

  pred = '\n';
} else {
  pred = mSpannableStringBuilder.charAt(len - 1);
origin: seven332/EhViewer

if (mSpannableStringBuilder.charAt(end - 1) == '\n' &&
    mSpannableStringBuilder.charAt(end - 2) == '\n') {
  end--;
origin: seven332/EhViewer

private static void endHeader(SpannableStringBuilder text) {
  int len = text.length();
  Object obj = getLast(text, Header.class);
  int where = text.getSpanStart(obj);
  text.removeSpan(obj);
  // Back off not to change only the text, not the blank line.
  while (len > where && text.charAt(len - 1) == '\n') {
    len--;
  }
  if (where != len) {
    Header h = (Header) obj;
    text.setSpan(new RelativeSizeSpan(HEADER_SIZES[h.mLevel]),
        where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    text.setSpan(new StyleSpan(Typeface.BOLD),
        where, len, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
  }
}
origin: square1-io/rich-text-android

@Override
public char charAt(int index) {
  return mSpannableString.charAt(index);
}
origin: stackoverflow.com

 SpannableStringBuilder resultSpan = new SpannableStringBuilder(yourString);

for (int i = 0; i < resultSpan.length(); i++) {
 if (resultSpan.charAt(i) == '\u0180') {
  CustomTypefaceSpan typefaceSpan = new CustomTypefaceSpan(customTypeface);
  resultSpan.setSpan(typefaceSpan, i, i + 1, 0);
 }
}
origin: stackoverflow.com

 public SpannableStringBuilder trimTrailingWhitespace(
    SpannableStringBuilder spannableString) {

  if (spannableString == null)
    return new SpannableStringBuilder("");

  int i = spannableString.length();

  // loop back to the first non-whitespace character
  while (--i >= 0 && Character.isWhitespace(spannableString.charAt(i))) {
  }

  return new SpannableStringBuilder(spannableString.subSequence(0, i + 1));
}
origin: stackoverflow.com

 private static void handleP(SpannableStringBuilder text) {
  int len = text.length();

  if (len >= 1 && text.charAt(len - 1) == '\n') {
    if (len >= 2 && text.charAt(len - 2) == '\n') {
      return;
    }
    text.append("\n");
    return;
  }

  if (len != 0) {

    text.append("\n\n");

  }
}
origin: Ronak-LM/memoir

private void handleP() {
  int len = mResult.length();
  if (len >= 1 && mResult.charAt(len - 1) == '\n') {
    if (len < 2 || mResult.charAt(len - 2) != '\n') {
      mResult.append("\n");
    }
  } else if (len != 0) {
    mResult.append("\n\n");
  }
}
origin: zulip/zulip-android

private static void handleP(SpannableStringBuilder text) {
  int len = text.length();
  if (len >= 1 && text.charAt(len - 1) == '\n') {
    if (len >= 2 && text.charAt(len - 2) == '\n') {
      return;
    }
    text.append("\n");
    return;
  }
  if (len != 0) {
    text.append("\n\n");
  }
}
origin: xuyisheng/TextViewForFullHtml

private static void handleP(SpannableStringBuilder text) {
  int len = text.length();
  if (len >= 1 && text.charAt(len - 1) == '\n') {
    if (len >= 2 && text.charAt(len - 2) == '\n') {
      return;
    }
    text.append("\n");
    return;
  }
  if (len != 0) {
    text.append("\n\n");
  }
}
origin: stackoverflow.com

 private static void handleP(SpannableStringBuilder text) {
  int len = text.length();

  if (len >= 1 && text.charAt(len - 1) == '\n') {
    if (len >= 2 && text.charAt(len - 2) == '\n') {
      return;
    }
    text.append("\n");
    return;
  }

  if (len != 0) {
    text.append("\n\n");


  }
}
origin: trezor/trezor-android

private static void handleP(SpannableStringBuilder text) {
  int len = text.length();
  if (len >= 1 && text.charAt(len - 1) == '\n') {
    if (len >= 2 && text.charAt(len - 2) == '\n') {
      return;
    }
    text.append("\n");
    return;
  }
  if (len != 0) {
    text.append("\n\n");
  }
}
origin: fourlastor/dante

private void addNewLine(SpannableStringBuilder text) {
  final int len = text.length();
  if (len >= 1 && text.charAt(len - 1) == '\n') {
    return;
  }
  if (len != 0) {
    text.append("\n");
  }
}
origin: Ronak-LM/memoir

private void removeTrailingLineBreaks() {
  int end = mResult.length();
  while (end > 0 && mResult.charAt(end - 1) == '\n') {
    end--;
  }
  if (end < mResult.length()) {
    mResult = SpannableStringBuilder.valueOf(mResult.subSequence(0, end));
  }
}
origin: Ronak-LM/memoir

private void endHeader() {
  int len = mResult.length();
  Object obj = getLast(Header.class);
  int where = mResult.getSpanStart(obj);
  mResult.removeSpan(obj);
  // Back off not to change only the text, not the blank line.
  while (len > where && mResult.charAt(len - 1) == '\n') {
    len--;
  }
  if (where != len) {
    Header h = (Header) obj;
    mResult.setSpan(new RelativeSizeSpan(HEADER_SIZES[h.mLevel]), where, len, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
    mResult.setSpan(new BoldSpan(), where, len, Spanned.SPAN_EXCLUSIVE_EXCLUSIVE);
  }
}
origin: ImangazalievM/Bubbble

/**
 * Parse the given input using {@link TouchableUrlSpan}s rather than vanilla {@link URLSpan}s
 * so that they respond to touch.
 */
public SpannableStringBuilder parseHtml(
    String input,
    ColorStateList linkTextColor) {
  SpannableStringBuilder spanned = fromHtml(input);
  // strip any trailing newlines
  while (spanned.charAt(spanned.length() - 1) == '\n') {
    spanned = spanned.delete(spanned.length() - 1, spanned.length());
  }
  return linkifyPlainLinks(spanned, linkTextColor);
}
android.textSpannableStringBuildercharAt

Popular methods of SpannableStringBuilder

  • <init>
  • setSpan
  • append
  • length
  • getSpans
  • toString
  • getSpanStart
  • removeSpan
  • getSpanEnd
  • delete
  • replace
  • clear
  • replace,
  • clear,
  • subSequence,
  • clearSpans,
  • getSpanFlags,
  • valueOf,
  • insert,
  • nextSpanTransition,
  • getChars

Popular in Java

  • Running tasks concurrently on multiple threads
  • getSystemService (Context)
  • scheduleAtFixedRate (Timer)
    Schedules the specified task for repeated fixed-rate execution, beginning after the specified delay.
  • getSupportFragmentManager (FragmentActivity)
    Return the FragmentManager for interacting with fragments associated with this activity.
  • Container (java.awt)
    A generic Abstract Window Toolkit(AWT) container object is a component that can contain other AWT co
  • Kernel (java.awt.image)
  • ConnectException (java.net)
    A ConnectException is thrown if a connection cannot be established to a remote host on a specific po
  • MessageDigest (java.security)
    Uses a one-way hash function to turn an arbitrary number of bytes into a fixed-length byte sequence.
  • DateTimeFormat (org.joda.time.format)
    Factory that creates instances of DateTimeFormatter from patterns and styles. Datetime formatting i
  • SAXParseException (org.xml.sax)
    Encapsulate an XML parse error or warning.This exception may include information for locating the er
Codota Logo
  • Products

    Search for Java codeSearch for JavaScript codeEnterprise
  • IDE Plugins

    IntelliJ IDEAWebStormAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogCodota Academy Plugin user guide Terms of usePrivacy policyJava Code IndexJavascript Code Index
Get Codota for your IDE now