diff --git a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/provider/M2StatusViewManager.java b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/provider/M2StatusViewManager.java new file mode 100644 index 0000000000..8966090d91 --- /dev/null +++ b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/provider/M2StatusViewManager.java @@ -0,0 +1,33 @@ +package com.mogo.och.bus.passenger.provider; + +import android.content.Context; +import android.view.View; + +import com.mogo.och.bus.passenger.ui.widget.M2StatusBarView; +import androidx.annotation.NonNull; + +import com.alibaba.android.arouter.facade.annotation.Route; +import com.mogo.eagle.core.data.constants.MogoServicePaths; +import com.mogo.eagle.core.function.api.hmi.view.IStatusViewLayout; + +/** + * @author congtaowang + * @since 2020-01-06 + *

+ * 根据优先级控制显示 window view. + */ +@Route( path = MogoServicePaths.PATH_STATUS_VIEW_MANAGER ) +public class M2StatusViewManager implements IStatusViewLayout { + + + @NonNull + @Override + public View getStatusView(Context context) { + return new M2StatusBarView(context); + } + + @Override + public void init(Context context) { + + } +} diff --git a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/ui/widget/M2BlueToothView.kt b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/ui/widget/M2BlueToothView.kt new file mode 100644 index 0000000000..2916611b3e --- /dev/null +++ b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/ui/widget/M2BlueToothView.kt @@ -0,0 +1,34 @@ +package com.mogo.och.bus.passenger.ui.widget + +import android.content.Context +import android.util.AttributeSet +import android.view.LayoutInflater +import com.mogo.eagle.core.function.api.devatools.IMoGoDevaToolsListener +import com.mogo.eagle.core.function.hmi.ui.widget.BlueToothView +import com.mogo.och.bus.passenger.R +import kotlinx.android.synthetic.m2.p_m2_view_blue_tooth.view.* + +/** + * 魔戒蓝牙控件 + * 放置于StatusBar右侧位置 + * todo arrow + */ +class M2BlueToothView @JvmOverloads constructor( + context: Context, + attrs: AttributeSet? = null, + defStyleAttr: Int = 0 +) : BlueToothView(context, attrs, defStyleAttr),IMoGoDevaToolsListener { + + init { + LayoutInflater.from(context).inflate(R.layout.p_m2_view_blue_tooth, this, true) + } + + override fun mofangStatus(status: Boolean) { + if (status) { + blueView.setImageResource(R.drawable.m2_blue_tooth_close) + } else { + blueView.setImageResource(R.drawable.m2_blue_tooth_open) + } + } + +} \ No newline at end of file diff --git a/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/ui/widget/M2StatusBarView.kt b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/ui/widget/M2StatusBarView.kt new file mode 100644 index 0000000000..8eb016875b --- /dev/null +++ b/OCH/mogo-och-bus-passenger/src/m2/java/com/mogo/och/bus/passenger/ui/widget/M2StatusBarView.kt @@ -0,0 +1,86 @@ +package com.mogo.och.bus.passenger.ui.widget + +import android.content.Context +import android.graphics.Color +import android.util.AttributeSet +import android.view.LayoutInflater +import android.view.ViewGroup +import androidx.constraintlayout.widget.ConstraintLayout +import chassis.ChassisStatesOuterClass +import com.mogo.eagle.core.data.config.FunctionBuildConfig +import com.mogo.eagle.core.function.api.autopilot.IMoGoBatteryManagementSystemListener +import com.mogo.eagle.core.function.api.hmi.view.IViewControlListener +import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener +import com.mogo.eagle.core.function.call.autopilot.CallerBatteryManagementSystemListenerManager +import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager +import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager +import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager +import com.mogo.eagle.core.function.hmi.ui.widget.DemoModeView +import com.mogo.och.bus.passenger.R +import kotlinx.android.synthetic.m2.p_m2_view_status_bar.view.* +import me.jessyan.autosize.utils.AutoSizeUtils + +/** + * @author: wangmingjun + * @date: 2023/2/14 + */ +class M2StatusBarView @JvmOverloads constructor( + context: Context, attrs: AttributeSet? = null +) : ConstraintLayout(context, attrs), IViewControlListener, IMoGoSkinModeChangeListener, + IMoGoBatteryManagementSystemListener { + + companion object { + const val TAG = "M2StatusBarView" + } + + init { + LayoutInflater.from(context).inflate(R.layout.p_m2_view_status_bar, this, true) + setBackgroundColor(Color.WHITE) + } + + override fun onAttachedToWindow() { + super.onAttachedToWindow() + post { + val params: ViewGroup.LayoutParams = getLayoutParams() + params.height = AutoSizeUtils.dp2px(context,47f) + layoutParams = params + } + //添加view控制 + CallerHmiViewControlListenerManager.addListener(TAG,this) + // 添加换肤监听 + CallerSkinModeListenerManager.addListener(TAG, this) + //电量 + CallerBatteryManagementSystemListenerManager.addListener(TAG,this) + + progress.progress = 50 + tv_power_cos.text = "50%" + } + + override fun onSkinModeChange(skinMode: Int) { + when (skinMode) { + 0 -> setStatusBarDarkOrLight(false) + 1 -> setStatusBarDarkOrLight(true) + } + } + + override fun onDetachedFromWindow() { + super.onDetachedFromWindow() + CallerHmiViewControlListenerManager.removeListener(TAG) + CallerSkinModeListenerManager.removeListener(TAG) + CallerDevaToolsManager.hideStatusBar() + } + + override fun onBatteryManagementSystemStates(states: ChassisStatesOuterClass.BMSSystemStates) { + val bmsSoc = states.bmsSoc + if(bmsSoc >1){ + progress.progress = bmsSoc.toInt() + tv_power_cos.text = "${bmsSoc.toInt()}%" + }else{ + val currenPower = (bmsSoc * 100).toInt() + progress.progress = currenPower + tv_power_cos.text = "$currenPower%" + } + } + + +} \ No newline at end of file diff --git a/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/m2_blue_tooth_close.png b/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/m2_blue_tooth_close.png new file mode 100644 index 0000000000..0c292d2cf3 Binary files /dev/null and b/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/m2_blue_tooth_close.png differ diff --git a/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/m2_blue_tooth_open.png b/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/m2_blue_tooth_open.png new file mode 100644 index 0000000000..cccf9e10fa Binary files /dev/null and b/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/m2_blue_tooth_open.png differ diff --git a/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/m2_status_bar_logo.png b/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/m2_status_bar_logo.png new file mode 100644 index 0000000000..ad3bd7fda7 Binary files /dev/null and b/OCH/mogo-och-bus-passenger/src/m2/res/drawable-nodpi/m2_status_bar_logo.png differ diff --git a/OCH/mogo-och-bus-passenger/src/m2/res/drawable/m2_power_seekbar_style.xml b/OCH/mogo-och-bus-passenger/src/m2/res/drawable/m2_power_seekbar_style.xml new file mode 100644 index 0000000000..3ac0c761ba --- /dev/null +++ b/OCH/mogo-och-bus-passenger/src/m2/res/drawable/m2_power_seekbar_style.xml @@ -0,0 +1,26 @@ + + + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_driving_info_fragment.xml b/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_driving_info_fragment.xml index 8440be86dd..d158f9b8b0 100644 --- a/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_driving_info_fragment.xml +++ b/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_driving_info_fragment.xml @@ -17,7 +17,7 @@ android:id="@+id/img_drive_bg" android:layout_width="@dimen/dp_290" android:layout_height="@dimen/dp_140" - android:layout_marginTop="@dimen/dp_24" + android:layout_marginTop="@dimen/dp_66" android:layout_marginLeft="@dimen/dp_24" app:layout_constraintTop_toTopOf="parent" app:layout_constraintLeft_toLeftOf="parent" diff --git a/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_view_blue_tooth.xml b/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_view_blue_tooth.xml new file mode 100644 index 0000000000..69ae14c394 --- /dev/null +++ b/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_view_blue_tooth.xml @@ -0,0 +1,15 @@ + + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_view_status_bar.xml b/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_view_status_bar.xml new file mode 100644 index 0000000000..15a1c12b4f --- /dev/null +++ b/OCH/mogo-och-bus-passenger/src/m2/res/layout/p_m2_view_status_bar.xml @@ -0,0 +1,72 @@ + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/OCH/mogo-och-bus-passenger/src/m2/res/values/colors.xml b/OCH/mogo-och-bus-passenger/src/m2/res/values/colors.xml index da9dd9c7d0..13bd4aff12 100644 --- a/OCH/mogo-och-bus-passenger/src/m2/res/values/colors.xml +++ b/OCH/mogo-och-bus-passenger/src/m2/res/values/colors.xml @@ -10,6 +10,7 @@ #6B7EA6 #2D3E5F #A5D8FF + #1B2546 #FFFFA28B #FFDA1100