Android ForegroundColorSpan - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Android ForegroundColorSpan class.

This code example shows how to use the following methods:
     * @param text 
     * @param color 
     * @return this text 
     */ 
    public StyledText foreground(final CharSequence text, final int color) {
        return append(text, new ForegroundColorSpan(color));
    } 
 
    /** 
     * Append text in with custom foreground color 
     * 
     * @param text 
     * @param color 
     * @return this text 
     */ 
    public StyledText foreground(final char text, final int color) {
        return append(text, new ForegroundColorSpan(color));
    } 
 
    /** 
7
CodeRank
This code example shows how to use the following methods:
 
import java.util.concurrent.atomic.AtomicReference; 
 
public class FileViewHolder implements ViewHolder<FilePath> { 
 
    private static ForegroundColorSpan highlightStyle = new ForegroundColorSpan(0x880000ff);
 
    private final TextView detail;
    private final AtomicReference<FilePathMatcher> filePathMatcher;
 
    public FileViewHolder(View v, AtomicReference<FilePathMatcher> filePathMatcher) {
        this.filePathMatcher = filePathMatcher;
        detail = (TextView) v.findViewById(commit_subject);
    } 
 
    public void updateViewFor(FilePath filePath) {
        CharSequence fileName = filePath.getPath();
        FilePathMatcher currentFPM = filePathMatcher.get();
        if (currentFPM != null) {
            fileName = highlightFilePath(filePath, currentFPM);
6
CodeRank
This code example shows how to use the following methods:
		return defaultValue;
	} 
 
	private URLSpan mCurrentLink;
	private ForegroundColorSpan mLinkFocusStyle = new ForegroundColorSpan(
			Color.RED);
 
	@Override 
	public boolean onTouchEvent(MotionEvent event) {
		CharSequence text = getText();
		int action = event.getAction();
 
		if (!(text instanceof Spannable)) {
			return super.onTouchEvent(event);
		} 
 
		Spannable buffer = (Spannable) text;
 
		if (action == MotionEvent.ACTION_UP
				|| action == MotionEvent.ACTION_DOWN
6
CodeRank
This code example shows how to use the following methods:
			String face = tm.getAttributes().getValue("", "face");
			String size = tm.getAttributes().getValue("", "size");
			if (!TextUtils.isEmpty(color)) {
				int c = Util.getHtmlColor(color);
				if (c != -1) {
					mSB.setSpan(new ForegroundColorSpan(c | 0xFF000000), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
				} 
			} 
			if (face != null) {
				mSB.setSpan(new TypefaceSpan(face), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
			} 
			if (size != null) {
				mSB.setSpan(Util.sizeToSpan(size), start, end, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
			} 
		} 
	} 
 
	private void endA(TagMarker tm) {
		int end = mSB.length();
		int start = tm.getStart();
6
CodeRank
This code example shows how to use the following methods:
This code example shows how to use the following methods:setSpan
 
        if (eventAuthor != null){
            if (eventAuthor.equals(comment.getUsername())){
                ((Spannable)((CommentView) convertView).userTexView.getText()).setSpan(new ForegroundColorSpan(Color.YELLOW), 0, length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            } else { 
                ((Spannable)((CommentView) convertView).userTexView.getText()).setSpan(new ForegroundColorSpan(Color.rgb(255, 200, 0)), 0, length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
            } 
 
        } 
        ((Spannable)((CommentView) convertView).userTexView.getText()).setSpan(new StyleSpan(android.graphics.Typeface.BOLD), 0, length, Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
 
        return convertView;
    } 
 
    private void createSpanSections(Spannable str, int[] styled) {
        str.setSpan(new ForegroundColorSpan(Color.BLACK), styled[0], styled[1], Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        str.setSpan(new ForegroundColorSpan(Color.GRAY), styled[1], styled[2], Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
        str.setSpan(new StyleSpan(android.graphics.Typeface.ITALIC), styled[1], styled[2], Spannable.SPAN_EXCLUSIVE_EXCLUSIVE);
    } 
 
5
CodeRank
This code example shows how to use the following methods:
This code example shows how to use the following methods:
  } 
 
  public StyleableSpannableStringBuilder appendGray(CharSequence text) {
//    Log.d(TAG, "appendBlue: " + text); 
    if (text != null) {
      return appendWithStyle(new ForegroundColorSpan(Color.GRAY), text);
    } 
    return null; 
  } 
} 
5
CodeRank
This code example shows how to use the following methods:
		updateView(); 
	} 
 
	public void setPrefixColor(final int prefixColor)
	{ 
		this.prefixColorSpan = new ForegroundColorSpan(prefixColor);
		updateView(); 
	} 
 
	public void setAmount(final BigInteger amount)
	{ 
		this.amount = amount;
		updateView(); 
	} 
 
	public void setPrecision(final int precision)
	{ 
		this.precision = precision;
		updateView(); 
	} 
5
CodeRank
This code example shows how to use the following methods:
				tfore = _color;
				tback = _back;
			} 
			fore = getTermColor(tfore, _bright);
			back = getTermColor(tback, false);
			return new Object[] { new ForegroundColorSpan(fore),
					new BackgroundColorSpan(back) };
		} 
		 
	}	 
	 
	class Style extends Format { 
		private boolean _underline;
		Style() 
		{ 
			_underline = false;
		} 
		public void setUnderline(boolean underline)
		{ 
			if (underline != _underline)
4
CodeRank

Related Android ForegroundColorSpan Questions & Answers:

See Code Examples for Android ForegroundColorSpan Methods: