List of usage examples for android.graphics Typeface DEFAULT_BOLD
Typeface DEFAULT_BOLD
To view the source code for android.graphics Typeface DEFAULT_BOLD.
Click Source Link
From source file:Main.java
public static Paint getScoreColor() { Paint paint = new Paint(); paint.setColor(Color.WHITE);/*from w ww .ja va 2 s. c om*/ paint.setTextSize(80); paint.setTypeface(Typeface.DEFAULT_BOLD); paint.setShadowLayer(3, 5, 5, Color.BLACK); return paint; }
From source file:Main.java
public static Paint getGameOverColor() { Paint paint = new Paint(); paint.setColor(Color.WHITE);//from w ww . ja v a 2s . co m paint.setTextSize(80); paint.setTypeface(Typeface.DEFAULT_BOLD); paint.setShadowLayer(2, 3, 3, Color.GRAY); return paint; }
From source file:Main.java
public static Paint getGameOverRestartMessageColor() { Paint paint = new Paint(); paint.setColor(Color.YELLOW); paint.setTextSize(20);//from ww w .ja v a 2s . co m paint.setTypeface(Typeface.DEFAULT_BOLD); // paint.setShadowLayer(2, 3, 3, Color.WHITE); return paint; }
From source file:Main.java
public static Bitmap int2Icon(Context context, int i) { Bitmap bitmap = BitmapFactory.decodeResource(context.getResources(), 0x7f020047); Bitmap bitmap1 = Bitmap.createBitmap(bitmap.getWidth(), bitmap.getHeight(), android.graphics.Bitmap.Config.ARGB_8888); Canvas canvas = new Canvas(bitmap1); Paint paint = new Paint(); paint.setDither(true);/*w w w . j ava 2s . c o m*/ paint.setFilterBitmap(true); canvas.drawBitmap(bitmap, 0.0F, 0.0F, paint); bitmap.recycle(); Paint paint1 = new Paint(257); paint1.setColor(-1); paint1.setTypeface(Typeface.DEFAULT_BOLD); paint1.setTextAlign(android.graphics.Paint.Align.CENTER); canvas.drawText(String.valueOf(i), bitmap.getWidth() / 2, 3 + bitmap.getHeight() / 2, paint1); return bitmap1; }
From source file:Main.java
static Bitmap generatorContactCountIcon(Context context, Bitmap icon) { int iconSize = (int) context.getResources().getDimension(android.R.dimen.app_icon_size); Bitmap contactIcon = Bitmap.createBitmap(iconSize, iconSize, Config.ARGB_8888); Canvas canvas = new Canvas(contactIcon); Paint iconPaint = new Paint(); iconPaint.setDither(true);//from w w w.j ava 2 s.c o m iconPaint.setFilterBitmap(true); Rect src = new Rect(0, 0, icon.getWidth(), icon.getHeight()); Rect dst = new Rect(0, 0, iconSize, iconSize); canvas.drawBitmap(icon, src, dst, iconPaint); int contacyCount = 11; Paint countPaint = new Paint(Paint.ANTI_ALIAS_FLAG | Paint.DEV_KERN_TEXT_FLAG); countPaint.setColor(Color.RED); countPaint.setTextSize(20f); countPaint.setTypeface(Typeface.DEFAULT_BOLD); canvas.drawText(String.valueOf(contacyCount), iconSize - 18, 25, countPaint); return contactIcon; }
From source file:Main.java
private static Typeface getTextTypeface(@Nullable final CharSequence text) { return hasStyleSpan(text, BOLD_SPAN) ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT; }
From source file:biz.wiz.android.wallet.util.ViewPagerTabs.java
public void addTabLabels(final int... labelResId) { final Context context = getContext(); paint.setTypeface(Typeface.DEFAULT_BOLD); for (final int resId : labelResId) { final String label = context.getString(resId); final int width = (int) paint.measureText(label); if (width > maxWidth) maxWidth = width;//from ww w . java2 s . c o m labels.add(label); } }
From source file:piuk.blockchain.android.util.ViewPagerTabs.java
@Override protected void onDraw(final Canvas canvas) { super.onDraw(canvas); final int viewWidth = getWidth(); final int viewHalfWidth = viewWidth / 2; final int viewBottom = getHeight(); final float density = getResources().getDisplayMetrics().density; final float spacing = 32 * density; final Path path = new Path(); path.moveTo(viewHalfWidth, viewBottom - 5 * density); path.lineTo(viewHalfWidth + 5 * density, viewBottom); path.lineTo(viewHalfWidth - 5 * density, viewBottom); path.close();//from ww w . j a v a2s . c o m paint.setColor(Color.WHITE); canvas.drawPath(path, paint); paint.setTypeface(Typeface.DEFAULT_BOLD); final float y = getPaddingTop() + -paint.getFontMetrics().top; for (int i = 0; i < labels.size(); i++) { final String label = labels.get(i); paint.setTypeface(i == pagePosition ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); paint.setColor(i == pagePosition ? Color.BLACK : Color.DKGRAY); final float x = viewHalfWidth + (maxWidth + spacing) * (i - pageOffset); final float labelWidth = paint.measureText(label); final float labelHalfWidth = labelWidth / 2; final float labelLeft = x - labelHalfWidth; final float labelVisibleLeft = labelLeft >= 0 ? 1f : 1f - (-labelLeft / labelWidth); final float labelRight = x + labelHalfWidth; final float labelVisibleRight = labelRight < viewWidth ? 1f : 1f - ((labelRight - viewWidth) / labelWidth); final float labelVisible = Math.min(labelVisibleLeft, labelVisibleRight); paint.setAlpha((int) (labelVisible * 255)); canvas.drawText(label, labelLeft, y, paint); } }
From source file:Main.java
private static Typeface getTextTypeface(final CharSequence text) { if (!(text instanceof SpannableString)) { return Typeface.DEFAULT; }/*ww w. j a v a 2 s. c o m*/ final SpannableString ss = (SpannableString) text; final StyleSpan[] styles = ss.getSpans(0, text.length(), StyleSpan.class); if (styles.length == 0) { return Typeface.DEFAULT; } if (styles[0].getStyle() == Typeface.BOLD) { return Typeface.DEFAULT_BOLD; } // TODO: BOLD_ITALIC, ITALIC case? return Typeface.DEFAULT; }
From source file:biz.wiz.android.wallet.util.ViewPagerTabs.java
@Override protected void onDraw(final Canvas canvas) { super.onDraw(canvas); final int viewWidth = getWidth(); final int viewHalfWidth = viewWidth / 2; final int viewBottom = getHeight(); final float density = getResources().getDisplayMetrics().density; final float spacing = 32 * density; path.reset();//from w w w . ja va2 s . c om path.moveTo(viewHalfWidth, viewBottom - 5 * density); path.lineTo(viewHalfWidth + 5 * density, viewBottom); path.lineTo(viewHalfWidth - 5 * density, viewBottom); path.close(); paint.setColor(Color.WHITE); canvas.drawPath(path, paint); paint.setTypeface(Typeface.DEFAULT_BOLD); final float y = getPaddingTop() + -paint.getFontMetrics().top; for (int i = 0; i < labels.size(); i++) { final String label = labels.get(i); paint.setTypeface(i == pagePosition ? Typeface.DEFAULT_BOLD : Typeface.DEFAULT); paint.setColor(i == pagePosition ? Color.BLACK : Color.DKGRAY); final float x = viewHalfWidth + (maxWidth + spacing) * (i - pageOffset); final float labelWidth = paint.measureText(label); final float labelHalfWidth = labelWidth / 2; final float labelLeft = x - labelHalfWidth; final float labelVisibleLeft = labelLeft >= 0 ? 1f : 1f - (-labelLeft / labelWidth); final float labelRight = x + labelHalfWidth; final float labelVisibleRight = labelRight < viewWidth ? 1f : 1f - ((labelRight - viewWidth) / labelWidth); final float labelVisible = Math.min(labelVisibleLeft, labelVisibleRight); paint.setAlpha((int) (labelVisible * 255)); canvas.drawText(label, labelLeft, y, paint); } }