Created
November 25, 2022 08:21
-
-
Save svsq/7c50bc5eae614a2bf070537b33e25af0 to your computer and use it in GitHub Desktop.
Number extensions
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// converts Dp to Pixels | |
val Number.toPixels get() = TypedValue.applyDimension( | |
TypedValue.COMPLEX_UNIT_DIP, | |
this.toFloat(), | |
Resources.getSystem().displayMetrics) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment