Skip to content

Commit

Permalink
Introduce our version of MarkView
Browse files Browse the repository at this point in the history
  • Loading branch information
daniloercoli committed May 20, 2015
1 parent 8699590 commit 8a2b015
Showing 1 changed file with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,12 @@ public static int getDisplayPixelHeight(Context context) {
return (size.y);
}

public static float spToPx(Context context, float sp){
DisplayMetrics displayMetrics = context.getResources().getDisplayMetrics();
final float scale = displayMetrics.scaledDensity;
return sp * scale;
}

public static int dpToPx(Context context, int dp) {
float px = TypedValue.applyDimension(TypedValue.COMPLEX_UNIT_DIP, dp,
context.getResources().getDisplayMetrics());
Expand Down

0 comments on commit 8a2b015

Please sign in to comment.