This commit is contained in:
qiji4215
2023-05-05 16:58:22 +08:00
16 changed files with 190 additions and 74 deletions

View File

@@ -91,6 +91,8 @@ class EvaluationResultViewModel @Inject constructor(
var mSoundMeter: SoundMeter? = null
var classTypeTemp: String = ""
init {
liveDataQsRecordBean.value = QsRecordBean(id = UUID.randomUUID().toString())
Log.e("jingo", "EvaluationResultViewModel 创建了 ${hashCode()}")
@@ -118,7 +120,7 @@ class EvaluationResultViewModel @Inject constructor(
/**
* 查询数据库,获取问题分类
*/
fun initNewData(bean: SignBean?,filePath: String) {
fun initNewData(bean: SignBean?, filePath: String) {
viewModelScope.launch(Dispatchers.IO) {
getClassTypeList()
getProblemLinkList()
@@ -128,6 +130,7 @@ class EvaluationResultViewModel @Inject constructor(
geoPoint?.let {
liveDataQsRecordBean.value!!.geometry = GeometryTools.createGeometry(it).toText()
mapController.markerHandle.addMarker(geoPoint, markerTitle)
mapController.animationHandler.animationByLonLat(geoPoint.latitude,geoPoint.longitude)
viewModelScope.launch {
captureLink(geoPoint.longitude, geoPoint.latitude)
}
@@ -148,6 +151,8 @@ class EvaluationResultViewModel @Inject constructor(
}
}
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)
}
@@ -171,6 +176,7 @@ class EvaluationResultViewModel @Inject constructor(
it.linkId =
linkList[0].properties[LinkTable.linkPid] ?: ""
mapController.lineHandler.showLine(linkList[0].geometry)
Log.e("jingo", "捕捉到的linkId = ${it.linkId}")
} else {
it.linkId = ""
mapController.lineHandler.removeLine()
@@ -195,6 +201,7 @@ class EvaluationResultViewModel @Inject constructor(
if (liveDataQsRecordBean.value!!.classType.isEmpty()) {
Log.e("jingo", "getClassTypeList $classType")
liveDataQsRecordBean.value!!.classType = classType
classTypeTemp = classType
}
getProblemList(classType)
}
@@ -284,12 +291,14 @@ class EvaluationResultViewModel @Inject constructor(
viewModelScope.launch(Dispatchers.IO) {
getProblemList(classType)
}
classTypeTemp = classType
}
/**
* 监听右侧栏的点击事件,修改数据
*/
fun setPhenomenonMiddleBean(adapterBean: RightBean) {
liveDataQsRecordBean.value!!.classType = classTypeTemp
liveDataQsRecordBean.value!!.phenomenon = adapterBean.text
liveDataQsRecordBean.value!!.problemType = adapterBean.title
liveDataQsRecordBean.postValue(liveDataQsRecordBean.value)
@@ -304,7 +313,6 @@ class EvaluationResultViewModel @Inject constructor(
fun saveData() {
viewModelScope.launch(Dispatchers.IO) {
val realm = Realm.getDefaultInstance()
Log.e("jingo", "realm hashCOde ${realm.hashCode()}")
realm.executeTransaction {
it.copyToRealmOrUpdate(liveDataQsRecordBean.value)
}
@@ -385,13 +393,13 @@ class EvaluationResultViewModel @Inject constructor(
fun addChatMsgEntity(filePath: String) {
if(filePath.isNotEmpty()){
if (filePath.isNotEmpty()) {
var chatMsgEntityList: MutableList<ChatMsgEntity> = ArrayList()
if(listDataChatMsgEntityList.value?.isEmpty() == false){
if (listDataChatMsgEntityList.value?.isEmpty() == false) {
chatMsgEntityList = listDataChatMsgEntityList.value!!
}
val chatMsgEntity = ChatMsgEntity()
chatMsgEntity.name = filePath.replace(Constant.USER_DATA_ATTACHEMNT_PATH,"").toString()
chatMsgEntity.name = filePath.replace(Constant.USER_DATA_ATTACHEMNT_PATH, "").toString()
chatMsgEntity.voiceUri = Constant.USER_DATA_ATTACHEMNT_PATH
chatMsgEntityList.add(chatMsgEntity)
@@ -399,7 +407,7 @@ class EvaluationResultViewModel @Inject constructor(
var attachmentList: RealmList<AttachmentBean> = RealmList()
//赋值处理
if(liveDataQsRecordBean.value?.attachmentBeanList?.isEmpty() == false){
if (liveDataQsRecordBean.value?.attachmentBeanList?.isEmpty() == false) {
attachmentList = liveDataQsRecordBean.value?.attachmentBeanList!!
}
@@ -415,7 +423,7 @@ class EvaluationResultViewModel @Inject constructor(
fun startSoundMetter(activity: Activity, v: View) {
if(mSpeakMode==null){
if (mSpeakMode == null) {
mSpeakMode = SpeakMode(activity)
}
@@ -425,7 +433,8 @@ class EvaluationResultViewModel @Inject constructor(
pop!!.width = ViewGroup.LayoutParams.MATCH_PARENT
pop!!.height = ViewGroup.LayoutParams.WRAP_CONTENT
pop!!.setBackgroundDrawable(BitmapDrawable())
val view = View.inflate(activity as Context, R.layout.cv_card_voice_rcd_hint_window, null)
val view =
View.inflate(activity as Context, R.layout.cv_card_voice_rcd_hint_window, null)
pop!!.contentView = view
volume = view.findViewById(R.id.volume)
}