|
|
|
|
@ -2,6 +2,7 @@ package com.fongmi.android.tv.utils; |
|
|
|
|
|
|
|
|
|
import android.graphics.drawable.Drawable; |
|
|
|
|
import android.util.DisplayMetrics; |
|
|
|
|
import android.util.TypedValue; |
|
|
|
|
import android.view.animation.Animation; |
|
|
|
|
import android.view.animation.AnimationUtils; |
|
|
|
|
|
|
|
|
|
@ -28,11 +29,15 @@ public class ResUtil { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static int getEms() { |
|
|
|
|
return Math.min(getScreenWidthPx() / dp2px(24), 35); |
|
|
|
|
return Math.min(getScreenWidthPx() / sp2px(24), 35); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static int dp2px(int dpValue) { |
|
|
|
|
return Math.round(dpValue * getDisplayMetrics().density); |
|
|
|
|
public static int sp2px(int sp) { |
|
|
|
|
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_SP, sp, getDisplayMetrics()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static int dp2px(int dp) { |
|
|
|
|
return (int) TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp, getDisplayMetrics()); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public static String getString(@StringRes int resId) { |
|
|
|
|
|