Merge branch 'master' of https://gitlab.navinfo.com/CollectVehicle/OneMapQS
Conflicts: app/src/main/java/com/navinfo/omqs/ui/activity/map/MainViewModel.kt vtm
This commit is contained in:
commit
8fe236922e
@ -136,6 +136,7 @@ dependencies {
|
||||
|
||||
//带侧滑的自定义列表
|
||||
implementation 'com.yanzhenjie.recyclerview:x:1.3.2'
|
||||
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
|
||||
}
|
||||
//允许引用生成的代码
|
||||
kapt {
|
||||
|
@ -196,7 +196,7 @@ class TaskUploadScope(
|
||||
evaluationTaskId = taskBean.id.toString(),
|
||||
linkPid = hadLinkDvoBean.linkPid,//"84207223282277331"
|
||||
linkStatus = linkStatus,
|
||||
markId = it.id,//"20065597"
|
||||
markId = it.id,
|
||||
trackPhotoNumber = "",
|
||||
markGeometry = it.geometry,
|
||||
featureName = it.classCode,
|
||||
|
@ -598,6 +598,7 @@ class MainViewModel @Inject constructor(
|
||||
DataCodeEnum.OMDB_ELECTRONICEYE.code,//电子眼
|
||||
DataCodeEnum.OMDB_TRAFFICLIGHT.code,//交通灯
|
||||
DataCodeEnum.OMDB_LANEINFO.code,//车信
|
||||
DataCodeEnum.OMDB_WARNINGSIGN.code,//危险信息
|
||||
-> signList.add(
|
||||
signBean
|
||||
)
|
||||
@ -1280,5 +1281,9 @@ class MainViewModel @Inject constructor(
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun clearMarker() {
|
||||
mapController.markerHandle.removeMarker()
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -2,6 +2,8 @@ package com.navinfo.omqs.ui.activity.map
|
||||
|
||||
import android.graphics.PorterDuff
|
||||
import android.graphics.PorterDuffColorFilter
|
||||
import android.graphics.drawable.BitmapDrawable
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.View
|
||||
import android.view.ViewGroup
|
||||
@ -14,6 +16,7 @@ import com.navinfo.omqs.databinding.AdapterSignLaneinfoBinding
|
||||
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
|
||||
import com.navinfo.omqs.ui.other.BaseViewHolder
|
||||
import com.navinfo.omqs.util.SignUtil
|
||||
import org.oscim.android.canvas.AndroidSvgBitmap
|
||||
|
||||
interface OnSignAdapterClickListener {
|
||||
fun onItemClick(signBean: SignBean)
|
||||
@ -60,7 +63,34 @@ class SignAdapter(private var listener: OnSignAdapterClickListener?) :
|
||||
if (holder.viewBinding is AdapterSignBinding) {
|
||||
val bd = holder.viewBinding
|
||||
|
||||
if (item.iconId != 0) bd.signMainIconBg.setImageResource(item.iconId)
|
||||
if (item.iconId != 0) {
|
||||
if (item.renderEntity.code == DataCodeEnum.OMDB_WARNINGSIGN.code) {
|
||||
try {
|
||||
var typeCode = "${item.iconId}"
|
||||
while (typeCode.length < 5) {
|
||||
typeCode = "0${typeCode}"
|
||||
}
|
||||
val input =
|
||||
holder.viewBinding.root.context.assets.open("omdb/appendix/1105_${typeCode}_0.svg")
|
||||
if (input != null) {
|
||||
val bitmap =
|
||||
AndroidSvgBitmap.getResourceBitmap(input, 1.0f, 60.0f, 60, 60, 100)
|
||||
input.close()
|
||||
val drawable = BitmapDrawable(
|
||||
holder.viewBinding.root.context.resources,
|
||||
bitmap
|
||||
)
|
||||
bd.signMainIconBg.setImageDrawable(drawable)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.e("jingo", "警示信息没有${item.iconId} 这个SVG")
|
||||
}
|
||||
} else {
|
||||
bd.signMainIconBg.setImageResource(item.iconId)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
bd.signMainIcon.text = item.iconText
|
||||
bd.signBottomText.text = item.name
|
||||
//点击错误按钮
|
||||
|
@ -142,7 +142,7 @@ class EvaluationResultViewModel @Inject constructor(
|
||||
override fun onCleared() {
|
||||
super.onCleared()
|
||||
mapController.mMapView.removeOnNIMapClickListener(TAG)
|
||||
mapController.markerHandle.removeMarker(TAG)
|
||||
mapController.markerHandle.removeMarker()
|
||||
mapController.lineHandler.removeLine()
|
||||
}
|
||||
|
||||
|
@ -134,6 +134,7 @@ class SignMoreInfoFragment : BaseFragment() {
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
viewModel.clearMarker()
|
||||
_binding = null
|
||||
}
|
||||
}
|
@ -1,14 +1,22 @@
|
||||
package com.navinfo.omqs.ui.fragment.signMoreInfo
|
||||
|
||||
import android.graphics.drawable.BitmapDrawable
|
||||
import android.util.Log
|
||||
import android.view.LayoutInflater
|
||||
import android.view.ViewGroup
|
||||
import com.bumptech.glide.Glide
|
||||
import com.caverock.androidsvg.SVG
|
||||
import com.caverock.androidsvg.SVGImageView
|
||||
import com.navinfo.collect.library.enums.DataCodeEnum
|
||||
import com.navinfo.omqs.databinding.AdapterTwoItemBinding
|
||||
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
|
||||
import com.navinfo.omqs.ui.other.BaseViewHolder
|
||||
import org.oscim.android.canvas.AndroidSvgBitmap
|
||||
|
||||
data class TwoItemAdapterItem(
|
||||
val title: String,
|
||||
val text: String
|
||||
val text: String,
|
||||
val code: String = "",
|
||||
)
|
||||
|
||||
class TwoItemAdapter : BaseRecyclerViewAdapter<TwoItemAdapterItem>() {
|
||||
@ -24,6 +32,31 @@ class TwoItemAdapter : BaseRecyclerViewAdapter<TwoItemAdapterItem>() {
|
||||
holder.viewBinding as AdapterTwoItemBinding
|
||||
val item = data[position]
|
||||
binding.title.text = item.title
|
||||
if (item.code == DataCodeEnum.OMDB_WARNINGSIGN.code) {
|
||||
try {
|
||||
val input =
|
||||
holder.viewBinding.root.context.assets.open("omdb/appendix/1105_${item.text}_0.svg")
|
||||
if (input != null) {
|
||||
val bitmap = AndroidSvgBitmap.getResourceBitmap(input, 1.0f, 60.0f, 60, 60, 100)
|
||||
input.close()
|
||||
val drawableLeft = BitmapDrawable(
|
||||
holder.viewBinding.root.context.resources,
|
||||
bitmap
|
||||
)
|
||||
drawableLeft.setBounds(
|
||||
0,
|
||||
0,
|
||||
(drawableLeft.minimumWidth * 1.2).toInt(),
|
||||
(drawableLeft.minimumHeight * 1.2).toInt()
|
||||
)//必须
|
||||
binding.text.setCompoundDrawables(
|
||||
drawableLeft, null, null, null
|
||||
)
|
||||
}
|
||||
} catch (e: Exception) {
|
||||
Log.e("jingo", "危险信息没有${item.text}这个svg")
|
||||
}
|
||||
}
|
||||
binding.text.text = item.text
|
||||
}
|
||||
}
|
@ -95,7 +95,6 @@ class TaskFragment : BaseFragment() {
|
||||
//增加侧滑按钮
|
||||
binding.taskRecyclerview.setSwipeMenuCreator(mSwipeMenuCreator)
|
||||
|
||||
|
||||
//单项点击
|
||||
binding.taskRecyclerview.setOnItemMenuClickListener { menuBridge, position ->
|
||||
menuBridge.closeMenu()
|
||||
|
@ -37,17 +37,10 @@ import com.navinfo.omqs.ui.widget.LeftDeleteView
|
||||
class TaskListAdapter(
|
||||
private val downloadManager: TaskDownloadManager,
|
||||
private val uploadManager: TaskUploadManager,
|
||||
private val recyclerView: RecyclerView,
|
||||
private var itemListener: ((Int, Int, TaskBean) -> Unit?)? = null,
|
||||
) : BaseRecyclerViewAdapter<TaskBean>() {
|
||||
private var selectPosition = -1
|
||||
|
||||
private var leftDeleteView: LeftDeleteView? = null
|
||||
|
||||
private val mRecyclerView = recyclerView
|
||||
|
||||
private var isShowDeleteView = false
|
||||
|
||||
private val downloadBtnClick = View.OnClickListener() {
|
||||
if (it.tag != null) {
|
||||
val taskBean = data[it.tag as Int]
|
||||
@ -110,10 +103,6 @@ class TaskListAdapter(
|
||||
val viewBinding =
|
||||
AdapterTaskListBinding.inflate(LayoutInflater.from(parent.context), parent, false)
|
||||
|
||||
val deleteView = viewBinding.root
|
||||
|
||||
deleteView.setRecyclerView(mRecyclerView)
|
||||
|
||||
return BaseViewHolder(viewBinding)
|
||||
}
|
||||
|
||||
@ -132,18 +121,6 @@ class TaskListAdapter(
|
||||
val binding: AdapterTaskListBinding =
|
||||
holder.viewBinding as AdapterTaskListBinding
|
||||
val taskBean = data[position]
|
||||
binding.root.mStatusChangeLister = {
|
||||
isShowDeleteView = it
|
||||
if (it) {
|
||||
//重置以后滑动布局
|
||||
restoreItemView()
|
||||
// 如果编辑菜单在显示
|
||||
leftDeleteView = binding.root
|
||||
selectPosition = position
|
||||
} else {
|
||||
selectPosition = -1
|
||||
}
|
||||
}
|
||||
//tag 方便onclick里拿到数据
|
||||
holder.tag = taskBean.id.toString()
|
||||
changeViews(binding, taskBean)
|
||||
@ -196,46 +173,22 @@ class TaskListAdapter(
|
||||
binding.root.isSelected = selectPosition == position
|
||||
|
||||
binding.taskItemLayout.setOnClickListener {
|
||||
if (isShowDeleteView) {
|
||||
leftDeleteView?.resetDeleteStatus()
|
||||
} else {
|
||||
val pos = holder.adapterPosition
|
||||
if (selectPosition != pos) {
|
||||
val lastPos = selectPosition
|
||||
selectPosition = pos
|
||||
if (lastPos > -1) {
|
||||
notifyItemChanged(lastPos)
|
||||
}
|
||||
binding.root.isSelected = true
|
||||
itemListener?.invoke(position, ItemClickStatus.ITEM_LAYOUT_CLICK, taskBean)
|
||||
val pos = holder.adapterPosition
|
||||
if (selectPosition != pos) {
|
||||
val lastPos = selectPosition
|
||||
selectPosition = pos
|
||||
if (lastPos > -1) {
|
||||
notifyItemChanged(lastPos)
|
||||
}
|
||||
binding.root.isSelected = true
|
||||
itemListener?.invoke(position, ItemClickStatus.ITEM_LAYOUT_CLICK, taskBean)
|
||||
}
|
||||
}
|
||||
|
||||
binding.taskDeleteLayout.setOnClickListener {
|
||||
//重置状态
|
||||
leftDeleteView?.resetDeleteStatus()
|
||||
if (taskBean.syncStatus != FileUploadStatus.DONE) {
|
||||
Toast.makeText(binding.taskUploadBtn.context, "数据未上传,不允许关闭!", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
} else {
|
||||
itemListener?.invoke(position, ItemClickStatus.DELETE_LAYOUT_CLICK, taskBean)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 重置item状态
|
||||
* @param point
|
||||
*/
|
||||
private fun restoreItemView() {
|
||||
leftDeleteView?.let {
|
||||
if (isShowDeleteView)
|
||||
it.resetDeleteStatus()
|
||||
}
|
||||
}
|
||||
|
||||
inner class DownloadObserver(val id: Int, val holder: BaseViewHolder) :
|
||||
Observer<TaskBean> {
|
||||
override fun onChanged(taskBean: TaskBean?) {
|
||||
|
@ -1,6 +1,5 @@
|
||||
package com.navinfo.omqs.ui.fragment.tasklist
|
||||
|
||||
import android.os.Build
|
||||
import android.os.Bundle
|
||||
import android.text.Editable
|
||||
import android.text.TextWatcher
|
||||
@ -9,12 +8,18 @@ import android.view.View
|
||||
import android.view.ViewGroup
|
||||
import android.widget.Toast
|
||||
import androidx.recyclerview.widget.LinearLayoutManager
|
||||
import androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
import com.navinfo.omqs.R
|
||||
import com.navinfo.omqs.databinding.FragmentTaskListBinding
|
||||
import com.navinfo.omqs.http.taskdownload.TaskDownloadManager
|
||||
import com.navinfo.omqs.http.taskupload.TaskUploadManager
|
||||
import com.navinfo.omqs.tools.FileManager
|
||||
import com.navinfo.omqs.ui.fragment.BaseFragment
|
||||
import com.navinfo.omqs.ui.other.shareViewModels
|
||||
import com.yanzhenjie.recyclerview.SwipeMenuCreator
|
||||
import com.yanzhenjie.recyclerview.SwipeMenuItem
|
||||
import dagger.hilt.android.AndroidEntryPoint
|
||||
import org.videolan.vlc.Util
|
||||
import javax.inject.Inject
|
||||
|
||||
@AndroidEntryPoint
|
||||
@ -35,7 +40,7 @@ class TaskListFragment : BaseFragment() {
|
||||
|
||||
private val adapter: TaskListAdapter by lazy {
|
||||
TaskListAdapter(
|
||||
downloadManager, uploadManager, binding.taskListRecyclerview
|
||||
downloadManager, uploadManager,
|
||||
) { _, status, taskBean ->
|
||||
if (taskBean.hadLinkDvoList.isEmpty()) {
|
||||
Toast.makeText(context, "数据错误,无Link数据!", Toast.LENGTH_SHORT).show()
|
||||
@ -46,8 +51,7 @@ class TaskListFragment : BaseFragment() {
|
||||
viewModel.setSelectTaskBean(taskBean)
|
||||
}
|
||||
TaskListAdapter.Companion.ItemClickStatus.DELETE_LAYOUT_CLICK -> {
|
||||
showLoadingDialog("正在关闭")
|
||||
context?.let { viewModel.removeTask(it, taskBean) }
|
||||
|
||||
}
|
||||
TaskListAdapter.Companion.ItemClickStatus.UPLOAD_LAYOUT_CLICK -> {
|
||||
showLoadingDialog("正在校验")
|
||||
@ -74,12 +78,53 @@ class TaskListFragment : BaseFragment() {
|
||||
|
||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||
super.onViewCreated(view, savedInstanceState)
|
||||
|
||||
//注意:使用滑动菜单不能开启滑动删除,否则只有滑动删除没有滑动菜单
|
||||
val mSwipeMenuCreator = SwipeMenuCreator { _, rightMenu, _ ->
|
||||
//添加菜单自动添加至尾部
|
||||
val deleteItem = SwipeMenuItem(context)
|
||||
deleteItem.height = Util.convertDpToPx(requireContext(), 60)
|
||||
deleteItem.width = Util.convertDpToPx(requireContext(), 80)
|
||||
deleteItem.text = "关闭"
|
||||
deleteItem.background = requireContext().getDrawable(R.color.red)
|
||||
deleteItem.setTextColor(requireContext().resources.getColor(R.color.white))
|
||||
rightMenu.addMenuItem(deleteItem)
|
||||
}
|
||||
|
||||
|
||||
val layoutManager = LinearLayoutManager(context)
|
||||
//// 设置 RecyclerView 的固定大小,避免在滚动时重新计算视图大小和布局,提高性能
|
||||
binding.taskListRecyclerview.setHasFixedSize(true)
|
||||
binding.taskListRecyclerview.layoutManager = layoutManager
|
||||
|
||||
//增加侧滑按钮
|
||||
binding.taskListRecyclerview.setSwipeMenuCreator(mSwipeMenuCreator)
|
||||
|
||||
//单项点击
|
||||
binding.taskListRecyclerview.setOnItemMenuClickListener { menuBridge, position ->
|
||||
menuBridge.closeMenu()
|
||||
val taskBean = adapter.data[position]
|
||||
if (taskBean.syncStatus != FileManager.Companion.FileUploadStatus.DONE) {
|
||||
Toast.makeText(context, "数据未上传,不允许关闭!", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
} else {
|
||||
viewModel.removeTask(requireContext(), taskBean)
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 刷新
|
||||
*/
|
||||
binding.refreshLayout.setOnRefreshListener {
|
||||
viewModel.loadNetTaskList(requireContext())
|
||||
}
|
||||
|
||||
loadFinish()
|
||||
binding.taskListRecyclerview.adapter = adapter
|
||||
|
||||
viewModel.liveDataTaskList.observe(viewLifecycleOwner) {
|
||||
loadFinish()
|
||||
adapter.initSelectTask(it, viewModel.currentSelectTaskBean?.id)
|
||||
}
|
||||
|
||||
@ -94,7 +139,12 @@ class TaskListFragment : BaseFragment() {
|
||||
}
|
||||
|
||||
binding.taskListSearch.addTextChangedListener(object : TextWatcher {
|
||||
override fun beforeTextChanged(s: CharSequence?, start: Int, count: Int, after: Int) {
|
||||
override fun beforeTextChanged(
|
||||
s: CharSequence?,
|
||||
start: Int,
|
||||
count: Int,
|
||||
after: Int
|
||||
) {
|
||||
}
|
||||
|
||||
override fun onTextChanged(s: CharSequence?, start: Int, before: Int, count: Int) {
|
||||
@ -106,8 +156,20 @@ class TaskListFragment : BaseFragment() {
|
||||
})
|
||||
}
|
||||
|
||||
private fun loadFinish() {
|
||||
binding.refreshLayout.isRefreshing = false
|
||||
|
||||
|
||||
// 第一次加载数据:一定要调用这个方法,否则不会触发加载更多。
|
||||
// 第一个参数:表示此次数据是否为空,假如你请求到的list为空(== null || list.size == 0),那么这里就要true。
|
||||
// 第二个参数:表示是否还有更多数据,根据服务器返回给你的page等信息判断是否还有更多,这样可以提供性能,如果不能判断则传true。
|
||||
|
||||
// 第一次加载数据:一定要调用这个方法,否则不会触发加载更多。
|
||||
// 第一个参数:表示此次数据是否为空,假如你请求到的list为空(== null || list.size == 0),那么这里就要true。
|
||||
// 第二个参数:表示是否还有更多数据,根据服务器返回给你的page等信息判断是否还有更多,这样可以提供性能,如果不能判断则传true。
|
||||
binding.taskListRecyclerview.loadMoreFinish(true, false)
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
super.onDestroyView()
|
||||
_binding = null
|
||||
|
@ -5,6 +5,7 @@ import android.content.SharedPreferences
|
||||
import android.content.SharedPreferences.OnSharedPreferenceChangeListener
|
||||
import android.os.Build
|
||||
import android.view.View
|
||||
import android.widget.Toast
|
||||
import androidx.annotation.RequiresApi
|
||||
import androidx.lifecycle.MutableLiveData
|
||||
import androidx.lifecycle.ViewModel
|
||||
@ -20,8 +21,10 @@ import com.navinfo.collect.library.utils.GeometryTools
|
||||
import com.navinfo.collect.library.utils.MapParamUtils
|
||||
import com.navinfo.omqs.Constant
|
||||
import com.navinfo.omqs.db.RealmOperateHelper
|
||||
import com.navinfo.omqs.http.NetResult
|
||||
import com.navinfo.omqs.http.NetworkService
|
||||
import com.navinfo.omqs.tools.FileManager
|
||||
import com.navinfo.omqs.ui.activity.login.LoginStatus
|
||||
import com.navinfo.omqs.ui.dialog.FirstDialog
|
||||
import com.navinfo.omqs.util.DateTimeUtil
|
||||
import dagger.hilt.android.lifecycle.HiltViewModel
|
||||
@ -176,6 +179,72 @@ class TaskViewModel @Inject constructor(
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 获取任务列表
|
||||
*/
|
||||
fun loadNetTaskList(context: Context){
|
||||
viewModelScope.launch(Dispatchers.IO) {
|
||||
when (val result = networkService.getTaskList(Constant.USER_ID)) {
|
||||
is NetResult.Success -> {
|
||||
if (result.data != null) {
|
||||
val realm = Realm.getDefaultInstance()
|
||||
realm.executeTransaction {
|
||||
result.data.obj?.let { list ->
|
||||
for (index in list.indices) {
|
||||
val task = list[index]
|
||||
val item = realm.where(TaskBean::class.java).equalTo(
|
||||
"id", task.id
|
||||
).findFirst()
|
||||
if (item != null) {
|
||||
task.fileSize = item.fileSize
|
||||
task.status = item.status
|
||||
task.currentSize = item.currentSize
|
||||
task.hadLinkDvoList = item.hadLinkDvoList
|
||||
//已上传后不在更新操作时间
|
||||
if (task.syncStatus != FileManager.Companion.FileUploadStatus.DONE) {
|
||||
//赋值时间,用于查询过滤
|
||||
task.operationTime = DateTimeUtil.getNowDate().time
|
||||
}
|
||||
} else {
|
||||
for (hadLink in task.hadLinkDvoList) {
|
||||
hadLink.taskId = task.id
|
||||
}
|
||||
//赋值时间,用于查询过滤
|
||||
task.operationTime = DateTimeUtil.getNowDate().time
|
||||
}
|
||||
realm.copyToRealmOrUpdate(task)
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
getLocalTaskList()
|
||||
}
|
||||
|
||||
is NetResult.Error<*> -> {
|
||||
withContext(Dispatchers.Main) {
|
||||
Toast.makeText(context, "${result.exception.message}", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
getLocalTaskList()
|
||||
}
|
||||
|
||||
is NetResult.Failure<*> -> {
|
||||
withContext(Dispatchers.Main) {
|
||||
Toast.makeText(context, "${result.code}:${result.msg}", Toast.LENGTH_SHORT)
|
||||
.show()
|
||||
}
|
||||
getLocalTaskList()
|
||||
}
|
||||
|
||||
is NetResult.Loading -> {}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* 获取任务列表
|
||||
*/
|
||||
|
@ -1,5 +1,6 @@
|
||||
package com.navinfo.omqs.util
|
||||
|
||||
import android.provider.ContactsContract.Data
|
||||
import android.util.Log
|
||||
import com.navinfo.collect.library.data.entity.RenderEntity
|
||||
import com.navinfo.collect.library.enums.DataCodeEnum
|
||||
@ -82,10 +83,6 @@ class SignUtil {
|
||||
else -> ""
|
||||
}
|
||||
}
|
||||
//隧道
|
||||
DataCodeEnum.OMDB_TUNNEL.code -> "隧道"
|
||||
//环岛
|
||||
DataCodeEnum.OMDB_ROUNDABOUT.code -> "环岛"
|
||||
//主辅路出入口
|
||||
DataCodeEnum.OMDB_LINK_ATTRIBUTE_MAIN_SIDE_ACCESS.code -> "出入口"
|
||||
//辅路
|
||||
@ -110,10 +107,8 @@ class SignUtil {
|
||||
DataCodeEnum.OMDB_LINK_FORM2_11.code -> "风景路"
|
||||
DataCodeEnum.OMDB_LINK_FORM2_12.code -> "测试路"
|
||||
DataCodeEnum.OMDB_LINK_FORM2_13.code -> "驾考路"
|
||||
DataCodeEnum.OMDB_VIADUCT.code -> "高架"
|
||||
DataCodeEnum.OMDB_LINK_CONSTRUCTION.code -> "道路施工"
|
||||
DataCodeEnum.OMDB_LANE_CONSTRUCTION.code -> "车道施工"
|
||||
else -> ""
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@ -128,38 +123,8 @@ class SignUtil {
|
||||
DataCodeEnum.OMDB_RD_LINK_KIND.code -> "种别"
|
||||
//道路方向
|
||||
DataCodeEnum.OMDB_LINK_DIRECT.code -> "方向"
|
||||
//车道边界类型
|
||||
DataCodeEnum.OMDB_LANE_MARK_BOUNDARYTYPE.code -> "车道边界类型"
|
||||
//常规线限速
|
||||
DataCodeEnum.OMDB_LINK_SPEEDLIMIT.code -> "线限速"
|
||||
//全封闭
|
||||
DataCodeEnum.OMDB_CON_ACCESS.code -> "全封闭" //暂时不要标题
|
||||
//匝道
|
||||
DataCodeEnum.OMDB_RAMP.code -> "匝道"
|
||||
//车道数
|
||||
DataCodeEnum.OMDB_LANE_NUM.code -> "车道数"
|
||||
//常规点限速
|
||||
DataCodeEnum.OMDB_SPEEDLIMIT.code -> "常规点限速"
|
||||
//常点限速
|
||||
DataCodeEnum.OMDB_SPEEDLIMIT_COND.code -> "条件点限速"
|
||||
//可变点限速
|
||||
DataCodeEnum.OMDB_SPEEDLIMIT_VAR.code -> "可变点限速"
|
||||
//普通交限
|
||||
DataCodeEnum.OMDB_RESTRICTION.code -> "普通交限"
|
||||
//电子眼
|
||||
DataCodeEnum.OMDB_ELECTRONICEYE.code -> "电子眼"
|
||||
//交通灯
|
||||
DataCodeEnum.OMDB_TRAFFICLIGHT.code -> "交通灯"
|
||||
//车信
|
||||
DataCodeEnum.OMDB_LANEINFO.code -> "车信"
|
||||
//上下线分离
|
||||
DataCodeEnum.OMDB_MULTI_DIGITIZED.code -> "上下线分离"
|
||||
//桥
|
||||
DataCodeEnum.OMDB_BRIDGE.code -> "桥"
|
||||
//隧道
|
||||
DataCodeEnum.OMDB_TUNNEL.code -> "隧道"
|
||||
//环岛
|
||||
DataCodeEnum.OMDB_ROUNDABOUT.code -> "环岛"
|
||||
|
||||
DataCodeEnum.OMDB_LINK_ATTRIBUTE_MAIN_SIDE_ACCESS.code,
|
||||
DataCodeEnum.OMDB_LINK_ATTRIBUTE_FORNTAGE.code,
|
||||
@ -183,11 +148,7 @@ class SignUtil {
|
||||
DataCodeEnum.OMDB_LINK_FORM2_12.code,
|
||||
DataCodeEnum.OMDB_LINK_FORM2_13.code -> "道路形态"
|
||||
|
||||
DataCodeEnum.OMDB_VIADUCT.code -> "高架"
|
||||
DataCodeEnum.OMDB_LINK_CONSTRUCTION.code -> "道路施工"
|
||||
DataCodeEnum.OMDB_LANE_CONSTRUCTION.code -> "车道施工"
|
||||
|
||||
else -> ""
|
||||
else -> DataCodeEnum.findTableNameByCode(data.code)
|
||||
}
|
||||
}
|
||||
|
||||
@ -349,18 +310,113 @@ class SignUtil {
|
||||
title = "linkPid", text = "${data.properties["linkPid"]}"
|
||||
)
|
||||
)
|
||||
val validPeriod = data.properties["validPeriod"]
|
||||
if(validPeriod != null){
|
||||
|
||||
val limitType = when (data.properties["limitType"]) {
|
||||
"4" -> "施工(全封闭)"
|
||||
"13" -> "施工(非全封闭)"
|
||||
else -> ""
|
||||
}
|
||||
list.add(
|
||||
TwoItemAdapterItem(
|
||||
title = "限制类型",
|
||||
text = limitType
|
||||
)
|
||||
)
|
||||
val validPeriod = data.properties["validPeriod"]
|
||||
if (validPeriod != null) {
|
||||
list.add(
|
||||
TwoItemAdapterItem(
|
||||
title = "施工时间",
|
||||
text = "${TimePeriodUtil.getTimePeriod(validPeriod)}"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
//车道施工
|
||||
DataCodeEnum.OMDB_LANE_CONSTRUCTION.code -> {
|
||||
list.add(
|
||||
TwoItemAdapterItem(
|
||||
title = "车道号码", text = "${data.properties["laneLinkPid"]}"
|
||||
)
|
||||
)
|
||||
val startTime = data.properties["startTime"]
|
||||
if (startTime != null) {
|
||||
list.add(
|
||||
TwoItemAdapterItem(
|
||||
title = "施工开始时间",
|
||||
text = "${TimePeriodUtil.getTimePeriod(startTime)}"
|
||||
)
|
||||
)
|
||||
}
|
||||
val endTime = data.properties["endTime"]
|
||||
if (endTime != null) {
|
||||
list.add(
|
||||
TwoItemAdapterItem(
|
||||
title = "施工结束时间",
|
||||
text = "${TimePeriodUtil.getTimePeriod(endTime)}"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
//警示信息
|
||||
DataCodeEnum.OMDB_WARNINGSIGN.code -> {
|
||||
list.add(
|
||||
TwoItemAdapterItem(
|
||||
title = "linkPid", text = "${data.properties["linkPid"]}"
|
||||
)
|
||||
)
|
||||
list.add(
|
||||
TwoItemAdapterItem(
|
||||
title = "警示信息号码", text = "${data.properties["warningsignId"]}"
|
||||
)
|
||||
)
|
||||
val direct = when (data.properties["direct"]) {
|
||||
"2" -> "顺方向"
|
||||
"3" -> "逆方向"
|
||||
else -> ""
|
||||
}
|
||||
list.add(
|
||||
TwoItemAdapterItem(
|
||||
title = "作用方向", text = direct
|
||||
)
|
||||
)
|
||||
|
||||
list.add(
|
||||
TwoItemAdapterItem(
|
||||
title = "标牌类型",
|
||||
text = "${data.properties["typeCode"]}",
|
||||
code = data.code
|
||||
)
|
||||
)
|
||||
list.add(
|
||||
TwoItemAdapterItem(
|
||||
title = "有效距离", text = "${data.properties["validDis"]}米"
|
||||
)
|
||||
)
|
||||
list.add(
|
||||
TwoItemAdapterItem(
|
||||
title = "预告距离", text = "${data.properties["warnDis"]}米"
|
||||
)
|
||||
)
|
||||
val vehicleType = data.properties["warnDis"]
|
||||
if (vehicleType != null) {
|
||||
list.add(
|
||||
TwoItemAdapterItem(
|
||||
title = "车辆类型",
|
||||
text = getElectronicEyeVehicleType(vehicleType.toInt())
|
||||
)
|
||||
)
|
||||
}
|
||||
list.add(
|
||||
TwoItemAdapterItem(
|
||||
title = "时间段", text = "${data.properties["validPeriod"]}"
|
||||
)
|
||||
)
|
||||
list.add(
|
||||
TwoItemAdapterItem(
|
||||
title = "文字说明", text = "${data.properties["descript"]}"
|
||||
)
|
||||
)
|
||||
}
|
||||
}
|
||||
adapter.data = list
|
||||
@ -728,6 +784,13 @@ class SignUtil {
|
||||
DataCodeEnum.OMDB_ELECTRONICEYE.code -> R.drawable.icon_electronic_eye
|
||||
//交通灯
|
||||
DataCodeEnum.OMDB_TRAFFICLIGHT.code -> R.drawable.icon_traffic_light
|
||||
//警示信息
|
||||
DataCodeEnum.OMDB_WARNINGSIGN.code -> {
|
||||
val typeCode = data.properties["typeCode"]
|
||||
if (typeCode != null)
|
||||
return typeCode.toInt()
|
||||
return 0
|
||||
}
|
||||
else -> 0
|
||||
}
|
||||
|
||||
@ -891,9 +954,11 @@ class SignUtil {
|
||||
//常规点限速
|
||||
DataCodeEnum.OMDB_SPEEDLIMIT.code -> getSpeedLimitMinText(element) != "0"
|
||||
//条件点限速
|
||||
DataCodeEnum.OMDB_SPEEDLIMIT_COND.code -> true
|
||||
//电子眼
|
||||
DataCodeEnum.OMDB_ELECTRONICEYE.code -> true
|
||||
DataCodeEnum.OMDB_SPEEDLIMIT_COND.code,
|
||||
//电子眼
|
||||
DataCodeEnum.OMDB_ELECTRONICEYE.code,
|
||||
//警示信息
|
||||
DataCodeEnum.OMDB_WARNINGSIGN.code -> true
|
||||
else -> false
|
||||
}
|
||||
return isMore
|
||||
@ -949,20 +1014,20 @@ class SignUtil {
|
||||
)
|
||||
}
|
||||
|
||||
val kindUp = when (renderEntity.properties["kindUp"]) {
|
||||
"0" -> "未调查"
|
||||
"1" -> "限速电子眼"
|
||||
"4" -> "区间测速电子眼"
|
||||
"5" -> "交通信号灯电子眼"
|
||||
"6" -> "专用车道电子眼"
|
||||
"7" -> "违章电子眼"
|
||||
"11" -> "路况监控电子眼"
|
||||
"19" -> "交通标线电子眼"
|
||||
"20" -> "专用功能电子眼"
|
||||
else -> ""
|
||||
}
|
||||
// val kindUp = when (renderEntity.properties["kindUp"]) {
|
||||
// "0" -> "未调查"
|
||||
// "1" -> "限速电子眼"
|
||||
// "4" -> "区间测速电子眼"
|
||||
// "5" -> "交通信号灯电子眼"
|
||||
// "6" -> "专用车道电子眼"
|
||||
// "7" -> "违章电子眼"
|
||||
// "11" -> "路况监控电子眼"
|
||||
// "19" -> "交通标线电子眼"
|
||||
// "20" -> "专用功能电子眼"
|
||||
// else -> ""
|
||||
// }
|
||||
|
||||
list.add(TwoItemAdapterItem(title = "电子眼类型大分类", text = kindUp))
|
||||
// list.add(TwoItemAdapterItem(title = "电子眼类型大分类", text = kindUp))
|
||||
|
||||
val kindCode = renderEntity.properties["kind"]!!.toInt()
|
||||
list.add(
|
||||
|
@ -1,6 +1,488 @@
|
||||
package com.navinfo.omqs.util
|
||||
|
||||
data class TimePeriod(
|
||||
val child: TimePeriod? = null
|
||||
private data class TimePeriod(
|
||||
//年
|
||||
var year: String = "",
|
||||
//月
|
||||
var month: String = "",
|
||||
//日
|
||||
var day: String = "",
|
||||
//时
|
||||
var hour: String = "",
|
||||
//分
|
||||
var minutes: String = "",
|
||||
//周
|
||||
var week: String = "",
|
||||
)
|
||||
|
||||
)
|
||||
|
||||
private data class TimePeriodObject(
|
||||
//开始时间
|
||||
var startTime: TimePeriod? = null,
|
||||
//结束时间
|
||||
var endTime: TimePeriod? = null,
|
||||
//是否是节假日
|
||||
var bH: Boolean = false,
|
||||
//是否是节假日除外
|
||||
var b_H: Boolean = false,
|
||||
//动态变化
|
||||
var bVMS: Boolean = false,
|
||||
//最终输出
|
||||
var res: String = ""
|
||||
) {
|
||||
/**
|
||||
* 交集 *
|
||||
*/
|
||||
fun intersection(periodObject: TimePeriodObject) {
|
||||
if (res != "" && periodObject.res == "") {
|
||||
res = "${res}${periodObject.toText()}"
|
||||
|
||||
} else if (res == "" && periodObject.res != "") {
|
||||
res = "${toText()}${periodObject.res}"
|
||||
} else if (res != "" && periodObject.res != "") {
|
||||
res = "${res}${periodObject.res}"
|
||||
} else {
|
||||
if (startTime == null) {
|
||||
startTime = periodObject.startTime
|
||||
} else if (periodObject.startTime != null) {
|
||||
if (startTime!!.year == "")
|
||||
startTime!!.year = periodObject.startTime!!.year
|
||||
if (startTime!!.month == "")
|
||||
startTime!!.month = periodObject.startTime!!.month
|
||||
if (startTime!!.day == "")
|
||||
startTime!!.day = periodObject.startTime!!.day
|
||||
if (startTime!!.hour == "")
|
||||
startTime!!.hour = periodObject.startTime!!.hour
|
||||
if (startTime!!.week == "")
|
||||
startTime!!.week = periodObject.startTime!!.week
|
||||
if (startTime!!.minutes == "")
|
||||
startTime!!.minutes = periodObject.startTime!!.minutes
|
||||
}
|
||||
|
||||
if (endTime == null) {
|
||||
endTime = periodObject.endTime
|
||||
} else if (periodObject.endTime != null) {
|
||||
if (endTime!!.year == "")
|
||||
endTime!!.year = periodObject.endTime!!.year
|
||||
if (endTime!!.month == "")
|
||||
endTime!!.month = periodObject.endTime!!.month
|
||||
if (endTime!!.day == "")
|
||||
endTime!!.day = periodObject.endTime!!.day
|
||||
if (endTime!!.hour == "")
|
||||
endTime!!.hour = periodObject.endTime!!.hour
|
||||
if (endTime!!.week == "")
|
||||
endTime!!.week = periodObject.endTime!!.week
|
||||
if (endTime!!.minutes == "")
|
||||
endTime!!.minutes = periodObject.endTime!!.minutes
|
||||
}
|
||||
|
||||
if (!bH)
|
||||
bH = periodObject.bH
|
||||
if (!b_H)
|
||||
b_H = periodObject.b_H
|
||||
if (!bVMS)
|
||||
bVMS = periodObject.bVMS
|
||||
}
|
||||
println("交集 $res")
|
||||
}
|
||||
|
||||
/**
|
||||
* 合集 +
|
||||
*/
|
||||
fun compilation(periodObject: TimePeriodObject) {
|
||||
res = if (res != "" && periodObject.res == "") {
|
||||
"${res},${periodObject.toText()}"
|
||||
} else if (res == "" && periodObject.res != "") {
|
||||
"${toText()},${periodObject.res}"
|
||||
} else if (res != "" && periodObject.res != "") {
|
||||
"${res},${periodObject.res}"
|
||||
} else
|
||||
"${toText()},${periodObject.toText()}"
|
||||
println("合集 $res")
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
*
|
||||
*/
|
||||
fun toText(): String {
|
||||
if (res == "") {
|
||||
startTime?.let {
|
||||
if (it.year != "") {
|
||||
res = "${it.year}年"
|
||||
}
|
||||
if (it.month != "") {
|
||||
res = if (it.year == "") {
|
||||
"每年${it.month}月"
|
||||
} else {
|
||||
"$res${it.month}月"
|
||||
}
|
||||
}
|
||||
if (it.day != "") {
|
||||
res = if (it.month == "") {
|
||||
"${res}每月${it.day}日"
|
||||
} else
|
||||
"$res${it.day}日"
|
||||
}
|
||||
}
|
||||
endTime?.let {
|
||||
if (it.year != "" || it.month != "" || it.day != "")
|
||||
res = "${res}到"
|
||||
if (it.year != "") {
|
||||
res = "${res}${it.year}年"
|
||||
}
|
||||
if (it.month != "") {
|
||||
res = "$res${it.month}月"
|
||||
}
|
||||
if (it.day != "") {
|
||||
res = "$res${it.day}日"
|
||||
}
|
||||
}
|
||||
|
||||
startTime?.let {
|
||||
if (it.week != "") {
|
||||
res = "${res}每${getWeekEnum(it.week)}"
|
||||
}
|
||||
}
|
||||
|
||||
endTime?.let {
|
||||
if (it.week != "") {
|
||||
res = "${res}到${getWeekEnum(it.week)}"
|
||||
}
|
||||
}
|
||||
|
||||
startTime?.let {
|
||||
if (it.hour != "") {
|
||||
res = if (it.minutes != "") {
|
||||
if (it.minutes.length == 1) {
|
||||
"${res}${it.hour}:0${it.minutes}"
|
||||
} else {
|
||||
"${res}${it.hour}:${it.minutes}"
|
||||
}
|
||||
} else {
|
||||
"${res}:00"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
endTime?.let {
|
||||
if (it.hour != "") {
|
||||
res = if (it.minutes != "") {
|
||||
if (it.minutes.length == 1) {
|
||||
"${res}-${it.hour}:0${it.minutes}"
|
||||
} else {
|
||||
"${res}-${it.hour}:${it.minutes}"
|
||||
}
|
||||
} else {
|
||||
"${res}-${it.hour}:00"
|
||||
}
|
||||
}
|
||||
}
|
||||
if (bH) {
|
||||
res = "节假日:$res"
|
||||
}
|
||||
if (b_H) {
|
||||
res = "节假日除外${res}:"
|
||||
}
|
||||
if (bVMS) {
|
||||
res = "动态变化:$res"
|
||||
}
|
||||
}
|
||||
println("中间:$res")
|
||||
return res
|
||||
}
|
||||
|
||||
private fun getWeekEnum(s: String): String {
|
||||
return when (s) {
|
||||
"1" -> "周日"
|
||||
"2" -> "周一"
|
||||
"3" -> "周二"
|
||||
"4" -> "周三"
|
||||
"5" -> "周四"
|
||||
"6" -> "周五"
|
||||
"7" -> "周六"
|
||||
else -> ""
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private enum class TimeType {
|
||||
NONE,
|
||||
YEAR,
|
||||
MONTH,
|
||||
DAY,
|
||||
HOUR,
|
||||
MINUTES,
|
||||
WEEK,
|
||||
HLD,
|
||||
_HLD,
|
||||
VMS
|
||||
}
|
||||
|
||||
class TimePeriodUtil {
|
||||
|
||||
companion object {
|
||||
fun getTimePeriod(time: String): String {
|
||||
println("时间段:$time")
|
||||
var i = 0
|
||||
val charArray = time.toCharArray()
|
||||
val list = mutableListOf<TimePeriodObject>()
|
||||
while (i < charArray.size) {
|
||||
when (charArray[i]) {
|
||||
'[' -> {
|
||||
i = getPeriodObject(charArray, i + 1, list)
|
||||
}
|
||||
'*' -> {
|
||||
i = getPeriodObject(charArray, i + 1, list)
|
||||
if (list.size > 1) {
|
||||
list[0].intersection(list[1])
|
||||
list.removeAt(1)
|
||||
}
|
||||
}
|
||||
'+' -> {
|
||||
i = getPeriodObject(charArray, i + 1, list)
|
||||
if (list.size > 1) {
|
||||
list[0].compilation(list[1])
|
||||
list.removeAt(1)
|
||||
}
|
||||
}
|
||||
}
|
||||
i++
|
||||
}
|
||||
if (list.size > 0)
|
||||
return list[0].toText()
|
||||
return time
|
||||
}
|
||||
|
||||
private fun getPeriodObject(
|
||||
charArray: CharArray,
|
||||
index: Int,
|
||||
parentList: MutableList<TimePeriodObject>,
|
||||
): Int {
|
||||
var i = index
|
||||
val list = mutableListOf<TimePeriodObject>()
|
||||
while (i < charArray.size) {
|
||||
when (charArray[i]) {
|
||||
'[' -> {
|
||||
i = getPeriodObject(charArray, i + 1, list)
|
||||
}
|
||||
'(' -> {
|
||||
var parentPeriodObject = TimePeriodObject()
|
||||
i = getMixUnit(charArray, i, parentPeriodObject)
|
||||
parentList.add(parentPeriodObject)
|
||||
return i
|
||||
}
|
||||
'*' -> {
|
||||
i = getPeriodObject(charArray, i + 1, list)
|
||||
if (list.size > 1) {
|
||||
list[0].intersection(list[1])
|
||||
list.removeAt(1)
|
||||
}
|
||||
}
|
||||
'+' -> {
|
||||
i = getPeriodObject(charArray, i + 1, list)
|
||||
if (list.size > 1) {
|
||||
list[0].compilation(list[1])
|
||||
list.removeAt(1)
|
||||
}
|
||||
}
|
||||
'H', '-', 'V' -> {
|
||||
i = getOther(charArray, i, parentList)
|
||||
return i
|
||||
}
|
||||
']' -> {
|
||||
if (list.isNotEmpty()) {
|
||||
parentList.add(list[0])
|
||||
}
|
||||
return i
|
||||
}
|
||||
}
|
||||
i++
|
||||
}
|
||||
return i
|
||||
}
|
||||
|
||||
private fun getOther(
|
||||
charArray: CharArray,
|
||||
index: Int,
|
||||
parentList: MutableList<TimePeriodObject>
|
||||
): Int {
|
||||
var i = index
|
||||
var timeType = TimeType.NONE
|
||||
while (i < charArray.size) {
|
||||
when (charArray[i]) {
|
||||
'H' -> {
|
||||
if (timeType == TimeType.NONE) {
|
||||
timeType = TimeType.HLD
|
||||
parentList.add(TimePeriodObject(bH = true))
|
||||
}
|
||||
}
|
||||
'-' -> {
|
||||
if (timeType == TimeType.NONE) {
|
||||
timeType = TimeType._HLD
|
||||
parentList.add(TimePeriodObject(b_H = true))
|
||||
}
|
||||
}
|
||||
'V' -> {
|
||||
if (timeType == TimeType.NONE) {
|
||||
timeType = TimeType.VMS
|
||||
parentList.add(TimePeriodObject(bVMS = true))
|
||||
}
|
||||
}
|
||||
']' -> {
|
||||
return i - 1
|
||||
}
|
||||
}
|
||||
i++
|
||||
}
|
||||
return i
|
||||
}
|
||||
|
||||
/**
|
||||
* 单元
|
||||
*/
|
||||
private fun getMixUnit(
|
||||
charArray: CharArray,
|
||||
index: Int,
|
||||
parentPeriodObject: TimePeriodObject
|
||||
): Int {
|
||||
var i = index
|
||||
|
||||
while (i < charArray.size) {
|
||||
when (charArray[i]) {
|
||||
'(' -> {
|
||||
val timePeriod = TimePeriod()
|
||||
i = getNumString(charArray, i + 1, timePeriod)
|
||||
if (parentPeriodObject.startTime == null) {
|
||||
parentPeriodObject.startTime = timePeriod
|
||||
} else {
|
||||
parentPeriodObject.endTime = timePeriod
|
||||
}
|
||||
}
|
||||
// '{' -> {
|
||||
// val timePeriod = TimePeriod()
|
||||
// i = getNumString(charArray, i + 1, timePeriod)
|
||||
// parentPeriodObject.allTime = true
|
||||
// }
|
||||
']' -> {
|
||||
return i - 1
|
||||
}
|
||||
}
|
||||
i++
|
||||
}
|
||||
return i
|
||||
}
|
||||
|
||||
/**
|
||||
* 解析数字
|
||||
*/
|
||||
private fun getNumString(
|
||||
charArray: CharArray,
|
||||
index: Int,
|
||||
parentPeriod: TimePeriod
|
||||
): Int {
|
||||
var i = index
|
||||
var timeType = TimeType.NONE
|
||||
val resBuffer = StringBuffer()
|
||||
while (i < charArray.size) {
|
||||
val char = charArray[i]
|
||||
//拼数字
|
||||
if (char.isDigit() && timeType != TimeType.NONE) {
|
||||
resBuffer.append(char)
|
||||
} else {
|
||||
when (timeType) {
|
||||
TimeType.YEAR -> parentPeriod.year = resBuffer.toString()
|
||||
TimeType.MONTH -> parentPeriod.month = resBuffer.toString()
|
||||
TimeType.DAY -> parentPeriod.day = resBuffer.toString()
|
||||
TimeType.HOUR -> parentPeriod.hour = resBuffer.toString()
|
||||
TimeType.MINUTES -> parentPeriod.minutes = resBuffer.toString()
|
||||
TimeType.WEEK -> parentPeriod.week = resBuffer.toString()
|
||||
else -> {}
|
||||
}
|
||||
timeType = when (char) {
|
||||
'y' -> TimeType.YEAR
|
||||
'M' -> TimeType.MONTH
|
||||
'd' -> TimeType.DAY
|
||||
'h' -> TimeType.HOUR
|
||||
'm' -> TimeType.MINUTES
|
||||
't' -> TimeType.WEEK
|
||||
')', '}' -> {
|
||||
return i
|
||||
}
|
||||
else -> TimeType.NONE
|
||||
}
|
||||
resBuffer.setLength(0)
|
||||
}
|
||||
i++
|
||||
}
|
||||
return i
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
fun main() {
|
||||
var t = ""
|
||||
var text = ""
|
||||
t = "[(y2010M8d16)(y2010M9d17)]"
|
||||
text = TimePeriodUtil.getTimePeriod(t)
|
||||
println("1:$text")
|
||||
t = "[(y2010M8d17){d1}]"
|
||||
text = TimePeriodUtil.getTimePeriod(t)
|
||||
println("2:$text")
|
||||
t = "[(M8d17)(M8d31)]"
|
||||
text = TimePeriodUtil.getTimePeriod(t)
|
||||
println("3:$text")
|
||||
t = "[(M8d17){d1}]"
|
||||
text = TimePeriodUtil.getTimePeriod(t)
|
||||
println("4:$text")
|
||||
t = "[(h9m0)(h23m59)]]"
|
||||
text = TimePeriodUtil.getTimePeriod(t)
|
||||
println("5:$text")
|
||||
t = "[(y2010)(y2030)]"
|
||||
text = TimePeriodUtil.getTimePeriod(t)
|
||||
println("6:$text")
|
||||
t = "[(y2010){y1}]"
|
||||
text = TimePeriodUtil.getTimePeriod(t)
|
||||
println("8:$text")
|
||||
t = "[(y2010M8t1){t1}]"
|
||||
text = TimePeriodUtil.getTimePeriod(t)
|
||||
println("9:$text")
|
||||
t = "[(y2010M8t1)(y2010M8t3)]"
|
||||
text = TimePeriodUtil.getTimePeriod(t)
|
||||
println("10:$text")
|
||||
t = "[(t4)(t1)]"
|
||||
text = TimePeriodUtil.getTimePeriod(t)
|
||||
println("11:$text")
|
||||
t = "[(t4){d1}]"
|
||||
text = TimePeriodUtil.getTimePeriod(t)
|
||||
println("12:$text")
|
||||
|
||||
t = "[[(y2010M8d8)(y2010M8d24)]*[(h7m0)(h22m0)]]"
|
||||
text = TimePeriodUtil.getTimePeriod(t)
|
||||
println("13:$text")
|
||||
|
||||
t = "[[(M8d1)(M8d31)]*[(t3){d1}]*[(h6m0)(h19m0)]]"
|
||||
text = TimePeriodUtil.getTimePeriod(t)
|
||||
println("14:$text")
|
||||
|
||||
t = "[[[(t4)(t6)]*[(h7m30)(h12m0)]]+[[(t4)(t6)]*[(h14m0)(h20m0)]]]"
|
||||
text = TimePeriodUtil.getTimePeriod(t)
|
||||
println("15:$text")
|
||||
|
||||
t = "[[[(M5d7){d1}]*[(h9m0)(h23m59)]]+[(M5d8)(M8d14)]+[[(M8d15){d1}]*[(h0m0)(h21m0)]]]"
|
||||
text = TimePeriodUtil.getTimePeriod(t)
|
||||
println("16:$text")
|
||||
|
||||
t = "[[HLD]*[(h8m0)(h16m0)]]"
|
||||
text = TimePeriodUtil.getTimePeriod(t)
|
||||
println("17:$text")
|
||||
|
||||
t = "[[-HLD]*[[[(M5d7){d1}]*[(h9m0)(h23m59)]]+[(M5d8)(M8d14)]+[[(M8d15){d1}]*[(h0m0)(h21m0)]]]]"
|
||||
text = TimePeriodUtil.getTimePeriod(t)
|
||||
println("18:$text")
|
||||
|
||||
t = "[[VMS]*[(h8m0)(h16m0)]]"
|
||||
text = TimePeriodUtil.getTimePeriod(t)
|
||||
println("19:$text")
|
||||
}
|
@ -93,6 +93,7 @@
|
||||
android:layout_height="300dp"
|
||||
android:layout_marginTop="80dp"
|
||||
android:minHeight="140dp"
|
||||
android:layout_marginBottom="40dp"
|
||||
app:layout_constraintLeft_toLeftOf="@id/main_activity_top_sign_recyclerview"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
|
@ -1,135 +1,111 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<com.navinfo.omqs.ui.widget.LeftDeleteView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:background="@drawable/selector_adapter_item_select_bg"
|
||||
tools:context="com.navinfo.omqs.ui.fragment.tasklist.TaskListAdapter"
|
||||
app:deleteBtnWidth="64"
|
||||
android:id="@+id/task_item_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="match_parent">
|
||||
android:background="@drawable/selector_adapter_item_select_bg"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
tools:context="com.navinfo.omqs.ui.fragment.tasklist.TaskListAdapter">
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/task_item_layout"
|
||||
android:paddingLeft="8dp"
|
||||
android:paddingTop="6dp"
|
||||
android:paddingRight="8dp"
|
||||
android:paddingBottom="8dp"
|
||||
<ImageView
|
||||
android:id="@+id/task_list_head"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_alignTop="@id/task_name"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginRight="6dp"
|
||||
android:background="@drawable/selector_task_head" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/task_list_head"
|
||||
android:layout_width="16dp"
|
||||
android:layout_height="16dp"
|
||||
android:layout_alignTop="@id/task_name"
|
||||
android:layout_marginLeft="6dp"
|
||||
android:layout_marginTop="2dp"
|
||||
android:layout_marginRight="6dp"
|
||||
android:background="@drawable/selector_task_head" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_name"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@id/task_list_head"
|
||||
android:text="任务名称"
|
||||
android:textColor="@color/selector_black_blue_color"
|
||||
android:textSize="14sp" />
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_toRightOf="@id/task_list_head"
|
||||
android:text="任务名称"
|
||||
android:textColor="@color/selector_black_blue_color"
|
||||
android:textSize="14sp" />
|
||||
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_data_version"
|
||||
style="@style/map_size_font_style"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/task_name"
|
||||
android:layout_alignLeft="@id/task_name"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:text="版本号"
|
||||
android:textColor="@color/selector_gray_blue_color"
|
||||
android:textSize="13sp" />
|
||||
<TextView
|
||||
android:id="@+id/task_data_version"
|
||||
style="@style/map_size_font_style"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/task_name"
|
||||
android:layout_alignLeft="@id/task_name"
|
||||
android:layout_marginTop="5dp"
|
||||
android:layout_marginBottom="5dp"
|
||||
android:text="版本号"
|
||||
android:textColor="@color/selector_gray_blue_color"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_city_name"
|
||||
style="@style/map_size_font_style"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/task_data_version"
|
||||
android:layout_alignLeft="@id/task_name"
|
||||
android:text="省市名称"
|
||||
android:textColor="@color/selector_gray_blue_color"
|
||||
android:textSize="13sp" />
|
||||
<TextView
|
||||
android:id="@+id/task_city_name"
|
||||
style="@style/map_size_font_style"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_below="@id/task_data_version"
|
||||
android:layout_alignLeft="@id/task_name"
|
||||
android:text="省市名称"
|
||||
android:textColor="@color/selector_gray_blue_color"
|
||||
android:textSize="13sp" />
|
||||
|
||||
<com.navinfo.omqs.ui.widget.TextProgressButtonBar
|
||||
android:id="@+id/task_download_btn"
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_alignBottom="@id/task_city_name"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="5dp"
|
||||
app:backgroundcolor="#888FB3"
|
||||
app:text="下载"
|
||||
app:textSize="@dimen/card_title_font_2size"
|
||||
app:textcolor="@color/white" />
|
||||
<com.navinfo.omqs.ui.widget.TextProgressButtonBar
|
||||
android:id="@+id/task_download_btn"
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_alignBottom="@id/task_city_name"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="5dp"
|
||||
app:backgroundcolor="#888FB3"
|
||||
app:text="下载"
|
||||
app:textSize="@dimen/card_title_font_2size"
|
||||
app:textcolor="@color/white" />
|
||||
|
||||
<com.navinfo.omqs.ui.widget.TextProgressButtonBar
|
||||
android:id="@+id/task_upload_btn"
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_alignBottom="@id/task_city_name"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="5dp"
|
||||
android:visibility="gone"
|
||||
app:backgroundcolor="#888FB3"
|
||||
app:text="未上传"
|
||||
app:textSize="@dimen/card_title_font_2size"
|
||||
app:textcolor="@color/white" />
|
||||
<com.navinfo.omqs.ui.widget.TextProgressButtonBar
|
||||
android:id="@+id/task_upload_btn"
|
||||
android:layout_width="75dp"
|
||||
android:layout_height="22dp"
|
||||
android:layout_alignBottom="@id/task_city_name"
|
||||
android:layout_alignParentRight="true"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginTop="5dp"
|
||||
android:visibility="gone"
|
||||
app:backgroundcolor="#888FB3"
|
||||
app:text="未上传"
|
||||
app:textSize="@dimen/card_title_font_2size"
|
||||
app:textcolor="@color/white" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_toLeftOf="@id/task_download_btn"
|
||||
android:clickable="true"
|
||||
android:focusable="false"
|
||||
android:shadowColor="@android:color/transparent"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/card_title_font_2size" />
|
||||
<TextView
|
||||
android:id="@+id/task_status"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_marginBottom="10dp"
|
||||
android:layout_toLeftOf="@id/task_download_btn"
|
||||
android:clickable="true"
|
||||
android:focusable="false"
|
||||
android:shadowColor="@android:color/transparent"
|
||||
android:textColor="@color/white"
|
||||
android:textSize="@dimen/card_title_font_2size" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/task_progress_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/task_download_btn"
|
||||
android:layout_alignBottom="@id/task_download_btn"
|
||||
android:layout_toLeftOf="@id/task_download_btn"
|
||||
android:gravity="center"
|
||||
android:visibility="invisible" />
|
||||
</RelativeLayout>
|
||||
<TextView
|
||||
android:id="@+id/task_progress_text"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignTop="@id/task_download_btn"
|
||||
android:layout_alignBottom="@id/task_download_btn"
|
||||
android:layout_toLeftOf="@id/task_download_btn"
|
||||
android:gravity="center"
|
||||
android:visibility="invisible" />
|
||||
</RelativeLayout>
|
||||
|
||||
<RelativeLayout
|
||||
android:id="@+id/task_delete_layout"
|
||||
android:background="@color/red"
|
||||
android:layout_width="64dp"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:layout_centerVertical="true"
|
||||
android:layout_centerInParent="true"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:focusable="false"
|
||||
android:enabled="false"
|
||||
android:text="关闭"
|
||||
android:textColor="#15141F"
|
||||
android:textSize="@dimen/left_pannel_title_font" />
|
||||
|
||||
</RelativeLayout>
|
||||
|
||||
</com.navinfo.omqs.ui.widget.LeftDeleteView>
|
||||
|
||||
|
@ -41,12 +41,17 @@
|
||||
app:layout_constraintRight_toRightOf="@id/task_list_search"
|
||||
app:layout_constraintTop_toTopOf="@id/task_list_search" />
|
||||
|
||||
<com.yanzhenjie.recyclerview.SwipeRecyclerView
|
||||
android:id="@+id/task_list_recyclerview"
|
||||
<androidx.swiperefreshlayout.widget.SwipeRefreshLayout
|
||||
android:id="@+id/refresh_layout"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="0dp"
|
||||
android:layout_marginTop="12dp"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/task_list_search" />
|
||||
app:layout_constraintTop_toBottomOf="@id/task_list_search">
|
||||
|
||||
<com.yanzhenjie.recyclerview.SwipeRecyclerView
|
||||
android:id="@+id/task_list_recyclerview"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</androidx.swiperefreshlayout.widget.SwipeRefreshLayout>
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
@ -72,13 +72,13 @@ enum class DataCodeEnum(var tableName: String, var code: String) {
|
||||
OMDB_LANE_LINK_LG("车道中心线", "5001");
|
||||
|
||||
companion object {
|
||||
fun findTableNameByCode(code: String): String? {
|
||||
fun findTableNameByCode(code: String): String {
|
||||
for (enumInstance in DataCodeEnum.values()) {
|
||||
if (enumInstance.code == code) {
|
||||
return enumInstance.tableName
|
||||
}
|
||||
}
|
||||
return null // 若未找到匹配的 code,则返回 null 或其他适当的默认值
|
||||
return "" // 若未找到匹配的 code,则返回 null 或其他适当的默认值
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -345,6 +345,16 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
|
||||
}
|
||||
}
|
||||
|
||||
fun removeMarker() {
|
||||
for (e in mDefaultMarkerLayer.itemList) {
|
||||
if (e is MarkerItem) {
|
||||
mDefaultMarkerLayer.removeItem(e)
|
||||
break
|
||||
}
|
||||
}
|
||||
mMapView.vtmMap.updateMap(true)
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 增加或更新marker
|
||||
|
@ -0,0 +1,12 @@
|
||||
package com.navinfo.collect.library.utils
|
||||
|
||||
import android.content.Context
|
||||
import java.io.InputStream
|
||||
|
||||
class AssetsFileLoadUtil {
|
||||
companion object {
|
||||
fun loadWarningSvg(context: Context, code: String): InputStream? {
|
||||
return context.assets.open("omdb/appendix/1105_${code}_0.svg")
|
||||
}
|
||||
}
|
||||
}
|
Loading…
x
Reference in New Issue
Block a user