fixed static

This commit is contained in:
Vladimir 2020-07-09 21:14:31 +03:00
parent dd3f76ab4d
commit 75add732ec
3 changed files with 4 additions and 4 deletions

View File

@ -53,4 +53,4 @@ val Float.px: Float
* @return Size in dp.
*/
val Int.dp: Int
get() = (this / Resources.getSystem().displayMetrics.density).toInt()
get() = (this / Resources.getSystem().displayMetrics.density).toInt()

View File

@ -75,8 +75,6 @@ object UiUtils {
*/
object OfMetrics {
private const val MAX_METRICS_TRIES_COUNT = 5
/**
* Returns right metrics with non-zero height/width.
* It is common bug when metrics are calling at [Application.onCreate] method and it returns metrics with zero height/width.
@ -101,12 +99,14 @@ object UiUtils {
message = "Use extension instead",
replaceWith = ReplaceWith("sizeInDp.toPixels()")
)
@Suppress("detekt.UnusedPrivateMember")
fun dpToPixels(context: Context, sizeInDp: Float): Float = sizeInDp.px
@Deprecated(
message = "Use extension instead",
replaceWith = ReplaceWith("pixels.toDp()")
)
@Suppress("detekt.UnusedPrivateMember")
fun pixelsToDp(context: Context, pixels: Int): Int = pixels.dp
}

View File

@ -45,4 +45,4 @@ fun View.showSoftInput() {
requestFocus()
val inputManager = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
inputManager.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT)
}
}