[6.5.0]融合红绿灯

This commit is contained in:
xuxinchao
2024-06-24 19:22:45 +08:00
parent d235abdadb
commit f80ec0481b
17 changed files with 180 additions and 0 deletions

View File

@@ -0,0 +1,33 @@
package com.mogo.eagle.core.function.hmi.ui.widget
import android.content.Context
import android.util.AttributeSet
import android.view.LayoutInflater
import androidx.constraintlayout.widget.ConstraintLayout
import com.mogo.eagle.core.function.hmi.R
/**
* 融合红绿灯View
* 鹰眼6.5.0版本需求
*/
class FusionTrafficLightView @JvmOverloads constructor(
context: Context,
attrs: AttributeSet? = null,
defStyleAttr: Int = 0
) : ConstraintLayout(context, attrs, defStyleAttr){
companion object {
private const val TAG = "FusionTrafficLightView"
}
override fun onAttachedToWindow() {
super.onAttachedToWindow()
LayoutInflater.from(context).inflate(R.layout.hmi_view_fusion_traffic_light, this, true)
}
override fun onDetachedFromWindow() {
super.onDetachedFromWindow()
}
}

View File

@@ -0,0 +1,50 @@
package com.mogo.eagle.core.function.hmi.ui.widget
import android.content.Context
import android.graphics.Canvas
import android.graphics.Paint
import android.graphics.RectF
import android.util.AttributeSet
import android.view.View
import com.mogo.eagle.core.function.hmi.R
/**
* 融合红绿灯红、黄、绿时间占比示意View
* 鹰眼6.5.0需求
*/
class TrafficLightProportionView constructor(
context: Context,
attrs: AttributeSet
) : View(context, attrs){
private var mCanvas: Canvas? = null
private var mRingPaint: Paint? = null
private var mRectF: RectF? = null
private var proportionList =ArrayList<Int>()
init {
}
override fun onMeasure(widthMeasureSpec: Int, heightMeasureSpec: Int) {
super.onMeasure(widthMeasureSpec, heightMeasureSpec)
val size = MeasureSpec.getSize(widthMeasureSpec)
.coerceAtLeast(MeasureSpec.getSize(widthMeasureSpec))
setMeasuredDimension(size, size)
}
override fun onDraw(canvas: Canvas?) {
super.onDraw(canvas)
}
private fun initAttr(context: Context,attrs: AttributeSet?){
if(null == attrs){
return
}
val array = context.obtainStyledAttributes(attrs, R.styleable.TrafficLightProportionView)
//TODO
array.recycle()
}
}

View File

@@ -0,0 +1,26 @@
package com.mogo.eagle.core.function.hmi.ui.widget
import android.content.Context
import android.graphics.Typeface
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatTextView
/**
* 融合红绿灯倒计时特定字体TextView
* 鹰眼6.5.0需求
*/
class TypefaceTextView constructor(
context: Context,
attrs: AttributeSet
) : AppCompatTextView(context, attrs) {
init {
initTypefaceTextView(context,attrs)
}
private fun initTypefaceTextView(context: Context, attrs: AttributeSet) {
val typeface = Typeface.createFromAsset(context.assets, "digital-7.ttf")
setTypeface(typeface)
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 36 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 32 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 879 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 34 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 859 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.5 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 33 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 908 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 3.4 KiB

View File

@@ -0,0 +1,60 @@
<?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:id="@+id/fusion_traffic_light_bg"
android:layout_width="@dimen/dp_250"
android:layout_height="@dimen/dp_250"
android:background="@drawable/bg_fusion_traffic_light_p"
>
<ImageView
android:id="@+id/fusion_traffic_light_state"
android:layout_width="@dimen/dp_147"
android:layout_height="@dimen/dp_147"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:src="@drawable/icon_light_green"
android:contentDescription="@string/fusion_traffic_light_state"
/>
<ImageView
android:id="@+id/fusion_traffic_light_scale"
android:layout_width="@dimen/dp_148"
android:layout_height="@dimen/dp_148"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:src="@drawable/icon_light_green_scale"
android:contentDescription="@string/fusion_traffic_light_scale"
/>
<ImageView
android:id="@+id/fusion_traffic_light_pointer"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintCircle="@id/fusion_traffic_light_state"
app:layout_constraintCircleRadius="@dimen/dp_60"
android:src="@drawable/icon_light_green_pointer"
android:contentDescription="@string/fusion_traffic_light_pointer"
tools:ignore="MissingConstraints"
/>
<com.mogo.eagle.core.function.hmi.ui.widget.TypefaceTextView
android:id="@+id/fusion_traffic_light_num"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
android:textColor="@color/black"
android:textSize="@dimen/sp_55"
android:textStyle="bold"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -118,4 +118,8 @@
<attr name="roma_change_dis_color" format="boolean"/>
</declare-styleable>
<declare-styleable name="TrafficLightProportionView">
<attr name="ringWidth" format="reference|dimension"/>
</declare-styleable>
</resources>

View File

@@ -100,4 +100,10 @@
<string name="sweeper_mode_change_tips">请确认是否要切换清扫业务切换将自动重启APP?</string>
<string name="pull_time_title">Taxi无人化演练任务拉取时间间隔</string>
<!--融合红绿灯-->
<string name="fusion_traffic_light_state">融合红绿灯灯态</string>
<string name="fusion_traffic_light_scale">融合红绿灯刻度</string>
<string name="fusion_traffic_light_pointer">融合红绿灯指针</string>
</resources>