[8.4.0] 无人化 状态栏
This commit is contained in:
@@ -69,12 +69,14 @@ import com.mogo.eagle.core.function.hmi.ui.tools.UpgradeAppDialog
|
||||
import com.mogo.eagle.core.function.hmi.ui.utils.HmiActionLog
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.ColdStartAgainWindow
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.HDMapVisualAngleAdjustLayout
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.StatusBarUnmannedView
|
||||
import com.mogo.eagle.core.function.hmi.ui.widget.StatusBarView
|
||||
import com.mogo.eagle.core.function.hmi.xiaozhi.XiaoZhiStateManager
|
||||
import com.mogo.eagle.core.utilcode.floating.MoGoPopWindow
|
||||
import com.mogo.eagle.core.utilcode.kotlin.safeCancel
|
||||
import com.mogo.eagle.core.utilcode.kotlin.scope
|
||||
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
|
||||
import com.mogo.eagle.core.utilcode.mogo.CockpitType
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.CallerLogger
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.scene.SceneConstant.Companion.M_HMI
|
||||
import com.mogo.eagle.core.utilcode.util.AppStateManager
|
||||
@@ -130,7 +132,12 @@ class MoGoHmiProvider : IMoGoHmiProvider {
|
||||
}
|
||||
|
||||
override fun setStatusBarDarkOrLight(light: Boolean) {
|
||||
CallerHmiViewControlListenerManager.setStatusBarDarkOrLight(StatusBarView.TAG, light)
|
||||
val tag = if (AppIdentityModeUtils.getCockpitType() == CockpitType.UNMANNED) {
|
||||
StatusBarUnmannedView.TAG
|
||||
} else {
|
||||
StatusBarView.TAG
|
||||
}
|
||||
CallerHmiViewControlListenerManager.setStatusBarDarkOrLight(tag, light)
|
||||
}
|
||||
|
||||
override fun updateStatusBarRightView(insert: Boolean, tag: String, viewGroup: ViewGroup) {
|
||||
|
||||
@@ -0,0 +1,67 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.graphics.drawable.ColorDrawable
|
||||
import android.util.AttributeSet
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.FrameLayout
|
||||
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.hmi.CallerHmiViewControlListenerManager
|
||||
import com.mogo.eagle.core.function.call.setting.CallerSkinModeListenerManager
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import kotlinx.android.synthetic.main.view_status_bar_unmanned.view.viewTextClock
|
||||
|
||||
class StatusBarUnmannedView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : FrameLayout(context, attrs, defStyleAttr), IMoGoSkinModeChangeListener, IViewControlListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "StatusBarUnmannedView"
|
||||
}
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_status_bar_unmanned, this, true)
|
||||
background = ColorDrawable(Color.parseColor("#A6000000")) // 黑色的65%
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
//添加view控制
|
||||
CallerHmiViewControlListenerManager.addListener(StatusBarView.TAG, this)
|
||||
// 添加换肤监听
|
||||
CallerSkinModeListenerManager.addListener(TAG, this)
|
||||
}
|
||||
|
||||
override fun onSkinModeChange(skinMode: Int) {
|
||||
ThreadUtils.runOnUiThread {
|
||||
when (skinMode) {
|
||||
0 -> setStatusBarDarkOrLight(false)
|
||||
1 -> setStatusBarDarkOrLight(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun setStatusBarDarkOrLight(light: Boolean) = if (light) {
|
||||
setTextColor(resources.getColor(R.color.color_2C2E30))
|
||||
} else {
|
||||
setTextColor(resources.getColor(R.color.color_FFFFFF))
|
||||
}
|
||||
|
||||
|
||||
private fun setTextColor(color: Int) {
|
||||
viewTextClock.setTextColor(color)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerHmiViewControlListenerManager.removeListener(StatusBarView.TAG)
|
||||
CallerSkinModeListenerManager.removeListener(TAG)
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<merge xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/dp_status_bar_height"
|
||||
tools:background="#A6000000"
|
||||
tools:parentTag="android.widget.FrameLayout">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<TextClock
|
||||
android:id="@+id/viewTextClock"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/dp_61"
|
||||
android:format12Hour="HH:mm:ss"
|
||||
android:format24Hour="HH:mm:ss"
|
||||
android:textColor="#ffffff"
|
||||
android:textSize="@dimen/dp_45"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<!--Wifi状态-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/dp_30" />
|
||||
|
||||
<Space
|
||||
android:layout_width="0dip"
|
||||
android:layout_height="@dimen/dp_1"
|
||||
android:layout_weight="1" />
|
||||
|
||||
|
||||
<LinearLayout
|
||||
android:id="@+id/viewStatusBarRight"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginEnd="@dimen/dp_40"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.BatteryGroupView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content" />
|
||||
</LinearLayout>
|
||||
</LinearLayout>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:background="@drawable/icon_status_bar_logo"
|
||||
android:contentDescription="@null"
|
||||
app:isUseSkin="true" />
|
||||
</merge>
|
||||
Reference in New Issue
Block a user