Merge branch 'dev_robotaxi-d-app-module_260_220304_2.6.0' of gitlab.zhidaoauto.com:zhjt/AndroidApp/MoGoEagleEye into dev_robotaxi-d-app-module_260_220304_2.6.0

# Conflicts:
#	core/function-impl/mogo-core-function-devatools/src/main/java/com/zhjt/mogo_core_function_devatools/feedback/biz/adapter/vh/BadCaseFBViewHolder.kt
#	core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/setting/DebugSettingView.kt
#	core/function-impl/mogo-core-function-hmi/src/main/res/layout/view_auto_pilot_check.xml
#	core/mogo-core-utils/src/main/java/com/mogo/eagle/core/utilcode/kotlin/Extensions.kt
This commit is contained in:
wangmingjun
2022-03-21 12:01:35 +08:00
5 changed files with 178 additions and 125 deletions

View File

@@ -10,10 +10,8 @@ import android.text.TextUtils
import android.text.TextUtils.TruncateAt.END
import android.util.StateSet
import android.util.TypedValue
import android.view.Gravity
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.view.*
import android.view.inputmethod.EditorInfo
import android.widget.EditText
import android.widget.ImageView
import android.widget.LinearLayout
@@ -21,6 +19,7 @@ import android.widget.TextView
import androidx.core.content.ContextCompat
import com.google.android.flexbox.FlexboxLayout
import com.mogo.eagle.core.utilcode.kotlin.*
import com.mogo.eagle.core.utilcode.util.KeyboardUtils
import com.mogo.eagle.core.utilcode.util.ToastUtils
import com.zhjt.mogo_core_function_devatools.R
import com.zhjt.mogo_core_function_devatools.badcase.repository.net.api.entity.BadCaseResponse.Reason
@@ -43,7 +42,7 @@ internal class BadCaseFBViewHolder(cb: IFeedbackCallback?, parent: ViewGroup): F
itemView.findViewById<EditText>(R.id.et)
}
private val editParent by lazy {
private val etParent by lazy {
itemView.findViewById<View>(R.id.et_root)
}
@@ -60,15 +59,24 @@ internal class BadCaseFBViewHolder(cb: IFeedbackCallback?, parent: ViewGroup): F
}
}
editParent.also {
etParent.also {
it.background = shape(solid = Color.parseColor("#263869"), radius = 20.PX)
}
val words = itemView.findViewById<TextView>(R.id.words_count)
val action = Runnable { KeyboardUtils.showSoftInput(et) }
et.onDetach {
et.removeCallbacks(action)
}
et.onClick {
it.requestFocus()
it.isFocusable = true
it.isFocusableInTouchMode = true
editParent.background = shape(solid = Color.parseColor("#263869"), radius = 20.PX, stroke = Color.parseColor("#5EBFFF"), strokeWidth = 2.PX)
it.post(action)
etParent.background = shape(solid = Color.parseColor("#263869"), radius = 20.PX, stroke = Color.parseColor("#5EBFFF"), strokeWidth = 2.PX)
}
et.setOnEditorActionListener { _, actionId, _ ->
if (actionId == EditorInfo.IME_ACTION_DONE) {
KeyboardUtils.hideSoftInput(et)
return@setOnEditorActionListener true
}
return@setOnEditorActionListener false
}
et.watch(
200,
@@ -91,9 +99,9 @@ internal class BadCaseFBViewHolder(cb: IFeedbackCallback?, parent: ViewGroup): F
if (!TextUtils.isEmpty(text)) {
et.setText(text)
Selection.setSelection(et.text, et.text.length)
editParent.background = shape(solid = Color.parseColor("#263869"), radius = 20.PX, stroke = Color.parseColor("#5EBFFF"), strokeWidth = 2.PX)
etParent.background = shape(solid = Color.parseColor("#263869"), radius = 20.PX, stroke = Color.parseColor("#5EBFFF"), strokeWidth = 2.PX)
} else {
editParent.background = shape(solid = Color.parseColor("#263869"), radius = 20.PX)
etParent.background = shape(solid = Color.parseColor("#263869"), radius = 20.PX)
}
}

View File

@@ -86,6 +86,7 @@
android:inputType="textMultiLine"
android:textSize="36px"
android:textColorHint="#4CFFFFFF"
android:imeOptions="actionDone"
android:hint="Case细节描述"
android:textColor="#FFFFFF" />

View File

@@ -1149,33 +1149,44 @@ class DebugSettingView @JvmOverloads constructor(
* 工控机异常回调
*/
override fun onAutopilotGuardian(guardianInfo: MogoReportMsg.MogoReportMessage?) {
guardianInfo?.let {
reportMsgLayout.visibility = View.VISIBLE
tvReportSrc.text = it.src
tvReportLevel.text = it.level
tvReportMsg.text = it.msg
tvReportCode.text = it.code
tvReportResult.text = it.getResult(0)
tvReportActions.text = it.getActions(0)
ThreadUtils.runOnUiThread{
guardianInfo?.let {
reportMsgLayout.visibility = View.VISIBLE
tvReportSrc.text = "src:${it.src}"
tvReportLevel.text = "level:${it.level}"
tvReportMsg.text = "msg:${it.msg}"
tvReportCode.text = "code:${it.code}"
var resultStr="result:"
for(result in it.resultList){
resultStr = "$resultStr$result "
}
tvReportResult.text = resultStr
if("error".equals(it.level)){
//字体为红色,吐司提示
tvReportSrc.setTextColor(Color.RED)
tvReportLevel.setTextColor(Color.RED)
tvReportMsg.setTextColor(Color.RED)
tvReportCode.setTextColor(Color.RED)
tvReportResult.setTextColor(Color.RED)
tvReportActions.setTextColor(Color.RED)
ToastUtils.showShort(it.msg)
}else{
tvReportSrc.setTextColor(Color.BLACK)
tvReportLevel.setTextColor(Color.BLACK)
tvReportMsg.setTextColor(Color.BLACK)
tvReportCode.setTextColor(Color.BLACK)
tvReportResult.setTextColor(Color.BLACK)
tvReportActions.setTextColor(Color.BLACK)
var actionStr="action:"
for(action in it.actionsList){
actionStr = "$actionStr$action "
}
tvReportActions.text = actionStr
if("error".equals(it.level)){
//字体为红色,吐司提示
tvReportSrc.setTextColor(Color.RED)
tvReportLevel.setTextColor(Color.RED)
tvReportMsg.setTextColor(Color.RED)
tvReportCode.setTextColor(Color.RED)
tvReportResult.setTextColor(Color.RED)
tvReportActions.setTextColor(Color.RED)
ToastUtils.showShort(it.msg)
}else{
tvReportSrc.setTextColor(Color.BLACK)
tvReportLevel.setTextColor(Color.BLACK)
tvReportMsg.setTextColor(Color.BLACK)
tvReportCode.setTextColor(Color.BLACK)
tvReportResult.setTextColor(Color.BLACK)
tvReportActions.setTextColor(Color.BLACK)
}
}
}
}

View File

@@ -9,10 +9,10 @@
<ScrollView
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent">
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent">
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
@@ -27,6 +27,96 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/checkLayout"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_216"
android:layout_marginTop="@dimen/dp_266"
android:orientation="horizontal"
app:layout_constraintTop_toTopOf="parent">
<RelativeLayout
android:id="@+id/check"
android:layout_width="0px"
android:layout_height="wrap_content"
app:layout_constraintEnd_toStartOf="@+id/debug"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:visibility="gone">
<com.mogo.eagle.core.function.hmi.ui.widget.CheckStatusView
android:id="@+id/viewCheckStatus"
android:layout_width="150px"
android:layout_height="150px"
android:layout_centerHorizontal="true" />
<TextView
android:id="@+id/tvCheck"
android:layout_width="wrap_content"
android:layout_height="42px"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="@string/check_vehicle_detection"
android:textColor="@color/color_FFA7B6F0"
android:textSize="32px" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/debug"
android:layout_width="0px"
android:layout_height="wrap_content"
app:layout_constraintEnd_toStartOf="@+id/feedback"
app:layout_constraintStart_toEndOf="@+id/check"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/ivDebugPanel"
android:layout_width="150px"
android:layout_height="150px"
android:layout_centerHorizontal="true"
android:background="@drawable/debug_icon_nor" />
<TextView
android:id="@+id/tvDebug"
android:layout_width="wrap_content"
android:layout_height="42px"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:text="@string/debug_panel"
android:textColor="@color/color_FFA7B6F0"
android:textSize="32px" />
</RelativeLayout>
<RelativeLayout
android:id="@+id/feedback"
android:layout_width="0px"
android:layout_height="wrap_content"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintStart_toEndOf="@+id/debug"
app:layout_constraintTop_toTopOf="parent">
<ImageView
android:id="@+id/ivDebugFeedback"
android:layout_width="150px"
android:layout_height="150px"
android:layout_centerHorizontal="true"
android:background="@drawable/debug_icon_feedback" />
<TextView
android:id="@+id/tvDebugFeedback"
android:layout_width="wrap_content"
android:layout_height="42px"
android:layout_alignParentBottom="true"
android:layout_centerHorizontal="true"
android:layout_marginTop="23px"
android:text="@string/debug_panel_fb"
android:textColor="@color/color_FFA7B6F0"
android:textSize="32px" />
</RelativeLayout>
</androidx.constraintlayout.widget.ConstraintLayout>
<TextView
android:layout_width="84px"
android:layout_height="86px"
@@ -39,69 +129,6 @@
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<com.mogo.eagle.core.function.hmi.ui.widget.CheckStatusView
android:id="@+id/viewCheckStatus"
android:layout_width="150px"
android:layout_height="150px"
android:layout_marginStart="113px"
android:layout_marginTop="266px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent" />
<TextView
android:id="@+id/tvCheck"
android:layout_width="128px"
android:layout_height="42px"
android:layout_marginStart="124px"
android:layout_marginTop="23px"
android:text="@string/check_vehicle_detection"
android:textColor="@color/color_FFA7B6F0"
android:textSize="32px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewCheckStatus" />
<ImageView
android:id="@+id/ivDebugPanel"
android:layout_width="150px"
android:layout_height="150px"
android:background="@drawable/debug_icon_nor"
app:layout_constraintStart_toEndOf="@id/viewCheckStatus"
app:layout_constraintTop_toTopOf="@id/viewCheckStatus"
android:layout_marginStart="142px" />
<TextView
android:id="@+id/tvDebug"
android:layout_width="128px"
android:layout_height="42px"
android:layout_marginStart="416px"
android:layout_marginTop="23px"
android:text="@string/debug_panel"
android:textColor="@color/color_FFA7B6F0"
android:textSize="32px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/ivDebugPanel" />
<ImageView
android:id="@+id/ivDebugFeedback"
android:layout_width="150px"
android:layout_height="150px"
android:background="@drawable/debug_icon_feedback"
app:layout_constraintStart_toEndOf="@id/ivDebugPanel"
app:layout_constraintTop_toTopOf="@id/viewCheckStatus"
android:layout_marginStart="142px" />
<TextView
android:id="@+id/tvDebugFeedback"
android:layout_width="128px"
android:layout_height="42px"
android:layout_marginStart="740px"
android:layout_marginTop="23px"
android:text="@string/debug_panel_fb"
android:textColor="@color/color_FFA7B6F0"
android:textSize="32px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ivDebugFeedback" />
<View
android:layout_width="14px"
android:layout_height="50px"
@@ -109,7 +136,7 @@
android:layout_marginTop="94px"
android:background="@color/color_FF2966EC"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCheck" />
app:layout_constraintTop_toBottomOf="@id/checkLayout" />
<TextView
android:id="@+id/tvSpeedTitle"
@@ -122,7 +149,7 @@
android:textColor="@color/color_FFFFFF"
android:textSize="42px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvCheck" />
app:layout_constraintTop_toBottomOf="@id/checkLayout" />
<androidx.appcompat.widget.LinearLayoutCompat
android:id="@+id/llSpeedPosition"
@@ -166,9 +193,9 @@
android:layout_marginStart="80px"
android:layout_marginTop="94px"
android:background="@color/color_FF2966EC"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/llSpeedPosition"
android:visibility="gone"/>
app:layout_constraintTop_toBottomOf="@id/llSpeedPosition" />
<TextView
android:id="@+id/tvSystemOperation"
@@ -180,18 +207,18 @@
android:text="@string/check_system_operation"
android:textColor="@color/color_FFFFFF"
android:textSize="42px"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/llSpeedPosition"
android:visibility="gone"/>
app:layout_constraintTop_toBottomOf="@id/llSpeedPosition" />
<com.mogo.eagle.core.function.hmi.ui.widget.CheckSystemView
android:id="@+id/checkSystemView"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_marginTop="40px"
android:visibility="gone"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/tvSystemOperation"
android:visibility="gone"/>
app:layout_constraintTop_toBottomOf="@id/tvSystemOperation" />
<View
android:id="@+id/viewSystemVersion"
@@ -207,15 +234,14 @@
android:id="@+id/tvSystemVersion"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="113px"
android:gravity="center"
android:text="@string/check_system_version"
android:textColor="@color/color_FFFFFF"
android:textSize="42px"
app:layout_constraintTop_toTopOf="@id/viewSystemVersion"
app:layout_constraintBottom_toBottomOf="@id/viewSystemVersion"
app:layout_constraintLeft_toLeftOf="parent"
android:layout_marginStart="113px"
/>
app:layout_constraintTop_toTopOf="@id/viewSystemVersion" />
<com.mogo.eagle.core.function.hmi.ui.widget.SystemVersionView
android:id="@+id/systemVersionView"
@@ -223,10 +249,9 @@
android:layout_height="wrap_content"
android:layout_marginTop="40px"
android:layout_marginBottom="40px"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewSystemVersion"
app:layout_constraintBottom_toBottomOf="parent"
/>
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toBottomOf="@id/viewSystemVersion" />
<com.mogo.eagle.core.function.hmi.ui.tools.SpeedKeyboardView
android:id="@+id/sKeyBoardView"

View File

@@ -255,12 +255,15 @@ private class GestureConflictFixer(private val ids: List<Int>) : RecyclerView.On
private fun computeIntercepted(x: Int, y: Int, rv: RecyclerView, ids: List<Int>): Boolean {
return ids.takeIf { it.isNotEmpty() }?.find {
val out = Rect()
rv.findViewById<View>(it)?.getGlobalVisibleRect(out)
if (!out.isEmpty) {
out.contains(x, y)
} else {
false
}
val view = rv.findViewById<View>(it)
view?.run {
getGlobalVisibleRect(out)
if (!out.isEmpty) {
out.contains(x, y) and (canScrollVertically(-1) || canScrollVertically(1))
} else {
false
}
} ?: false
}?.let { it != View.NO_ID } ?: false
}
@@ -273,8 +276,13 @@ private class GestureConflictFixer(private val ids: List<Int>) : RecyclerView.On
scrollState = newState
if (oldState == RecyclerView.SCROLL_STATE_IDLE && newState == RecyclerView.SCROLL_STATE_DRAGGING) {
recyclerView.layoutManager?.let {
if (intercpted) {
recyclerView.stopScroll()
val canScrollHorizontally = it.canScrollHorizontally()
val canScrollVertically = it.canScrollVertically()
if (canScrollHorizontally != canScrollVertically) {
if (intercpted || (canScrollHorizontally && abs(dy) > abs(dx))
|| (canScrollVertically && abs(dx) > abs(dy))) {
recyclerView.stopScroll()
}
}
}
}