1.解决新增问题后点击获取数据无效2.预警面板增加快速问题记录
This commit is contained in:
parent
6cc0a20aa6
commit
5f953aa816
@ -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,80 +213,92 @@ class MainViewModel @Inject constructor(
|
||||
val linkList = realmOperateHelper.queryLink(
|
||||
point = point,
|
||||
)
|
||||
//看板数据
|
||||
val signList = mutableListOf<SignBean>()
|
||||
val topSignList = mutableListOf<SignBean>()
|
||||
mapController.lineHandler.linksLayer.clear()
|
||||
if (linkList.isNotEmpty()) {
|
||||
//看板数据
|
||||
val signList = mutableListOf<SignBean>()
|
||||
val topSignList = mutableListOf<SignBean>()
|
||||
mapController.lineHandler.linksLayer.clear()
|
||||
|
||||
val link = linkList[0]
|
||||
|
||||
val linkId = link.properties[RenderEntity.Companion.LinkTable.linkPid]
|
||||
Log.e("jingo", "捕捉到的linkid $linkId ${link.geometry}")
|
||||
mapController.lineHandler.showLine(link.geometry)
|
||||
linkId?.let {
|
||||
var elementList = realmOperateHelper.queryLinkByLinkPid(it)
|
||||
for (element in elementList) {
|
||||
val distance = GeometryTools.distanceToDouble(
|
||||
point, GeometryTools.createGeoPoint(element.geometry)
|
||||
)
|
||||
|
||||
val signBean = SignBean(
|
||||
iconId = SignUtil.getSignIcon(element),
|
||||
iconText = SignUtil.getSignIconText(element),
|
||||
distance = distance.toInt(),
|
||||
elementId = element.id,
|
||||
linkId = linkId,
|
||||
geometry = element.geometry,
|
||||
name = SignUtil.getSignNameText(element),
|
||||
bottomRightText = SignUtil.getSignBottomRightText(element),
|
||||
elementCode = element.code
|
||||
)
|
||||
if(linkIdCache!=linkId){
|
||||
|
||||
when (element.code) {
|
||||
2002, 2008, 2010, 2041 -> topSignList.add(
|
||||
signBean
|
||||
Log.e("jingo", "捕捉到的linkid $linkId ${link.geometry}")
|
||||
mapController.lineHandler.showLine(link.geometry)
|
||||
linkId?.let {
|
||||
var elementList = realmOperateHelper.queryLinkByLinkPid(it)
|
||||
for (element in elementList) {
|
||||
val distance = GeometryTools.distanceToDouble(
|
||||
point, GeometryTools.createGeoPoint(element.geometry)
|
||||
)
|
||||
4002, 4003, 4004, 4022 -> signList.add(
|
||||
signBean
|
||||
|
||||
val signBean = SignBean(
|
||||
iconId = SignUtil.getSignIcon(element),
|
||||
iconText = SignUtil.getSignIconText(element),
|
||||
distance = distance.toInt(),
|
||||
elementId = element.id,
|
||||
linkId = linkId,
|
||||
geometry = element.geometry,
|
||||
name = SignUtil.getSignNameText(element),
|
||||
bottomRightText = SignUtil.getSignBottomRightText(element),
|
||||
elementCode = element.code
|
||||
)
|
||||
|
||||
when (element.code) {
|
||||
2002, 2008, 2010, 2041 -> topSignList.add(
|
||||
signBean
|
||||
)
|
||||
4002, 4003, 4004, 4022 -> signList.add(
|
||||
signBean
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
val realm = Realm.getDefaultInstance()
|
||||
val entity = realm.where(RenderEntity::class.java)
|
||||
.equalTo("table", "OMDB_RESTRICTION")
|
||||
.and()
|
||||
.equalTo(
|
||||
"properties['linkIn']",
|
||||
it
|
||||
).findFirst()
|
||||
if (entity != null) {
|
||||
val outLink = entity.properties["linkOut"]
|
||||
val linkOutEntity = realm.where(RenderEntity::class.java)
|
||||
.equalTo("table", "OMDB_RD_LINK")
|
||||
val realm = Realm.getDefaultInstance()
|
||||
val entity = realm.where(RenderEntity::class.java)
|
||||
.equalTo("table", "OMDB_RESTRICTION")
|
||||
.and()
|
||||
.equalTo(
|
||||
"properties['${RenderEntity.Companion.LinkTable.linkPid}']",
|
||||
outLink
|
||||
"properties['linkIn']",
|
||||
it
|
||||
).findFirst()
|
||||
if (linkOutEntity != null) {
|
||||
mapController.lineHandler.linksLayer.addLine(
|
||||
linkOutEntity.geometry,
|
||||
0x7DFF0000
|
||||
)
|
||||
Log.e("jingo", "捕捉到的linkid $outLink ${linkOutEntity.geometry}")
|
||||
if (entity != null) {
|
||||
val outLink = entity.properties["linkOut"]
|
||||
val linkOutEntity = realm.where(RenderEntity::class.java)
|
||||
.equalTo("table", "OMDB_RD_LINK")
|
||||
.and()
|
||||
.equalTo(
|
||||
"properties['${RenderEntity.Companion.LinkTable.linkPid}']",
|
||||
outLink
|
||||
).findFirst()
|
||||
if (linkOutEntity != null) {
|
||||
mapController.lineHandler.linksLayer.addLine(
|
||||
linkOutEntity.geometry,
|
||||
0x7DFF0000
|
||||
)
|
||||
Log.e("jingo", "捕捉到的linkid $outLink ${linkOutEntity.geometry}")
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
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("未捕捉到数据")
|
||||
}
|
||||
liveDataTopSignList.postValue(topSignList.distinctBy { it.elementCode })
|
||||
liveDataSignList.postValue(signList.distinctBy { it.elementCode })
|
||||
val speechText = SignUtil.getRoadSpeechText(topSignList)
|
||||
withContext(Dispatchers.Main) {
|
||||
speakMode?.speakText(speechText)
|
||||
}
|
||||
Log.e("jingo", "自动捕捉数据 共${signList.size}条")
|
||||
}
|
||||
}
|
||||
|
||||
@ -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,28 +363,35 @@ 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()
|
||||
|
||||
if (objects != null) {
|
||||
oldBean = realm.copyFromRealm(objects)
|
||||
oldBean?.let {
|
||||
liveDataQsRecordBean.postValue(it.copy())
|
||||
val p = GeometryTools.createGeoPoint(it.geometry)
|
||||
mapController.markerHandle.addMarker(
|
||||
GeoPoint(p.latitude, p.longitude), markerTitle
|
||||
)
|
||||
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 = bgRealm.copyFromRealm(objects)
|
||||
oldBean?.let {
|
||||
liveDataQsRecordBean.postValue(it.copy())
|
||||
val p = GeometryTools.createGeoPoint(it.geometry)
|
||||
mapController.markerHandle.addMarker(GeoPoint(p.latitude, p.longitude), markerTitle)
|
||||
|
||||
if (it.linkId.isNotEmpty()) {
|
||||
val link = realmOperateHelper.queryLink(it.linkId)
|
||||
link?.let { l ->
|
||||
mapController.lineHandler.showLine(l.geometry)
|
||||
//获取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()
|
||||
}
|
||||
}
|
||||
}
|
||||
// 显示语音数据到界面
|
||||
getChatMsgEntityList()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
BIN
app/src/main/res/drawable-xhdpi/icon_evaluation.png
Normal file
BIN
app/src/main/res/drawable-xhdpi/icon_evaluation.png
Normal file
Binary file not shown.
After Width: | Height: | Size: 704 B |
BIN
app/src/main/res/drawable-xxhdpi/icon_evaluation.png
Normal file
BIN
app/src/main/res/drawable-xxhdpi/icon_evaluation.png
Normal file
Binary file not shown.
After Width: | Height: | 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>
|
Loading…
x
Reference in New Issue
Block a user