添加了密码登录和人脸登录界面
This commit is contained in:
@@ -0,0 +1,49 @@
|
||||
package com.sw.platecabinet.ext
|
||||
|
||||
import android.content.res.Resources
|
||||
import android.util.TypedValue
|
||||
import androidx.annotation.Dimension
|
||||
|
||||
/**
|
||||
* 将 Int 值转换为 dp 值
|
||||
*/
|
||||
val Int.dp: Int
|
||||
@Dimension(unit = Dimension.DP)
|
||||
get() = TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP,
|
||||
this.toFloat(),
|
||||
Resources.getSystem().displayMetrics
|
||||
).toInt()
|
||||
|
||||
/**
|
||||
* 将 Float 值转换为 dp 值
|
||||
*/
|
||||
val Float.dp: Float
|
||||
@Dimension(unit = Dimension.DP)
|
||||
get() = TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_DIP,
|
||||
this,
|
||||
Resources.getSystem().displayMetrics
|
||||
)
|
||||
|
||||
/**
|
||||
* 将 Int 值转换为 sp 值
|
||||
*/
|
||||
val Int.sp: Float
|
||||
@Dimension(unit = Dimension.SP)
|
||||
get() = TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_SP,
|
||||
this.toFloat(),
|
||||
Resources.getSystem().displayMetrics
|
||||
)
|
||||
|
||||
/**
|
||||
* 将 Float 值转换为 sp 值
|
||||
*/
|
||||
val Float.sp: Float
|
||||
@Dimension(unit = Dimension.SP)
|
||||
get() = TypedValue.applyDimension(
|
||||
TypedValue.COMPLEX_UNIT_SP,
|
||||
this,
|
||||
Resources.getSystem().displayMetrics
|
||||
)
|
||||
Reference in New Issue
Block a user