Skip to content

Commit

Permalink
Merge branch 'develop' into feature/update-to-gradle-2.4
Browse files Browse the repository at this point in the history
  • Loading branch information
maxme committed Aug 25, 2015
2 parents f0d7560 + 6c6e7ec commit 031be0d
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 3 deletions.
6 changes: 3 additions & 3 deletions WordPressUtils/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -24,13 +24,13 @@ dependencies {
android {
publishNonDefault true

compileSdkVersion 19
buildToolsVersion "22.0.1"
compileSdkVersion 22
buildToolsVersion '22.0.1'

defaultConfig {
versionName "1.5.0"
minSdkVersion 14
targetSdkVersion 19
targetSdkVersion 22
}
}

Expand Down
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 031be0d

Please sign in to comment.