From 244859f9a052d89836a6baf4be42e0f2977c172e Mon Sep 17 00:00:00 2001 From: chenfufeng Date: Fri, 18 Mar 2022 11:02:20 +0800 Subject: [PATCH] =?UTF-8?q?[Fix]=E6=81=A2=E5=A4=8D=E5=8A=A8=E6=80=81?= =?UTF-8?q?=E8=AF=B7=E6=B1=82=E6=82=AC=E6=B5=AE=E7=AA=97=E6=9D=83=E9=99=90?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 原因:Android11弹Toast需要悬浮窗权限 --- .../hmi/ui/tools/AutoPilotAndCheckView.kt | 33 ++++++++++--------- .../src/main/AndroidManifest.xml | 1 + .../core/function/main/MainActivity.java | 16 ++++----- .../eagle/core/utilcode/util/ToastUtils.java | 4 +-- .../module/common/dialog/BaseFloatDialog.java | 12 +++---- .../module/common/wm/WindowManagerImpl.java | 4 +-- .../module/common/wm/WindowManagerView.java | 1 - 7 files changed, 36 insertions(+), 35 deletions(-) diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt index 960adf8bbf..72fc255bcd 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/tools/AutoPilotAndCheckView.kt @@ -37,6 +37,7 @@ class AutoPilotAndCheckView @JvmOverloads constructor( private var clickListener: ClickListener? = null private var keyBoardUtil: KeyBoardUtil? = null private var connectStatus = false + private var lastTime = 0L init { LayoutInflater.from(context).inflate(R.layout.view_auto_pilot_check, this, true) @@ -51,10 +52,6 @@ class AutoPilotAndCheckView @JvmOverloads constructor( keyBoardUtil?.setActionListener { inputContent -> inputContent.toIntOrNull()?.let { speed -> when { - !connectStatus -> { - ToastUtils.showShort("设置车速失败,请启动域控制器") - keyBoardUtil?.hideKeyboard() - } speed > 60 -> { // 设置失败键盘不消失,让用户直接修改 ToastUtils.showShort("超过最大限速值60,设置失败") @@ -90,22 +87,28 @@ class AutoPilotAndCheckView @JvmOverloads constructor( ivDebugFeedback.onClick { clickListener?.showFeedbackView() } - etInputSpeed.setOnTouchListener { v, _ -> - if (!connectStatus) { - ToastUtils.showShort("设置车速失败,请启动域控制器") - keyBoardUtil?.hideKeyboard() - return@setOnTouchListener true - } else { - llSpeedPosition.background = resources.getDrawable(R.drawable.pilot_speed_high_light_bg) - if (etInputSpeed.hasFocusable()) { + etInputSpeed.setOnFocusChangeListener { v, hasFocus -> + when { + hasFocus -> { + llSpeedPosition.background = resources.getDrawable(R.drawable.pilot_speed_high_light_bg) if (keyBoardUtil == null) { keyBoardUtil = KeyBoardUtil(sKeyBoardView, etInputSpeed) } keyBoardUtil?.showKeyboard() } - if (!etInputSpeed.hasFocus()) { - etInputSpeed.requestFocus() - } + else -> llSpeedPosition.background = resources.getDrawable(R.drawable.pilot_speed_bg) + } + } + etInputSpeed.setOnTouchListener { v, event -> + var curTime = System.currentTimeMillis() + if (curTime - lastTime < 1000) { + return@setOnTouchListener true + } + if (!connectStatus) { + ToastUtils.showShort("设置车速失败,请启动域控制器") + keyBoardUtil?.hideKeyboard() + return@setOnTouchListener true + } else { return@setOnTouchListener false } } diff --git a/core/function-impl/mogo-core-function-main/src/main/AndroidManifest.xml b/core/function-impl/mogo-core-function-main/src/main/AndroidManifest.xml index b068b0c04a..9ed171e1dc 100644 --- a/core/function-impl/mogo-core-function-main/src/main/AndroidManifest.xml +++ b/core/function-impl/mogo-core-function-main/src/main/AndroidManifest.xml @@ -9,6 +9,7 @@ +