[8.1.0]
[fea] [status bar]
This commit is contained in:
@@ -2,15 +2,12 @@ package com.mogo.och.shuttle.weaknet.passenger.ui.widget
|
||||
|
||||
import android.annotation.*
|
||||
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.function.api.autopilot.IMoGoChassisStatesListener
|
||||
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.CallerChassisStatesListenerManager
|
||||
import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsManager
|
||||
import com.mogo.eagle.core.function.call.hmi.CallerHmiViewControlListenerManager
|
||||
@@ -20,10 +17,9 @@ import com.mogo.eagle.core.utilcode.util.ClickUtils
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
import com.mogo.och.common.module.manager.bluetooth.BleManager
|
||||
import com.mogo.och.common.module.manager.loop.BizLoopManager
|
||||
import com.mogo.och.common.module.utils.ResourcesUtils
|
||||
import com.mogo.och.shuttle.weaknet.passenger.R
|
||||
import kotlinx.android.synthetic.main.shuttle_p_m2_view_status_bar.view.aciv_wait_ele
|
||||
import kotlinx.android.synthetic.main.shuttle_p_m2_view_status_bar.view.iv_logon
|
||||
import kotlinx.android.synthetic.main.shuttle_p_m2_view_status_bar.view.progress
|
||||
import kotlinx.android.synthetic.main.shuttle_p_m2_view_status_bar.view.tv_power_cos
|
||||
import kotlinx.coroutines.*
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
@@ -34,7 +30,7 @@ import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
*/
|
||||
class M2StatusBarView @JvmOverloads constructor(
|
||||
context: Context, attrs: AttributeSet? = null
|
||||
) : ConstraintLayout(context, attrs), IViewControlListener, IMoGoSkinModeChangeListener,
|
||||
) : ConstraintLayout(context, attrs),
|
||||
IMoGoChassisStatesListener {
|
||||
|
||||
companion object {
|
||||
@@ -46,7 +42,7 @@ class M2StatusBarView @JvmOverloads constructor(
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.shuttle_p_m2_view_status_bar, this, true)
|
||||
setBackgroundColor(Color.parseColor("#80FFFFFF"))
|
||||
setBackgroundColor(ResourcesUtils.getColor(R.color.white))
|
||||
isClickable = true
|
||||
isFocusable = true
|
||||
}
|
||||
@@ -55,24 +51,18 @@ class M2StatusBarView @JvmOverloads constructor(
|
||||
@SuppressLint("ClickableViewAccessibility")
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
|
||||
post {
|
||||
val params: ViewGroup.LayoutParams = getLayoutParams()
|
||||
params.height = AutoSizeUtils.dp2px(context,60f)
|
||||
params.height = AutoSizeUtils.dp2px(context,100f)
|
||||
layoutParams = params
|
||||
}
|
||||
//添加view控制
|
||||
CallerHmiViewControlListenerManager.addListener(TAG,this)
|
||||
// 添加换肤监听
|
||||
CallerSkinModeListenerManager.addListener(TAG, this)
|
||||
|
||||
//电量
|
||||
CallerChassisStatesListenerManager.addListener(TAG,this)
|
||||
|
||||
progress?.also {
|
||||
it.progress = 0
|
||||
aciv_wait_ele.visibility = VISIBLE
|
||||
}
|
||||
tv_power_cos?.also {
|
||||
it.text = "检测中"
|
||||
it.text = "?"
|
||||
}
|
||||
iv_logon.onClick {
|
||||
BizLoopManager.runInMainThread{
|
||||
@@ -86,13 +76,6 @@ class M2StatusBarView @JvmOverloads constructor(
|
||||
}
|
||||
}
|
||||
|
||||
override fun onSkinModeChange(skinMode: Int) {
|
||||
when (skinMode) {
|
||||
0 -> setStatusBarDarkOrLight(false)
|
||||
1 -> setStatusBarDarkOrLight(true)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
super.onDetachedFromWindow()
|
||||
CallerHmiViewControlListenerManager.removeListener(TAG)
|
||||
@@ -112,14 +95,11 @@ class M2StatusBarView @JvmOverloads constructor(
|
||||
if (oldBmsSoc != bmsSoc ) {
|
||||
scope.launch {
|
||||
if(bmsSoc >1){
|
||||
progress?.also { it.progress = bmsSoc.toInt() }
|
||||
tv_power_cos?.also { it.text = "${bmsSoc.toInt()}%" }
|
||||
}else{
|
||||
val power = (bmsSoc * 100).toInt()
|
||||
progress?.also { it.progress = power }
|
||||
tv_power_cos?.also {it.text = "$power%" }
|
||||
}
|
||||
aciv_wait_ele.visibility = GONE
|
||||
}
|
||||
}
|
||||
} finally {
|
||||
|
||||
Binary file not shown.
|
After Width: | Height: | Size: 828 B |
Binary file not shown.
|
Before Width: | Height: | Size: 3.2 KiB After Width: | Height: | Size: 3.4 KiB |
@@ -3,92 +3,105 @@
|
||||
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_60"
|
||||
android:layout_height="@dimen/dp_100"
|
||||
tools:ignore="MissingDefaultResource"
|
||||
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout">
|
||||
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_logon"
|
||||
android:layout_width="@dimen/dp_58"
|
||||
android:layout_height="@dimen/dp_58"
|
||||
android:src="@drawable/shuttle_p_m2_status_bar_logo"
|
||||
app:isUseSkin="true"
|
||||
android:layout_marginStart="@dimen/dp_49"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tv_line_name"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_logon"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_logon"
|
||||
app:layout_constraintStart_toEndOf="@+id/iv_logon"
|
||||
android:layout_marginStart="@dimen/dp_20"
|
||||
android:text="@string/m2_line_name_detaile"
|
||||
android:textSize="@dimen/dp_38"
|
||||
android:textStyle="bold"
|
||||
android:ellipsize="end"
|
||||
android:maxLines="@integer/keyCode_1"
|
||||
app:layout_constraintEnd_toStartOf="@+id/textClockDate"
|
||||
android:textColor="@color/common_203555"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"/>
|
||||
|
||||
<com.mogo.och.common.module.biz.scanner.ScannerStateView
|
||||
android:id="@+id/scannerStateView"
|
||||
android:layout_width="@dimen/dp_40"
|
||||
android:layout_height="@dimen/dp_40"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginEnd="@dimen/dp_18"
|
||||
android:src="@drawable/driver_connect_statis"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_logon"
|
||||
app:layout_constraintEnd_toStartOf="@+id/textClockDate"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_logon" />
|
||||
|
||||
<TextClock
|
||||
android:id="@+id/textClockDate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:format12Hour="HH:mm:ss"
|
||||
android:format24Hour="HH:mm:ss"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_logon"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_logon"
|
||||
app:layout_constraintEnd_toStartOf="@+id/wifiStateView"
|
||||
android:gravity="center"
|
||||
android:layout_marginEnd="@dimen/dp_18"
|
||||
android:textColor="@color/common_203555"
|
||||
android:textSize="@dimen/dp_40"
|
||||
android:textStyle="bold"
|
||||
android:includeFontPadding="false" />
|
||||
|
||||
|
||||
<!--Wifi状态-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
|
||||
android:id="@+id/wifiStateView"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_28"
|
||||
android:layout_width="@dimen/dp_47"
|
||||
android:layout_height="@dimen/dp_47"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/dp_40"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_logon"
|
||||
app:layout_constraintStart_toStartOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_logon"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_logon"
|
||||
app:layout_constraintEnd_toStartOf="@+id/aciv_battery_bg"
|
||||
android:layout_marginEnd="@dimen/dp_18"
|
||||
app:wifi_show_title="false"
|
||||
app:wifi_size="@dimen/dp_18" />
|
||||
|
||||
<!--魔方连接状态 蓝牙-->
|
||||
<com.mogo.och.shuttle.weaknet.passenger.ui.widget.M2BlueToothView
|
||||
android:id="@+id/blueToothView"
|
||||
android:layout_width="@dimen/dp_15"
|
||||
android:layout_height="@dimen/dp_22"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/dp_32"
|
||||
android:src="@drawable/shuttle_p_m2_blue_tooth_open"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_logon"
|
||||
app:layout_constraintStart_toEndOf="@+id/wifiStateView"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_logon" />
|
||||
|
||||
<com.mogo.och.common.module.biz.scanner.ScannerStateView
|
||||
android:id="@+id/scannerStateView"
|
||||
android:layout_width="@dimen/dp_24"
|
||||
android:layout_height="@dimen/dp_24"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/dp_40"
|
||||
android:src="@drawable/driver_connect_statis"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_logon"
|
||||
app:layout_constraintStart_toEndOf="@+id/blueToothView"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_logon" />
|
||||
|
||||
<ProgressBar
|
||||
android:id="@+id/progress"
|
||||
style="?android:attr/progressBarStyleHorizontal"
|
||||
android:layout_width="@dimen/dp_115"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_40"
|
||||
android:layout_marginEnd="@dimen/dp_7"
|
||||
android:layout_marginRight="4dp"
|
||||
android:background="@null"
|
||||
android:maxHeight="@dimen/dp_8"
|
||||
android:minHeight="@dimen/dp_8"
|
||||
android:progressDrawable="@drawable/shuttle_p_m2_power_seekbar_style"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_logon"
|
||||
app:layout_constraintRight_toLeftOf="@+id/tv_power_cos"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_logon" />
|
||||
|
||||
<androidx.appcompat.widget.AppCompatImageView
|
||||
android:id="@+id/aciv_wait_ele"
|
||||
android:src="@drawable/shuttle_p_m2_electricity"
|
||||
app:layout_constraintTop_toTopOf="@+id/progress"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/progress"
|
||||
app:layout_constraintStart_toStartOf="@+id/progress"
|
||||
app:layout_constraintEnd_toEndOf="@+id/progress"
|
||||
android:layout_width="@dimen/dp_12"
|
||||
android:layout_height="@dimen/dp_18"/>
|
||||
android:id="@+id/aciv_battery_bg"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_logon"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_logon"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
android:src="@drawable/m2_p_battery"
|
||||
android:layout_marginEnd="@dimen/dp_22"
|
||||
android:layout_width="@dimen/dp_50"
|
||||
android:layout_height="@dimen/dp_29"/>
|
||||
|
||||
<TextView
|
||||
android:gravity="center"
|
||||
android:id="@+id/tv_power_cos"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginRight="@dimen/dp_40"
|
||||
android:textColor="@color/shuttle_p_m2_power_tv_color"
|
||||
android:textSize="@dimen/dp_18"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/iv_logon"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="@+id/iv_logon" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/iv_logon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_7"
|
||||
android:src="@drawable/shuttle_p_m2_status_bar_logo"
|
||||
app:isUseSkin="true"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintEnd_toEndOf="parent"
|
||||
app:layout_constraintStart_toStartOf="parent" />
|
||||
android:layout_width="@dimen/dp_50"
|
||||
android:layout_height="@dimen/dp_29"
|
||||
android:textColor="@color/common_203555"
|
||||
android:textSize="@dimen/dp_20"
|
||||
android:paddingStart="@dimen/dp_5"
|
||||
android:textStyle="bold"
|
||||
android:paddingEnd="@dimen/dp_9"
|
||||
app:layout_constraintTop_toTopOf="@+id/aciv_battery_bg"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/aciv_battery_bg"
|
||||
app:layout_constraintStart_toStartOf="@+id/aciv_battery_bg"
|
||||
app:layout_constraintEnd_toEndOf="@+id/aciv_battery_bg"
|
||||
tools:text="20"/>
|
||||
|
||||
|
||||
</merge>
|
||||
|
||||
@@ -11,4 +11,6 @@
|
||||
<string name="shuttle_p_m2_empty_remain_minute">—分钟</string>
|
||||
<string name="shuttle_p_m2_arrived_station_title">请按秩序下车</string>
|
||||
<string name="shuttle_p_m2_not_select_line_content">暂无路线</string>
|
||||
|
||||
<string name="m2_line_name_detaile">MOGO BUS</string>
|
||||
</resources>
|
||||
@@ -75,6 +75,7 @@ class WifiStateView @JvmOverloads constructor(
|
||||
}
|
||||
|
||||
private val txtSize: Float
|
||||
private val txtShow: Boolean
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_wifi_state, this, true)
|
||||
@@ -83,6 +84,7 @@ class WifiStateView @JvmOverloads constructor(
|
||||
R.styleable.WifiStateView_wifi_size,
|
||||
resources.getDimension(R.dimen.dp_30)
|
||||
)
|
||||
txtShow = a.getBoolean(R.styleable.WifiStateView_wifi_show_title,true)
|
||||
a.recycle()
|
||||
viewStatusBarTag.setTextSize(TypedValue.COMPLEX_UNIT_PX,AutoSizeUtils.dp2px(context,txtSize).toFloat())
|
||||
wifiManager =
|
||||
@@ -91,6 +93,11 @@ class WifiStateView @JvmOverloads constructor(
|
||||
val wifiInfo = wifiManager!!.connectionInfo
|
||||
Log.d(TAG, "wifi-info : $wifiInfo, ssid->: ${wifiInfo.ssid}")
|
||||
wifiName = wifiInfo.ssid.replace("\"","")
|
||||
if(txtShow){
|
||||
viewStatusBarTag.visibility = VISIBLE
|
||||
}else{
|
||||
viewStatusBarTag.visibility = GONE
|
||||
}
|
||||
}
|
||||
|
||||
private val wifiStateReceiver: BroadcastReceiver = object : BroadcastReceiver() {
|
||||
|
||||
@@ -91,6 +91,7 @@
|
||||
|
||||
<declare-styleable name="WifiStateView">
|
||||
<attr name="wifi_size" format="dimension"/>
|
||||
<attr name="wifi_show_title" format="boolean"/>
|
||||
</declare-styleable>
|
||||
|
||||
<style name="AudioFileInfoOverlayText">
|
||||
|
||||
Reference in New Issue
Block a user