1.解决新增问题后点击获取数据无效2.预警面板增加快速问题记录

This commit is contained in:
qiji4215 2023-06-02 13:57:50 +08:00
parent 6cc0a20aa6
commit 5f953aa816
9 changed files with 138 additions and 79 deletions
app/src/main

@ -76,7 +76,7 @@ class LoginViewModel @Inject constructor(
var jobLogin: Job? = null;
init {
loginUser.value = LoginUserBean(userCode = "02911", passWord = "123456")
loginUser.value = LoginUserBean(userCode = "haofuyue00213", passWord = "123456")
}

@ -75,11 +75,12 @@ class MainActivity : BaseActivity() {
* 提前显示要素看板
*/
private val signAdapter by lazy {
SignAdapter { position, signBean ->
SignAdapter { position, autoSave,signBean ->
rightController.currentDestination?.let {
if (it.id == R.id.RightEmptyFragment) {
val bundle = Bundle()
bundle.putParcelable("SignBean", signBean)
bundle.putBoolean("AutoSave", autoSave)
rightController.navigate(R.id.EvaluationResultFragment, bundle)
}
}

@ -85,6 +85,7 @@ class MainViewModel @Inject constructor(
//录音图标
var volume: ImageView? = null
var mSoundMeter: SoundMeter? = null
var menuState: Boolean = false
@ -98,6 +99,8 @@ class MainViewModel @Inject constructor(
*/
private var bSelectRoad = false
private var linkIdCache = ""
init {
mapController.mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
when (e) {
@ -210,13 +213,18 @@ class MainViewModel @Inject constructor(
val linkList = realmOperateHelper.queryLink(
point = point,
)
if (linkList.isNotEmpty()) {
//看板数据
val signList = mutableListOf<SignBean>()
val topSignList = mutableListOf<SignBean>()
mapController.lineHandler.linksLayer.clear()
if (linkList.isNotEmpty()) {
val link = linkList[0]
val linkId = link.properties[RenderEntity.Companion.LinkTable.linkPid]
if(linkIdCache!=linkId){
Log.e("jingo", "捕捉到的linkid $linkId ${link.geometry}")
mapController.lineHandler.showLine(link.geometry)
linkId?.let {
@ -276,14 +284,21 @@ class MainViewModel @Inject constructor(
}
}
}
liveDataTopSignList.postValue(topSignList.distinctBy { it.elementCode })
liveDataSignList.postValue(signList.distinctBy { it.elementCode })
val speechText = SignUtil.getRoadSpeechText(topSignList)
withContext(Dispatchers.Main) {
speakMode?.speakText(speechText)
}
}
linkIdCache = linkId ?: ""
Log.e("jingo", "自动捕捉数据 共${signList.size}")
}else{
ToastUtils.showLong("未捕捉到数据")
}
}
}
@ -483,6 +498,8 @@ class MainViewModel @Inject constructor(
*/
fun setSelectRoad(select: Boolean) {
bSelectRoad = select
//去掉缓存
linkIdCache = ""
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.M) {
mapController.lineHandler.removeLine()
liveDataSignList.value = mutableListOf()

@ -8,7 +8,7 @@ import com.navinfo.omqs.databinding.AdapterSignBinding
import com.navinfo.omqs.ui.other.BaseRecyclerViewAdapter
import com.navinfo.omqs.ui.other.BaseViewHolder
class SignAdapter(private var itemListener: ((Int, SignBean) -> Unit?)? = null) :
class SignAdapter(private var itemListener: ((Int, Boolean, SignBean) -> Unit?)? = null) :
BaseRecyclerViewAdapter<SignBean>() {
override fun getItemViewRes(position: Int): Int {
return R.layout.adapter_sign
@ -27,9 +27,12 @@ class SignAdapter(private var itemListener: ((Int, SignBean) -> Unit?)? = null)
bd.signMainIconBg.setImageResource(item.iconId)
bd.signMainIcon.text = item.iconText
bd.signBottomText.text = item.name
bd.signMainFastError.setOnClickListener{
itemListener?.invoke(position, true,item)
}
bd.signBottomRightText.text = item.bottomRightText
bd.root.setOnClickListener {
itemListener?.invoke(position, item)
itemListener?.invoke(position, false,item)
}
}
}

@ -102,12 +102,18 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
voiceOnTouchStart()//Do Something
Log.e("qj", "voiceOnTouchStart")
}
MotionEvent.ACTION_UP -> {
voiceOnTouchStop()//Do Something
Log.e("qj", "voiceOnTouchStop")
Log.e("qj", "ACTION_UP")
}
MotionEvent.ACTION_CANCEL -> {
voiceOnTouchStop()//Do Something
Log.e("qj", "ACTION_CANCEL")
}
}
return v?.onTouchEvent(event) ?: true
return true
}
})
@ -117,18 +123,26 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
// val id = args.qsId
var id = ""
var signBean: SignBean? = null
var autoSave: Boolean = false
var filePath: String = ""
arguments?.let {
id = it.getString("QsId", "")
filePath = it.getString("filePath", "")
try {
signBean = it.getParcelable("SignBean")
autoSave = it.getBoolean("AutoSave")
} catch (e: java.lang.Exception) {
}
}
if (id == null || id.isEmpty()) {
viewModel.initNewData(signBean, filePath)
//增加监听,联动列表自动保存
viewModel.liveDataRightTypeList.observe(viewLifecycleOwner) {
if (autoSave) {
viewModel.saveData()
}
}
} else {
viewModel.initData(id)
}
@ -288,6 +302,7 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
}
}
else -> {}
}
}
@ -299,6 +314,7 @@ class EvaluationResultFragment : BaseFragment(), View.OnClickListener {
@RequiresApi(Build.VERSION_CODES.Q)
fun voiceOnTouchStop() {
Log.e("qj", "voiceOnTouchStop====${Constant.IS_VIDEO_SPEED}")
if (Constant.IS_VIDEO_SPEED) {
viewModel.stopSoundMeter()
}

@ -34,8 +34,12 @@ import com.navinfo.omqs.util.DateTimeUtil
import com.navinfo.omqs.util.SoundMeter
import com.navinfo.omqs.util.SpeakMode
import dagger.hilt.android.lifecycle.HiltViewModel
import io.realm.OrderedCollectionChangeSet
import io.realm.Realm
import io.realm.RealmList
import io.realm.RealmModel
import io.realm.RealmResults
import io.realm.kotlin.addChangeListener
import io.realm.kotlin.where
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
@ -359,32 +363,39 @@ class EvaluationResultViewModel @Inject constructor(
fun initData(id: String) {
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.N) {
viewModelScope.launch(Dispatchers.IO) {
val realm = Realm.getDefaultInstance()
val objects = realm.where<QsRecordBean>().equalTo("id", id).findFirst()
viewModelScope.launch(Dispatchers.IO) {
Realm.getDefaultInstance().use { realm ->
realm.executeTransactionAsync { bgRealm ->
// find the item
val objects = bgRealm.where(QsRecordBean::class.java).equalTo("id", id).findFirst()
if (objects != null) {
oldBean = realm.copyFromRealm(objects)
oldBean = bgRealm.copyFromRealm(objects)
oldBean?.let {
liveDataQsRecordBean.postValue(it.copy())
val p = GeometryTools.createGeoPoint(it.geometry)
mapController.markerHandle.addMarker(
GeoPoint(p.latitude, p.longitude), markerTitle
)
mapController.markerHandle.addMarker(GeoPoint(p.latitude, p.longitude), markerTitle)
//获取linkid
if (it.linkId.isNotEmpty()) {
viewModelScope.launch(Dispatchers.IO) {
val link = realmOperateHelper.queryLink(it.linkId)
link?.let { l ->
mapController.lineHandler.showLine(l.geometry)
}
}
}
liveDataQsRecordBean.value?.attachmentBeanList = it.attachmentBeanList
// 显示语音数据到界面
getChatMsgEntityList()
}
}
}
}
}
}
}
/**
* 查询问题类型列表

Binary file not shown.

After

(image error) Size: 704 B

Binary file not shown.

After

(image error) Size: 988 B

@ -47,4 +47,15 @@
android:layout_alignParentRight="true"
android:layout_marginRight="15dp"
android:textSize="14sp"/>
<ImageView
android:id="@+id/sign_main_fast_error"
android:layout_marginRight="4dp"
android:layout_marginTop="4dp"
android:layout_alignParentRight="true"
android:layout_alignParentTop="true"
android:background="@drawable/icon_evaluation"
android:layout_width="wrap_content"
android:layout_height="wrap_content"/>
</RelativeLayout>