[m1]
[底部图片修改、添加statusbar]
This commit is contained in:
yangyakun
2023-02-12 22:31:26 +08:00
parent 02e5bcd5c4
commit f1f93d1b97
22 changed files with 350 additions and 9 deletions

View File

@@ -0,0 +1,57 @@
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools">
<application>
<!-- &lt;!&ndash;保活用&ndash;&gt;
<service
android:name="com.zhidao.boot.persistent.lib.PersistentAliveService"
android:enabled="true"
android:exported="true">
<intent-filter>
<action android:name="com.zhidao.boot.persistent.lib.action" />
</intent-filter>
</service>
<activity
android:name="com.zhidao.boot.persistent.lib.PersistentAliveActivity"
android:resizeableActivity="false"
android:screenOrientation="landscape"
android:theme="@android:style/Theme.Translucent.NoTitleBar" />
-->
<activity
android:name=".ui.M1HomeActivity"
android:clearTaskOnLaunch="false"
android:configChanges="mcc|mnc|locale|touchscreen|keyboard|keyboardHidden|navigation|screenLayout|fontScale|uiMode|orientation|screenSize|smallestScreenSize"
android:enabled="true"
android:hardwareAccelerated="true"
android:launchMode="singleTop"
android:resizeableActivity="false"
android:resumeWhilePausing="true"
android:screenOrientation="landscape"
android:stateNotNeeded="true"
android:theme="@style/Main"
android:windowSoftInputMode="adjustPan|stateHidden">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
<!--调试用暂时开启LAUNCHER这个属性-->
<category android:name="android.intent.category.LAUNCHER" />
<category android:name="android.intent.category.LAUNCHER_APP" />
<category android:name="android.intent.category.HOME" />
<category android:name="android.intent.category.DEFAULT" />
</intent-filter>
<intent-filter>
<data
android:host="launcher"
android:path="/main/switch2"
android:scheme="mogo" />
<category android:name="android.intent.category.DEFAULT" />
<action android:name="android.intent.action.VIEW" />
<category android:name="android.intent.category.BROWSABLE" />
</intent-filter>
</activity>
</application>
</manifest>

View File

@@ -0,0 +1,12 @@
package com.mogo.och.bus.passenger.ui
import android.os.Bundle
import com.mogo.eagle.core.function.main.MainLauncherActivity
import com.mogo.och.bus.passenger.view.statusbar.StatusBarView
class M1HomeActivity : MainLauncherActivity() {
override fun onCreate(savedInstanceState: Bundle?) {
statusBar = StatusBarView(this)
super.onCreate(savedInstanceState)
}
}

View File

@@ -0,0 +1,33 @@
package com.mogo.och.bus.passenger.view.statusbar
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.m1.bus_p_m1_view_blue_tooth.view.*
/**
* 魔戒蓝牙控件
* 放置于StatusBar右侧位置
*/
class M1BlueToothView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : BlueToothView(context, attrs, defStyleAttr),IMoGoDevaToolsListener {
init {
LayoutInflater.from(context).inflate(R.layout.bus_p_m1_view_blue_tooth, this, true)
}
override fun mofangStatus(status: Boolean) {
if (status) {
mofangView.setImageResource(R.drawable.bus_p_m1_blue_tooth_close)
} else {
mofangView.setImageResource(R.drawable.bus_p_m1_blue_tooth_open)
}
}
}

View File

