优化已采集页面数据统计、更新初始化页面加载动画资源、替换新识别模型
This commit is contained in:
@@ -14,6 +14,7 @@ import android.os.Bundle
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.util.TypedValue
|
||||
import android.view.TouchDelegate
|
||||
import android.view.View
|
||||
import android.view.inputmethod.EditorInfo
|
||||
import android.view.inputmethod.InputMethodManager
|
||||
@@ -270,3 +271,24 @@ fun String.copyText(context: Context, showToast: Boolean = true) {
|
||||
Toast.makeText(context, "文本已复制到剪贴板", Toast.LENGTH_SHORT).show()
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 扩大 View 的点击区域
|
||||
* @param horizontal 水平方向扩大距离(dp)→ 左右各扩大一半
|
||||
* @param vertical 垂直方向扩大距离(dp)→ 上下各扩大一半
|
||||
*/
|
||||
fun View.expandClickArea(horizontal: Int, vertical: Int) {
|
||||
val density = resources.displayMetrics.density
|
||||
val hPx = (horizontal * density).toInt()
|
||||
val vPx = (vertical * density).toInt()
|
||||
|
||||
post {
|
||||
val rect = android.graphics.Rect()
|
||||
getHitRect(rect)
|
||||
|
||||
// 扩大区域:负值 = 向外扩大
|
||||
rect.inset(-hPx, -vPx)
|
||||
//rect.bottom += downPx // 只往下扩大
|
||||
(parent as View).touchDelegate = TouchDelegate(rect, this)
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user