修改面板快捷新增时的种类联动

This commit is contained in:
squallzhjch 2023-05-06 15:38:27 +08:00
parent fbff312f41
commit 3733634eb5
8 changed files with 52 additions and 38 deletions

View File

@ -19,4 +19,6 @@ data class SignBean(
val geometry: String,
//底部文字
val bottomText: String,
//要素code类型
val elementCode: Int
) : Parcelable

View File

@ -75,7 +75,7 @@ class RealmOperateHelper() {
GeometryTools.createPoint(
point.longitude,
point.latitude
), it
) , it
)
)
} else {

View File

@ -33,6 +33,9 @@ interface ScProblemTypeDao {
@Query("select DISTINCT CLASS_TYPE from ScProblemType order by CLASS_TYPE")
suspend fun findClassTypeList(): List<String>?
@Query("select DISTINCT CLASS_TYPE from ScProblemType where ELEMENT_CODE=:code")
suspend fun findClassTypeByCode(code: Int): String?
/**
* 获取问题类型并去重
*/

View File

@ -215,7 +215,8 @@ class MainViewModel @Inject constructor(
elementId = element.id,
linkId = linkId,
geometry = element.geometry,
bottomText = SignUtil.getSignBottomText(element)
bottomText = SignUtil.getSignBottomText(element),
elementCode = element.code
)
)
}

View File

