[6.5.0]红绿灯UI调整

This commit is contained in:
xuxinchao
2024-07-02 14:43:20 +08:00
parent 9b5a965fc2
commit a9ae61f310
12 changed files with 45 additions and 9 deletions

View File

@@ -2,7 +2,6 @@ package com.mogo.eagle.core.function.hmi.ui.notice.traffic
import android.content.Context
import android.util.AttributeSet
import android.util.Log
import android.view.LayoutInflater
import android.view.View
import android.widget.TextView
@@ -80,8 +79,6 @@ class TrafficLightPromptView @JvmOverloads constructor(
*/
override fun onShowTrafficLightPrompt(currentState: TrafficLightEnum, currentDuration: Int) {
super.onShowTrafficLightPrompt(currentState, currentDuration)
Log.i("xuxinchao","TrafficLightPromptView onTrafficLightPrompt")
Log.i("xuxinchao","onShowTrafficLightPrompt user="+user)
ThreadUtils.runOnUiThread {
when(currentState){
TrafficLightEnum.GREEN->{
@@ -90,7 +87,6 @@ class TrafficLightPromptView @JvmOverloads constructor(
tvTrafficNum?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_green))
tvTrafficNumDecimal?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_green))
}else{
Log.i("xuxinchao","user="+user)
tvTrafficNum?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_green_p))
tvTrafficNumDecimal?.setTextColor(ContextCompat.getColor(context,R.color.light_prompt_green_p))
}

View File

@@ -4,6 +4,7 @@ import android.content.Context
import android.graphics.Typeface
import android.util.AttributeSet
import androidx.appcompat.widget.AppCompatTextView
import com.mogo.eagle.core.function.hmi.R
/**
* 融合红绿灯倒计时特定字体TextView
@@ -19,8 +20,20 @@ class TypefaceTextView constructor(
}
private fun initTypefaceTextView(context: Context, attrs: AttributeSet) {
val typeface = Typeface.createFromAsset(context.assets, "digital-7.ttf")
setTypeface(typeface)
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.TypefaceTextView)
val type = typedArray.getInt(R.styleable.TypefaceTextView_textType, 0)
if (type == 0) {
return
}
var typeface: Typeface? = null
when (type) {
1 -> typeface = Typeface.createFromAsset(context.assets, "DS-DIGI-1.ttf")
2 -> typeface = Typeface.createFromAsset(context.assets, "DS-DIGIB-2.ttf")
3 -> typeface = Typeface.createFromAsset(context.assets, "DS-DIGII-3.ttf")
4 -> typeface = Typeface.createFromAsset(context.assets, "DS-DIGIT-4.ttf")
}
typeface?.let { setTypeface(it) }
typedArray.recycle()
}
}

Binary file not shown.

Before

Width:  |  Height:  |  Size: 27 KiB

After

Width:  |  Height:  |  Size: 14 KiB

View File

@@ -53,7 +53,7 @@
app:layout_constraintRight_toRightOf="parent"
android:textColor="@color/black"
android:textSize="@dimen/sp_55"
android:textStyle="bold"
app:textType="DS_DIGIB_2"
/>
<com.mogo.eagle.core.function.hmi.ui.widget.ProportionChartView

View File

@@ -15,6 +15,7 @@
android:layout_marginLeft="@dimen/dp_150"
android:textSize="@dimen/sp_30"
android:textColor="@color/white"
android:text="即将绿灯"
/>
<TextView
@@ -23,8 +24,10 @@
android:layout_height="wrap_content"
app:layout_constraintTop_toBottomOf="@id/tvPromptTitle"
app:layout_constraintLeft_toLeftOf="@id/tvPromptTitle"
android:layout_marginTop="@dimen/dp_10"
android:textSize="@dimen/sp_21"
android:textColor="@color/white"
android:text="请准备出发"
/>
<com.mogo.eagle.core.function.hmi.ui.widget.TypefaceTextView
@@ -33,7 +36,11 @@
android:layout_height="wrap_content"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintBottom_toBottomOf="@id/tvPromptContent"
android:textSize="@dimen/sp_30"
android:layout_marginRight="@dimen/dp_15"
android:textSize="@dimen/sp_40"
android:text=".99"
android:textColor="@color/light_prompt_red"
app:textType="DS_DIGIB_2"
/>
<com.mogo.eagle.core.function.hmi.ui.widget.TypefaceTextView
@@ -42,7 +49,10 @@
android:layout_height="wrap_content"
app:layout_constraintBottom_toBottomOf="@id/tvTrafficNumDecimal"
app:layout_constraintRight_toLeftOf="@id/tvTrafficNumDecimal"
android:textSize="@dimen/sp_76"
android:textSize="@dimen/sp_90"
android:text="3"
android:textColor="@color/light_prompt_red"
app:textType="DS_DIGIB_2"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -15,6 +15,7 @@
android:textColor="@color/light_prompt_content"
android:layout_marginTop="@dimen/dp_50"
android:layout_marginStart="@dimen/dp_50"
android:text="即将红灯,请减速慢行"
/>
<com.mogo.eagle.core.function.hmi.ui.widget.TypefaceTextView
@@ -24,6 +25,9 @@
app:layout_constraintBottom_toBottomOf="@id/tvPromptContent"
app:layout_constraintLeft_toRightOf="@id/tvPromptContent"
android:textSize="@dimen/sp_76"
android:text="2"
android:layout_marginLeft="@dimen/dp_25"
app:textType="DS_DIGIB_2"
/>
<com.mogo.eagle.core.function.hmi.ui.widget.TypefaceTextView
@@ -33,6 +37,9 @@
app:layout_constraintBottom_toBottomOf="@id/tvTrafficNum"
app:layout_constraintLeft_toRightOf="@id/tvTrafficNum"
android:textSize="@dimen/sp_30"
android:text=".99"
app:textType="DS_DIGIB_2"
android:gravity="bottom"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -143,4 +143,13 @@
</attr>
</declare-styleable>
<declare-styleable name="TypefaceTextView">
<attr name="textType">
<enum name="DS_DIGI_1" value="1"/>
<enum name="DS_DIGIB_2" value="2"/>
<enum name="DS_DIGII_3" value="3"/>
<enum name="DS_DIGIT_4" value="4"/>
</attr>
</declare-styleable>
</resources>