Merge branch 'master' of gitlab.navinfo.com:CollectVehicle/OneMapQS

 Conflicts:
	app/src/main/java/com/navinfo/omqs/ui/activity/map/MainViewModel.kt
	app/src/main/res/layout/adapter_sign.xml
This commit is contained in:
squallzhjch 2023-06-02 14:17:05 +08:00
commit ebc4ddf5a9
13 changed files with 131 additions and 64 deletions

View File

@ -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")
}

View File

@ -79,11 +79,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)
}
}
@ -264,7 +265,7 @@ class MainActivity : BaseActivity() {
//开启定位
mapController.locationLayerHandler.startLocation()
mapController.mMapView.setLogoVisable(View.GONE)
//启动轨迹存储
// viewModel.startSaveTraceThread(this)

View File

@ -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,45 +213,50 @@ 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")
@ -275,17 +283,18 @@ 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)
}
Log.e("jingo", "自动捕捉数据 共${signList.size}")
}else{
mapController.lineHandler.removeLine()
}
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{
mapController.lineHandler.removeLine()
}
}
}
@ -469,6 +478,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()

View File

@ -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)
}
}
}

View File

@ -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()
}

View File

@ -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()
}
}
}

Binary file not shown.

After

Width:  |  Height:  |  Size: 704 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 988 B

View File

@ -117,6 +117,8 @@
tools:ignore="TouchTargetSizeCheck" />
</com.google.android.material.textfield.TextInputLayout>
<TextView
android:id="@+id/tv_login_forget_passwd"
android:layout_width="match_parent"

View File

@ -62,4 +62,15 @@
android:layout_toRightOf="@id/sign_main_bg"
android:background="@drawable/icon_sign_info"
android:visibility="gone" />
<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>

View File

@ -1,5 +1,5 @@
<resources>
<dimen name="fab_margin">200dp</dimen>
<dimen name="fab_margin">48dp</dimen>
<dimen name="top_right_drawer_btns_wh" comment="地图主页右上角抽屉按钮的大小">54dp</dimen>
<dimen name="top_right_drawer_wh" comment="地图主页右上角抽屉的把手按钮的大小">42dp</dimen>
<dimen name="top_right_drawer_btns_mr" comment="地图主页右上角抽屉按钮距离右侧间距">44dp</dimen>

View File

@ -800,6 +800,17 @@ public final class NIMapView extends RelativeLayout {
}
}
/**
* 设置logo显隐
*
* @param position 按钮位置
*/
public void setLogoVisable(int visable) {
if (logoImage != null) {
logoImage.setVisibility(visable);
}
}
/**
* 设置缩放按钮位置
*

1
vtm Submodule

@ -0,0 +1 @@
Subproject commit dd13e533c38b5738ab404c2737d7ccadeff01323