[6.4.0] add func of wifi name
This commit is contained in:
@@ -22,7 +22,7 @@
|
||||
<!--Wifi状态-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
|
||||
android:id="@+id/wifiStateView"
|
||||
android:layout_width="@dimen/dp_28"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_28"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/dp_40"
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<!--Wifi状态-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
|
||||
android:id="@+id/wifiStateView"
|
||||
android:layout_width="@dimen/dp_28"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_28"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -54,7 +54,7 @@
|
||||
<!--Wifi状态-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
|
||||
android:id="@+id/wifiStateView"
|
||||
android:layout_width="@dimen/dp_34"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_34"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -22,7 +22,7 @@
|
||||
<!--Wifi状态-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
|
||||
android:id="@+id/wifiStateView"
|
||||
android:layout_width="@dimen/dp_28"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_28"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -10,7 +10,7 @@
|
||||
<!--Wifi状态-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
|
||||
android:id="@+id/wifiStateView"
|
||||
android:layout_width="@dimen/dp_28"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_28"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<!--Wifi状态-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
|
||||
android:id="@+id/wifiStateView"
|
||||
android:layout_width="@dimen/dp_54"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_54"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/gl_horizontal"
|
||||
|
||||
@@ -20,7 +20,7 @@
|
||||
<!--Wifi状态-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
|
||||
android:id="@+id/wifiStateView"
|
||||
android:layout_width="@dimen/dp_54"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_54"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/gl_horizontal"
|
||||
|
||||
@@ -119,7 +119,6 @@ class StatusBarView @JvmOverloads constructor(
|
||||
|
||||
private fun setTextColor(color: Int) {
|
||||
viewTextClock.setTextColor(color)
|
||||
viewStatusBarTag.setTextColor(color)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
|
||||
@@ -8,19 +8,27 @@ import android.net.wifi.WifiManager
|
||||
import android.os.Handler
|
||||
import android.os.Message
|
||||
import android.util.AttributeSet
|
||||
import androidx.appcompat.widget.AppCompatImageView
|
||||
import android.util.Log
|
||||
import android.util.TypedValue
|
||||
import android.view.LayoutInflater
|
||||
import android.widget.ImageView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import com.mogo.eagle.core.data.config.FunctionBuildConfig
|
||||
import com.mogo.eagle.core.function.api.setting.IMoGoSkinModeChangeListener
|
||||
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 com.mogo.eagle.core.utilcode.util.UiThreadHandler
|
||||
import kotlinx.android.synthetic.main.view_wifi_state.view.viewStatusBarTag
|
||||
import kotlinx.android.synthetic.main.view_wifi_state.view.viewWifiStateBg
|
||||
import me.jessyan.autosize.utils.AutoSizeUtils
|
||||
import java.lang.ref.WeakReference
|
||||
import kotlin.properties.Delegates
|
||||
|
||||
|
||||
class WifiStateView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : AppCompatImageView(context, attrs, defStyleAttr), IMoGoSkinModeChangeListener {
|
||||
context: Context, attrs: AttributeSet? = null,defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs), IMoGoSkinModeChangeListener {
|
||||
|
||||
companion object {
|
||||
const val TAG = "WifiStateView"
|
||||
@@ -37,20 +45,46 @@ class WifiStateView @JvmOverloads constructor(
|
||||
override fun handleMessage(msg: Message) {
|
||||
super.handleMessage(msg)
|
||||
val view = stateViewWeakReference?.get()
|
||||
view?.updateView(msg.what) {
|
||||
view.setImageResource(it)
|
||||
view?.updateLevel(msg.what)
|
||||
}
|
||||
}
|
||||
}
|
||||
private var wifiManager: WifiManager? = null
|
||||
private var wifiHandler: WifiHandler? = null
|
||||
|
||||
private var level: Int by Delegates.observable(0) { _, o, n ->
|
||||
if (o != n) {
|
||||
UiThreadHandler.post {
|
||||
updateView(n){
|
||||
viewWifiStateBg.setImageResource(it)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private var wifiManager: WifiManager? = null
|
||||
private var wifiHandler: WifiHandler? = null
|
||||
private var wifiName: String by Delegates.observable("") { _, o, n ->
|
||||
if (o != n) {
|
||||
UiThreadHandler.post {
|
||||
if(n.contains("unknow")){
|
||||
viewStatusBarTag.text = ""
|
||||
}else{
|
||||
viewStatusBarTag.text = n
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Volatile
|
||||
private var level: Int = 0
|
||||
private val txtSize: Float
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_wifi_state, this, true)
|
||||
val a = context.obtainStyledAttributes(attrs, R.styleable.WifiStateView, defStyleAttr, 0)
|
||||
txtSize = a.getDimension(
|
||||
R.styleable.WifiStateView_wifi_size,
|
||||
resources.getDimension(R.dimen.dp_35)
|
||||
)
|
||||
a.recycle()
|
||||
viewStatusBarTag.setTextSize(TypedValue.COMPLEX_UNIT_PX,AutoSizeUtils.dp2px(context,txtSize).toFloat())
|
||||
wifiManager =
|
||||
context.applicationContext.getSystemService(Context.WIFI_SERVICE) as WifiManager?
|
||||
wifiHandler = WifiHandler(this)
|
||||
@@ -67,6 +101,8 @@ class WifiStateView @JvmOverloads constructor(
|
||||
return
|
||||
}
|
||||
val wifiInfo = wifiManager!!.connectionInfo
|
||||
wifiName = wifiInfo.ssid.replace("\"","")
|
||||
Log.i("emArrow", "wifiName: $wifiName")
|
||||
level = WifiManager.calculateSignalLevel(wifiInfo.rssi, 5)
|
||||
wifiHandler?.sendEmptyMessage(level)
|
||||
}
|
||||
@@ -95,9 +131,25 @@ class WifiStateView @JvmOverloads constructor(
|
||||
|
||||
override fun onSkinModeChange(skinMode: Int) {
|
||||
wifiHandler?.sendEmptyMessage(level)
|
||||
UiThreadHandler.post {
|
||||
when (skinMode) {
|
||||
0 -> setStatusBarDarkOrLight(false)
|
||||
1 -> setStatusBarDarkOrLight(true)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun updateView(wifiState: Int, resId: ((Int) -> Unit)) {
|
||||
private fun setStatusBarDarkOrLight(light: Boolean) = if (light) {
|
||||
viewStatusBarTag.setTextColor(resources.getColor(R.color.color_2C2E30))
|
||||
} else {
|
||||
viewStatusBarTag.setTextColor(resources.getColor(R.color.color_FFFFFF))
|
||||
}
|
||||
|
||||
fun updateLevel(wifiState: Int){
|
||||
level = wifiState
|
||||
}
|
||||
|
||||
private fun updateView(wifiState: Int, resId: ((Int) -> Unit)) {
|
||||
when (FunctionBuildConfig.skinMode) {
|
||||
0 -> {
|
||||
when (wifiState) {
|
||||
@@ -109,6 +161,7 @@ class WifiStateView @JvmOverloads constructor(
|
||||
4 -> resId.invoke(R.drawable.wifi_light_state_five)
|
||||
}
|
||||
}
|
||||
|
||||
1 -> {
|
||||
when (wifiState) {
|
||||
-1 -> resId.invoke(R.drawable.wifi_dark_state_one)
|
||||
|
||||
@@ -18,20 +18,9 @@
|
||||
android:textSize="@dimen/dp_45"
|
||||
android:textStyle="bold" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/viewStatusBarTag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/dp_27"
|
||||
android:gravity="center"
|
||||
android:text="@string/status_bar_tag"
|
||||
android:textColor="@color/color_2C2E30"
|
||||
android:textSize="@dimen/dp_35" />
|
||||
|
||||
<!--Wifi状态-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.WifiStateView
|
||||
android:layout_width="@dimen/dp_54"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="@dimen/dp_54"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginStart="@dimen/dp_18" />
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout 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="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/viewStatusBarTag"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_27"
|
||||
android:gravity="center_vertical"
|
||||
android:maxLength="15"
|
||||
android:textColor="@color/color_2C2E30"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/viewWifiStateBg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@+id/viewStatusBarTag"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
tools:ignore="MissingConstraints" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -89,6 +89,10 @@
|
||||
<attr name="pnc_txt_style" format="reference"/>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="WifiStateView">
|
||||
<attr name="wifi_size" format="dimension"/>
|
||||
</declare-styleable>
|
||||
|
||||
<style name="AudioFileInfoOverlayText">
|
||||
<item name="android:shadowColor">#80000000</item>
|
||||
<item name="android:shadowRadius">11</item>
|
||||
|
||||
@@ -8,6 +8,7 @@ import androidx.annotation.RequiresApi;
|
||||
|
||||
import com.google.common.collect.BiMap;
|
||||
import com.google.common.collect.HashBiMap;
|
||||
import com.mogo.eagle.core.data.enums.TrafficTypeEnum;
|
||||
import com.mogo.eagle.core.data.traffic.TrafficData;
|
||||
import com.mogo.eagle.core.utilcode.geometry.S2CellId;
|
||||
import com.mogo.eagle.core.utilcode.geometry.S2LatLng;
|
||||
@@ -103,7 +104,7 @@ public class TrackManager {
|
||||
MessagePad.TrackedObject cache = cacheTrack.getCache();
|
||||
if (cache != null) {
|
||||
//相对静止物体 感知融合同位置物体,使用缓存数据做覆盖
|
||||
if (cacheTrack.relativeStatic()) {
|
||||
if (cacheTrack.relativeStatic() && data.getType() != TrafficTypeEnum.TYPE_TRAFFIC_ID_CONE.getType()) {
|
||||
if (data.getColor() != null && !data.getColor().isEmpty()) {
|
||||
cache = cache.toBuilder().setColor(data.getColor()).build();
|
||||
}
|
||||
|
||||
@@ -51,11 +51,14 @@ object TrackerSourceFilterHelper {
|
||||
var color = ""
|
||||
if (!FunctionBuildConfig.isDrawUnknownIdentifyData
|
||||
&& data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_WEI_ZHI.type
|
||||
&& data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_CONE.type
|
||||
) {
|
||||
return ""
|
||||
}
|
||||
|
||||
if(data.type == TrafficTypeEnum.TYPE_TRAFFIC_ID_CONE.type){
|
||||
return ""
|
||||
}
|
||||
|
||||
if(FunctionBuildConfig.isFusionColor){
|
||||
if(isFusion(data)){
|
||||
color = "#982FFFFF"
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user