增加任务列表下拉刷新功能
增加警示信息的预警面板和详情面板
This commit is contained in:
parent
f5e6a87b9b
commit
2d3e725119
@ -136,6 +136,7 @@ dependencies {
|
||||
|
||||
//带侧滑的自定义列表
|
||||
implementation 'com.yanzhenjie.recyclerview:x:1.3.2'
|
||||
implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.1.0"
|
||||
}
|
||||
//允许引用生成的代码
|
||||
kapt {
|
||||
|
@ -471,10 +471,11 @@ class MainViewModel @Inject constructor(
|
||||
private suspend fun captureItem(point: GeoPoint) {
|
||||
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
|
||||
val itemList = realmOperateHelper.queryElement(
|
||||
GeometryTools.createPoint(
|
||||
point = GeometryTools.createPoint(
|
||||
point.longitude,
|
||||
point.latitude
|
||||
)
|
||||
),
|
||||
buffer = 2.0
|
||||
)
|
||||
|
||||
if (itemList.size == 1) {
|
||||
@ -597,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
|
||||
)
|
||||
@ -1279,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
|
||||
//点击错误按钮
|
||||
|
@ -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 -> DataCodeEnum.valueOf(data.code).tableName
|
||||
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)
|
||||
}
|
||||
}
|
||||
|
||||
@ -397,6 +358,66 @@ class SignUtil {
|
||||
)
|
||||
}
|
||||
}
|
||||
//警示信息
|
||||
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
|
||||
return adapter
|
||||
@ -763,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
|
||||
}
|
||||
|
||||
@ -926,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
|
||||
@ -984,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(
|
||||
|
@ -251,7 +251,7 @@ class TimePeriodUtil {
|
||||
}
|
||||
if (list.size > 0)
|
||||
return list[0].toText()
|
||||
return ""
|
||||
return time
|
||||
}
|
||||
|
||||
private fun getPeriodObject(
|
||||
|
@ -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>
|
@ -64,6 +64,7 @@ enum class DataCodeEnum(var tableName: String, var code: String) {
|
||||
OMDB_SPEEDLIMIT_COND("条件点限速", "4003"),
|
||||
OMDB_SPEEDLIMIT_VAR("可变点限速", "4004"),
|
||||
OMDB_RESTRICTION("普通交限", "4006"),
|
||||
OMDB_WARNINGSIGN("警示信息", "4009"),
|
||||
OMDB_ELECTRONICEYE("电子眼", "4010"),
|
||||
OMDB_TRAFFICLIGHT("交通灯", "4022"),
|
||||
OMDB_TOLLGATE("收费站", "4023"),
|
||||
@ -71,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 或其他适当的默认值
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -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