use of org.signal.core.util.BreakIteratorCompat in project Signal-Android by WhisperSystems.
the class StringUtil method getGraphemeCount.
/**
* @return The number of graphemes in the provided string.
*/
public static int getGraphemeCount(@NonNull CharSequence text) {
BreakIteratorCompat iterator = BreakIteratorCompat.getInstance();
iterator.setText(text);
return iterator.countBreaks();
}
use of org.signal.core.util.BreakIteratorCompat in project Signal-Android by WhisperSystems.
the class EditAboutFragment method presentCount.
private void presentCount(@NonNull String aboutBody) {
BreakIteratorCompat breakIterator = BreakIteratorCompat.getInstance();
breakIterator.setText(aboutBody);
int glyphCount = breakIterator.countBreaks();
if (glyphCount >= ABOUT_LIMIT_DISPLAY_THRESHOLD) {
this.countView.setVisibility(View.VISIBLE);
this.countView.setText(getResources().getString(R.string.EditAboutFragment_count, glyphCount, ABOUT_MAX_GLYPHS));
} else {
this.countView.setVisibility(View.GONE);
}
}
Aggregations