Merge remote-tracking branch 'origin/master'
This commit is contained in:
@@ -60,7 +60,7 @@ object AppConst {
|
|||||||
val sysElevation = appCtx.resources.getDimension(R.dimen.design_appbar_elevation).toInt()
|
val sysElevation = appCtx.resources.getDimension(R.dimen.design_appbar_elevation).toInt()
|
||||||
|
|
||||||
val androidId: String by lazy {
|
val androidId: String by lazy {
|
||||||
Settings.System.getString(appCtx.contentResolver, Settings.Secure.ANDROID_ID)
|
Settings.System.getString(appCtx.contentResolver, Settings.Secure.ANDROID_ID) ?: "null"
|
||||||
}
|
}
|
||||||
|
|
||||||
val appInfo: AppInfo by lazy {
|
val appInfo: AppInfo by lazy {
|
||||||
|
|||||||
@@ -53,13 +53,13 @@ object BitmapUtils {
|
|||||||
height: Int? = null
|
height: Int? = null
|
||||||
): Int {
|
): Int {
|
||||||
//获取比例大小
|
//获取比例大小
|
||||||
val wRatio = width?.let { ceil((options.outWidth / it).toDouble()).toInt() } ?: -1
|
val wRatio = width?.let { ceil((options.outWidth / it.toFloat())).toInt() } ?: -1
|
||||||
val hRatio = height?.let { ceil((options.outHeight / it).toDouble()).toInt() } ?: -1
|
val hRatio = height?.let { ceil((options.outHeight / it.toFloat())).toInt() } ?: -1
|
||||||
//如果超出指定大小,则缩小相应的比例
|
//如果超出指定大小,则缩小相应的比例
|
||||||
return when {
|
return when {
|
||||||
wRatio > 1 && hRatio > 1 -> max(wRatio, hRatio)
|
wRatio > 1 && hRatio > 1 -> max(wRatio, hRatio)
|
||||||
wRatio > 1 -> wRatio
|
wRatio > 1 -> wRatio
|
||||||
hRatio > 1 -> hRatio
|
hRatio > 1 -> hRatio
|
||||||
else -> 1
|
else -> 1
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user