File tree Expand file tree Collapse file tree 3 files changed +18
-3
lines changed
java/org/buffer/android/utils Expand file tree Collapse file tree 3 files changed +18
-3
lines changed Original file line number Diff line number Diff line change @@ -31,7 +31,7 @@ publish {
31
31
userOrg = ' buffer'
32
32
groupId = ' org.buffer.android'
33
33
artifactId = ' android-utils'
34
- publishVersion = ' 0.4 '
34
+ publishVersion = ' 0.5 '
35
35
desc = ' An Android library for frequently used utility functions'
36
36
website = ' https://github.com/bufferapp/android-utils'
37
37
}
Original file line number Diff line number Diff line change
1
+ package org.buffer.android.utils
2
+
3
+ import android.content.res.Resources
4
+ import kotlin.math.roundToInt
5
+
6
+ object DisplayMetricsUtil {
7
+
8
+ fun dpToPx (dp : Int ): Int {
9
+ val density = Resources .getSystem().displayMetrics.density
10
+ return (dp * density).roundToInt()
11
+ }
12
+
13
+ fun dpToPx (dp : Float ): Int {
14
+ val density = Resources .getSystem().displayMetrics.density
15
+ return (dp * density).roundToInt()
16
+ }
17
+ }
Original file line number Diff line number Diff line change 1
1
<resources >
2
- <string name =" app_name" >Android Utils</string >
3
-
4
2
<string name =" error_message_internet_connect" >The internet connection appears to be offline.</string >
5
3
</resources >
You can’t perform that action at this time.
0 commit comments