[6.5.0]自动探查
@@ -0,0 +1,80 @@
|
||||
package com.mogo.eagle.core.function.hmi.ui.notice.exploration
|
||||
|
||||
import android.animation.Animator
|
||||
import android.animation.AnimatorListenerAdapter
|
||||
import android.animation.ObjectAnimator
|
||||
import android.animation.ValueAnimator
|
||||
import android.content.Context
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.widget.ImageView
|
||||
import android.widget.TextView
|
||||
import androidx.core.content.ContextCompat
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.data.notice.AutoExplorationEntity
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
|
||||
/**
|
||||
* 自动探查适配器
|
||||
* 鹰眼650需求
|
||||
*/
|
||||
class AutomaticExplorationAdapter(val context: Context,val user: Int): RecyclerView.Adapter<AutomaticExplorationAdapter.ExplorationHolder>() {
|
||||
|
||||
private var data: List<AutoExplorationEntity> ?= null
|
||||
|
||||
fun setData(data: List<AutoExplorationEntity>){
|
||||
this.data = data
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): ExplorationHolder {
|
||||
return if(user == 0){
|
||||
val view = LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.item_auto_exploration, parent, false)
|
||||
ExplorationHolder(view)
|
||||
}else{
|
||||
val view = LayoutInflater.from(parent.context)
|
||||
.inflate(R.layout.item_auto_exploration_p, parent, false)
|
||||
ExplorationHolder(view)
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemCount() = data?.size ?: 0
|
||||
|
||||
override fun onBindViewHolder(holder: ExplorationHolder, position: Int) {
|
||||
data?.let {
|
||||
holder.tvExplorationContent.text = it[position].explorationContent
|
||||
val rotationAnim = ObjectAnimator.ofFloat(holder.ivExplorationLoading, "rotation", 0f, 360f)
|
||||
rotationAnim.repeatCount = it[position].explorationDuration.toInt()/1000
|
||||
rotationAnim.repeatMode = ValueAnimator.RESTART
|
||||
rotationAnim.duration = 1000
|
||||
rotationAnim.interpolator = LinearInterpolator()
|
||||
rotationAnim.addListener(object: AnimatorListenerAdapter(){
|
||||
override fun onAnimationEnd(animation: Animator) {
|
||||
super.onAnimationEnd(animation)
|
||||
if(user == 0){
|
||||
holder.ivExplorationLoading.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_exploration_done
|
||||
))
|
||||
}else{
|
||||
holder.ivExplorationLoading.setImageDrawable(
|
||||
ContextCompat.getDrawable(
|
||||
context,
|
||||
R.drawable.icon_exploration_done_p
|
||||
))
|
||||
}
|
||||
}
|
||||
})
|
||||
rotationAnim.start()
|
||||
}
|
||||
}
|
||||
|
||||
class ExplorationHolder(itemView: View) : RecyclerView.ViewHolder(itemView){
|
||||
var ivExplorationLoading: ImageView = itemView.findViewById(R.id.ivExplorationLoading)
|
||||
var tvExplorationContent: TextView = itemView.findViewById(R.id.tvExplorationContent)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -9,8 +9,10 @@ import android.view.View
|
||||
import android.view.animation.LinearInterpolator
|
||||
import android.widget.ImageView
|
||||
import androidx.constraintlayout.widget.ConstraintLayout
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.eagle.core.data.notice.AutoExplorationEntity
|
||||
import com.mogo.eagle.core.function.hmi.R
|
||||
import com.mogo.eagle.core.utilcode.util.ThreadUtils
|
||||
|
||||
|
||||
/**
|
||||
@@ -23,17 +25,31 @@ class AutomaticExplorationView @JvmOverloads constructor(
|
||||
defStyleAttr: Int = 0
|
||||
) : ConstraintLayout(context, attrs, defStyleAttr) {
|
||||
|
||||
private var user = 0
|
||||
private var ivClose: ImageView ?= null //关闭按钮
|
||||
private var ivScan: ImageView ?= null //扫描视图
|
||||
private var rvExplorationList: RecyclerView ?= null
|
||||
private var automaticExplorationAdapter: AutomaticExplorationAdapter ?= null
|
||||
|
||||
companion object {
|
||||
private const val TAG = "AutomaticExplorationView"
|
||||
}
|
||||
|
||||
init {
|
||||
val typedArray = context.obtainStyledAttributes(attrs, R.styleable.AutomaticExplorationView)
|
||||
user = typedArray.getInt(R.styleable.AutomaticExplorationView_explorationUser,0)
|
||||
typedArray.recycle()
|
||||
}
|
||||
|
||||
override fun onAttachedToWindow() {
|
||||
super.onAttachedToWindow()
|
||||
LayoutInflater.from(context).inflate(R.layout.view_automatic_exploration, this, true)
|
||||
if(user == 0){
|
||||
LayoutInflater.from(context).inflate(R.layout.view_automatic_exploration, this, true)
|
||||
}else{
|
||||
LayoutInflater.from(context).inflate(R.layout.view_automatic_exploration_p, this, true)
|
||||
}
|
||||
initEvent()
|
||||
initData()
|
||||
}
|
||||
|
||||
private fun initEvent(){
|
||||
@@ -52,8 +68,24 @@ class AutomaticExplorationView @JvmOverloads constructor(
|
||||
rotationAnim.interpolator = LinearInterpolator()
|
||||
rotationAnim.start()
|
||||
}
|
||||
rvExplorationList = findViewById(R.id.rvExplorationList)
|
||||
val linearLayoutManager = LinearLayoutManager(context)
|
||||
linearLayoutManager.orientation = LinearLayoutManager.VERTICAL
|
||||
automaticExplorationAdapter = AutomaticExplorationAdapter(context,user)
|
||||
rvExplorationList?.adapter = automaticExplorationAdapter
|
||||
rvExplorationList?.layoutManager = linearLayoutManager
|
||||
}
|
||||
|
||||
|
||||
private fun initData() {
|
||||
val dataList = ArrayList<AutoExplorationEntity>()
|
||||
dataList.add(AutoExplorationEntity("当前道路事件分析",5000L))
|
||||
dataList.add(AutoExplorationEntity("前方车辆",6000L))
|
||||
dataList.add(AutoExplorationEntity("两侧车辆",7000L))
|
||||
dataList.add(AutoExplorationEntity("后方车辆",3000L))
|
||||
dataList.add(AutoExplorationEntity("前方路口车辆流速分析",5000L))
|
||||
dataList.add(AutoExplorationEntity("前方路口行人/非机动车分析",6000L))
|
||||
dataList.add(AutoExplorationEntity("路侧视频分析",8000L))
|
||||
automaticExplorationAdapter?.setData(dataList)
|
||||
}
|
||||
|
||||
override fun onDetachedFromWindow() {
|
||||
|
||||
|
After Width: | Height: | Size: 9.3 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.1 KiB |
|
After Width: | Height: | Size: 1.3 KiB |
|
After Width: | Height: | Size: 770 B |
|
After Width: | Height: | Size: 996 B |
|
After Width: | Height: | Size: 14 KiB |
@@ -0,0 +1,26 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_margin="@dimen/dp_10"
|
||||
>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivExplorationLoading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/icon_exploration_loading"
|
||||
android:contentDescription="@string/exploration_loading"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvExplorationContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/sp_18"
|
||||
android:textColor="@color/white"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -0,0 +1,25 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="horizontal"
|
||||
android:layout_margin="@dimen/dp_10">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivExplorationLoading"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:src="@drawable/icon_exploration_loading_p"
|
||||
android:contentDescription="@string/exploration_loading"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvExplorationContent"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:textSize="@dimen/sp_18"
|
||||
android:textColor="@color/auto_exploration_content_p"
|
||||
android:layout_marginLeft="@dimen/dp_10"
|
||||
/>
|
||||
|
||||
</LinearLayout>
|
||||
@@ -1,28 +1,29 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="@dimen/dp_580"
|
||||
android:layout_height="@dimen/dp_500"
|
||||
android:background="@drawable/bg_automatic_exploration"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
android:layout_width="@dimen/dp_500"
|
||||
android:layout_height="@dimen/dp_421"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:background="@drawable/bg_auto_exploration">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivScan"
|
||||
android:layout_width="@dimen/dp_67"
|
||||
android:layout_height="@dimen/dp_67"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:src="@drawable/icon_scan"
|
||||
android:src="@drawable/icon_exploration_scan"
|
||||
android:contentDescription="@string/exploration_scan"
|
||||
android:layout_margin="@dimen/dp_20"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_50"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="@id/ivScan"
|
||||
app:layout_constraintBottom_toBottomOf="@id/ivScan"
|
||||
app:layout_constraintLeft_toLeftOf="@id/ivScan"
|
||||
app:layout_constraintRight_toRightOf="@id/ivScan"
|
||||
android:src="@drawable/icon_vehicle_lane"
|
||||
android:src="@drawable/icon_exploration_lane"
|
||||
android:contentDescription="@string/exploration_vehicle_lane"
|
||||
/>
|
||||
|
||||
@@ -34,21 +35,18 @@
|
||||
app:layout_constraintBottom_toBottomOf="@id/ivScan"
|
||||
app:layout_constraintStart_toEndOf="@id/ivScan"
|
||||
android:textSize="@dimen/sp_32"
|
||||
android:textColor="@color/color_131415"
|
||||
android:textColor="@color/white"
|
||||
android:text="@string/exploration_title"
|
||||
android:layout_marginStart="@dimen/dp_30"
|
||||
android:layout_marginTop="@dimen/dp_30"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivClose"
|
||||
android:layout_width="@dimen/dp_26"
|
||||
android:layout_height="@dimen/dp_25"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:src="@drawable/icon_exploration_close"
|
||||
android:contentDescription="@string/exploration_close"
|
||||
android:padding="@dimen/dp_20"
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/rvExplorationList"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvExplorationTitle"
|
||||
app:layout_constraintLeft_toLeftOf="@id/tvExplorationTitle"
|
||||
/>
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,61 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="@dimen/dp_580"
|
||||
android:layout_height="@dimen/dp_500"
|
||||
android:background="@drawable/bg_automatic_exploration"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivScan"
|
||||
android:layout_width="@dimen/dp_67"
|
||||
android:layout_height="@dimen/dp_67"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
android:src="@drawable/icon_scan"
|
||||
android:contentDescription="@string/exploration_scan"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:layout_width="@dimen/dp_50"
|
||||
android:layout_height="@dimen/dp_50"
|
||||
app:layout_constraintTop_toTopOf="@id/ivScan"
|
||||
app:layout_constraintBottom_toBottomOf="@id/ivScan"
|
||||
app:layout_constraintLeft_toLeftOf="@id/ivScan"
|
||||
app:layout_constraintRight_toRightOf="@id/ivScan"
|
||||
android:src="@drawable/icon_vehicle_lane"
|
||||
android:contentDescription="@string/exploration_vehicle_lane"
|
||||
/>
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvExplorationTitle"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toTopOf="@id/ivScan"
|
||||
app:layout_constraintBottom_toBottomOf="@id/ivScan"
|
||||
app:layout_constraintStart_toEndOf="@id/ivScan"
|
||||
android:textSize="@dimen/sp_32"
|
||||
android:textColor="@color/color_131415"
|
||||
android:text="@string/exploration_title"
|
||||
android:layout_marginStart="@dimen/dp_30"
|
||||
/>
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivClose"
|
||||
android:layout_width="@dimen/dp_26"
|
||||
android:layout_height="@dimen/dp_25"
|
||||
app:layout_constraintTop_toTopOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
android:src="@drawable/icon_exploration_close"
|
||||
android:contentDescription="@string/exploration_close"
|
||||
android:padding="@dimen/dp_20"
|
||||
/>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@id/rvExplorationList"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintTop_toBottomOf="@id/tvExplorationTitle"
|
||||
app:layout_constraintLeft_toLeftOf="@id/tvExplorationTitle"
|
||||
/>
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -136,4 +136,11 @@
|
||||
</attr>
|
||||
</declare-styleable>
|
||||
|
||||
<declare-styleable name="AutomaticExplorationView">
|
||||
<attr name="explorationUser">
|
||||
<enum name="driver" value="0"/>
|
||||
<enum name="passenger" value="1"/>
|
||||
</attr>
|
||||
</declare-styleable>
|
||||
|
||||
</resources>
|
||||
@@ -100,4 +100,6 @@
|
||||
<color name="light_prompt_green_p">#36DB1C</color>
|
||||
<color name="light_prompt_yellow_p">#FDB700</color>
|
||||
|
||||
<color name="auto_exploration_content_p">#131415</color>
|
||||
|
||||
</resources>
|
||||
@@ -126,6 +126,7 @@
|
||||
<string name="exploration_vehicle_lane">自动探索车道线</string>
|
||||
<string name="exploration_title">正在为您探查前方道路</string>
|
||||
<string name="exploration_close">自动探索关闭按钮</string>
|
||||
<string name="exploration_loading">自动探索条目图标</string>
|
||||
|
||||
|
||||
<string name="road_cross_live_tip">蘑菇为您实时护航中,请放心驾驶!</string>
|
||||
|
||||