修改车信存储
This commit is contained in:
+2
-2
@@ -17,7 +17,7 @@ android {
|
|||||||
compileSdk 33
|
compileSdk 33
|
||||||
|
|
||||||
defaultConfig {
|
defaultConfig {
|
||||||
applicationId "com.navinfo.omqs"
|
// applicationId "com.navinfo.omqs"
|
||||||
minSdk 21
|
minSdk 21
|
||||||
targetSdk 21
|
targetSdk 21
|
||||||
versionCode 1
|
versionCode 1
|
||||||
@@ -26,7 +26,7 @@ android {
|
|||||||
multiDexEnabled true
|
multiDexEnabled true
|
||||||
|
|
||||||
ndk {
|
ndk {
|
||||||
abiFilters "armeabi-v7a", "armeabi", "mips"
|
abiFilters "arm64-v8a", "armeabi-v7a", "armeabi", "mips"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -127,10 +127,10 @@ class LoginViewModel @Inject constructor(
|
|||||||
if (userNameCache == userName && passwordCache == password) {
|
if (userNameCache == userName && passwordCache == password) {
|
||||||
viewModelScope.launch(Dispatchers.IO) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
createUserFolder(context, userCodeCache, userRealName)
|
createUserFolder(context, userCodeCache, userRealName)
|
||||||
getOfflineCityList(context)
|
// getOfflineCityList(context)
|
||||||
// loginStatus.postValue(LoginStatus.LOGIN_STATUS_SUCCESS)
|
// loginStatus.postValue(LoginStatus.LOGIN_STATUS_SUCCESS)
|
||||||
}
|
}
|
||||||
return
|
// return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
//不指定IO,会在主线程里运行
|
//不指定IO,会在主线程里运行
|
||||||
|
|||||||
+169
-34
@@ -20,6 +20,7 @@ import androidx.annotation.RequiresApi
|
|||||||
import androidx.lifecycle.MutableLiveData
|
import androidx.lifecycle.MutableLiveData
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
|
import com.alibaba.fastjson.JSON
|
||||||
import com.blankj.utilcode.util.ToastUtils
|
import com.blankj.utilcode.util.ToastUtils
|
||||||
import com.navinfo.collect.library.data.entity.*
|
import com.navinfo.collect.library.data.entity.*
|
||||||
import com.navinfo.collect.library.enums.DataCodeEnum
|
import com.navinfo.collect.library.enums.DataCodeEnum
|
||||||
@@ -45,6 +46,8 @@ import io.realm.RealmList
|
|||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import kotlinx.coroutines.withContext
|
import kotlinx.coroutines.withContext
|
||||||
|
import org.json.JSONArray
|
||||||
|
import org.json.JSONObject
|
||||||
import org.locationtech.jts.geom.Geometry
|
import org.locationtech.jts.geom.Geometry
|
||||||
import org.oscim.core.GeoPoint
|
import org.oscim.core.GeoPoint
|
||||||
import org.oscim.core.GeometryBuffer.GeometryType
|
import org.oscim.core.GeometryBuffer.GeometryType
|
||||||
@@ -69,7 +72,7 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
/**
|
/**
|
||||||
* 车信列表
|
* 车信列表
|
||||||
*/
|
*/
|
||||||
var laneInfoList: MutableList<LaneInfoItem>? = null
|
val laneInfoList = MutableLiveData<MutableList<LaneInfoItem>>()
|
||||||
|
|
||||||
var liveDataLanInfoChange = MutableLiveData<String>()
|
var liveDataLanInfoChange = MutableLiveData<String>()
|
||||||
|
|
||||||
@@ -139,7 +142,7 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
|
|
||||||
init {
|
init {
|
||||||
mapController.mMapView.addOnNIMapClickListener(TAG, object : OnGeoPointClickListener {
|
mapController.mMapView.addOnNIMapClickListener(TAG, object : OnGeoPointClickListener {
|
||||||
override fun onMapClick(tag: String, point: GeoPoint,other:String) {
|
override fun onMapClick(tag: String, point: GeoPoint, other: String) {
|
||||||
if (tag == TAG) {
|
if (tag == TAG) {
|
||||||
liveDataQsRecordBean.value!!.geometry =
|
liveDataQsRecordBean.value!!.geometry =
|
||||||
GeometryTools.createGeometry(point).toText()
|
GeometryTools.createGeometry(point).toText()
|
||||||
@@ -174,7 +177,7 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
if (bean != null) {
|
if (bean != null) {
|
||||||
renderEntity = bean.renderEntity
|
renderEntity = bean.renderEntity
|
||||||
if (renderEntity!!.code == DataCodeEnum.OMDB_LANEINFO.code) {
|
if (renderEntity!!.code == DataCodeEnum.OMDB_LANEINFO.code) {
|
||||||
laneInfoList = SignUtil.getLineInfoIcons(renderEntity!!)
|
laneInfoList.postValue(SignUtil.getLineInfoIcons(renderEntity!!))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,7 +283,7 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
if (bean != null) {
|
if (bean != null) {
|
||||||
renderEntity = bean.renderEntity
|
renderEntity = bean.renderEntity
|
||||||
if (renderEntity!!.code == DataCodeEnum.OMDB_LANEINFO.code) {
|
if (renderEntity!!.code == DataCodeEnum.OMDB_LANEINFO.code) {
|
||||||
laneInfoList = SignUtil.getLineInfoIcons(renderEntity!!)
|
laneInfoList.postValue(SignUtil.getLineInfoIcons(renderEntity!!))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -454,7 +457,42 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
liveDataToastMessage.postValue("没有绑定到任何link,请选择")
|
liveDataToastMessage.postValue("没有绑定到任何link,请选择")
|
||||||
return@launch
|
return@launch
|
||||||
}
|
}
|
||||||
|
if (liveDataQsRecordBean.value!!.classCode == DataCodeEnum.OMDB_LANEINFO.code)
|
||||||
|
try {
|
||||||
|
val jsonObject: JSONObject = if (liveDataQsRecordBean.value!!.remarks != "") {
|
||||||
|
JSONObject(liveDataQsRecordBean.value!!.remarks)
|
||||||
|
} else {
|
||||||
|
JSONObject()
|
||||||
|
}
|
||||||
|
if (!jsonObject.has("original")) {
|
||||||
|
renderEntity?.let {
|
||||||
|
val laneOldList = SignUtil.getLineInfoIcons(it)
|
||||||
|
val jsonOriginalArray = JSONArray()
|
||||||
|
for (lane in laneOldList) {
|
||||||
|
val jsonItem = JSONObject()
|
||||||
|
jsonItem.put("id", lane.id)
|
||||||
|
jsonItem.put("type", lane.type)
|
||||||
|
jsonOriginalArray.put(jsonItem)
|
||||||
|
}
|
||||||
|
jsonObject.put("original", jsonOriginalArray)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
laneInfoList.value?.let {
|
||||||
|
val jsonOriginalArray = JSONArray()
|
||||||
|
for (lane in it) {
|
||||||
|
val jsonItem = JSONObject()
|
||||||
|
jsonItem.put("id", lane.id)
|
||||||
|
jsonItem.put("type", lane.type)
|
||||||
|
jsonOriginalArray.put(jsonItem)
|
||||||
|
}
|
||||||
|
jsonObject.put("now", jsonOriginalArray)
|
||||||
|
}
|
||||||
|
liveDataQsRecordBean.value!!.remarks = jsonObject.toString()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
Log.e("jingo", "车信json ${liveDataQsRecordBean.value!!.remarks}")
|
||||||
val realm = realmOperateHelper.getRealmDefaultInstance()
|
val realm = realmOperateHelper.getRealmDefaultInstance()
|
||||||
liveDataQsRecordBean.value!!.taskId = liveDataTaskBean.value!!.id
|
liveDataQsRecordBean.value!!.taskId = liveDataTaskBean.value!!.id
|
||||||
liveDataQsRecordBean.value!!.checkTime = DateTimeUtil.getDataTime()
|
liveDataQsRecordBean.value!!.checkTime = DateTimeUtil.getDataTime()
|
||||||
@@ -504,7 +542,7 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
@RequiresApi(Build.VERSION_CODES.N)
|
@RequiresApi(Build.VERSION_CODES.N)
|
||||||
fun initData(id: String) {
|
fun initData(id: String) {
|
||||||
Log.e("jingo", "捕捉到的要素 id = $id")
|
Log.e("jingo", "捕捉到的要素 id = $id")
|
||||||
viewModelScope.launch(Dispatchers.Main) {
|
viewModelScope.launch(Dispatchers.IO) {
|
||||||
|
|
||||||
val realm = realmOperateHelper.getRealmDefaultInstance()
|
val realm = realmOperateHelper.getRealmDefaultInstance()
|
||||||
|
|
||||||
@@ -523,16 +561,43 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
liveDataQsRecordBean.postValue(it.copy())
|
liveDataQsRecordBean.postValue(it.copy())
|
||||||
val p = GeometryTools.createGeoPoint(it.geometry)
|
var hisNowLanInfo = false
|
||||||
mapController.markerHandle.addMarker(
|
if (it.classCode == DataCodeEnum.OMDB_LANEINFO.code) {
|
||||||
GeoPoint(
|
try {
|
||||||
p.latitude, p.longitude
|
val jsonObject = JSONObject(it.remarks)
|
||||||
), TAG, "", null
|
if (jsonObject.has("now")) {
|
||||||
)
|
val jsonArray = jsonObject.getJSONArray("now")
|
||||||
//定位
|
val list = mutableListOf<LaneInfoItem>()
|
||||||
val mapPosition = mapController.mMapView.vtmMap.mapPosition
|
for (i in 0 until jsonArray.length()) {
|
||||||
mapPosition.setPosition(p.latitude, p.longitude)
|
val itemObject = jsonArray[i] as JSONObject
|
||||||
mapController.mMapView.vtmMap.animator().animateTo(300, mapPosition)
|
if (itemObject.has("id") && itemObject.has("type")) {
|
||||||
|
list.add(LaneInfoItem(itemObject.getInt("id"), itemObject.getInt("type")))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
hisNowLanInfo = true
|
||||||
|
laneInfoList.postValue(list)
|
||||||
|
}
|
||||||
|
|
||||||
|
// editLaneInfoProblem()
|
||||||
|
} catch (e: Exception) {
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
launch(Dispatchers.Main) {
|
||||||
|
val p = GeometryTools.createGeoPoint(it.geometry)
|
||||||
|
mapController.markerHandle.addMarker(
|
||||||
|
GeoPoint(
|
||||||
|
p.latitude, p.longitude
|
||||||
|
), TAG, "", null
|
||||||
|
)
|
||||||
|
|
||||||
|
//定位
|
||||||
|
val mapPosition = mapController.mMapView.vtmMap.mapPosition
|
||||||
|
mapPosition.setPosition(p.latitude, p.longitude)
|
||||||
|
mapController.mMapView.vtmMap.animator().animateTo(300, mapPosition)
|
||||||
|
}
|
||||||
|
|
||||||
//获取linkid
|
//获取linkid
|
||||||
if (it.linkId.isNotEmpty()) {
|
if (it.linkId.isNotEmpty()) {
|
||||||
val link = realmOperateHelper.queryLink(it.linkId)
|
val link = realmOperateHelper.queryLink(it.linkId)
|
||||||
@@ -548,15 +613,15 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
liveDataQsRecordBean.value?.attachmentBeanList = it.attachmentBeanList
|
liveDataQsRecordBean.value?.attachmentBeanList = it.attachmentBeanList
|
||||||
liveDataLanInfoChange.value = it.description
|
liveDataLanInfoChange.postValue(it.description)
|
||||||
// 显示语音数据到界面
|
// 显示语音数据到界面
|
||||||
getChatMsgEntityList()
|
getChatMsgEntityList()
|
||||||
realm.close()
|
realm.close()
|
||||||
//增加要素高亮
|
//增加要素高亮
|
||||||
if(it.elementId!=null){
|
if (it.elementId != null) {
|
||||||
val realm2 = realmOperateHelper.getSelectTaskRealmInstance()
|
val realm2 = realmOperateHelper.getSelectTaskRealmInstance()
|
||||||
val rEntity = realm2.where(RenderEntity::class.java).equalTo("id",it.elementId).findFirst()
|
val rEntity = realm2.where(RenderEntity::class.java).equalTo("id", it.elementId).findFirst()
|
||||||
if(rEntity!=null){
|
if (rEntity != null) {
|
||||||
show(rEntity!!)
|
show(rEntity!!)
|
||||||
}
|
}
|
||||||
if (it.classCode == DataCodeEnum.OMDB_LANEINFO.code) {
|
if (it.classCode == DataCodeEnum.OMDB_LANEINFO.code) {
|
||||||
@@ -565,7 +630,8 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
.equalTo("linkPid", it.linkId).findFirst()
|
.equalTo("linkPid", it.linkId).findFirst()
|
||||||
if (r != null) {
|
if (r != null) {
|
||||||
renderEntity = realm2.copyFromRealm(r)
|
renderEntity = realm2.copyFromRealm(r)
|
||||||
laneInfoList = SignUtil.getLineInfoIcons(renderEntity!!)
|
if (!hisNowLanInfo)
|
||||||
|
laneInfoList.postValue(SignUtil.getLineInfoIcons(renderEntity!!))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
realm2.close()
|
realm2.close()
|
||||||
@@ -778,7 +844,10 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
* 增加车信
|
* 增加车信
|
||||||
*/
|
*/
|
||||||
fun updateLaneInfo(index: Int, id: Int, type: Int) {
|
fun updateLaneInfo(index: Int, id: Int, type: Int) {
|
||||||
laneInfoList?.let {
|
if (laneInfoList.value == null) {
|
||||||
|
laneInfoList.value = mutableListOf<LaneInfoItem>()
|
||||||
|
}
|
||||||
|
laneInfoList.value?.let {
|
||||||
val laneInfoItem = it[index]
|
val laneInfoItem = it[index]
|
||||||
if (laneInfoItem.id != id || laneInfoItem.type != type) {
|
if (laneInfoItem.id != id || laneInfoItem.type != type) {
|
||||||
laneInfoItem.id = id
|
laneInfoItem.id = id
|
||||||
@@ -792,7 +861,10 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
* 增加车信
|
* 增加车信
|
||||||
*/
|
*/
|
||||||
fun addLaneInfo(id: Int, type: Int): Int {
|
fun addLaneInfo(id: Int, type: Int): Int {
|
||||||
laneInfoList?.let {
|
if (laneInfoList.value == null) {
|
||||||
|
laneInfoList.value = mutableListOf<LaneInfoItem>()
|
||||||
|
}
|
||||||
|
laneInfoList.value?.let {
|
||||||
it.add(LaneInfoItem(id, type))
|
it.add(LaneInfoItem(id, type))
|
||||||
editLaneInfoProblem()
|
editLaneInfoProblem()
|
||||||
return it.size
|
return it.size
|
||||||
@@ -804,7 +876,10 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
* 删除车信
|
* 删除车信
|
||||||
*/
|
*/
|
||||||
fun backspaceLaneInfo() {
|
fun backspaceLaneInfo() {
|
||||||
laneInfoList?.let {
|
if (laneInfoList.value == null) {
|
||||||
|
laneInfoList.value = mutableListOf<LaneInfoItem>()
|
||||||
|
}
|
||||||
|
laneInfoList.value?.let {
|
||||||
if (it.isNotEmpty()) {
|
if (it.isNotEmpty()) {
|
||||||
it.removeLast()
|
it.removeLast()
|
||||||
editLaneInfoProblem()
|
editLaneInfoProblem()
|
||||||
@@ -816,20 +891,76 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
* 删除车信
|
* 删除车信
|
||||||
*/
|
*/
|
||||||
fun removeAllLaneInfo() {
|
fun removeAllLaneInfo() {
|
||||||
laneInfoList?.clear()
|
laneInfoList.value?.clear()
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 组织车信备注文字
|
* 组织车信备注文字
|
||||||
*/
|
*/
|
||||||
private fun editLaneInfoProblem() {
|
private fun editLaneInfoProblem() {
|
||||||
laneInfoList?.let {
|
if (laneInfoList.value == null) {
|
||||||
|
laneInfoList.value = mutableListOf<LaneInfoItem>()
|
||||||
|
}
|
||||||
|
laneInfoList.value?.let {
|
||||||
liveDataQsRecordBean.value?.let { bean ->
|
liveDataQsRecordBean.value?.let { bean ->
|
||||||
var strBuffer = StringBuffer()
|
val strBuffer = StringBuffer()
|
||||||
if (bean.problemType == "遗漏")
|
if (bean.problemType == "遗漏")
|
||||||
strBuffer.append("车信缺失,车道从左到右分别是:")
|
strBuffer.append("车信缺失\n")
|
||||||
else if (bean.problemType == "错误")
|
else if (bean.problemType == "错误")
|
||||||
strBuffer.append("车信错误,车道从左到右分别是:")
|
strBuffer.append("车信错误\n")
|
||||||
|
|
||||||
|
renderEntity?.let {
|
||||||
|
val oldList = SignUtil.getLineInfoIcons(it)
|
||||||
|
strBuffer.append("原车道:")
|
||||||
|
for (item in oldList) {
|
||||||
|
when (item.id) {
|
||||||
|
R.drawable.laneinfo_1 -> strBuffer.append("[直(1)")
|
||||||
|
R.drawable.laneinfo_2 -> strBuffer.append("[左(2)")
|
||||||
|
R.drawable.laneinfo_3 -> strBuffer.append("[右(3)")
|
||||||
|
R.drawable.laneinfo_5 -> strBuffer.append("[左斜前(5)")
|
||||||
|
R.drawable.laneinfo_6 -> strBuffer.append("[右斜前(6)")
|
||||||
|
R.drawable.laneinfo_4 -> strBuffer.append("[调(4)")
|
||||||
|
R.drawable.laneinfo_7 -> strBuffer.append("[反向调(7)")
|
||||||
|
R.drawable.laneinfo_1_2 -> strBuffer.append("[左直(1,2)")
|
||||||
|
R.drawable.laneinfo_1_5 -> strBuffer.append("[左斜前直(1,5)")
|
||||||
|
R.drawable.laneinfo_2_5 -> strBuffer.append("[左左斜前(2,5)")
|
||||||
|
R.drawable.laneinfo_2_6 -> strBuffer.append("[左右斜前(2,6)")
|
||||||
|
R.drawable.laneinfo_1_3 -> strBuffer.append("[直右(1,3)")
|
||||||
|
R.drawable.laneinfo_1_6 -> strBuffer.append("[右斜前直(1,6)")
|
||||||
|
R.drawable.laneinfo_3_5 -> strBuffer.append("[左斜前右(3,5)")
|
||||||
|
R.drawable.laneinfo_3_6 -> strBuffer.append("[右斜前右(3,6)")
|
||||||
|
R.drawable.laneinfo_2_3 -> strBuffer.append("[左右(2,3)")
|
||||||
|
R.drawable.laneinfo_5_6 -> strBuffer.append("[左斜前右斜前(5,6)")
|
||||||
|
R.drawable.laneinfo_1_4 -> strBuffer.append("[直调(1,4)")
|
||||||
|
R.drawable.laneinfo_4_5 -> strBuffer.append("[调左斜前(4,5)")
|
||||||
|
R.drawable.laneinfo_2_4 -> strBuffer.append("[左调(2,4)")
|
||||||
|
R.drawable.laneinfo_3_4 -> strBuffer.append("[右调(3,4)")
|
||||||
|
R.drawable.laneinfo_4_6 -> strBuffer.append("[调右斜前(4,6)")
|
||||||
|
R.drawable.laneinfo_1_7 -> strBuffer.append("[直反向调(1,7)")
|
||||||
|
R.drawable.laneinfo_1_2_3 -> strBuffer.append("[左直右(1,2,3)")
|
||||||
|
R.drawable.laneinfo_1_2_4 -> strBuffer.append("[调左直(1,2,4)")
|
||||||
|
R.drawable.laneinfo_1_2_5 -> strBuffer.append("[左左斜前直(1,2,5)")
|
||||||
|
R.drawable.laneinfo_1_2_6 -> strBuffer.append("[左直右斜前(1,2,6)")
|
||||||
|
R.drawable.laneinfo_1_3_4 -> strBuffer.append("[调直右(1,3,4)")
|
||||||
|
R.drawable.laneinfo_1_3_5 -> strBuffer.append("[左斜前直右(1,3,5)")
|
||||||
|
R.drawable.laneinfo_1_3_6 -> strBuffer.append("[直右斜前右(1,3,6)")
|
||||||
|
R.drawable.laneinfo_2_3_4 -> strBuffer.append("[调左右(2,3,4)")
|
||||||
|
R.drawable.laneinfo_0 -> strBuffer.append("[不允许存在(0)")
|
||||||
|
}
|
||||||
|
when (item.type) {
|
||||||
|
1 -> {
|
||||||
|
strBuffer.append("(附加)]")
|
||||||
|
}
|
||||||
|
2 -> {
|
||||||
|
strBuffer.append("(公交)]")
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
strBuffer.append("]")
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
strBuffer.append("\n现车道:")
|
||||||
for (item in it) {
|
for (item in it) {
|
||||||
when (item.id) {
|
when (item.id) {
|
||||||
R.drawable.laneinfo_1 -> strBuffer.append("[直(1)")
|
R.drawable.laneinfo_1 -> strBuffer.append("[直(1)")
|
||||||
@@ -865,12 +996,16 @@ class EvaluationResultViewModel @Inject constructor(
|
|||||||
R.drawable.laneinfo_2_3_4 -> strBuffer.append("[调左右(2,3,4)")
|
R.drawable.laneinfo_2_3_4 -> strBuffer.append("[调左右(2,3,4)")
|
||||||
R.drawable.laneinfo_0 -> strBuffer.append("[不允许存在(0)")
|
R.drawable.laneinfo_0 -> strBuffer.append("[不允许存在(0)")
|
||||||
}
|
}
|
||||||
if (item.type == 1) {
|
when (item.type) {
|
||||||
strBuffer.append("(附加)]")
|
1 -> {
|
||||||
} else if (item.type == 2) {
|
strBuffer.append("(附加)]")
|
||||||
strBuffer.append("(公交)]")
|
}
|
||||||
} else {
|
2 -> {
|
||||||
strBuffer.append("]")
|
strBuffer.append("(公交)]")
|
||||||
|
}
|
||||||
|
else -> {
|
||||||
|
strBuffer.append("]")
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
liveDataQsRecordBean.value!!.description = strBuffer.toString()
|
liveDataQsRecordBean.value!!.description = strBuffer.toString()
|
||||||
|
|||||||
+54
-52
@@ -10,6 +10,7 @@ import android.widget.AdapterView
|
|||||||
import android.widget.ImageView
|
import android.widget.ImageView
|
||||||
import com.navinfo.omqs.R
|
import com.navinfo.omqs.R
|
||||||
import com.navinfo.omqs.databinding.FragmentLineInfoEditBinding
|
import com.navinfo.omqs.databinding.FragmentLineInfoEditBinding
|
||||||
|
import com.navinfo.omqs.ui.activity.map.LaneInfoItem
|
||||||
import com.navinfo.omqs.ui.fragment.BaseFragment
|
import com.navinfo.omqs.ui.fragment.BaseFragment
|
||||||
import com.navinfo.omqs.ui.other.shareViewModels
|
import com.navinfo.omqs.ui.other.shareViewModels
|
||||||
|
|
||||||
@@ -37,7 +38,10 @@ class LaneInfoEditFragment : BaseFragment() {
|
|||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
initLaneInfo()
|
viewModel.laneInfoList.observe(viewLifecycleOwner){
|
||||||
|
initLaneInfo(it)
|
||||||
|
viewModel.laneInfoList.removeObservers(viewLifecycleOwner)
|
||||||
|
}
|
||||||
initFLowLayout()
|
initFLowLayout()
|
||||||
|
|
||||||
binding.laneInfoBackspace.setOnClickListener {
|
binding.laneInfoBackspace.setOnClickListener {
|
||||||
@@ -271,61 +275,59 @@ class LaneInfoEditFragment : BaseFragment() {
|
|||||||
/**
|
/**
|
||||||
* 初始化车道信息
|
* 初始化车道信息
|
||||||
*/
|
*/
|
||||||
private fun initLaneInfo() {
|
private fun initLaneInfo(list:MutableList<LaneInfoItem>) {
|
||||||
if (viewModel.laneInfoList != null) {
|
val container = binding.laneInfoTopContainer
|
||||||
val container = binding.laneInfoTopContainer
|
container.removeAllViews()
|
||||||
container.removeAllViews()
|
val lineViewS = View(context)
|
||||||
val lineViewS = View(context)
|
lineViewS.layoutParams = ViewGroup.LayoutParams(24, 110)
|
||||||
lineViewS.layoutParams = ViewGroup.LayoutParams(24, 110)
|
lineViewS.background =
|
||||||
lineViewS.background =
|
requireContext().getDrawable(R.drawable.shape_vertical_dashed_line)
|
||||||
requireContext().getDrawable(R.drawable.shape_vertical_dashed_line)
|
container.addView(lineViewS, lineViewS.layoutParams)
|
||||||
container.addView(lineViewS, lineViewS.layoutParams)
|
for (i in list.indices) {
|
||||||
for (i in viewModel.laneInfoList!!.indices) {
|
val laneInfo = list[i]
|
||||||
val laneInfo = viewModel.laneInfoList!![i]
|
val imageView = ImageView(context)
|
||||||
val imageView = ImageView(context)
|
val drawable = requireContext().getDrawable(laneInfo.id)
|
||||||
val drawable = requireContext().getDrawable(laneInfo.id)
|
val color = when (laneInfo.type) {
|
||||||
val color = when (laneInfo.type) {
|
1 -> requireContext().resources.getColor(R.color.lane_info_1)
|
||||||
1 -> requireContext().resources.getColor(R.color.lane_info_1)
|
2 -> requireContext().resources.getColor(R.color.lane_info_2)
|
||||||
2 -> requireContext().resources.getColor(R.color.lane_info_2)
|
else -> requireContext().resources.getColor(R.color.white)
|
||||||
else -> requireContext().resources.getColor(R.color.white)
|
}
|
||||||
}
|
// 创建 PorterDuffColorFilter 对象
|
||||||
// 创建 PorterDuffColorFilter 对象
|
val colorFilter = PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN)
|
||||||
val colorFilter = PorterDuffColorFilter(color, PorterDuff.Mode.SRC_IN)
|
// 将 PorterDuffColorFilter 设置给 Drawable
|
||||||
// 将 PorterDuffColorFilter 设置给 Drawable
|
drawable!!.colorFilter = colorFilter
|
||||||
drawable!!.colorFilter = colorFilter
|
// 将 Drawable 设置给 ImageView
|
||||||
// 将 Drawable 设置给 ImageView
|
imageView.scaleType = ImageView.ScaleType.FIT_XY
|
||||||
imageView.scaleType = ImageView.ScaleType.FIT_XY
|
imageView.setColorFilter(color, PorterDuff.Mode.SRC_IN)
|
||||||
imageView.setColorFilter(color, PorterDuff.Mode.SRC_IN)
|
imageView.setImageDrawable(drawable)
|
||||||
imageView.setImageDrawable(drawable)
|
// 将 ImageView 的颜色设置为红色
|
||||||
// 将 ImageView 的颜色设置为红色
|
imageView.layoutParams = ViewGroup.LayoutParams(45, 100)
|
||||||
imageView.layoutParams = ViewGroup.LayoutParams(45, 100)
|
container.addView(imageView, imageView.layoutParams)
|
||||||
container.addView(imageView, imageView.layoutParams)
|
if (i < list.size - 1) {
|
||||||
if (i < viewModel.laneInfoList!!.size - 1) {
|
val lineView = View(context)
|
||||||
val lineView = View(context)
|
lineView.layoutParams = ViewGroup.LayoutParams(24, 110)
|
||||||
lineView.layoutParams = ViewGroup.LayoutParams(24, 110)
|
lineView.background =
|
||||||
lineView.background =
|
requireContext().getDrawable(R.drawable.shape_vertical_dashed_line)
|
||||||
requireContext().getDrawable(R.drawable.shape_vertical_dashed_line)
|
container.addView(lineView, lineView.layoutParams)
|
||||||
container.addView(lineView, lineView.layoutParams)
|
}
|
||||||
}
|
imageView.tag = i
|
||||||
imageView.tag = i
|
imageView.setOnClickListener {
|
||||||
imageView.setOnClickListener {
|
selectView = if (selectView == it) {
|
||||||
selectView = if (selectView == it) {
|
selectView!!.setBackgroundColor(requireContext().resources.getColor(R.color.gray))
|
||||||
|
null
|
||||||
|
} else {
|
||||||
|
if (selectView != null) {
|
||||||
selectView!!.setBackgroundColor(requireContext().resources.getColor(R.color.gray))
|
selectView!!.setBackgroundColor(requireContext().resources.getColor(R.color.gray))
|
||||||
null
|
|
||||||
} else {
|
|
||||||
if (selectView != null) {
|
|
||||||
selectView!!.setBackgroundColor(requireContext().resources.getColor(R.color.gray))
|
|
||||||
}
|
|
||||||
imageView.setBackgroundColor(requireContext().resources.getColor(R.color.lane_info_0))
|
|
||||||
it as ImageView
|
|
||||||
}
|
}
|
||||||
|
imageView.setBackgroundColor(requireContext().resources.getColor(R.color.lane_info_0))
|
||||||
|
it as ImageView
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
val lineViewE = View(context)
|
|
||||||
lineViewE.layoutParams = ViewGroup.LayoutParams(24, 110)
|
|
||||||
lineViewE.background =
|
|
||||||
requireContext().getDrawable(R.drawable.shape_vertical_dashed_line)
|
|
||||||
container.addView(lineViewE, lineViewE.layoutParams)
|
|
||||||
}
|
}
|
||||||
|
val lineViewE = View(context)
|
||||||
|
lineViewE.layoutParams = ViewGroup.LayoutParams(24, 110)
|
||||||
|
lineViewE.background =
|
||||||
|
requireContext().getDrawable(R.drawable.shape_vertical_dashed_line)
|
||||||
|
container.addView(lineViewE, lineViewE.layoutParams)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
+6
-2
@@ -93,8 +93,11 @@ open class QsRecordBean @JvmOverloads constructor(
|
|||||||
* 显示坐标
|
* 显示坐标
|
||||||
*/
|
*/
|
||||||
var guideGeometry: String = "",
|
var guideGeometry: String = "",
|
||||||
|
/**
|
||||||
) : RealmObject() {
|
* 备份数据
|
||||||
|
*/
|
||||||
|
var remarks: String = "",
|
||||||
|
) : RealmObject() {
|
||||||
|
|
||||||
fun copy(): QsRecordBean {
|
fun copy(): QsRecordBean {
|
||||||
val qs = QsRecordBean(
|
val qs = QsRecordBean(
|
||||||
@@ -115,6 +118,7 @@ open class QsRecordBean @JvmOverloads constructor(
|
|||||||
t_lifecycle = t_lifecycle,
|
t_lifecycle = t_lifecycle,
|
||||||
t_status = t_status,
|
t_status = t_status,
|
||||||
attachmentBeanList = attachmentBeanList,
|
attachmentBeanList = attachmentBeanList,
|
||||||
|
remarks = remarks,
|
||||||
)
|
)
|
||||||
qs.geometry = geometry
|
qs.geometry = geometry
|
||||||
return qs
|
return qs
|
||||||
|
|||||||
+1
-1
Submodule vtm updated: c046e788f5...dc42d45796
Reference in New Issue
Block a user