Back to project page android-iconkit.
The source code is released under:
Apache License
If you think the Android project android-iconkit listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
/** * ------------------------------------------------------------- * Copyright (c) 2013 tank, All rights reserved. * https://github.com/Tank000/android-iconkit *// w w w. ja v a 2s . com * @version: 1.0 * @author: tank.tyt@gmail.com * ------------------------------------------------------------- */ package com.tank.iconkit; import android.content.Context; import android.graphics.Typeface; import android.util.TypedValue; public class Util { private static Typeface tf; public static Typeface getTypeFace(Context ctx){ if(tf==null){ tf = Typeface.createFromAsset(ctx.getAssets(), "fonts/fontawesome.ttf"); } return tf; } public static int dip2px(Context context, float dipValue) { // return (int)TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, 20, context.getResources().getDisplayMetrics()); final float scale = context.getResources().getDisplayMetrics().density; return (int) (dipValue * scale + 0.5f); } }