feat: 增加车信图标及渲染配置
This commit is contained in:
@@ -1,13 +1,8 @@
|
||||
package com.navinfo.omqs.ui.fragment
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.KeyEvent
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.activity.OnBackPressedCallback
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.navigation.fragment.findNavController
|
||||
|
||||
abstract class BaseFragment : Fragment() {
|
||||
// override fun onCreateView(
|
||||
@@ -49,8 +44,8 @@ abstract class BaseFragment : Fragment() {
|
||||
// savedInstanceState: Bundle?
|
||||
// ): View
|
||||
|
||||
fun onBackPressed(): Boolean{
|
||||
findNavController().navigateUp()
|
||||
open fun onBackPressed(): Boolean{
|
||||
// findNavController().navigateUp()
|
||||
return true
|
||||
}
|
||||
|
||||
|
||||
@@ -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,19 +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 com.navinfo.omqs.ui.dialog.FirstDialog
|
||||
import org.videolan.vlc.Util
|
||||
|
||||
|
||||
@AndroidEntryPoint
|
||||
class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
||||
@@ -31,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?
|
||||
@@ -56,6 +62,8 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
||||
adapter.refreshData(it)
|
||||
}
|
||||
|
||||
binding.evaluationPictureViewpager
|
||||
|
||||
return binding.root
|
||||
}
|
||||
|
||||
@@ -70,12 +78,12 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
||||
val mDialog = FirstDialog(context)
|
||||
mDialog.setTitle("提示?")
|
||||
mDialog.setMessage("是否退出,请确认!")
|
||||
mDialog.setPositiveButton("确定", object : FirstDialog.OnClickListener {
|
||||
override fun onClick(dialog: Dialog?, which: Int) {
|
||||
mDialog.dismiss()
|
||||
onBackPressed()
|
||||
}
|
||||
})
|
||||
mDialog.setPositiveButton(
|
||||
"确定"
|
||||
) { _, _ ->
|
||||
mDialog.dismiss()
|
||||
onBackPressed()
|
||||
}
|
||||
mDialog.setNegativeButton("取消", null)
|
||||
mDialog.show()
|
||||
}
|
||||
@@ -91,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 ->
|
||||
@@ -111,6 +134,7 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
||||
true
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 读取元数据
|
||||
*/
|
||||
@@ -249,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 {
|
||||
@@ -315,4 +357,9 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
|
||||
}
|
||||
}
|
||||
|
||||
override fun onBackPressed(): Boolean {
|
||||
findNavController().navigateUp()
|
||||
return true
|
||||
}
|
||||
|
||||
}
|
||||
@@ -26,6 +26,7 @@ import com.navinfo.collect.library.utils.GeometryTools
|
||||
import com.navinfo.omqs.Constant
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.bean.ChatMsgEntity
|
||||
import com.navinfo.omqs.bean.ScProblemTypeBean
|
||||
import com.navinfo.omqs.bean.SignBean
|
||||
import com.navinfo.omqs.db.RealmOperateHelper
|
||||
import com.navinfo.omqs.db.RoomAppDatabase
|
||||
@@ -65,7 +66,7 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
/**
|
||||
* 问题分类 liveData,给[LeftAdapter]展示的数据
|
||||
*/
|
||||
val liveDataLeftTypeList = MutableLiveData<List<String>>()
|
||||
val liveDataLeftTypeList = MutableLiveData<List<ScProblemTypeBean>>()
|
||||
|
||||
/**
|
||||
* 问题类型 liveData 给[MiddleAdapter]展示的数据
|
||||
@@ -95,6 +96,8 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
|
||||
var classTypeTemp: String = ""
|
||||
|
||||
var classCodeTemp: String = ""
|
||||
|
||||
init {
|
||||
liveDataQsRecordBean.value = QsRecordBean(id = UUID.randomUUID().toString())
|
||||
viewModelScope.launch {
|
||||
@@ -137,7 +140,7 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
}
|
||||
} else {
|
||||
liveDataQsRecordBean.value?.run {
|
||||
elementId = bean.elementId
|
||||
elementId = bean.renderEntity.code.toString()
|
||||
linkId = bean.linkId
|
||||
if (linkId.isNotEmpty()) {
|
||||
viewModelScope.launch {
|
||||
@@ -149,7 +152,7 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
val point = GeometryTools.createGeoPoint(bean.geometry)
|
||||
val point = GeometryTools.createGeoPoint(bean.renderEntity.geometry)
|
||||
this.geometry = GeometryTools.createGeometry(point).toText()
|
||||
mapController.animationHandler.animationByLatLon(point.latitude, point.longitude)
|
||||
mapController.markerHandle.addMarker(point, markerTitle)
|
||||
@@ -194,22 +197,24 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
list?.let {
|
||||
if (list.isNotEmpty()) {
|
||||
//通知页面更新
|
||||
var classType = list[0]
|
||||
var classType = list[0].classType
|
||||
var classCode = list[0].elementCode
|
||||
liveDataLeftTypeList.postValue(it)
|
||||
if (bean != null) {
|
||||
val classType2 = roomAppDatabase.getScProblemTypeDao()
|
||||
.findClassTypeByCode(bean.elementCode)
|
||||
val classType2 = roomAppDatabase.getScProblemTypeDao().findClassTypeByCode(bean.renderEntity.code)
|
||||
if (classType2 != null) {
|
||||
classType = classType2
|
||||
}
|
||||
}
|
||||
//如果右侧栏没数据,给个默认值
|
||||
if (liveDataQsRecordBean.value!!.classType.isEmpty()) {
|
||||
|
||||
liveDataQsRecordBean.value!!.classType = classType
|
||||
liveDataQsRecordBean.value!!.classCode = classCode
|
||||
classTypeTemp = classType
|
||||
classCodeTemp = classCode
|
||||
} else {
|
||||
classType = liveDataQsRecordBean.value!!.classType
|
||||
classCode = liveDataQsRecordBean.value!!.classCode
|
||||
}
|
||||
getProblemList(classType)
|
||||
}
|
||||
@@ -298,6 +303,7 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
*/
|
||||
fun setPhenomenonMiddleBean(adapterBean: RightBean) {
|
||||
liveDataQsRecordBean.value!!.classType = classTypeTemp
|
||||
liveDataQsRecordBean.value!!.classCode = classCodeTemp
|
||||
liveDataQsRecordBean.value!!.phenomenon = adapterBean.text
|
||||
liveDataQsRecordBean.value!!.problemType = adapterBean.title
|
||||
liveDataQsRecordBean.postValue(liveDataQsRecordBean.value)
|
||||
|
||||
@@ -5,17 +5,15 @@ import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import androidx.annotation.RequiresApi
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.bean.ScProblemTypeBean
|
||||
import com.navinfo.omqs.databinding.TextItemSelectBinding
|
||||
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
|
||||
import com.navinfo.omqs.ui.other.BaseViewHolder
|
||||
|
||||
class LeftAdapter(private var itemListener: ((Int, String) -> Unit?)? = null) :
|
||||
BaseRecyclerViewAdapter<String>() {
|
||||
BaseRecyclerViewAdapter<ScProblemTypeBean>() {
|
||||
private var selectTitle = ""
|
||||
|
||||
override fun getItemViewRes(position: Int): Int {
|
||||
return R.layout.text_item_select
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
|
||||
val viewBinding =
|
||||
@@ -27,18 +25,18 @@ class LeftAdapter(private var itemListener: ((Int, String) -> Unit?)? = null) :
|
||||
override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
|
||||
val bd = holder.viewBinding as TextItemSelectBinding
|
||||
val title = data[position]
|
||||
bd.itemId.text = title
|
||||
holder.viewBinding.root.isSelected = selectTitle == title
|
||||
bd.itemId.text = title.classType
|
||||
holder.viewBinding.root.isSelected = selectTitle == title.classType
|
||||
bd.root.setOnClickListener {
|
||||
if (selectTitle != title) {
|
||||
selectTitle = title
|
||||
if (selectTitle != title.classType) {
|
||||
selectTitle = title.classType
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
itemListener?.invoke(position, title)
|
||||
itemListener?.invoke(position, title.classType)
|
||||
}
|
||||
}
|
||||
|
||||
override fun refreshData(newData: List<String>) {
|
||||
override fun refreshData(newData: List<ScProblemTypeBean>) {
|
||||
data = newData
|
||||
notifyDataSetChanged()
|
||||
}
|
||||
|
||||
@@ -13,9 +13,6 @@ class MiddleAdapter(private var itemListener: ((Int, String) -> Unit?)? = null)
|
||||
BaseRecyclerViewAdapter<String>() {
|
||||
private var selectTitle = ""
|
||||
|
||||
override fun getItemViewRes(position: Int): Int {
|
||||
return R.layout.text_item_select
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
|
||||
val viewBinding =
|
||||
|
||||
@@ -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]
|
||||
}
|
||||
|
||||
}
|
||||
@@ -11,9 +11,6 @@ class RightGroupHeaderAdapter(private var itemListener: ((Int, RightBean) -> Uni
|
||||
BaseRecyclerViewAdapter<RightBean>() {
|
||||
private var selectTitle = ""
|
||||
private var groupTitleList = mutableListOf<String>()
|
||||
override fun getItemViewRes(position: Int): Int {
|
||||
return R.layout.text_item_select2
|
||||
}
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
|
||||
val viewBinding =
|
||||
|
||||
@@ -224,10 +224,6 @@ class SoundtListAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
override fun getItemViewRes(position: Int): Int {
|
||||
return R.layout.adapter_sound_list
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -131,10 +131,6 @@ class OfflineMapCityListAdapter(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemViewRes(position: Int): Int {
|
||||
return R.layout.adapter_offline_map_city
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -1,13 +1,14 @@
|
||||
package com.navinfo.omqs.ui.fragment.personalcenter
|
||||
|
||||
import android.Manifest
|
||||
import android.content.Intent
|
||||
import android.net.Uri
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.fragment.app.viewModels
|
||||
import androidx.lifecycle.lifecycleScope
|
||||
import androidx.navigation.fragment.findNavController
|
||||
import com.blankj.utilcode.util.ToastUtils
|
||||
import com.blankj.utilcode.util.UriUtils
|
||||
@@ -21,6 +22,8 @@ import com.navinfo.omqs.db.ImportOMDBHelper
|
||||
import com.navinfo.omqs.hilt.ImportOMDBHiltFactory
|
||||
import com.navinfo.omqs.tools.CoroutineUtils
|
||||
import com.navinfo.omqs.ui.fragment.BaseFragment
|
||||
import com.navinfo.omqs.ui.activity.scan.QrCodeActivity
|
||||
import com.permissionx.guolindev.PermissionX
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import org.oscim.core.GeoPoint
|
||||
import javax.inject.Inject
|
||||
@@ -123,6 +126,16 @@ class PersonalCenterFragment(private var backListener: (() -> Unit?)? = null) :
|
||||
// R.id.personal_center_menu_layer_manager -> { // 图层管理
|
||||
// findNavController().navigate(R.id.QsLayerManagerFragment)
|
||||
// }
|
||||
/* R.id.personal_center_menu_qs_record_list -> {
|
||||
findNavController().navigate(R.id.QsRecordListFragment)
|
||||
}
|
||||
R.id.personal_center_menu_layer_manager -> { // 图层管理
|
||||
findNavController().navigate(R.id.QsLayerManagerFragment)
|
||||
}*/
|
||||
R.id.personal_center_menu_scan_qr_code -> {
|
||||
//跳转二维码扫描界面
|
||||
checkPermission()
|
||||
}
|
||||
}
|
||||
true
|
||||
}
|
||||
@@ -134,6 +147,11 @@ class PersonalCenterFragment(private var backListener: (() -> Unit?)? = null) :
|
||||
fileChooser.setCallbacks(this@PersonalCenterFragment)
|
||||
}
|
||||
|
||||
private fun intentTOQRCode() {
|
||||
var intent = Intent(context, QrCodeActivity::class.java);
|
||||
startActivity(intent)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
@@ -147,4 +165,18 @@ class PersonalCenterFragment(private var backListener: (() -> Unit?)? = null) :
|
||||
super.onActivityResult(requestCode, resultCode, data)
|
||||
fileChooser.onActivityResult(requestCode, resultCode, data)
|
||||
}
|
||||
|
||||
private fun checkPermission() {
|
||||
PermissionX.init(this)
|
||||
.permissions(Manifest.permission.CAMERA, Manifest.permission.RECORD_AUDIO)
|
||||
.request { allGranted, grantedList, deniedList ->
|
||||
if (allGranted) {
|
||||
//所有权限已经授权
|
||||
Toast.makeText(context,"授权成功",Toast.LENGTH_LONG).show()
|
||||
intentTOQRCode()
|
||||
} else {
|
||||
Toast.makeText(context, "拒绝权限: $deniedList", Toast.LENGTH_LONG).show()
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -58,9 +58,6 @@ class QsRecordListAdapter(
|
||||
binding.qsRecordTime.text = qsRecordBean.checkTime
|
||||
}
|
||||
|
||||
override fun getItemViewRes(position: Int): Int {
|
||||
return R.layout.adapter_qs_record_list
|
||||
}
|
||||
|
||||
// 提供set方法
|
||||
fun setOnKotlinItemClickListener(itemClickListener: IKotlinItemClickListener) {
|
||||
|
||||
@@ -0,0 +1,30 @@
|
||||
package com.navinfo.omqs.ui.fragment.signMoreInfo
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.databinding.AdapterElectronicEyeBinding
|
||||
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
|
||||
import com.navinfo.omqs.ui.other.BaseViewHolder
|
||||
|
||||
data class ElectronicEyeMoreInfoAdapterItem(
|
||||
val title: String,
|
||||
val text: String
|
||||
)
|
||||
|
||||
class ElectronicEyeInfoAdapter : BaseRecyclerViewAdapter<ElectronicEyeMoreInfoAdapterItem>() {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
|
||||
val viewBinding =
|
||||
AdapterElectronicEyeBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
return BaseViewHolder(viewBinding)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
|
||||
val binding: AdapterElectronicEyeBinding =
|
||||
holder.viewBinding as AdapterElectronicEyeBinding
|
||||
val item = data[position]
|
||||
binding.title.text = item.title
|
||||
binding.text.text = item.text
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
package com.navinfo.omqs.ui.fragment.signMoreInfo
|
||||
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.bean.RoadNameBean
|
||||
import com.navinfo.omqs.databinding.AdapterRoadNameBinding
|
||||
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
|
||||
import com.navinfo.omqs.ui.other.BaseViewHolder
|
||||
|
||||
class RoadNameInfoAdapter : BaseRecyclerViewAdapter<RoadNameBean>() {
|
||||
|
||||
override fun onCreateViewHolder(parent: ViewGroup, viewType: Int): BaseViewHolder {
|
||||
val viewBinding =
|
||||
AdapterRoadNameBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
return BaseViewHolder(viewBinding)
|
||||
}
|
||||
|
||||
override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
|
||||
val binding: AdapterRoadNameBinding =
|
||||
holder.viewBinding as AdapterRoadNameBinding
|
||||
val bean = data[position]
|
||||
binding.title.text = bean.getNameClassStr()
|
||||
binding.name.text = bean.name
|
||||
binding.type.text = bean.getTypeStr()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.navinfo.omqs.ui.fragment.signMoreInfo
|
||||
|
||||
import android.os.Bundle
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import androidx.fragment.app.activityViewModels
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.databinding.FragmentSignInfoBinding
|
||||
import com.navinfo.omqs.ui.activity.map.MainViewModel
|
||||
import com.navinfo.omqs.ui.fragment.BaseFragment
|
||||
import com.navinfo.omqs.ui.widget.SignUtil
|
||||
|
||||
|
||||
class SignMoreInfoFragment : BaseFragment() {
|
||||
private var _binding: FragmentSignInfoBinding? = null
|
||||
private val binding get() = _binding!!
|
||||
|
||||
private val viewModel by activityViewModels<MainViewModel>()
|
||||
override fun onCreateView(
|
||||
inflater: LayoutInflater, container: ViewGroup?, savedInstanceState: Bundle?
|
||||
): View {
|
||||
_binding = FragmentSignInfoBinding.inflate(inflater, container, false)
|
||||
return binding.root
|
||||
}
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
val layoutManager = LinearLayoutManager(context)
|
||||
//// 设置 RecyclerView 的固定大小,避免在滚动时重新计算视图大小和布局,提高性能
|
||||
binding.signInfoRecyclerview.setHasFixedSize(true)
|
||||
binding.signInfoRecyclerview.layoutManager = layoutManager
|
||||
viewModel.liveDataSignMoreInfo.observe(viewLifecycleOwner) {
|
||||
binding.signInfoTitle.text = it.name
|
||||
val drawable = resources.getDrawable(R.drawable.icon_main_moreinfo_text_left, null);
|
||||
drawable.setBounds(
|
||||
0,
|
||||
0,
|
||||
drawable.minimumWidth,
|
||||
drawable.minimumHeight
|
||||
);//必须设置图片大小,否则不显示
|
||||
binding.signInfoTitle.setCompoundDrawables(
|
||||
drawable, null, null, null
|
||||
)
|
||||
|
||||
when (it.code) {
|
||||
//道路名
|
||||
2011 -> {
|
||||
val adapter = RoadNameInfoAdapter()
|
||||
binding.signInfoRecyclerview.adapter = adapter
|
||||
adapter.refreshData(SignUtil.getRoadNameList(it))
|
||||
}
|
||||
//常规点限速
|
||||
4002->{
|
||||
val adapter = ElectronicEyeInfoAdapter()
|
||||
binding.signInfoRecyclerview.adapter = adapter
|
||||
adapter.refreshData(SignUtil.getSpeedLimitMoreInfoText(it))
|
||||
}
|
||||
//条件点限速
|
||||
4003 -> {
|
||||
val adapter = ElectronicEyeInfoAdapter()
|
||||
binding.signInfoRecyclerview.adapter = adapter
|
||||
adapter.refreshData(SignUtil.getConditionLimitMoreInfoText(it))
|
||||
}
|
||||
//电子眼
|
||||
4010
|
||||
-> {
|
||||
val drawable = resources.getDrawable(R.drawable.icon_electronic_eye_left, null);
|
||||
drawable.setBounds(
|
||||
0,
|
||||
0,
|
||||
drawable.minimumWidth,
|
||||
drawable.minimumHeight
|
||||
);//必须设置图片大小,否则不显示
|
||||
binding.signInfoTitle.setCompoundDrawables(
|
||||
drawable, null, null, null
|
||||
)
|
||||
val adapter = ElectronicEyeInfoAdapter()
|
||||
binding.signInfoRecyclerview.adapter = adapter
|
||||
adapter.refreshData(SignUtil.getElectronicEyeMoreInfo(it))
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
binding.signInfoCancel.setOnClickListener {
|
||||
activity?.run {
|
||||
supportFragmentManager.beginTransaction().remove(this@SignMoreInfoFragment)
|
||||
.commit()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
}
|
||||
}
|
||||
@@ -58,9 +58,6 @@ class TaskAdapter(
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemViewRes(position: Int): Int {
|
||||
return R.layout.adapter_task
|
||||
}
|
||||
|
||||
fun resetSelect() {
|
||||
selectPosition = -1
|
||||
|
||||
@@ -282,10 +282,6 @@ class TaskListAdapter(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun getItemViewRes(position: Int): Int {
|
||||
return R.layout.adapter_task_list
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -15,7 +15,8 @@ import dagger.hilt.android.AndroidEntryPoint
|
||||
* 评测任务viewpager管理页面
|
||||
*/
|
||||
@AndroidEntryPoint
|
||||
class TaskManagerFragment(private var backListener: ((TaskManagerFragment) -> Unit?)? = null) : BaseFragment() {
|
||||
class TaskManagerFragment(private var backListener: ((TaskManagerFragment) -> Unit?)? = null) :
|
||||
BaseFragment() {
|
||||
private var _binding: FragmentTaskManagerBinding? = null
|
||||
|
||||
private val binding get() = _binding!!
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context
|
||||
import android.graphics.Color
|
||||
import android.os.Build
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
import androidx.lifecycle.viewModelScope
|
||||
@@ -95,18 +96,21 @@ class TaskViewModel @Inject constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
is NetResult.Error<*> -> {
|
||||
withContext(Dispatchers.Main) {
|
||||
Toast.makeText(context, "${result.exception.message}", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
||||
is NetResult.Failure<*> -> {
|
||||
withContext(Dispatchers.Main) {
|
||||
Toast.makeText(context, "${result.code}:${result.msg}", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
}
|
||||
|
||||
is NetResult.Loading -> {}
|
||||
}
|
||||
val realm = Realm.getDefaultInstance()
|
||||
@@ -139,41 +143,42 @@ class TaskViewModel @Inject constructor(
|
||||
/**
|
||||
* 设置当前选择的任务,并高亮当前任务的所有link
|
||||
*/
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
fun setSelectTaskBean(taskBean: TaskBean) {
|
||||
currentSelectTaskBean = taskBean
|
||||
|
||||
liveDataTaskLinks.value = taskBean.hadLinkDvoList
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mapController.lineHandler.omdbTaskLinkLayer.removeAll()
|
||||
if(taskBean.hadLinkDvoList.isNotEmpty()){
|
||||
mapController.lineHandler.omdbTaskLinkLayer.addLineList(taskBean.hadLinkDvoList)
|
||||
var maxX = 0.0
|
||||
var maxY = 0.0
|
||||
var minX = 0.0
|
||||
var minY = 0.0
|
||||
for (item in taskBean.hadLinkDvoList) {
|
||||
val geometry = GeometryTools.createGeometry(item.geometry)
|
||||
if(geometry!=null){
|
||||
val envelope = geometry.envelopeInternal
|
||||
if (envelope.maxX > maxX) {
|
||||
maxX = envelope.maxX
|
||||
}
|
||||
if (envelope.maxY > maxY) {
|
||||
maxY = envelope.maxY
|
||||
}
|
||||
if (envelope.minX < minX || minX == 0.0) {
|
||||
minX = envelope.minX
|
||||
}
|
||||
if (envelope.minY < minY || minY == 0.0) {
|
||||
minY = envelope.minY
|
||||
}
|
||||
|
||||
mapController.lineHandler.omdbTaskLinkLayer.removeAll()
|
||||
if (taskBean.hadLinkDvoList.isNotEmpty()) {
|
||||
mapController.lineHandler.omdbTaskLinkLayer.addLineList(taskBean.hadLinkDvoList)
|
||||
var maxX = 0.0
|
||||
var maxY = 0.0
|
||||
var minX = 0.0
|
||||
var minY = 0.0
|
||||
for (item in taskBean.hadLinkDvoList) {
|
||||
val geometry = GeometryTools.createGeometry(item.geometry)
|
||||
if (geometry != null) {
|
||||
val envelope = geometry.envelopeInternal
|
||||
if (envelope.maxX > maxX) {
|
||||
maxX = envelope.maxX
|
||||
}
|
||||
if (envelope.maxY > maxY) {
|
||||
maxY = envelope.maxY
|
||||
}
|
||||
if (envelope.minX < minX || minX == 0.0) {
|
||||
minX = envelope.minX
|
||||
}
|
||||
if (envelope.minY < minY || minY == 0.0) {
|
||||
minY = envelope.minY
|
||||
}
|
||||
}
|
||||
//增加异常数据判断
|
||||
if(maxX!=0.0&&maxY!=0.0&&minX!=0.0&&minY!=0.0){
|
||||
mapController.animationHandler.animateToBox(
|
||||
maxX = maxX, maxY = maxY, minX = minX, minY = minY
|
||||
)
|
||||
}
|
||||
}
|
||||
//增加异常数据判断
|
||||
if (maxX != 0.0 && maxY != 0.0 && minX != 0.0 && minY != 0.0) {
|
||||
mapController.animationHandler.animateToBox(
|
||||
maxX = maxX, maxY = maxY, minX = minX, minY = minY
|
||||
)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -181,20 +186,20 @@ class TaskViewModel @Inject constructor(
|
||||
/**
|
||||
* 高亮当前选中的link
|
||||
*/
|
||||
@RequiresApi(Build.VERSION_CODES.M)
|
||||
fun showCurrentLink(link: HadLinkDvoBean) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
|
||||
mapController.lineHandler.omdbTaskLinkLayer.showSelectLine(link)
|
||||
val geometry = GeometryTools.createGeometry(link.geometry)
|
||||
if(geometry!=null){
|
||||
val envelope = geometry.envelopeInternal
|
||||
mapController.animationHandler.animateToBox(
|
||||
maxX = envelope.maxX,
|
||||
maxY = envelope.maxY,
|
||||
minX = envelope.minX,
|
||||
minY = envelope.minY
|
||||
)
|
||||
}
|
||||
mapController.lineHandler.omdbTaskLinkLayer.showSelectLine(link)
|
||||
val geometry = GeometryTools.createGeometry(link.geometry)
|
||||
if (geometry != null) {
|
||||
val envelope = geometry.envelopeInternal
|
||||
mapController.animationHandler.animateToBox(
|
||||
maxX = envelope.maxX,
|
||||
maxY = envelope.maxY,
|
||||
minX = envelope.minX,
|
||||
minY = envelope.minY
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
override fun onCleared() {
|
||||
|
||||
Reference in New Issue
Block a user