优化人脸识别区域
This commit is contained in:
@@ -952,8 +952,8 @@ class MainScreenPresentation(
|
||||
// val h = 900.dp //684.dp
|
||||
// val w = 500.dp
|
||||
// val h = 850.dp
|
||||
val w = 720.dp
|
||||
val h = 1280.dp
|
||||
val w = 600.dp
|
||||
val h = 1068.dp
|
||||
//(1024*scale).toInt()
|
||||
val layoutParams = FrameLayout.LayoutParams(w, h);
|
||||
// val layoutParams = FrameLayout.LayoutParams(480, 320);
|
||||
|
||||
@@ -325,8 +325,12 @@ class FacePayPresentation(
|
||||
// layoutParams.height = (456.dp * 1.5).roundToInt()
|
||||
// layoutParams.width = 1024
|
||||
// layoutParams.height = 768
|
||||
val w = 500.dp
|
||||
val h = 850.dp
|
||||
// val w = 500.dp
|
||||
// val h = 850.dp
|
||||
val w = 600.dp
|
||||
val h = 1068.dp
|
||||
// val w = 720.dp
|
||||
// val h = 1280.dp
|
||||
val layoutParams = FrameLayout.LayoutParams(w, h);
|
||||
|
||||
previewView.setLayoutParams(layoutParams)
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.sw.dualscreen.view
|
||||
import android.content.Context
|
||||
import android.graphics.*
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
import android.view.View
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.core.graphics.toColorInt
|
||||
@@ -38,7 +39,10 @@ class HollowCircleRectView @JvmOverloads constructor(
|
||||
|
||||
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
|
||||
// 强制View尺寸为精准px值,避免父布局干扰
|
||||
setMeasuredDimension(rectWidthPx.toInt(), rectHeightPx.toInt())
|
||||
val rectWidthPxInt = rectWidthPx.toInt()
|
||||
val rectHeightPxInt = rectHeightPx.toInt()
|
||||
Log.d("HollowCircleRectView", "onMeasure: $rectWidthPxInt,$rectHeightPxInt")
|
||||
setMeasuredDimension(rectWidthPxInt, rectHeightPxInt)
|
||||
}
|
||||
|
||||
override fun onDraw(canvas: Canvas) {
|
||||
@@ -52,6 +56,7 @@ class HollowCircleRectView @JvmOverloads constructor(
|
||||
val circleX = rectWidthPx / 2 // 水平居中:200dp转px
|
||||
val circleY = rectHeightPx / 2 // 垂直居中:340dp转px
|
||||
// 核心修复:用固定半径circleRadiusPx,而非直径/2(避免浮点运算偏差)
|
||||
Log.d("HollowCircleRectView", "onDraw: $circleX,$circleY,$circleRadiusPx")
|
||||
path.addCircle(circleX, circleY, circleRadiusPx, Path.Direction.CW)
|
||||
|
||||
// 3. 填充规则+绘制
|
||||
|
||||
@@ -402,6 +402,9 @@ class UserViewModel : BaseViewModel() {
|
||||
block(response.data.toString())
|
||||
} else {
|
||||
block("")
|
||||
// // TODO: 临时测试----------------
|
||||
// block("${System.currentTimeMillis()}")
|
||||
// // TODO: 临时测试----------------
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user