@@ -0,0 +1,84 @@
package com.mogo.och.bus.passenger.view.statusbar
import android.annotation.SuppressLint
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.m1.bus_p_m1_view_status_bar.view.*
import me.jessyan.autosize.utils.AutoSizeUtils
class StatusBarView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoSkinModeChangeListener, IViewControlListener, IMoGoBatteryManagementSystemListener {
companion object {
const val TAG = "StatusBarView"
}
init {
LayoutInflater.from(context).inflate(R.layout.bus_p_m1_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)
updateStatusBarRightView(FunctionBuildConfig.isDemoMode, "demoMode", DemoModeView(this.context))
}
override fun onSkinModeChange(skinMode: Int) {
when (skinMode) {
0 -> setStatusBarDarkOrLight(false)
1 -> setStatusBarDarkOrLight(true)
}
}
override fun updateStatusBarLeftView(insert: Boolean, tag: String, viewGroup: ViewGroup) {
}
@SuppressLint("SetTextI18n")
override fun updateStatusBarDownloadView(insert: Boolean, tag: String, progress: Int) {
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
CallerHmiViewControlListenerManager.removeListener(TAG)
CallerSkinModeListenerManager.removeListener(TAG)
CallerDevaToolsManager.hideStatusBar()
}
override fun onBatteryManagementSystemStates(states: ChassisStatesOuterClass.BMSSystemStates) {
progress.progress = states.bmsSoc.toInt()
tv_power_cos.text = "${states.bmsSoc.toInt()}%"
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 30 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 30 KiB

After

Width:  |  Height:  |  Size: 31 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 930 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 925 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.7 KiB

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<corners android:radius="@dimen/dp_7_5"/>
<solid android:color="@color/bus_p_m1_a3bdf2" />
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="5dp"/>
<solid android:color="@android:color/transparent" />
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<scale android:scaleWidth="100%">
<shape android:shape="rectangle">
<corners android:radius="5dp"/>
<gradient android:startColor="@color/bus_p_m1_56c59c" android:endColor="@color/bus_p_m1_56efa0" android:angle="0"/>
</shape>
</scale>
</item>
</layer-list>

View File

@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:drawable="@drawable/bus_p_function_soft_press" android:state_checked="true"/>
<item android:drawable="@drawable/bus_p_function_soft_normal" android:state_checked="false"/>
<item android:drawable="@drawable/bus_p_function_soft_press" android:state_pressed="true"/>
<item android:drawable="@drawable/bus_p_function_soft_normal" android:state_pressed="false"/>
<item android:drawable="@drawable/bus_p_function_soft_normal"/>
<item android:drawable="@drawable/bus_p_function_device_press" android:state_checked="true"/>
<item android:drawable="@drawable/bus_p_function_device_normal" android:state_checked="false"/>
<item android:drawable="@drawable/bus_p_function_device_press" android:state_pressed="true"/>
<item android:drawable="@drawable/bus_p_function_device_normal" android:state_pressed="false"/>
<item android:drawable="@drawable/bus_p_function_device_normal"/>
</selector>

View File

@@ -0,0 +1,26 @@
<?xml version="1.0" encoding="utf-8"?>
<layer-list
xmlns:android="http://schemas.android.com/apk/res/android">
<item android:id="@android:id/background">
<shape>
<corners android:radius="@dimen/dp_7_5"/>
<solid android:color="@color/bus_p_m1_a3bdf2" />
</shape>
</item>
<item android:id="@android:id/secondaryProgress">
<clip>
<shape>
<corners android:radius="5dp"/>
<solid android:color="@android:color/transparent" />
</shape>
</clip>
</item>
<item android:id="@android:id/progress">
<scale android:scaleWidth="100%">
<shape android:shape="rectangle">
<corners android:radius="5dp"/>
<gradient android:startColor="@color/bus_p_m1_56c59c" android:endColor="@color/bus_p_m1_56efa0"/>
</shape>
</scale>
</item>
</layer-list>

View File

@@ -167,7 +167,7 @@
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintEnd_toStartOf="@+id/cb_bp_setting_soft"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="@dimen/dp_162"
android:layout_width="@dimen/dp_181"
android:layout_height="@dimen/dp_179"/>
<ImageView

View File

@@ -21,7 +21,7 @@
app:layout_constraintHorizontal_chainStyle="packed"
app:layout_constraintEnd_toStartOf="@+id/cb_bp_setting_soft"
app:layout_constraintBottom_toBottomOf="parent"
android:layout_width="@dimen/dp_162"
android:layout_width="@dimen/dp_181"
android:layout_height="@dimen/dp_179"/>
<CheckBox

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="@dimen/dp_18"
android:layout_height="@dimen/dp_26">
<ImageView
android:id="@+id/mofangView"
android:layout_width="@dimen/dp_18"
android:layout_height="@dimen/dp_26"
android:scaleType="fitXY"
android:src="@drawable/bus_p_m1_blue_tooth_open"
tools:ignore="ContentDescription" />
</RelativeLayout>

View File

@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<merge xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/dp_47"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:parentTag="androidx.constraintlayout.widget.ConstraintLayout"
tools:ignore="MissingDefaultResource">
<TextClock
android:id="@+id/viewTextClock"
android:layout_width="wrap_content"
android:layout_height="@dimen/dp_64"
android:format12Hour="HH:mm MM月dd日 EEEE"
android:format24Hour="HH:mm MM月dd日 EEEE"
android:gravity="center"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:layout_marginEnd="@dimen/dp_90"
android:textColor="@color/bus_p_m1_1b2546"
android:includeFontPadding="false"
android:textSize="@dimen/dp_22"
android:textStyle="bold" />
<!--Wifi状态-->
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
android:id="@+id/wifiStateView"
android:layout_width="@dimen/dp_34"
android:layout_height="@dimen/dp_34"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
android:layout_gravity="center"
android:layout_marginStart="@dimen/dp_80" />
<!--魔方连接状态-->
<com.mogo.och.bus.passenger.view.statusbar.M1BlueToothView
android:id="@+id/blueToothView"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/wifiStateView"
android:layout_width="@dimen/dp_18"
android:layout_height="@dimen/dp_26"
android:src="@drawable/bus_p_m1_blue_tooth_open"
android:layout_gravity="center"
android:layout_marginStart="@dimen/dp_32" />
<SeekBar
android:id="@+id/progress"
android:layout_width="@dimen/dp_115"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_40"
android:layout_marginEnd="@dimen/dp_7"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/blueToothView"
android:maxHeight="@dimen/dp_10"
android:minHeight="@dimen/dp_10"
android:splitTrack="false"
android:progressDrawable="@drawable/taxi_video_seekbar_style"
android:thumb="@null" />
<TextView
android:id="@+id/tv_power_cos"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toEndOf="@+id/progress"
android:textSize="@dimen/dp_22"
android:textColor="@color/bus_p_m1_1b2546"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
<ImageView
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
android:src="@drawable/bus_p_m1_status_bar_logo"
android:layout_width="@dimen/dp_116"
android:layout_height="@dimen/dp_31"/>
</merge>

View File

@@ -10,6 +10,10 @@
<color name="bus_p_m1_96a5c2">#96A5C2</color>
<color name="bus_p_m1_f5fbff">#F5FBFF</color>
<color name="bus_p_m1_112b57">#112B57</color>
<color name="bus_p_m1_1b2546">#1B2546</color>
<color name="bus_p_m1_a3bdf2">#A3BDF2</color>
<color name="bus_p_m1_56c59c">#56C59C</color>
<color name="bus_p_m1_56efa0">#56EFA0</color>
<color name="bus_p_m1_CCFFFFFF">#CCFFFFFF</color>
</resources>

View File

@@ -10,13 +10,12 @@ import com.mogo.eagle.core.function.call.devatools.CallerDevaToolsListenerManage
import com.mogo.eagle.core.function.hmi.R
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
import kotlinx.android.synthetic.main.view_blue_tooth.view.*
import kotlinx.android.synthetic.main.view_status_bar.view.*
/**
* 魔戒蓝牙控件
* 放置于StatusBar右侧位置
*/
class BlueToothView @JvmOverloads constructor(
open class BlueToothView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0