[6.0.0] finish the roma passenger func
This commit is contained in:
Binary file not shown.
|
After Width: | Height: | Size: 15 KiB |
Binary file not shown.
|
After Width: | Height: | Size: 5.1 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB |
Binary file not shown.
|
Before Width: | Height: | Size: 21 KiB |
@@ -1,8 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<selector xmlns:tools="http://schemas.android.com/tools" xmlns:android="http://schemas.android.com/apk/res/android" tools:ignore="MissingDefaultResource">
|
||||
<item android:drawable="@drawable/iv_roma_bus_passenger_press_bg" android:state_focused="true" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/iv_roma_bus_passenger_press_bg" android:state_focused="false" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/iv_roma_bus_passenger_press_bg" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/iv_roma_bus_passenger_press_bg" android:state_focused="true" />
|
||||
<item android:drawable="@drawable/iv_roma_bus_passenger_bg" />
|
||||
<item android:drawable="@drawable/bus_p_roma_checked" android:state_focused="true" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/bus_p_roma_checked" android:state_focused="false" android:state_pressed="true" />
|
||||
<item android:drawable="@drawable/bus_p_roma_checked" android:state_selected="true" />
|
||||
<item android:drawable="@drawable/bus_p_roma_checked" android:state_focused="true" />
|
||||
<item android:drawable="@drawable/bus_p_roma_normal" />
|
||||
</selector>
|
||||
@@ -36,16 +36,17 @@
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@+id/video_switch_iv"
|
||||
app:roma_close="@drawable/roma_bus_p_bg_selector"
|
||||
app:roma_open="@drawable/iv_roma_bus_passenger_press_bg" />
|
||||
app:roma_open="@drawable/bus_p_roma_checked" />
|
||||
|
||||
<!-- <com.mogo.eagle.core.function.hmi.ui.widget.RomaDistanceView-->
|
||||
<!-- android:layout_width="@dimen/dp_334"-->
|
||||
<!-- android:layout_height="@dimen/dp_120"-->
|
||||
<!-- android:layout_marginLeft="@dimen/dp_50"-->
|
||||
<!-- android:layout_marginBottom="@dimen/dp_20"-->
|
||||
<!-- app:layout_constraintBottom_toBottomOf="parent"-->
|
||||
<!-- app:layout_constraintLeft_toRightOf="@+id/romaPView"-->
|
||||
<!-- app:roma_change_dis_color="true" />-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.RomaDistanceView
|
||||
android:layout_width="@dimen/dp_334"
|
||||
android:layout_height="@dimen/dp_120"
|
||||
android:layout_marginLeft="@dimen/dp_50"
|
||||
android:layout_marginBottom="@dimen/dp_20"
|
||||
app:roma_distance_bg="@drawable/roma_distance_bg"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toRightOf="@+id/romaPView"
|
||||
app:roma_change_dis_color="true" />
|
||||
|
||||
<!--pnc行为决策-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.vehicle.PncActionsView
|
||||
|
||||
@@ -81,14 +81,15 @@
|
||||
app:roma_close="@drawable/roma_taxi_p_bg_selector"
|
||||
app:roma_open="@drawable/taxi_p_roma_checked" />
|
||||
|
||||
<!-- <com.mogo.eagle.core.function.hmi.ui.widget.RomaDistanceView-->
|
||||
<!-- android:layout_width="@dimen/dp_334"-->
|
||||
<!-- android:layout_height="@dimen/dp_120"-->
|
||||
<!-- android:layout_marginLeft="@dimen/dp_50"-->
|
||||
<!-- android:layout_marginTop="100dp"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!-- app:layout_constraintLeft_toRightOf="@+id/romaPView"-->
|
||||
<!-- app:roma_change_dis_color="true"/>-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.RomaDistanceView
|
||||
android:layout_width="@dimen/dp_334"
|
||||
android:layout_height="@dimen/dp_120"
|
||||
android:layout_marginStart="@dimen/dp_50"
|
||||
android:layout_marginTop="100dp"
|
||||
app:roma_distance_bg="@drawable/roma_distance_bg"
|
||||
app:layout_constraintLeft_toRightOf="@+id/romaPView"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:roma_change_dis_color="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rv_location_center"
|
||||
|
||||
@@ -79,15 +79,15 @@
|
||||
app:roma_close="@drawable/roma_taxi_p_bg_selector"
|
||||
app:roma_open="@drawable/taxi_p_roma_checked" />
|
||||
|
||||
<!-- <com.mogo.eagle.core.function.hmi.ui.widget.RomaDistanceView-->
|
||||
<!-- android:layout_width="@dimen/dp_334"-->
|
||||
<!-- android:layout_height="@dimen/dp_120"-->
|
||||
<!-- android:layout_marginLeft="@dimen/dp_50"-->
|
||||
<!-- android:layout_marginTop="100dp"-->
|
||||
<!-- android:background="@drawable/layer_roma_distance_bg"-->
|
||||
<!-- app:layout_constraintLeft_toRightOf="@+id/romaPView"-->
|
||||
<!-- app:layout_constraintTop_toTopOf="parent"-->
|
||||
<!-- app:roma_change_dis_color="true" />-->
|
||||
<com.mogo.eagle.core.function.hmi.ui.widget.RomaDistanceView
|
||||
android:layout_width="@dimen/dp_334"
|
||||
android:layout_height="@dimen/dp_120"
|
||||
android:layout_marginStart="@dimen/dp_50"
|
||||
android:layout_marginTop="100dp"
|
||||
app:roma_distance_bg="@drawable/roma_distance_bg"
|
||||
app:layout_constraintLeft_toRightOf="@+id/romaPView"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:roma_change_dis_color="true" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/rv_location_center"
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.widget
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Handler
|
||||
import android.os.Looper
|
||||
import android.os.Message
|
||||
import android.text.Html
|
||||
import android.util.AttributeSet
|
||||
import android.util.Log
|
||||
@@ -18,13 +21,33 @@ class RomaDistanceView @JvmOverloads constructor(
|
||||
context: Context,
|
||||
attrs: AttributeSet? = null,
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr) , IMoGoRomaListener {
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr), IMoGoRomaListener {
|
||||
|
||||
companion object {
|
||||
private const val TAG = "RomaDistanceView"
|
||||
}
|
||||
|
||||
private var disChangeColor = false
|
||||
private var dis: Int = 0
|
||||
private val mHandler = object : Handler(Looper.getMainLooper()) {
|
||||
override fun handleMessage(msg: Message) {
|
||||
super.handleMessage(msg)
|
||||
if (msg.what == 1) {
|
||||
if (dis != 0) {
|
||||
if (romaDistanceBg.visibility == View.GONE) {
|
||||
romaDistanceBg.visibility = View.VISIBLE
|
||||
}
|
||||
if (disChangeColor) {
|
||||
romaDistanceMeter.text =
|
||||
Html.fromHtml("<font color='#293449'>漫游距离</font><font color='#0752C3'>${dis}米</font>")
|
||||
} else {
|
||||
romaDistanceMeter.text = "漫游距离${dis}米"
|
||||
}
|
||||
}
|
||||
}
|
||||
sendEmptyMessageDelayed(1, 1000)
|
||||
}
|
||||
}
|
||||
|
||||
init {
|
||||
LayoutInflater.from(context).inflate(R.layout.view_roma_distance, this, true)
|
||||
@@ -34,14 +57,16 @@ class RomaDistanceView @JvmOverloads constructor(
|
||||
defStyleAttr,
|
||||
0
|
||||
)
|
||||
// val distanceBg = a.getResourceId(R.styleable.RomaDistanceView_roma_distance_bg,0)
|
||||
// if(distanceBg != 0){
|
||||
// romaDistanceBg.background = resources.getDrawable(distanceBg)
|
||||
// }
|
||||
val txtSize = a.getInteger(R.styleable.RomaDistanceView_roma_txt_size,35)
|
||||
romaDistanceMeter.setTextSize(TypedValue.COMPLEX_UNIT_PX,
|
||||
AutoSizeUtils.dp2px(getContext(),txtSize.toFloat()).toFloat())
|
||||
val txtDisColor = a.getBoolean(R.styleable.RomaDistanceView_roma_change_dis_color,false)
|
||||
val distanceBg = a.getResourceId(R.styleable.RomaDistanceView_roma_distance_bg, 0)
|
||||
if (distanceBg != 0) {
|
||||
romaDistanceBg.background = resources.getDrawable(distanceBg)
|
||||
}
|
||||
val txtSize = a.getInteger(R.styleable.RomaDistanceView_roma_txt_size, 35)
|
||||
romaDistanceMeter.setTextSize(
|
||||
TypedValue.COMPLEX_UNIT_PX,
|
||||
AutoSizeUtils.dp2px(getContext(), txtSize.toFloat()).toFloat()
|
||||
)
|
||||
val txtDisColor = a.getBoolean(R.styleable.RomaDistanceView_roma_change_dis_color, false)
|
||||
disChangeColor = txtDisColor
|
||||
a.recycle()
|
||||
}
|
||||
@@ -54,22 +79,19 @@ class RomaDistanceView @JvmOverloads constructor(
|
||||
override fun romaStatus(status: Boolean) {
|
||||
super.romaStatus(status)
|
||||
if (status) {
|
||||
romaDistanceBg.visibility = View.VISIBLE
|
||||
mHandler.sendEmptyMessageDelayed(1, 500)
|
||||
} else {
|
||||
mHandler.removeMessages(1)
|
||||
romaDistanceBg.visibility = View.GONE
|
||||
romaDistanceMeter.text = ""
|
||||
dis = 0
|
||||
}
|
||||
}
|
||||
|
||||
override fun romaDistance(distance: String) {
|
||||
super.romaDistance(distance)
|
||||
val dis = distance.toDouble().toInt()
|
||||
Log.i(TAG, "romaDistance:$distance")
|
||||
if(disChangeColor){
|
||||
romaDistanceMeter.text = Html.fromHtml("漫游距离<font color='#0752C3'>${dis}米</font>")
|
||||
}else{
|
||||
romaDistanceMeter.text = "漫游距离${dis}米"
|
||||
}
|
||||
dis = distance.toDouble().toInt()
|
||||
Log.i(TAG, "romaDistance:$dis")
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
|
||||
@@ -9,9 +9,8 @@
|
||||
android:id="@+id/romaDistanceMeter"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="@dimen/dp_20"
|
||||
android:layout_gravity="center_horizontal"
|
||||
android:gravity="center_horizontal"
|
||||
android:gravity="center"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
|
||||
Reference in New Issue
Block a user