统一地图图标渲染尺寸
优化提前显示面板,详细信息面板 增加多媒体照片
This commit is contained in:
@@ -21,5 +21,7 @@ data class SignBean(
|
||||
//底部右侧文字
|
||||
val bottomRightText: String = "",
|
||||
//捕捉数据
|
||||
val renderEntity: RenderEntity
|
||||
val renderEntity: RenderEntity,
|
||||
//道路信息排序用的字段
|
||||
val index: Int = 0
|
||||
) : Parcelable
|
||||
@@ -259,11 +259,13 @@ class MainViewModel @Inject constructor(
|
||||
name = SignUtil.getSignNameText(element),
|
||||
bottomRightText = SignUtil.getSignBottomRightText(element),
|
||||
renderEntity = element,
|
||||
isMoreInfo = SignUtil.isMoreInfo(element)
|
||||
isMoreInfo = SignUtil.isMoreInfo(element),
|
||||
index = SignUtil.getRoadInfoIndex(element)
|
||||
)
|
||||
Log.e("jingo", "捕捉到的数据code ${element.code}")
|
||||
when (element.code) {
|
||||
2002, 2008, 2010, 2041 -> topSignList.add(
|
||||
//车道数,种别,功能等级,线限速,道路方向
|
||||
2041, 2008, 2002, 2019, 2010 -> topSignList.add(
|
||||
signBean
|
||||
)
|
||||
4002, 4003, 4004, 4010, 4022, 4601 -> signList.add(
|
||||
@@ -293,7 +295,8 @@ class MainViewModel @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
liveDataTopSignList.postValue(topSignList.distinctBy { it.distance })
|
||||
liveDataTopSignList.postValue(topSignList.distinctBy { it.name }.sortedBy { it.index })
|
||||
|
||||
liveDataSignList.postValue(signList.sortedBy { it.distance })
|
||||
val speechText = SignUtil.getRoadSpeechText(topSignList)
|
||||
withContext(Dispatchers.Main) {
|
||||
|
||||
@@ -83,6 +83,9 @@ class SignAdapter(private var listener: OnSignAdapterClickListener?) :
|
||||
bd.signSecondIcon.text = minSpeed
|
||||
}
|
||||
}
|
||||
bd.signMainBg.setOnClickListener {
|
||||
listener?.onItemClick(item)
|
||||
}
|
||||
} else if (holder.viewBinding is AdapterSignLaneinfoBinding) {
|
||||
val bd = holder.viewBinding
|
||||
bd.signMoreIconsLayout.removeAllViews()
|
||||
@@ -123,10 +126,11 @@ class SignAdapter(private var listener: OnSignAdapterClickListener?) :
|
||||
lineViewE.layoutParams = ViewGroup.LayoutParams(24, 80)
|
||||
lineViewE.background = context.getDrawable(R.drawable.shape_vertical_dashed_line)
|
||||
bd.signMoreIconsLayout.addView(lineViewE, lineViewE.layoutParams)
|
||||
bd.root.setOnClickListener {
|
||||
listener?.onItemClick(item)
|
||||
}
|
||||
}
|
||||
holder.viewBinding.root.setOnClickListener {
|
||||
listener?.onItemClick(item)
|
||||
}
|
||||
|
||||
holder.tag = item.name + position
|
||||
}
|
||||
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.navinfo.omqs.ui.fragment.evaluationresult
|
||||
|
||||
import android.app.Dialog
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.util.Log
|
||||
@@ -8,20 +7,22 @@ import android.view.LayoutInflater
|
||||
import android.view.MotionEvent
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.databinding.DataBindingUtil
|
||||
import androidx.navigation.NavOptions
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.navinfo.omqs.Constant
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.bean.SignBean
|
||||
import com.navinfo.omqs.databinding.FragmentEvaluationResultBinding
|
||||
import com.navinfo.omqs.ui.dialog.FirstDialog
|
||||
import com.navinfo.omqs.ui.fragment.BaseFragment
|
||||
import com.navinfo.omqs.ui.other.shareViewModels
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import androidx.navigation.findNavController
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.navinfo.omqs.ui.dialog.FirstDialog
|
||||
import org.videolan.vlc.Util
|
||||
|
||||
|
||||
@AndroidEntryPoint
|
||||
class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
||||
@@ -32,6 +33,10 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
||||
*/
|
||||
private val viewModel by shareViewModels<EvaluationResultViewModel>("QsRecode")
|
||||
|
||||
private val pictureAdapter by lazy {
|
||||
PictureAdapter()
|
||||
}
|
||||
|
||||
// private val args:EmptyFragmentArgs by navArgs()
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
@@ -57,6 +62,8 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
||||
adapter.refreshData(it)
|
||||
}
|
||||
|
||||
binding.evaluationPictureViewpager
|
||||
|
||||
return binding.root
|
||||
}
|
||||
|
||||
@@ -92,6 +99,21 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
||||
viewModel.deleteData(requireContext())
|
||||
|
||||
}
|
||||
/**
|
||||
* 照片view
|
||||
*/
|
||||
binding.evaluationPictureViewpager.adapter = pictureAdapter
|
||||
val list = mutableListOf("1", "2", "3")
|
||||
pictureAdapter.refreshData(list)
|
||||
|
||||
binding.evaluationPictureLeft.setOnClickListener(this)
|
||||
binding.evaluationPictureRight.setOnClickListener(this)
|
||||
|
||||
|
||||
val recyclerView = binding.evaluationPictureViewpager.getChildAt(0) as RecyclerView
|
||||
|
||||
recyclerView.setPadding(0, 0, Util.convertDpToPx(requireContext(), 50), 0)
|
||||
recyclerView.clipToPadding = false
|
||||
|
||||
|
||||
binding.evaluationVoice.setOnTouchListener { _, event ->
|
||||
@@ -112,6 +134,7 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
||||
true
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 读取元数据
|
||||
*/
|
||||
@@ -250,6 +273,24 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
||||
override fun onClick(v: View?) {
|
||||
v?.let {
|
||||
when (v.id) {
|
||||
//照片左侧按钮
|
||||
R.id.evaluation_picture_left -> {
|
||||
val currentItem = binding.evaluationPictureViewpager.currentItem
|
||||
if (currentItem > 0) {
|
||||
binding.evaluationPictureViewpager.currentItem = currentItem - 1
|
||||
} else {
|
||||
}
|
||||
|
||||
}
|
||||
//照片右侧按钮
|
||||
R.id.evaluation_picture_right -> {
|
||||
val currentItem = binding.evaluationPictureViewpager.currentItem
|
||||
if (currentItem < pictureAdapter.data.size - 1) {
|
||||
binding.evaluationPictureViewpager.currentItem = currentItem + 1
|
||||
} else {
|
||||
|
||||
}
|
||||
}
|
||||
//上三项,打开面板
|
||||
R.id.evaluation_class_type, R.id.evaluation_problem_type, R.id.evaluation_phenomenon -> {
|
||||
activity?.run {
|
||||
|
||||
@@ -0,0 +1,21 @@
|
||||
package com.navinfo.omqs.ui.fragment.evaluationresult
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import com.navinfo.omqs.databinding.AdapterPictureBinding
|
||||
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
|
||||
import com.navinfo.omqs.ui.other.BaseViewHolder
|
||||
|
||||
class PictureAdapter : BaseRecyclerViewAdapter<String>() {
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
|
||||
val viewBinding =
|
||||
AdapterPictureBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
return BaseViewHolder(viewBinding)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
|
||||
val bd = holder.viewBinding as AdapterPictureBinding
|
||||
bd.button.text = data[position]
|
||||
}
|
||||
|
||||
}
|
||||
@@ -24,6 +24,8 @@ class SignUtil {
|
||||
2008 -> getKindText(data)
|
||||
//道路方向
|
||||
2010 -> getRoadDirectionText(data)
|
||||
//常规线限速
|
||||
2019 -> getLineSpeedLimitText(data)
|
||||
//车道数
|
||||
2041 -> getLaneNumText(data)
|
||||
//常规点限速,条件点限速
|
||||
@@ -32,6 +34,13 @@ class SignUtil {
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 常规线限速值
|
||||
*/
|
||||
private fun getLineSpeedLimitText(data: RenderEntity): String {
|
||||
return "${data.properties["maxSpeed"]}"
|
||||
}
|
||||
|
||||
/**
|
||||
*获取道路功能等级文字
|
||||
*/
|
||||
@@ -71,6 +80,8 @@ class SignUtil {
|
||||
2008 -> "种别"
|
||||
//道路方向
|
||||
2010 -> "方向"
|
||||
//常规线限速
|
||||
2019 -> "线限速"
|
||||
//车道数
|
||||
2041 -> "车道数"
|
||||
//常规点限速
|
||||
@@ -96,8 +107,11 @@ class SignUtil {
|
||||
*/
|
||||
fun getSignBottomRightText(data: RenderEntity): String {
|
||||
return when (data.code) {
|
||||
|
||||
//条件点限速
|
||||
4003 -> getConditionLimitText(data)
|
||||
//电子眼
|
||||
4010 -> data.properties["name"].toString()
|
||||
else -> ""
|
||||
}
|
||||
}
|
||||
@@ -438,7 +452,6 @@ class SignUtil {
|
||||
4010 -> true
|
||||
else -> false
|
||||
}
|
||||
Log.e("jingo", "更多信息:${element.code} $isMore")
|
||||
return isMore
|
||||
}
|
||||
|
||||
@@ -584,7 +597,6 @@ class SignUtil {
|
||||
val itemObject = itemArray[i]
|
||||
val type = typeArray[i]
|
||||
var laneInfo = "laneinfo_${itemObject.toString().replace(",", "_")}"
|
||||
Log.e("jingo", "车信图标 $laneInfo")
|
||||
list.add(
|
||||
LaneInfoItem(
|
||||
id = getResId(
|
||||
@@ -614,5 +626,19 @@ class SignUtil {
|
||||
R.drawable.laneinfo_0
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 道路信息排序用的
|
||||
*/
|
||||
fun getRoadInfoIndex(element: RenderEntity): Int {
|
||||
return when (element.code) {
|
||||
2041 -> 0
|
||||
2008 -> 1
|
||||
2002 -> 2
|
||||
2019 -> 3
|
||||
2010 -> 4
|
||||
else -> 999
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user