diff --git a/.idea/misc.xml b/.idea/misc.xml index e3494654c7..b26ddeecc3 100644 --- a/.idea/misc.xml +++ b/.idea/misc.xml @@ -13,8 +13,10 @@ - + + + diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt index 2628ebafed..098ff1099c 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/MoGoHmiFragment.kt @@ -29,7 +29,9 @@ class MoGoHmiFragment : MvpFragment var mWarningFloat: WarningFloat.Builder? = null - override fun initViews() {} + override fun initViews() { + autopilotStatus.visibility = View.VISIBLE + } override fun getLayoutId(): Int { return R.layout.fragment_hmi diff --git a/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt new file mode 100644 index 0000000000..9e53b57b1b --- /dev/null +++ b/core/function-impl/mogo-core-function-hmi/src/main/java/com/mogo/eagle/core/function/hmi/ui/widget/AutoPilotStatusView.kt @@ -0,0 +1,70 @@ +package com.mogo.eagle.core.function.hmi.ui.widget + +import android.content.Context +import android.content.res.TypedArray +import android.util.AttributeSet +import android.view.LayoutInflater +import androidx.constraintlayout.widget.ConstraintLayout +import com.mogo.eagle.core.function.hmi.R +import com.mogo.eagle.core.utilcode.util.LogUtils +import kotlinx.android.synthetic.main.view_autopilot_status.view.* + +/** + * @author xiaoyuzhou + * @date 2021/9/22 3:59 下午 + * 自动驾驶状态按钮 + */ +class AutoPilotStatusView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet +) : ConstraintLayout(context, attrs) { + + private val TAG = "AutopilotStatusView" + + private var mAutopilotStatus: Int = 0 + + init { + val typedArray: TypedArray = + context.obtainStyledAttributes(attrs, R.styleable.AutopilotStatusView) + mAutopilotStatus = typedArray.getInt(R.styleable.AutopilotStatusView_autopilotStatus, 0) + typedArray.recycle() + + LogUtils.dTag(TAG, "autopilotStatus: $mAutopilotStatus") + + initView(context) + } + + private fun initView(context: Context) { + LayoutInflater.from(context).inflate(R.layout.view_autopilot_status, this, true) + + val lp = LayoutParams(LayoutParams.WRAP_CONTENT, LayoutParams.WRAP_CONTENT) + layoutParams = lp + + setAutoPilotStatus(mAutopilotStatus) + } + + /** + * 设置自动驾驶状态 + * 0-// 不可自动驾驶,adas与工控机没有链接,或工控机异常 + * 1-// 可自动驾驶,目前处于人工干预状态 + * 2-// 自动驾驶中 + */ + fun setAutoPilotStatus(autopilotStatus: Int) { + mAutopilotStatus = autopilotStatus + when (autopilotStatus) { + 0 -> {// 不可自动驾驶,adas与工控机没有链接,或工控机异常 + clAutopilotStatus.setBackgroundResource(R.drawable.module_hmi_autopilot_status_disabled_bg) + tvStatusDes.setTextColor(resources.getColor(R.color.module_mogo_autopilot_status_disable)) + } + 1 -> {// 可自动驾驶,目前处于人工干预状态 + clAutopilotStatus.setBackgroundResource(R.drawable.module_hmi_autopilot_status_enable_bg) + tvStatusDes.setTextColor(resources.getColor(R.color.module_mogo_autopilot_status_enable)) + } + 2 -> {// 自动驾驶中 + clAutopilotStatus.setBackgroundResource(R.drawable.module_hmi_autopilot_status_checked_bg) + tvStatusDes.setTextColor(resources.getColor(R.color.module_mogo_autopilot_status_enable)) + } + } + } + +} \ No newline at end of file diff --git a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml index fe8d7fea80..d36076ac81 100644 --- a/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml +++ b/core/function-impl/mogo-core-function-hmi/src/main/res/layout/fragment_hmi.xml @@ -18,12 +18,24 @@ android:id="@+id/flSpeedChartView" android:layout_width="@dimen/module_ext_speed_width" android:layout_height="@dimen/module_ext_speed_height" - android:layout_marginLeft="@dimen/dp_40" - android:layout_marginTop="@dimen/dp_40" + android:layout_marginLeft="@dimen/module_mogo_autopilot_status_margin_left" + android:layout_marginTop="@dimen/module_ext_arcView_top" android:elevation="@dimen/dp_10" app:layout_constraintLeft_toLeftOf="parent" app:layout_constraintTop_toTopOf="parent" /> + + + + + + + + + \ No newline at end of file diff --git a/core/mogo-core-res/build.gradle b/core/mogo-core-res/build.gradle index 876949686b..058751820b 100644 --- a/core/mogo-core-res/build.gradle +++ b/core/mogo-core-res/build.gradle @@ -41,7 +41,7 @@ android { sourceSets { main { res.srcDirs = [ - 'src/main/function-common-res', + 'src/main/res', 'src/main/function-adas-res', 'src/main/function-chat-res', 'src/main/function-check-res', diff --git a/core/mogo-core-res/src/main/function-hmi-res/drawable-xxhdpi/icon_autopilot_status.png b/core/mogo-core-res/src/main/function-hmi-res/drawable-xxhdpi/icon_autopilot_status.png new file mode 100644 index 0000000000..927296d690 Binary files /dev/null and b/core/mogo-core-res/src/main/function-hmi-res/drawable-xxhdpi/icon_autopilot_status.png differ diff --git a/core/mogo-core-res/src/main/function-hmi-res/drawable/module_hmi_autopilot_status_bg.xml b/core/mogo-core-res/src/main/function-hmi-res/drawable/module_hmi_autopilot_status_bg.xml new file mode 100644 index 0000000000..96123080b7 --- /dev/null +++ b/core/mogo-core-res/src/main/function-hmi-res/drawable/module_hmi_autopilot_status_bg.xml @@ -0,0 +1,7 @@ + + + + + + + diff --git a/core/mogo-core-res/src/main/function-hmi-res/drawable/module_hmi_autopilot_status_checked_bg.xml b/core/mogo-core-res/src/main/function-hmi-res/drawable/module_hmi_autopilot_status_checked_bg.xml new file mode 100644 index 0000000000..d18c145877 --- /dev/null +++ b/core/mogo-core-res/src/main/function-hmi-res/drawable/module_hmi_autopilot_status_checked_bg.xml @@ -0,0 +1,14 @@ + + + + + + diff --git a/core/mogo-core-res/src/main/function-hmi-res/drawable/module_hmi_autopilot_status_disabled_bg.xml b/core/mogo-core-res/src/main/function-hmi-res/drawable/module_hmi_autopilot_status_disabled_bg.xml new file mode 100644 index 0000000000..21ff274a65 --- /dev/null +++ b/core/mogo-core-res/src/main/function-hmi-res/drawable/module_hmi_autopilot_status_disabled_bg.xml @@ -0,0 +1,14 @@ + + + + + + diff --git a/core/mogo-core-res/src/main/function-hmi-res/drawable/module_hmi_autopilot_status_enable_bg.xml b/core/mogo-core-res/src/main/function-hmi-res/drawable/module_hmi_autopilot_status_enable_bg.xml new file mode 100644 index 0000000000..fac249b7fa --- /dev/null +++ b/core/mogo-core-res/src/main/function-hmi-res/drawable/module_hmi_autopilot_status_enable_bg.xml @@ -0,0 +1,14 @@ + + + + + + diff --git a/core/mogo-core-res/src/main/function-hmi-res/drawable/yi_biao_pan_bg_nor.xml b/core/mogo-core-res/src/main/function-hmi-res/drawable/yi_biao_pan_bg_nor.xml index 06579a8582..f62c0fb5d2 100644 --- a/core/mogo-core-res/src/main/function-hmi-res/drawable/yi_biao_pan_bg_nor.xml +++ b/core/mogo-core-res/src/main/function-hmi-res/drawable/yi_biao_pan_bg_nor.xml @@ -5,8 +5,8 @@ android:endColor="#3B4577" android:startColor="#3B4577" /> + android:bottomLeftRadius="@dimen/module_ext_speed_width_big_radius" + android:bottomRightRadius="@dimen/module_ext_speed_width_sm_radius" + android:topLeftRadius="@dimen/module_ext_speed_width_sm_radius" + android:topRightRadius="@dimen/module_ext_speed_width_big_radius" /> \ No newline at end of file diff --git a/core/mogo-core-res/src/main/function-hmi-res/values-xhdpi-2560x1440/dimens.xml b/core/mogo-core-res/src/main/function-hmi-res/values-xhdpi-2560x1440/dimens.xml deleted file mode 100644 index 6b2cd8c0f7..0000000000 --- a/core/mogo-core-res/src/main/function-hmi-res/values-xhdpi-2560x1440/dimens.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - 460px - 460px - - 320px - 320px - 20px - 110px - 40px - \ No newline at end of file diff --git a/core/mogo-core-res/src/main/function-hmi-res/values-xhdpi/dimens.xml b/core/mogo-core-res/src/main/function-hmi-res/values-xhdpi/dimens.xml deleted file mode 100644 index c7c9f95016..0000000000 --- a/core/mogo-core-res/src/main/function-hmi-res/values-xhdpi/dimens.xml +++ /dev/null @@ -1,11 +0,0 @@ - - - 300px - 300px - - 200px - 200px - 10px - 80px - 28px - \ No newline at end of file diff --git a/core/mogo-core-res/src/main/function-common-res/drawable-mdpi/placeholder.png b/core/mogo-core-res/src/main/res/drawable-mdpi/placeholder.png similarity index 100% rename from core/mogo-core-res/src/main/function-common-res/drawable-mdpi/placeholder.png rename to core/mogo-core-res/src/main/res/drawable-mdpi/placeholder.png diff --git a/core/mogo-core-res/src/main/function-common-res/drawable-xhdpi/placeholder.png b/core/mogo-core-res/src/main/res/drawable-xhdpi/placeholder.png similarity index 100% rename from core/mogo-core-res/src/main/function-common-res/drawable-xhdpi/placeholder.png rename to core/mogo-core-res/src/main/res/drawable-xhdpi/placeholder.png diff --git a/core/mogo-core-res/src/main/function-common-res/drawable/placeholder.png b/core/mogo-core-res/src/main/res/drawable/placeholder.png similarity index 100% rename from core/mogo-core-res/src/main/function-common-res/drawable/placeholder.png rename to core/mogo-core-res/src/main/res/drawable/placeholder.png diff --git a/core/mogo-core-res/src/main/res/values-xhdpi-2560x1440/dimens.xml b/core/mogo-core-res/src/main/res/values-xhdpi-2560x1440/dimens.xml new file mode 100644 index 0000000000..4fd980836a --- /dev/null +++ b/core/mogo-core-res/src/main/res/values-xhdpi-2560x1440/dimens.xml @@ -0,0 +1,31 @@ + + + 460px + 460px + + 30px + 130px + + 40px + 320px + 320px + 20px + 110px + 40px + + 74px + 92px + + 460px + 140px + 40px + 30px + 92px + 44px + 28px + + 30px + 70px + + + \ No newline at end of file diff --git a/core/mogo-core-res/src/main/res/values/color.xml b/core/mogo-core-res/src/main/res/values/color.xml new file mode 100644 index 0000000000..5c0e10bf2e --- /dev/null +++ b/core/mogo-core-res/src/main/res/values/color.xml @@ -0,0 +1,5 @@ + + + #FFFFFF + #4DFFFFFF + \ No newline at end of file diff --git a/core/mogo-core-res/src/main/res/values/dimens.xml b/core/mogo-core-res/src/main/res/values/dimens.xml new file mode 100644 index 0000000000..3d1a96d9ed --- /dev/null +++ b/core/mogo-core-res/src/main/res/values/dimens.xml @@ -0,0 +1,29 @@ + + + 300px + 300px + + 20px + 110px + + 40px + 200px + 200px + 10px + 80px + 28px + + 46px + 60px + + 300px + 100px + 40px + 30px + 20px + 30px + 18px + + 20px + 50px + \ No newline at end of file diff --git a/core/mogo-core-res/src/main/function-common-res/values/string.xml b/core/mogo-core-res/src/main/res/values/string.xml similarity index 100% rename from core/mogo-core-res/src/main/function-common-res/values/string.xml rename to core/mogo-core-res/src/main/res/values/string.xml diff --git a/core/mogo-core-res/src/main/function-common-res/values/styles.xml b/core/mogo-core-res/src/main/res/values/styles.xml similarity index 65% rename from core/mogo-core-res/src/main/function-common-res/values/styles.xml rename to core/mogo-core-res/src/main/res/values/styles.xml index af232939d1..4ee346db1c 100644 --- a/core/mogo-core-res/src/main/function-common-res/values/styles.xml +++ b/core/mogo-core-res/src/main/res/values/styles.xml @@ -11,4 +11,12 @@ + + + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java index 64190b4bf3..bddd39a1c2 100644 --- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java +++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java @@ -215,7 +215,7 @@ public class EntranceFragment extends MvpFragment { - ctvAutopilotStatus.setChecked(isInAutopilot); - }); - } +// /** +// * 自动驾驶状态改变 +// * +// * @param isInAutopilot true - 在自动驾驶中 false - 不在自动驾驶中 +// */ +// public void onAutopilotStatusChanged(boolean isInAutopilot) { +// getActivity().runOnUiThread(() -> { +// ctvAutopilotStatus.setChecked(isInAutopilot); +// }); +// } private void autopilotStatusClick() { EntranceViewHolder.getInstance().entranceAutopilotStatusClick(); @@ -443,7 +443,7 @@ public class EntranceFragment extends MvpFragment - - - - - - - - - - - - - - - diff --git a/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml b/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml index 2ac66fe2ce..be6938df0c 100644 --- a/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml +++ b/modules/mogo-module-extensions/src/main/res/layout/module_ext_layout_entrance.xml @@ -6,27 +6,6 @@ android:layout_width="match_parent" android:layout_height="match_parent"> - - 50px 60px - 460px - 140px - 20px - 530px - 92px - 44px + \ No newline at end of file diff --git a/modules/mogo-module-extensions/src/main/res/values/dimens.xml b/modules/mogo-module-extensions/src/main/res/values/dimens.xml index 55739ccfca..064dab01f5 100644 --- a/modules/mogo-module-extensions/src/main/res/values/dimens.xml +++ b/modules/mogo-module-extensions/src/main/res/values/dimens.xml @@ -251,11 +251,5 @@ 35px 38px - 300px - 100px - 20px - 345px - 20px - 30px \ No newline at end of file