[6.4.0][启自驾指引] 适配ui
This commit is contained in:
@@ -477,6 +477,7 @@ class DevaToolsProvider : IDevaToolsProvider {
|
||||
}
|
||||
|
||||
override fun attachAutopilotStatusView(ctx: Context, group: ViewGroup) {
|
||||
StatusManager.init(ctx)
|
||||
if (group.childCount > 0) {
|
||||
if (group.visibility != View.VISIBLE) {
|
||||
group.visibility = View.VISIBLE
|
||||
|
||||
@@ -310,6 +310,24 @@ data class SteerStatus(val angle: Float, var isError: Boolean = false): Status()
|
||||
override fun isException(): Boolean {
|
||||
return isError
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as SteerStatus
|
||||
|
||||
if (angle != other.angle) return false
|
||||
if (isError != other.isError) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = angle.hashCode()
|
||||
result = 31 * result + isError.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -320,6 +338,26 @@ data class AcceleratorStatus(val angle: Float, var isError: Boolean = false): St
|
||||
override fun isException(): Boolean {
|
||||
return isError
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as AcceleratorStatus
|
||||
|
||||
if (angle != other.angle) return false
|
||||
if (isError != other.isError) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = angle.hashCode()
|
||||
result = 31 * result + isError.hashCode()
|
||||
return result
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -330,6 +368,24 @@ data class BrakeStatus(val angle: Float, var isError: Boolean = false): Status()
|
||||
override fun isException(): Boolean {
|
||||
return isError
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as BrakeStatus
|
||||
|
||||
if (angle != other.angle) return false
|
||||
if (isError != other.isError) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = angle.hashCode()
|
||||
result = 31 * result + isError.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -341,6 +397,24 @@ data class DoubleFlashStatus(val type: Int, var isError: Boolean = false): Statu
|
||||
override fun isException(): Boolean {
|
||||
return isError
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as DoubleFlashStatus
|
||||
|
||||
if (type != other.type) return false
|
||||
if (isError != other.isError) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = type
|
||||
result = 31 * result + isError.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -351,6 +425,24 @@ data class GearStatus(val value: Int, var isError: Boolean = false): Status(), I
|
||||
override fun isException(): Boolean {
|
||||
return isError
|
||||
}
|
||||
|
||||
override fun equals(other: Any?): Boolean {
|
||||
if (this === other) return true
|
||||
if (javaClass != other?.javaClass) return false
|
||||
|
||||
other as GearStatus
|
||||
|
||||
if (value != other.value) return false
|
||||
if (isError != other.isError) return false
|
||||
|
||||
return true
|
||||
}
|
||||
|
||||
override fun hashCode(): Int {
|
||||
var result = value
|
||||
result = 31 * result + isError.hashCode()
|
||||
return result
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -31,6 +31,7 @@ import kotlinx.android.synthetic.main.layout_autopilot_launch_before.view.iv_dou
|
||||
import kotlinx.android.synthetic.main.layout_autopilot_launch_before.view.iv_steer
|
||||
import kotlinx.android.synthetic.main.layout_autopilot_launch_before.view.speed
|
||||
import kotlinx.android.synthetic.main.layout_autopilot_launch_before.view.tv_brake_or_accelerator
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
|
||||
class AutoPilotLaunchBeforeView: LinearLayout, IStatusListener {
|
||||
|
||||
@@ -38,11 +39,12 @@ class AutoPilotLaunchBeforeView: LinearLayout, IStatusListener {
|
||||
private const val TAG = "AutoPilotLaunchBeforeView"
|
||||
}
|
||||
|
||||
constructor(context: Context?) : this(context, null)
|
||||
constructor(context: Context?, attrs: AttributeSet?) : this(context, attrs, 0)
|
||||
constructor(context: Context?, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
||||
constructor(context: Context) : this(context, null)
|
||||
constructor(context: Context, attrs: AttributeSet?) : this(context, attrs, 0)
|
||||
constructor(context: Context, attrs: AttributeSet?, defStyleAttr: Int) : super(context, attrs, defStyleAttr) {
|
||||
LayoutInflater.from(context).inflate(R.layout.layout_autopilot_launch_before, this, true)
|
||||
background = ContextCompat.getDrawable(context!!, R.drawable.bg_autopilot_launch_before)
|
||||
background = ContextCompat.getDrawable(context, R.drawable.icon_bg_autopilot_status)
|
||||
setPadding(AutoSizeUtils.dp2px(context, 27f), AutoSizeUtils.dp2px(context, 33f), AutoSizeUtils.dp2px(context, 30f), AutoSizeUtils.dp2px(context, 30f))
|
||||
}
|
||||
|
||||
|
||||
@@ -84,13 +86,13 @@ class AutoPilotLaunchBeforeView: LinearLayout, IStatusListener {
|
||||
val isError = status.isError
|
||||
val angle = status.angle
|
||||
iv_brake_or_accelerator?.isSelected = isError
|
||||
tv_brake_or_accelerator?.text = "a: $angle"
|
||||
tv_brake_or_accelerator?.text = "a:${angle.toInt()}"
|
||||
}
|
||||
is BrakeStatus -> {
|
||||
val isError = status.isError
|
||||
val angle = status.angle
|
||||
iv_brake_or_accelerator?.isSelected = isError
|
||||
tv_brake_or_accelerator?.text = "a: -$angle"
|
||||
tv_brake_or_accelerator?.text = "a:-${angle.toInt()}"
|
||||
}
|
||||
is DoubleFlashStatus -> {
|
||||
val isError = status.isError
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 35 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 24 KiB |
@@ -1,32 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
<item android:width="@dimen/dp_560" android:height="@dimen/dp_200">
|
||||
<shape
|
||||
android:shape="rectangle">
|
||||
<gradient
|
||||
android:startColor="#387BD4"
|
||||
android:centerColor="#0D1578"
|
||||
android:endColor="#387BD4"
|
||||
android:angle="-45"/>
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/dp_66"
|
||||
android:bottomRightRadius="@dimen/dp_66"
|
||||
android:topRightRadius="@dimen/dp_26"
|
||||
android:bottomLeftRadius="@dimen/dp_26"/>
|
||||
</shape>
|
||||
|
||||
</item>
|
||||
|
||||
<item android:width="@dimen/dp_556" android:height="@dimen/dp_196" android:left="@dimen/dp_2" android:top="@dimen/dp_2">
|
||||
<shape
|
||||
android:shape="rectangle">
|
||||
<solid android:color="#000936" />
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/dp_66"
|
||||
android:bottomRightRadius="@dimen/dp_66"
|
||||
android:topRightRadius="@dimen/dp_26"
|
||||
android:bottomLeftRadius="@dimen/dp_26"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -1,34 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<layer-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<item android:width="@dimen/dp_184" android:height="@dimen/dp_200">
|
||||
<shape
|
||||
android:shape="rectangle">
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/dp_66"
|
||||
android:bottomRightRadius="@dimen/dp_66"
|
||||
android:topRightRadius="@dimen/dp_26"
|
||||
android:bottomLeftRadius="@dimen/dp_26"/>
|
||||
<gradient
|
||||
android:startColor="#9FC8FF"
|
||||
android:centerColor="#1F318E"
|
||||
android:endColor="#9FC8FF"
|
||||
android:angle="-90"/>
|
||||
</shape>
|
||||
</item>
|
||||
<item android:width="@dimen/dp_180" android:height="@dimen/dp_196" android:left="@dimen/dp_2" android:top="@dimen/dp_2">
|
||||
<shape
|
||||
android:shape="rectangle">
|
||||
<corners
|
||||
android:topLeftRadius="@dimen/dp_65"
|
||||
android:bottomRightRadius="@dimen/dp_65"
|
||||
android:topRightRadius="@dimen/dp_25"
|
||||
android:bottomLeftRadius="@dimen/dp_25"/>
|
||||
|
||||
<gradient
|
||||
android:startColor="#231CDE"
|
||||
android:centerColor="#000936"
|
||||
android:endColor="#892B5AD7"
|
||||
android:angle="-90"/>
|
||||
</shape>
|
||||
</item>
|
||||
</layer-list>
|
||||
@@ -2,10 +2,14 @@
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
tools:parentTag="android.widget.LinearLayout"
|
||||
tools:layout_width="wrap_content"
|
||||
tools:layout_height="wrap_content"
|
||||
tools:layout_width="@dimen/dp_624"
|
||||
tools:layout_height="@dimen/dp_269"
|
||||
tools:orientation="horizontal"
|
||||
tools:background="@drawable/bg_autopilot_launch_before">
|
||||
tools:background="@drawable/icon_bg_autopilot_status"
|
||||
tools:paddingTop="@dimen/dp_33"
|
||||
tools:paddingBottom="@dimen/dp_30"
|
||||
tools:paddingStart="@dimen/dp_27"
|
||||
tools:paddingEnd="@dimen/dp_30">
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/speed_chart_parent"
|
||||
@@ -13,7 +17,7 @@
|
||||
android:layout_height="@dimen/dp_200"
|
||||
android:gravity="center"
|
||||
android:orientation="vertical"
|
||||
android:background="@drawable/bg_speed_chart">
|
||||
android:background="@drawable/icon_bg_speed">
|
||||
<TextView
|
||||
android:id="@+id/speed"
|
||||
android:layout_width="wrap_content"
|
||||
@@ -21,8 +25,8 @@
|
||||
android:textSize="@dimen/dp_74"
|
||||
android:textColor="@color/white"
|
||||
tools:text="65"
|
||||
android:text="0"
|
||||
android:layout_marginBottom="@dimen/dp_2"/>
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
@@ -36,13 +40,15 @@
|
||||
android:layout_height="@dimen/dp_200"
|
||||
android:layout_weight="1"
|
||||
android:orientation="vertical"
|
||||
android:gravity="center_vertical">
|
||||
android:gravity="center_vertical"
|
||||
android:paddingEnd="@dimen/dp_34">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_marginStart="@dimen/dp_34"
|
||||
android:layout_marginTop="@dimen/dp_10"
|
||||
android:background="@drawable/bg_geer_position"
|
||||
android:paddingStart="@dimen/dp_53"
|
||||
android:paddingEnd="@dimen/dp_53"
|
||||
@@ -120,7 +126,7 @@
|
||||
android:textSize="@dimen/dp_34"
|
||||
android:layout_marginTop="-1dp"
|
||||
android:textColor="@color/white"
|
||||
tools:text="a:0.0"/>
|
||||
android:text="a:-0.0"/>
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
</merge>
|
||||
Reference in New Issue
Block a user