Java Code Examples for android.graphics.Typeface#DEFAULT_BOLD

The following examples show how to use android.graphics.Typeface#DEFAULT_BOLD . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: TwitterLoginButton.java    From twitter-kit-android with Apache License 2.0 6 votes vote down vote up
@TargetApi(Build.VERSION_CODES.LOLLIPOP)
private void setupButton() {
    final Resources res = getResources();
    super.setCompoundDrawablesWithIntrinsicBounds(
            res.getDrawable(R.drawable.tw__ic_logo_default), null, null, null);
    super.setCompoundDrawablePadding(
            res.getDimensionPixelSize(R.dimen.tw__login_btn_drawable_padding));
    super.setText(R.string.tw__login_btn_txt);
    super.setTextColor(res.getColor(R.color.tw__solid_white));
    super.setTextSize(TypedValue.COMPLEX_UNIT_PX,
            res.getDimensionPixelSize(R.dimen.tw__login_btn_text_size));
    super.setTypeface(Typeface.DEFAULT_BOLD);
    super.setPadding(res.getDimensionPixelSize(R.dimen.tw__login_btn_left_padding), 0,
            res.getDimensionPixelSize(R.dimen.tw__login_btn_right_padding), 0);
    super.setBackgroundResource(R.drawable.tw__login_btn);
    super.setOnClickListener(new LoginClickListener());
    if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP) {
        super.setAllCaps(false);
    }
}
 
Example 2
Source File: Key.java    From openboard with GNU General Public License v3.0 5 votes vote down vote up
@Nonnull
public Typeface selectPreviewTypeface(final KeyDrawParams params) {
    if (previewHasLetterSize()) {
        return selectTypeface(params);
    }
    return Typeface.DEFAULT_BOLD;
}
 
Example 3
Source File: TypefaceUtils.java    From LokiBoard-Android-Keylogger with Apache License 2.0 5 votes vote down vote up
private static int getCharGeometryCacheKey(final char referenceChar, final Paint paint) {
    final int labelSize = (int)paint.getTextSize();
    final Typeface face = paint.getTypeface();
    final int codePointOffset = referenceChar << 15;
    if (face == Typeface.DEFAULT) {
        return codePointOffset + labelSize;
    } else if (face == Typeface.DEFAULT_BOLD) {
        return codePointOffset + labelSize + 0x1000;
    } else if (face == Typeface.MONOSPACE) {
        return codePointOffset + labelSize + 0x2000;
    } else {
        return codePointOffset + labelSize;
    }
}
 
Example 4
Source File: Key.java    From Indic-Keyboard with Apache License 2.0 5 votes vote down vote up
@Nonnull
public Typeface selectPreviewTypeface(final KeyDrawParams params) {
    if (previewHasLetterSize()) {
        return selectTypeface(params);
    }
    return Typeface.DEFAULT_BOLD;
}
 
Example 5
Source File: TransitionEditView.java    From PLDroidShortVideo with Apache License 2.0 5 votes vote down vote up
private void initTypeFaces() {
    mTypefaces = new Typeface[4];
    mTypefaces[0] = Typeface.SANS_SERIF;
    mTypefaces[1] = Typeface.DEFAULT_BOLD;
    mTypefaces[2] = Typeface.createFromAsset(mContext.getAssets(), "fonts/zcool-gdh.ttf");
    mTypefaces[3] = Typeface.createFromAsset(mContext.getAssets(), "fonts/HappyZcool-2016.ttf");
}
 
Example 6
Source File: TypefaceUtils.java    From simple-keyboard with Apache License 2.0 5 votes vote down vote up
private static int getCharGeometryCacheKey(final char referenceChar, final Paint paint) {
    final int labelSize = (int)paint.getTextSize();
    final Typeface face = paint.getTypeface();
    final int codePointOffset = referenceChar << 15;
    if (face == Typeface.DEFAULT) {
        return codePointOffset + labelSize;
    } else if (face == Typeface.DEFAULT_BOLD) {
        return codePointOffset + labelSize + 0x1000;
    } else if (face == Typeface.MONOSPACE) {
        return codePointOffset + labelSize + 0x2000;
    } else {
        return codePointOffset + labelSize;
    }
}
 
Example 7
Source File: TypefaceUtils.java    From Indic-Keyboard with Apache License 2.0 5 votes vote down vote up
private static int getCharGeometryCacheKey(final char referenceChar, final Paint paint) {
    final int labelSize = (int)paint.getTextSize();
    final Typeface face = paint.getTypeface();
    final int codePointOffset = referenceChar << 15;
    if (face == Typeface.DEFAULT) {
        return codePointOffset + labelSize;
    } else if (face == Typeface.DEFAULT_BOLD) {
        return codePointOffset + labelSize + 0x1000;
    } else if (face == Typeface.MONOSPACE) {
        return codePointOffset + labelSize + 0x2000;
    } else {
        return codePointOffset + labelSize;
    }
}
 
Example 8
Source File: TypefaceUtils.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 5 votes vote down vote up
private static int getCharGeometryCacheKey(final char referenceChar, final Paint paint) {
    final int labelSize = (int)paint.getTextSize();
    final Typeface face = paint.getTypeface();
    final int codePointOffset = referenceChar << 15;
    if (face == Typeface.DEFAULT) {
        return codePointOffset + labelSize;
    } else if (face == Typeface.DEFAULT_BOLD) {
        return codePointOffset + labelSize + 0x1000;
    } else if (face == Typeface.MONOSPACE) {
        return codePointOffset + labelSize + 0x2000;
    } else {
        return codePointOffset + labelSize;
    }
}
 
