fixed static
This commit is contained in:
parent
dd3f76ab4d
commit
75add732ec
|
|
@ -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()
|
||||
|
|
|
|||
|
|
@ -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
|
||||
|
||||
}
|
||||
|
|
|
|||
|
|
@ -45,4 +45,4 @@ fun View.showSoftInput() {
|
|||
requestFocus()
|
||||
val inputManager = context.getSystemService(Context.INPUT_METHOD_SERVICE) as InputMethodManager
|
||||
inputManager.showSoftInput(this, InputMethodManager.SHOW_IMPLICIT)
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue