File tree Expand file tree Collapse file tree 2 files changed +9
-3
lines changed
src/main/java/org/wordpress/android/util Expand file tree Collapse file tree 2 files changed +9
-3
lines changed Original file line number Diff line number Diff line change @@ -24,13 +24,13 @@ dependencies {
2424android {
2525 publishNonDefault true
2626
27- compileSdkVersion 19
28- buildToolsVersion " 22.0.1"
27+ compileSdkVersion 22
28+ buildToolsVersion ' 22.0.1'
2929
3030 defaultConfig {
3131 versionName " 1.5.0"
3232 minSdkVersion 14
33- targetSdkVersion 19
33+ targetSdkVersion 22
3434 }
3535}
3636
Original file line number Diff line number Diff line change @@ -38,6 +38,12 @@ public static int getDisplayPixelHeight(Context context) {
3838 return (size .y );
3939 }
4040
41+ public static float spToPx (Context context , float sp ){
42+ DisplayMetrics displayMetrics = context .getResources ().getDisplayMetrics ();
43+ final float scale = displayMetrics .scaledDensity ;
44+ return sp * scale ;
45+ }
46+
4147 public static int dpToPx (Context context , int dp ) {
4248 float px = TypedValue .applyDimension (TypedValue .COMPLEX_UNIT_DIP , dp ,
4349 context .getResources ().getDisplayMetrics ());
You can’t perform that action at this time.
0 commit comments