@ -117,11 +117,9 @@ class EvaluationResultViewModel @Inject constructor(
* 查询数据库获取问题分类
*/
fun initNewData(bean: SignBean?, filePath: String) {
viewModelScope.launch(Dispatchers.IO) {
getClassTypeList()
getProblemLinkList()
}
//获取当前定位点
val geoPoint = mapController.locationLayerHandler.getCurrentGeoPoint()
//如果不是从面板进来的
if (bean == null) {
geoPoint?.let {
liveDataQsRecordBean.value!!.geometry = GeometryTools.createGeometry(it).toText()
@ -147,13 +145,17 @@ class EvaluationResultViewModel @Inject constructor(
}
}
}
val point = GeometryTools.createGeoPoint(bean.geometry)
this.geometry = GeometryTools.createGeometry(point).toText()
mapController.animationHandler.animationByLonLat(point.latitude, point.longitude)
mapController.markerHandle.addMarker(point, markerTitle)
}
val point = GeometryTools.createGeoPoint(bean.geometry)
liveDataQsRecordBean.value!!.geometry = GeometryTools.createGeometry(point).toText()
mapController.animationHandler.animationByLonLat(point.latitude, point.longitude)
mapController.markerHandle.addMarker(point, markerTitle)
}
//查询元数据
viewModelScope.launch(Dispatchers.IO) {
getClassTypeList(bean)
getProblemLinkList()
}
addChatMsgEntity(filePath)
}
@ -182,18 +184,23 @@ class EvaluationResultViewModel @Inject constructor(
/**
* //获取问题分类列表
*/
fun getClassTypeList() {
Log.e("jingo", "getClassTypeList S")
fun getClassTypeList(bean: SignBean? = null) {
viewModelScope.launch(Dispatchers.IO) {
val list = roomAppDatabase.getScProblemTypeDao().findClassTypeList()
list?.let {
if (list.isNotEmpty()) {
//通知页面更新
liveDataLeftTypeList.postValue(it)
val classType = it[0]
var classType = it[0]
if (bean != null) {
val classType2 = roomAppDatabase.getScProblemTypeDao()
.findClassTypeByCode(bean.elementCode)
if (classType2 != null)
classType = classType2
}
//如果右侧栏没数据,给个默认值
if (liveDataQsRecordBean.value!!.classType.isEmpty()) {
Log.e("jingo", "getClassTypeList $classType")
liveDataQsRecordBean.value!!.classType = classType
classTypeTemp = classType
}
@ -201,7 +208,6 @@ class EvaluationResultViewModel @Inject constructor(
}
}
}
Log.e("jingo", "getClassTypeList E")
}
/**

View File

@ -1,5 +1,6 @@
package com.navinfo.omqs.ui.fragment.evaluationresult
import android.os.Build
import android.os.Bundle
import android.util.Log
import android.view.LayoutInflater
@ -62,11 +63,13 @@ class PhenomenonFragment :
}
binding.phenomenonRightRecyclerview.adapter = rightAdapter
//右侧菜单增加组标题
binding.phenomenonRightRecyclerview.addItemDecoration(
RightGroupHeaderDecoration(
requireContext()
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
binding.phenomenonRightRecyclerview.addItemDecoration(
RightGroupHeaderDecoration(
requireContext()
)
)
)
}
//右侧菜单查询数据监听
viewModel.liveDataRightTypeList.observe(viewLifecycleOwner) {
rightAdapter.refreshData(it)

View File

@ -6,16 +6,16 @@
android:layout_height="wrap_content"
android:background="@color/ivory"
android:paddingLeft="10dp"
android:paddingRight="10dp"
android:paddingTop="5dp"
android:paddingRight="10dp"
tools:context="com.navinfo.omqs.ui.fragment.offlinemap.OfflineMapCityListAdapter">
<TextView
android:id="@+id/offline_map_city_name"
style="@style/map_size_font_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="省市名称"
style="@style/map_size_font_style"
android:textSize="@dimen/default_font_size" />
<TextView
@ -24,19 +24,19 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/offline_map_city_name"
android:drawableLeft="@mipmap/point_blue"
android:layout_marginTop="5dp"
android:textColor="@color/gray_121"
android:text="文件大小" />
android:drawableLeft="@mipmap/point_blue"
android:text="文件大小"
android:textColor="@color/gray_121" />
<TextView
android:id="@+id/offline_map_download_btn"
style="@style/map_download_style_btn"
android:layout_width="60dp"
android:layout_alignTop="@id/offline_map_city_name"
android:layout_alignBottom="@id/offline_map_city_size"
android:layout_alignParentRight="true"
android:layout_gravity="center_vertical"
android:gravity="center"
android:shadowColor="@android:color/transparent"
android:text="下载"
android:textColor="@color/btn_blue_solid"
@ -44,6 +44,7 @@
<TextView
android:id="@+id/tv_city_list_status"
style="@style/content_font_default_size_13sp"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_centerVertical="true"
@ -51,8 +52,7 @@
android:layout_toLeftOf="@id/offline_map_download_btn"
android:clickable="true"
android:focusable="false"
android:shadowColor="@android:color/transparent"
style="@style/content_font_default_size_13sp" />
android:shadowColor="@android:color/transparent" />
<com.navinfo.omqs.ui.widget.MyProgressBar
android:id="@+id/offline_map_progress"
@ -60,7 +60,7 @@
android:layout_width="match_parent"
android:layout_height="16dp"
android:layout_below="@id/offline_map_download_btn"
android:progressDrawable="@drawable/progress_bg"
android:paddingTop="10dp"
android:progressDrawable="@drawable/progress_bg"
android:visibility="invisible" />
</RelativeLayout>

View File

@ -15,10 +15,9 @@
android:id="@+id/task_name"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_toLeftOf="@id/task_download_btn"
android:layout_marginRight="5dp"
android:text="任务名称"
android:textColor="@color/white"
android:textSize="@dimen/default_font_size" />
android:textSize="12sp" />
<TextView
android:id="@+id/task_city_name"
@ -35,9 +34,10 @@
style="@style/map_size_font_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_toRightOf="@id/task_city_name"
android:layout_alignTop="@id/task_city_name"
android:layout_marginLeft="5dp"
android:layout_marginRight="5dp"
android:layout_below="@id/task_city_name"
android:layout_toLeftOf="@id/task_upload_btn"
android:layout_alignParentLeft="true"
android:text="版本号"
android:textSize="@dimen/card_title_font_3size" />
@ -46,9 +46,8 @@
style="@style/map_size_font_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/task_city_name"
android:layout_below="@id/task_data_version"
android:layout_marginTop="5dp"
android:drawableLeft="@mipmap/point_blue"
android:text="路线颜色"
android:textSize="@dimen/card_title_font_3size" />