统一地图图标渲染尺寸
优化提前显示面板,详细信息面板 增加多媒体照片
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
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
9
app/src/main/res/drawable/icon_picture_left.xml
Normal file
9
app/src/main/res/drawable/icon_picture_left.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="32dp"
|
||||
android:height="32dp"
|
||||
android:viewportWidth="32"
|
||||
android:viewportHeight="32">
|
||||
<path
|
||||
android:pathData="M0,16A16,16 0,1 1,16 32,16.018 16.018,0 0,1 0,16ZM3.049,16A12.951,12.951 0,1 0,16 3.049,12.966 12.966,0 0,0 3.049,16ZM16.243,21.84 L11.806,17.4a2,2 0,0 1,0 -2.819l4.432,-4.432a2,2 0,0 1,2.824 2.826L16.04,15.994l3.022,3.022a2,2 0,0 1,0.166 2.636l-0.166,0.188a2,2 0,0 1,-2.819 0Z"
|
||||
android:fillColor="#4954ee"/>
|
||||
</vector>
|
||||
9
app/src/main/res/drawable/icon_picture_right.xml
Normal file
9
app/src/main/res/drawable/icon_picture_right.xml
Normal file
@@ -0,0 +1,9 @@
|
||||
<vector xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:width="32dp"
|
||||
android:height="32dp"
|
||||
android:viewportWidth="32"
|
||||
android:viewportHeight="32">
|
||||
<path
|
||||
android:pathData="M32,16A16,16 0,1 1,16 0,16.018 16.018,135 0,1 32,16ZM28.951,16A12.951,12.951 0,1 0,16 28.951,12.966 12.966,0 0,0 28.951,16ZM15.757,10.16 L20.194,14.6a2,2 0,0 1,-0 2.819l-4.432,4.432a2,2 0,0 1,-2.824 -2.826L15.96,16.006l-3.022,-3.022a2,2 0,0 1,-0.166 -2.636l0.166,-0.188a2,2 0,0 1,2.819 -0Z"
|
||||
android:fillColor="#6917c2"/>
|
||||
</vector>
|
||||
@@ -4,7 +4,7 @@
|
||||
android:left="-300dp"
|
||||
android:right="-300dp">
|
||||
<rotate
|
||||
android:drawable="@drawable/shape_dashed_line"
|
||||
android:drawable="@drawable/laneinfo_1_2"
|
||||
android:fromDegrees="90" />
|
||||
</item>
|
||||
</layer-list>
|
||||
11
app/src/main/res/layout/adapter_picture.xml
Normal file
11
app/src/main/res/layout/adapter_picture.xml
Normal file
@@ -0,0 +1,11 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
<Button
|
||||
android:id="@+id/button"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/app_name" />
|
||||
</FrameLayout>
|
||||
@@ -69,8 +69,9 @@
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignBottom="@id/sign_main_bg"
|
||||
android:layout_marginLeft="2dp"
|
||||
android:padding="4dp"
|
||||
android:layout_toRightOf="@id/sign_main_bg"
|
||||
android:background="@drawable/icon_sign_info"
|
||||
android:src="@drawable/icon_sign_info"
|
||||
android:visibility="gone" />
|
||||
|
||||
<ImageView
|
||||
|
||||
@@ -24,9 +24,9 @@
|
||||
android:id="@+id/evaluation_bar"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:drawableLeft="@drawable/selector_btn_back_xml"
|
||||
android:layout_marginLeft="12dp"
|
||||
android:layout_marginTop="14dp"
|
||||
android:drawableLeft="@drawable/selector_btn_back_xml"
|
||||
android:text="Mark"
|
||||
android:textColor="@color/default_blue_text_color"
|
||||
android:textSize="16sp"
|
||||
@@ -49,10 +49,10 @@
|
||||
android:id="@+id/evaluation_bar_cancel"
|
||||
android:layout_width="40dp"
|
||||
android:layout_height="40dp"
|
||||
android:visibility="gone"
|
||||
android:layout_marginRight="10dp"
|
||||
android:background="@color/transparent"
|
||||
android:src="@drawable/icon_fragment_close"
|
||||
android:visibility="gone"
|
||||
app:layout_constraintRight_toLeftOf="@id/evaluation_bar_save"
|
||||
app:layout_constraintTop_toTopOf="@id/evaluation_bar_save" />
|
||||
|
||||
@@ -196,12 +196,12 @@
|
||||
android:elevation="2dp"
|
||||
android:gravity="start"
|
||||
android:hint="请输入备注信息"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:inputType="textMultiLine"
|
||||
android:lines="3"
|
||||
android:maxLines="3"
|
||||
android:paddingLeft="12dp"
|
||||
android:paddingTop="2dp"
|
||||
android:paddingBottom="2dp"
|
||||
android:text="@={viewModel.liveDataQsRecordBean.description}"
|
||||
android:textSize="12sp" />
|
||||
|
||||
@@ -212,8 +212,8 @@
|
||||
android:layout_height="1dp"
|
||||
android:layout_marginLeft="8dp"
|
||||
android:layout_marginTop="26dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:layout_marginRight="8dp"
|
||||
android:layout_marginBottom="20dp"
|
||||
android:background="#D6DBF0" />
|
||||
|
||||
<TextView
|
||||
@@ -224,6 +224,44 @@
|
||||
android:textColor="@color/default_blue_text_color"
|
||||
android:textSize="16sp" />
|
||||
|
||||
<!--
|
||||
这种效果也好实现,主要的关键点是 Android:clipChildren=”false” 这个属性。
|
||||
1.配置ViewPager 和其父布局的 android:clipChildren属性为”false”.
|
||||
(android:clipChildren表示是否限制子View在其范围内,默认为true. 代码设置setClipChildren(false))
|
||||
因为如果clipChildren属性设置为true,就表明我们要将children给clip掉,就是说对于子元素来说,超出当前view的部分都会被切掉,那我们在这里把它设置成false,就表明超出view的部分,不要切掉,依然显示。
|
||||
注意:setClipChildren(false)在3.0以上版本中,开启了硬件加速后将不能正常工作,所以需要将其设置为软件加速。设置软硬件加速使用 setLayerType(View.LAYER_TYPE_SOFTWARE, null); 也可以在布局文件中添加 android:layerType=”software”
|
||||
|
||||
-->
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:gravity="center"
|
||||
android:orientation="horizontal">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/evaluation_picture_left"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginRight="4dp"
|
||||
android:background="@drawable/icon_picture_left"
|
||||
android:padding="5dp" />
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/evaluation_picture_viewpager"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="50dp"
|
||||
android:layout_weight="1"
|
||||
android:clipChildren="false" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/evaluation_picture_right"
|
||||
android:layout_width="24dp"
|
||||
android:layout_height="24dp"
|
||||
android:layout_marginLeft="4dp"
|
||||
android:background="@drawable/icon_picture_right"
|
||||
android:padding="5dp" />
|
||||
</LinearLayout>
|
||||
|
||||
<androidx.recyclerview.widget.RecyclerView
|
||||
android:id="@+id/evaluation_voice_recyclerview"
|
||||
android:layout_width="match_parent"
|
||||
|
||||
Reference in New Issue
Block a user