Example 9
Source File: TypefaceUtils.java    From openboard with GNU General Public License v3.0 5 votes vote down vote up
private static int getCharGeometryCacheKey(final char referenceChar, final Paint paint) {
    final int labelSize = (int)paint.getTextSize();
    final Typeface face = paint.getTypeface();
    final int codePointOffset = referenceChar << 15;
    if (face == Typeface.DEFAULT) {
        return codePointOffset + labelSize;
    } else if (face == Typeface.DEFAULT_BOLD) {
        return codePointOffset + labelSize + 0x1000;
    } else if (face == Typeface.MONOSPACE) {
        return codePointOffset + labelSize + 0x2000;
    } else {
        return codePointOffset + labelSize;
    }
}
 
Example 10
Source File: Key.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 5 votes vote down vote up
@Nonnull
public Typeface selectPreviewTypeface(final KeyDrawParams params) {
    if (previewHasLetterSize()) {
        return selectTypeface(params);
    }
    return Typeface.DEFAULT_BOLD;
}
 
Example 11
Source File: StackPresenterTest.java    From react-native-navigation with MIT License 5 votes vote down vote up
@Test
public void mergeTopBarOptions() {
    Options options = new Options();
    uut.mergeChildOptions(options, EMPTY_OPTIONS, parent, child);
    assertTopBarOptions(options, 0);

    TitleOptions title = new TitleOptions();
    title.text = new Text("abc");
    title.component.name = new Text("someComponent");
    title.component.componentId = new Text("compId");
    title.color = new Colour(0);
    title.fontSize = new Fraction(1.0f);
    title.fontFamily = Typeface.DEFAULT_BOLD;
    options.topBar.title = title;
    SubtitleOptions subtitleOptions = new SubtitleOptions();
    subtitleOptions.text = new Text("Sub");
    subtitleOptions.color = new Colour(1);
    options.topBar.subtitle = subtitleOptions;
    options.topBar.background.color = new Colour(0);
    options.topBar.testId = new Text("test123");
    options.topBar.animate = new Bool(false);
    options.topBar.visible = new Bool(false);
    options.topBar.drawBehind = new Bool(false);
    options.topBar.hideOnScroll = new Bool(false);
    options.topBar.validate();

    uut.mergeChildOptions(options, EMPTY_OPTIONS, parent, child);

    assertTopBarOptions(options, 1);

    options.topBar.drawBehind = new Bool(true);
    uut.mergeChildOptions(options, EMPTY_OPTIONS, parent, child);
}
 
Example 12
Source File: TagView.java    From android-tagview with Apache License 2.0 5 votes vote down vote up
private TagSpan createSpan(String text, int color) {
    return new TagSpan(
            text,
            tagPadding,
            getTextSize(),
            getTypeface() == Typeface.DEFAULT_BOLD,
            getCurrentTextColor(),
            color,
            tagCornerRadius
    );
}
 
Example 13
Source File: SpanFormatter.java    From NFCard with GNU General Public License v3.0 5 votes vote down vote up
FontSpan(int color, float size, Typeface face) {
	this.color = color;
	this.size = size;

	if (face == Typeface.DEFAULT) {
		this.face = null;
		this.bold = false;
	} else if (face == Typeface.DEFAULT_BOLD) {
		this.face = null;
		this.bold = true;
	} else {
		this.face = face;
		this.bold = false;
	}
}
 
Example 14
Source File: SuggestionStripLayoutHelper.java    From AOSP-Kayboard-7.1.2 with Apache License 2.0 4 votes vote down vote up
private static Typeface getTextTypeface(@Nullable final CharSequence text) {
    return hasStyleSpan(text, BOLD_SPAN) ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT;
}
 
Example 15
Source File: NumericPageIndicator.java    From NumericPageIndicator with Apache License 2.0 4 votes vote down vote up
public void setPageNumberTextBold(boolean pageNumberTextBold) {
    mPageNumberTextBold = pageNumberTextBold;
    final Typeface typeface = mPageNumberTextBold ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT;
    mPaintPageNumberText.setTypeface(typeface);
    invalidate();
}
 
Example 16
Source File: SuggestionStripLayoutHelper.java    From Indic-Keyboard with Apache License 2.0 4 votes vote down vote up
private static Typeface getTextTypeface(@Nullable final CharSequence text) {
    return hasStyleSpan(text, BOLD_SPAN) ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT;
}
 
Example 17
Source File: Key.java    From simple-keyboard with Apache License 2.0 4 votes vote down vote up
public Typeface selectPreviewTypeface(final KeyDrawParams params) {
    if (previewHasLetterSize()) {
        return selectTypeface(params);
    }
    return Typeface.DEFAULT_BOLD;
}
 
Example 18
Source File: Key.java    From LokiBoard-Android-Keylogger with Apache License 2.0 4 votes vote down vote up
public Typeface selectPreviewTypeface(final KeyDrawParams params) {
    if (previewHasLetterSize()) {
        return selectTypeface(params);
    }
    return Typeface.DEFAULT_BOLD;
}
 
Example 19
Source File: SuggestionStripLayoutHelper.java    From openboard with GNU General Public License v3.0 4 votes vote down vote up
private static Typeface getTextTypeface(@Nullable final CharSequence text) {
    return hasStyleSpan(text, BOLD_SPAN) ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT;
}