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

View File

@ -1,7 +1,10 @@
package com.navinfo.omqs.bean
import android.os.Parcelable
import com.google.gson.annotations.SerializedName
import kotlinx.android.parcel.Parcelize
@Parcelize
data class EvaluationInfo(
@SerializedName("evaluationTaskId")
val evaluationTaskId: String = "",//测评任务id
@ -46,5 +49,5 @@ data class EvaluationInfo(
@SerializedName("evaluationWay")
val evaluationWay: String = ""//测评方式
)
) : Parcelable

View File

@ -24,6 +24,7 @@ import io.realm.Realm
import kotlinx.coroutines.*
import okhttp3.OkHttpClient
import okhttp3.logging.HttpLoggingInterceptor
import retrofit2.Call
import retrofit2.Retrofit
import retrofit2.converter.gson.GsonConverterFactory
import java.util.concurrent.TimeUnit
@ -66,7 +67,7 @@ class GlobalModule {
}.apply {
level = if (Constant.DEBUG) {
//坑 下载文件时打印log 内存不足
HttpLoggingInterceptor.Level.BASIC
HttpLoggingInterceptor.Level.BODY
} else {
HttpLoggingInterceptor.Level.NONE
}
@ -92,9 +93,12 @@ class GlobalModule {
@Singleton
fun provideGson(): Gson = GsonBuilder()
// 解决解析Json时将int类型自动转换为Double的问题
.registerTypeAdapter(object : TypeToken<Map<String, Any?>>() {}.getType(), IntTypeAdapter())
.registerTypeAdapter(object : TypeToken<Map<String, Any>>() {}.getType(), IntTypeAdapter())
.registerTypeAdapter(object : TypeToken<Map<Any, Any>>() {}.getType(), IntTypeAdapter())
.registerTypeAdapter(object : TypeToken<Map<String, Any?>>() {}.type, IntTypeAdapter())
.registerTypeAdapter(object : TypeToken<Map<String, Any>>() {}.type, IntTypeAdapter())
.registerTypeAdapter(object : TypeToken<Map<Any, Any>>() {}.type, IntTypeAdapter())
// .registerTypeAdapter(Call::class.java, object : TypeToken<Call<*>>(){
//
// })
.create()
@Provides

View File

@ -58,7 +58,7 @@ interface RetrofitNetworkServiceAPI {
@Headers("Content-Type: application/json")
@POST("/devcp/upload")
suspend fun postRequest(@Body listEvaluationInfo: List<EvaluationInfo>?): Call<ResponseBody>
suspend fun postRequest(@Body listEvaluationInfo: List<EvaluationInfo>?): Response<ResponseBody>
/**
* @FormUrlEncoded 请求格式注解请求实体是一个From表单每个键值对需要使用@Field注解

View File

@ -9,6 +9,7 @@ import androidx.lifecycle.Observer
import com.navinfo.collect.library.data.entity.QsRecordBean
import com.navinfo.omqs.bean.EvaluationInfo
import com.navinfo.omqs.bean.TaskBean
import com.navinfo.omqs.http.NetResult
import com.navinfo.omqs.tools.FileManager
import com.navinfo.omqs.tools.FileManager.Companion.FileUploadStatus
import io.realm.Realm
@ -114,9 +115,16 @@ class TaskUploadScope(
taskBean.hadLinkDvoList.forEach { hadLinkDvoBean ->
val objects = realm.where(QsRecordBean::class.java)
.equalTo("linkId", /*"84207223282277331"*/hadLinkDvoBean.linkPid).findAll()
if(objects.size == 0){
// change(FileUploadStatus.NONE)
return
}
val bodyList: MutableList<EvaluationInfo> = ArrayList()
if (objects != null) {
objects.forEach{
val copyList =realm.copyFromRealm(objects)
copyList.forEach {
val evaluationInfo = EvaluationInfo(
taskBean.id.toString(),
hadLinkDvoBean.linkPid,//"84207223282277331"
@ -137,26 +145,20 @@ class TaskUploadScope(
bodyList.add(evaluationInfo)
}
uploadManager.netApi.postRequest(bodyList).enqueue(object :
Callback<ResponseBody> {
override fun onResponse(
call: Call<ResponseBody>,
response: Response<ResponseBody>
) {
if (response.code() == 200) {
taskBean.syncStatus = FileUploadStatus.DONE
// handle the response
Log.e("qj", "")
change(FileUploadStatus.DONE)
}
}
override fun onFailure(call: Call<ResponseBody>, t: Throwable) {
val result = uploadManager.netApi.postRequest(bodyList)// .enqueue(object :
// Callback<ResponseBody> {
if (result.isSuccessful) {
if (result.code() == 200) {
taskBean.syncStatus = FileUploadStatus.DONE
// handle the response
change(FileUploadStatus.DONE)
} else {
// handle the failure
Log.e("qj", "")
change(FileUploadStatus.ERROR)
}
})
} else {
change(FileUploadStatus.ERROR)
}
}
}

View File

@ -17,8 +17,9 @@ class LayerConfigUtils {
fun getLayerConfigList(): List<ImportConfig> {
// 首先读取Shared文件如果存在则直接返回否则读取config文件
return SPStaticUtils.getString(Constant.EVENT_LAYER_MANAGER_CHANGE, null).let {
if (it!=null) {
val result: List<ImportConfig> = gson.fromJson(it, object : TypeToken<List<ImportConfig>>(){}.type)
if (it != null) {
val result: List<ImportConfig> =
gson.fromJson(it, object : TypeToken<List<ImportConfig>>() {}.type)
result
} else {
LayerConfigUtils.getLayerConfigListFromAssetsFile()
@ -30,12 +31,13 @@ class LayerConfigUtils {
val resultList = mutableListOf<ImportConfig>()
if (omdbConfigFile.exists()) {
val omdbConfiStr = FileIOUtils.readFile2String(omdbConfigFile)
val omdbConfig = gson.fromJson<ImportConfig>(omdbConfiStr, ImportConfig::class.java)
val omdbConfig = gson.fromJson<ImportConfig>(omdbConfiStr, ImportConfig::class.java)
resultList.add(omdbConfig)
}
if (otherConfigFile.exists()) {
val otherConfiStr = FileIOUtils.readFile2String(otherConfigFile)
val otherConfig = gson.fromJson<ImportConfig>(otherConfiStr, ImportConfig::class.java)
val otherConfig =
gson.fromJson<ImportConfig>(otherConfiStr, ImportConfig::class.java)
resultList.add(otherConfig)
}
return resultList

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

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:color="@color/white" />
<item android:state_pressed="true" android:color="@color/white" />
<item android:state_selected="true" android:color="@color/white" />
<item android:state_checked="true" android:color="@color/white" />
<item android:color="@color/black" />
</selector>

View File

@ -0,0 +1,6 @@
<?xml version="1.0" encoding="utf-8"?>
<ripple
xmlns:android="http://schemas.android.com/apk/res/android"
android:color="@color/ripple_color">
<item android:drawable="@drawable/shape_btn_check"/>
</ripple>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<selector xmlns:android="http://schemas.android.com/apk/res/android">
<item android:state_enabled="false" android:drawable="@drawable/ripple_btn_normal"></item>
<item android:state_checked="true" android:drawable="@drawable/ripple_btn_normal"/>
<item android:state_pressed="true" android:drawable="@drawable/ripple_btn_normal"/>
<item android:state_selected="true" android:drawable="@drawable/ripple_btn_normal"></item>
<item android:drawable="@drawable/ripple_btn_checked"/>
</selector>

View File

@ -0,0 +1,8 @@
<?xml version="1.0" encoding="utf-8"?>
<shape
xmlns:android="http://schemas.android.com/apk/res/android"
android:shape="rectangle">
<solid android:color="@color/colorSurface"></solid>
<stroke android:color="@color/gray_121" android:width="0.1dp"></stroke>
<corners android:radius="30dp" />
</shape>

View File

@ -4,46 +4,88 @@
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:background="@color/design_default_color_background"
android:background="@color/bg_left_pannel"
tools:context=".ui.fragment.offlinemap.OfflineMapFragment">
<com.google.android.material.tabs.TabLayout
android:id="@+id/offline_map_tab_layout"
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/title_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/blue"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent">
<com.google.android.material.tabs.TabItem
app:layout_constraintTop_toTopOf="parent"
style="@style/left_pannel_title_layout">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/offline_map_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="下载管理" />
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"
android:layout_marginTop="5dp"
app:layout_constraintBottom_toBottomOf="parent"
android:background="@drawable/selector_bg_round_button"
android:foreground="@drawable/ripple_btn_press"
style="@style/btn_round"
android:src="@drawable/ic_baseline_keyboard_arrow_left_24"></androidx.appcompat.widget.AppCompatImageView>
<com.google.android.material.tabs.TabItem
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="城市列表" />
</com.google.android.material.tabs.TabLayout>
android:textSize="@dimen/left_pannel_title_font"
android:textStyle="bold"
android:text="离线地图"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintBottom_toBottomOf="parent"></androidx.appcompat.widget.AppCompatTextView>
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/offline_map_viewpager"
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.cardview.widget.CardView
android:layout_width="match_parent"
android:layout_height="0dp"
app:layout_constraintTop_toBottomOf="@id/title_layout"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/offline_map_tab_layout" />
style="@style/default_card_view">
<LinearLayout
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingVertical="@dimen/default_widget_padding"
android:orientation="vertical">
<com.google.android.material.tabs.TabLayout
android:id="@+id/offline_map_tab_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:background="@color/transparent"
app:tabBackground="@drawable/selector_bg_gradient_checkbox"
app:tabTextColor="@color/black"
app:tabGravity="center"
app:tabPadding="0dp"
app:tabIndicator="@null"
app:tabMode="scrollable"
app:tabIndicatorHeight="0dp"
app:tabSelectedTextColor="@color/white"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@id/title_layout">
<ImageView
android:id="@+id/offline_map_back"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginLeft="10dp"
android:padding="10dp"
android:src="@mipmap/icon_back_n"
app:layout_constraintBottom_toBottomOf="@id/offline_map_tab_layout"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="@id/offline_map_tab_layout" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/default_widget_padding"
android:text="下载管理" />
<com.google.android.material.tabs.TabItem
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginHorizontal="@dimen/default_widget_padding"
android:text="城市列表" />
</com.google.android.material.tabs.TabLayout>
<androidx.viewpager2.widget.ViewPager2
android:id="@+id/offline_map_viewpager"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@id/offline_map_tab_layout" />
</LinearLayout>
</androidx.cardview.widget.CardView>
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@ -115,6 +115,15 @@
<item name="android:paddingBottom">1dp</item>
</style>
<style name="checked_gradient_color" parent="TextAppearance.AppCompat.Button">
<item name="android:textColor">@color/selector_default_text_color_black_enable_white</item>
<item name="android:background">@drawable/selector_bg_gradient_checkbox</item>
<item name="android:clickable">true</item>
<item name="android:focusable">true</item>
<item name="android:gravity">center</item>
<item name="android:paddingBottom">1dp</item>
</style>
<style name="fm_btn_default_blue_white" parent="@android:style/Widget.Button">
<item name="android:background">@drawable/selector_bg_blue_gray_bg_4_radius</item>
<item name="android:textColor">@color/selector_default_text_color_white_enable_gray</item>

View File

@ -591,8 +591,9 @@ public final class NIMapView extends RelativeLayout {
BASE(0)/*底图图层组*/,
VECTOR_TILE(1)/*矢量瓦片组*/,
VECTOR(2)/*高亮组*/,
OPERATE(3)/*操作图层组*/,
NAVIGATION(4)/*定位导航组*/;
OPERATE_LINE(3)/*操作图层组*/,
OPERATE_MARKER(4)/*操作图层组*/,
NAVIGATION(5)/*定位导航组*/;
int groupIndex;

View File

@ -39,6 +39,9 @@ class LineHandler(context: AppCompatActivity, mapView: NIMapView) : BaseHandler(
//绘制线 样式
private val lineStyle: Style
//高亮线绘制线 样式
private val defaultLineStyle: Style
//线型编辑时的样式
private val editTempStyle: Style
@ -60,14 +63,16 @@ class LineHandler(context: AppCompatActivity, mapView: NIMapView) : BaseHandler(
private val mDefaultPathLayer: PathLayer
val omdbTaskLinkLayer by lazy {
val omdbTaskLinkLayer = OmdbTaskLinkLayer(mMapView.vtmMap,
val omdbTaskLinkLayer = OmdbTaskLinkLayer(
mMapView.vtmMap,
Style.builder()
// .stippleColor(context.resources.getColor(R.color.draw_line_red_color, null))
.fillColor(context.resources.getColor(R.color.draw_line_red_color, null))
.fillAlpha(0.5f)
.strokeColor(context.resources.getColor(R.color.draw_line_red_color, null))
.fillColor(context.resources.getColor(R.color.draw_line_red_color, null))
.fillAlpha(0.5f)
.strokeColor(context.resources.getColor(R.color.draw_line_red_color, null))
.strokeWidth(4f)
.fixed(true).build())
.fixed(true).build()
)
addLayer(omdbTaskLinkLayer, NIMapView.LAYER_GROUPS.VECTOR)
omdbTaskLinkLayer
}
@ -84,6 +89,15 @@ class LineHandler(context: AppCompatActivity, mapView: NIMapView) : BaseHandler(
.strokeColor(context.resources.getColor(R.color.draw_line_blue2_color, null))
.fixed(true).build()
defaultLineStyle = Style.builder()
.stippleColor(context.resources.getColor(R.color.draw_line_blue2_color, null))
.strokeWidth(10f)
.fillColor(context.resources.getColor(R.color.teal_200, null))
.fillAlpha(0.5f)
.strokeColor(context.resources.getColor(R.color.teal_200, null))
.fixed(true).build()
newTempStyle =
Style.builder().stippleColor(context.resources.getColor(R.color.transparent, null))
.stipple(30).stippleWidth(30f).strokeWidth(4f)
@ -95,8 +109,8 @@ class LineHandler(context: AppCompatActivity, mapView: NIMapView) : BaseHandler(
.stipple(30).stippleWidth(30f).strokeWidth(8f)
.strokeColor(context.resources.getColor(R.color.draw_line_red_color, null))
.fixed(true).randomOffset(false).build()
mDefaultPathLayer = PathLayer(mMapView.vtmMap, lineStyle)
addLayer(mDefaultPathLayer, NIMapView.LAYER_GROUPS.VECTOR)
mDefaultPathLayer = PathLayer(mMapView.vtmMap, defaultLineStyle)
addLayer(mDefaultPathLayer, NIMapView.LAYER_GROUPS.OPERATE_LINE)
mPathLayer = PathLayer(mMapView.vtmMap, lineStyle)
// addLayer(mPathLayer, NIMapView.LAYER_GROUPS.OPERATE)

View File

@ -93,7 +93,7 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
//初始化之间数据图层
initQsRecordDataLayer()
addLayer(mDefaultMarkerLayer, NIMapView.LAYER_GROUPS.OPERATE);
addLayer(mDefaultMarkerLayer, NIMapView.LAYER_GROUPS.OPERATE_MARKER);
// 设置矢量图层均在12级以上才显示
mMapView.vtmMap.events.bind(Map.UpdateListener { e, mapPosition ->
if (e == Map.SCALE_EVENT) {
@ -259,7 +259,7 @@ class MarkHandler(context: AppCompatActivity, mapView: NIMapView) :
return true
}
})
addLayer(itemizedLayer, NIMapView.LAYER_GROUPS.OPERATE)
addLayer(itemizedLayer, NIMapView.LAYER_GROUPS.OPERATE_MARKER)
mContext.lifecycleScope.launch(Dispatchers.IO) {
var list = mutableListOf<QsRecordBean>()
val realm = Realm.getDefaultInstance()

View File

@ -116,7 +116,7 @@ open class MeasureLayerHandler(context: AppCompatActivity, mapView: NIMapView) :
mPathLayer = PathLayer(mMapView.vtmMap, lineStyle)
addLayer(mPathLayer, NIMapView.LAYER_GROUPS.OPERATE)
addLayer(mPathLayer, NIMapView.LAYER_GROUPS.OPERATE_LINE)
}