[6.5.0][Opt]优化下司机屏UI

This commit is contained in:
chenfufeng
2024-07-19 15:44:15 +08:00
parent 27a2fd83ca
commit 563764d9aa
12 changed files with 252 additions and 35 deletions

View File

@@ -12,6 +12,7 @@ import com.bumptech.glide.request.transition.Transition
import com.mogo.commons.constants.HostConst
import com.mogo.eagle.core.data.BaseResponse
import com.mogo.eagle.core.data.Response
import com.mogo.eagle.core.data.config.FunctionBuildConfig
import com.mogo.eagle.core.data.road.RoadCameraLive
import com.mogo.eagle.core.function.business.roadcross.net.BATCH_LIVE
import com.mogo.eagle.core.function.business.roadcross.net.INDERoadCameraApiService
@@ -22,6 +23,7 @@ import com.mogo.eagle.core.network.apiCall
import com.mogo.eagle.core.network.apiResponseCall
import com.mogo.eagle.core.network.cancel
import com.mogo.eagle.core.network.request
import com.mogo.eagle.core.utilcode.mogo.AppIdentityModeUtils
import com.mogo.eagle.core.utilcode.util.DrivingDirectionUtils
import com.mogo.eagle.core.utilcode.util.LocationUtils
import com.mogo.eagle.core.utilcode.util.Md5Util
@@ -309,21 +311,41 @@ class TravelRealityModel private constructor() {
*/
fun calculateAnchor(orientation: Int): Pair<Float, Float> {
// 0:左1:上2:右3:下
return when (orientation) {
0 -> {
Pair(0.94f, 0.48f)
}
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
return when (orientation) {
0 -> {
Pair(0.98f, 0.51f)
}
1 -> {
Pair(0.49f, 0.94f)
}
1 -> {
Pair(0.49f, 0.99f)
}
2 -> {
Pair(0.05f, 0.47f)
}
2 -> {
Pair(0.02f, 0.49f)
}
else -> {
Pair(0.50f, 0.04f)
else -> {
Pair(0.51f, 0.02f)
}
}
} else {
return when (orientation) {
0 -> {
Pair(0.94f, 0.48f)
}
1 -> {
Pair(0.49f, 0.94f)
}
2 -> {
Pair(0.05f, 0.47f)
}
else -> {
Pair(0.50f, 0.04f)
}
}
}
}

View File

@@ -30,16 +30,32 @@ class EventVideoView @JvmOverloads constructor(
// 0:左1:上2:右3:下
when (orientation) {
0 -> {
LayoutInflater.from(context).inflate(R.layout.layout_event_toward_right_maker, this, true)
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
LayoutInflater.from(context).inflate(R.layout.layout_event_toward_right_d_maker, this, true)
} else {
LayoutInflater.from(context).inflate(R.layout.layout_event_toward_right_maker, this, true)
}
}
1 -> {
LayoutInflater.from(context).inflate(R.layout.layout_event_toward_down_maker, this, true)
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
LayoutInflater.from(context).inflate(R.layout.layout_event_toward_down_d_maker, this, true)
} else {
LayoutInflater.from(context).inflate(R.layout.layout_event_toward_down_maker, this, true)
}
}
2 -> {
LayoutInflater.from(context).inflate(R.layout.layout_event_toward_left_maker, this, true)
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
LayoutInflater.from(context).inflate(R.layout.layout_event_toward_left_d_maker, this, true)
} else {
LayoutInflater.from(context).inflate(R.layout.layout_event_toward_left_maker, this, true)
}
}
else -> {
LayoutInflater.from(context).inflate(R.layout.layout_event_toward_up_maker, this, true)
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
LayoutInflater.from(context).inflate(R.layout.layout_event_toward_up_d_maker, this, true)
} else {
LayoutInflater.from(context).inflate(R.layout.layout_event_toward_up_maker, this, true)
}
}
}
initView()
@@ -49,26 +65,7 @@ class EventVideoView @JvmOverloads constructor(
private fun initView() {
videoImgView = findViewById(R.id.videoImg)
val eventLayout = findViewById<ConstraintLayout>(R.id.eventMarkerLayout)
val titleView = findViewById<TextView>(R.id.tvTitle)
if (AppIdentityModeUtils.isDriver(FunctionBuildConfig.appIdentityMode)) {
when (orientation) {
0 -> {
eventLayout.setBackgroundResource(R.drawable.event_video_right_driver_bg)
}
1 -> {
eventLayout.setBackgroundResource(R.drawable.event_video_down_driver_bg)
}
2 -> {
eventLayout.setBackgroundResource(R.drawable.event_video_left_driver_bg)
}
else -> {
eventLayout.setBackgroundResource(R.drawable.event_video_up_driver_bg)
}
}
titleView.setTextColor(Color.WHITE)
}
title?.let {
titleView.text = it
}

View File

@@ -129,6 +129,7 @@ class TravelRealityView @JvmOverloads constructor(
private var topPadding: Int = 150
private var rightPadding: Int = 100
private var bottomPadding: Int = 300
private var isSmaller = false
// 绘制智慧道路的范围
private var roadRange = 56f
@@ -239,6 +240,7 @@ class TravelRealityView @JvmOverloads constructor(
topPadding = typedArray.getInt(R.styleable.TravelRealityView_topPadding, 0)
rightPadding = typedArray.getInt(R.styleable.TravelRealityView_rightPadding, 0)
bottomPadding = typedArray.getInt(R.styleable.TravelRealityView_bottomPadding, 0)
isSmaller = typedArray.getBoolean(R.styleable.TravelRealityView_isSmaller, false)
typedArray.recycle()
initView(context)
} catch (e: Exception) {

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="320dp"
android:layout_height="390dp"
android:id="@+id/eventMarkerLayout"
android:background="@drawable/event_video_down_driver_bg"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:ignore="MissingDefaultResource">
<ImageView
android:id="@+id/videoImg"
android:layout_width="280dp"
android:layout_height="198dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="21dp"
android:layout_marginStart="20dp"
android:scaleType="fitXY"
tools:src="@drawable/mogo_test"
/>
<TextView
android:id="@+id/tvTitle"
android:layout_width="182dp"
android:layout_height="36dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:gravity="center"
android:textStyle="bold"
android:layout_marginBottom="141dp"
tools:text="全息路口"
android:textColor="#FFFFFF"
android:textSize="25dp"
/>
<ImageView
android:layout_width="88dp"
android:layout_height="17dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:background="@drawable/event_logo_d_icon"
android:layout_marginBottom="116dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -15,6 +15,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="15dp"
android:scaleType="fitXY"
/>
<TextView

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="390dp"
android:layout_height="320dp"
android:id="@+id/eventMarkerLayout"
android:background="@drawable/event_video_left_driver_bg"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:ignore="MissingDefaultResource">
<ImageView
android:id="@+id/videoImg"
android:layout_width="280dp"
android:layout_height="198dp"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="20dp"
android:layout_marginEnd="24dp"
android:scaleType="fitXY"
tools:src="@drawable/mogo_test"
/>
<TextView
android:id="@+id/tvTitle"
android:layout_width="182dp"
android:layout_height="36dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:gravity="center"
android:textStyle="bold"
android:layout_marginStart="144dp"
android:layout_marginBottom="57dp"
tools:text="全息路口"
android:textColor="#FFFFFF"
android:textSize="25dp"
/>
<ImageView
android:layout_width="88dp"
android:layout_height="17dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:background="@drawable/event_logo_d_icon"
android:layout_marginStart="191dp"
android:layout_marginBottom="34dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,47 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="390dp"
android:layout_height="320dp"
android:id="@+id/eventMarkerLayout"
android:background="@drawable/event_video_right_driver_bg"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto">
<ImageView
android:id="@+id/videoImg"
android:layout_width="280dp"
android:layout_height="198dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="21dp"
android:layout_marginStart="23dp"
android:scaleType="fitXY"
tools:src="@drawable/mogo_test"
/>
<TextView
android:id="@+id/tvTitle"
android:layout_width="183dp"
android:layout_height="36dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:gravity="center"
android:textStyle="bold"
android:layout_marginStart="73dp"
android:layout_marginBottom="57dp"
tools:text="全息路口"
android:textColor="#FFFFFF"
android:textSize="25dp"
/>
<ImageView
android:layout_width="90dp"
android:layout_height="17dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:background="@drawable/event_logo_d_icon"
android:layout_marginStart="119dp"
android:layout_marginBottom="34dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -15,6 +15,7 @@
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="15dp"
android:layout_marginStart="20dp"
android:scaleType="fitXY"
/>
<TextView

View File

@@ -0,0 +1,48 @@
<?xml version="1.0" encoding="utf-8"?>
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="320dp"
android:layout_height="390dp"
android:id="@+id/eventMarkerLayout"
android:background="@drawable/event_video_up_driver_bg"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
tools:ignore="MissingDefaultResource">
<ImageView
android:id="@+id/videoImg"
android:layout_width="279dp"
android:layout_height="198dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="88dp"
android:layout_marginStart="21dp"
android:scaleType="fitXY"
tools:src="@drawable/mogo_test"
/>
<TextView
android:id="@+id/tvTitle"
android:layout_width="182dp"
android:layout_height="36dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:gravity="center"
android:textStyle="bold"
android:layout_marginBottom="61dp"
tools:text="全息路口"
android:textColor="#FFFFFF"
android:textSize="25dp"
/>
<ImageView
android:layout_width="90dp"
android:layout_height="17dp"
app:layout_constraintStart_toStartOf="parent"
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintBottom_toBottomOf="parent"
android:background="@drawable/event_logo_d_icon"
android:layout_marginBottom="38dp"
/>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -15,6 +15,7 @@
app:layout_constraintEnd_toEndOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="87dp"
android:scaleType="fitXY"
/>
<TextView

View File

@@ -73,5 +73,7 @@
<attr name="topPadding" />
<attr name="rightPadding" />
<attr name="bottomPadding" />
<!-- 是否是小窗口显示 -->
<attr name="isSmaller" format="boolean" />
</declare-styleable>
</resources>