@@ -0,0 +1,1329 @@
+package com.coolerfall.easyutil;%0A%0Aimport android.content.Context;%0Aimport android.util.DisplayMetrics;%0A%0A/**%0A * Dimen utils: constains some dimension utils.%0A *%0A * @author Vincent Cheung%0A * @since  Jul. 31, 2015%0A */%0Apublic class DimenUtils %7B%0A%09/**%0A%09 * Get the width of current screen.%0A%09 *%0A%09 * @param  contex the contex%0A%09 * @return the width%0A%09 */%0A%09public static int getScreenWidth(Context contex) %7B%0A%09%09DisplayMetrics dm = contex.getResources().getDisplayMetrics();%0A%09%09return dm.widthPixels;%0A%09%7D%0A%0A%09/**%0A%09 * Get the height of current screen.%0A%09 *%0A%09 * @param  contex the context%0A%09 * @return the height%0A%09 */%0A%09public static int getScreenHeight(Context contex) %7B%0A%09%09DisplayMetrics dm = contex.getResources().getDisplayMetrics();%0A%09%09return dm.heightPixels;%0A%09%7D%0A%0A%09/**%0A%09 * Convert dp to pixel.%0A%09 *%0A%09 * @param  context context to use%0A%09 * @param  dp      dp%0A%09 * @return         pixel%0A%09 */%0A%09public static int dpToPx(Context context, float dp) %7B%0A%09%09final float scale = context.getResources().getDisplayMetrics().density;%0A%09%09return (int) (dp * scale + 0.5);%0A%09%7D%0A%0A%09/**%0A%09 * Convert pixel to dp.%0A%09 *%0A%09 * @param  context the context to use%0A%09 * @param  px      pixel%0A%09 * @return         dp%0A%09 */%0A%09public static int pxToDp(Context context, float px) %7B%0A%09%09final float scale = context.getResources().getDisplayMetrics().density;%0A%09%09return (int) (px / scale + 0.5);%0A%09%7D%0A%7D%0A

add dimen utils