调整离线地图UI,任务列表UI,个人中心UI

This commit is contained in:
squallzhjch
2023-06-16 15:16:10 +08:00
parent 6cd9bab9e1
commit 083a6fd57a
31 changed files with 312 additions and 405 deletions

View File

@@ -23,6 +23,7 @@ import com.navinfo.collect.library.map.NIMapController
import com.navinfo.omqs.Constant
import com.navinfo.omqs.R
import com.navinfo.omqs.bean.ImportConfig
import com.navinfo.omqs.bean.SignBean
import com.navinfo.omqs.databinding.ActivityMainBinding
import com.navinfo.omqs.http.offlinemapdownload.OfflineMapDownloadManager
import com.navinfo.omqs.tools.LayerConfigUtils
@@ -67,9 +68,7 @@ class MainActivity : BaseActivity() {
registerForActivityResult(ActivityResultContracts.StartActivityForResult()) { result ->
if (result.resultCode == Activity.RESULT_OK) {
val data: Intent? = result.data
Log.e("jingo", "MainActivity someActivityResultLauncher RESULT_OK")
} else {
Log.e("jingo", "MainActivity someActivityResultLauncher ${result.resultCode}")
}
}
@@ -88,16 +87,44 @@ class MainActivity : BaseActivity() {
* 提前显示要素看板
*/
private val signAdapter by lazy {
SignAdapter { _, 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)
SignAdapter(object : OnSignAdapterClickListener {
override fun onItemClick(signBean: SignBean) {
rightController.currentDestination?.let {
if (it.id == R.id.RightEmptyFragment) {
val bundle = Bundle()
bundle.putParcelable("SignBean", signBean)
bundle.putBoolean("AutoSave", false)
rightController.navigate(R.id.EvaluationResultFragment, bundle)
}
}
}
}
override fun onMoreInfoClick(selectTag: String, tag: String, signBean: SignBean) {
if (binding.mainActivitySignMoreInfoGroup.visibility != View.VISIBLE || selectTag != tag) {
binding.mainActivitySignMoreInfoGroup.visibility = View.VISIBLE
binding.mainActivitySignMoreInfoTitle.text = signBean.name
binding.mainActivitySignMoreInfoText1.text = signBean.bottomRightText
binding.mainActivitySignMoreInfoText2.text = signBean.moreText
} else {
binding.mainActivitySignMoreInfoGroup.visibility = View.GONE
}
}
override fun onErrorClick(signBean: SignBean) {
rightController.currentDestination?.let {
if (it.id == R.id.RightEmptyFragment) {
val bundle = Bundle()
bundle.putParcelable("SignBean", signBean)
bundle.putBoolean("AutoSave", true)
rightController.navigate(R.id.EvaluationResultFragment, bundle)
}
}
}
override fun onHideMoreInfoView() {
binding.mainActivitySignMoreInfoGroup.visibility = View.GONE
}
})
}
/**
@@ -150,11 +177,9 @@ class MainActivity : BaseActivity() {
when (event?.action) {
MotionEvent.ACTION_DOWN -> {
voiceOnTouchStart()//Do Something
Log.e("qj", "voiceOnTouchStart")
}
MotionEvent.ACTION_UP -> {
voiceOnTouchStop()//Do Something
Log.e("qj", "voiceOnTouchStop")
}
}
v?.onTouchEvent(event) ?: true
@@ -205,9 +230,9 @@ class MainActivity : BaseActivity() {
}
//监听地图中点变化
viewModel.liveDataCenterPoint.observe(this) {
Log.e("qj","${it.longitude}")
try{
if(it!=null&&it.longitude!=null&&it.latitude!=null){
Log.e("qj", "${it.longitude}")
try {
if (it != null && it.longitude != null && it.latitude != null) {
binding.mainActivityGeometry.text = "经纬度:${
BigDecimal(it.longitude).setScale(
7,
@@ -215,8 +240,8 @@ class MainActivity : BaseActivity() {
)
},${BigDecimal(it.latitude).setScale(7, RoundingMode.HALF_UP)}"
}
}catch (e:Exception){
Log.e("qj","异常")
} catch (e: Exception) {
Log.e("qj", "异常 $e")
}
}
@@ -248,7 +273,7 @@ class MainActivity : BaseActivity() {
val view = this.layoutInflater.inflate(R.layout.dialog_view_edittext, null)
val inputDialog = MaterialAlertDialogBuilder(
this
).setTitle("标记原因").setView(view)
).setTitle("坐标定位").setView(view)
var editText = view.findViewById<EditText>(R.id.dialog_edittext)
editText.hint = "请输入经纬度例如:\n116.1234567,39.1234567\n116.1234567 39.1234567"
inputDialog.setNegativeButton("取消") { dialog, _ ->
@@ -260,7 +285,7 @@ class MainActivity : BaseActivity() {
val parts = editText.text.toString().split("[,\\s]".toRegex())
if (parts.size == 2) {
val x = parts[0].toDouble()
val y = parts[0].toDouble()
val y = parts[1].toDouble()
mapController.animationHandler.animationByLatLon(y, x)
} else {
Toast.makeText(this, "输入格式不正确", Toast.LENGTH_SHORT).show()
@@ -474,10 +499,11 @@ class MainActivity : BaseActivity() {
.replace(R.id.main_activity_left_fragment, leftFragment!!).commit()
}
}
/**
* 打开离线地图
*/
fun onClickOfflineMapFragment(){
fun onClickOfflineMapFragment() {
if (leftFragment !is OfflineMapFragment) {
if (leftFragment == null) {
binding.mainActivityBottomSheetGroup.visibility = View.VISIBLE

View File

@@ -183,11 +183,10 @@ class MainViewModel @Inject constructor(
location.tiley = y
}
}
Log.e("jingo", "定位点插入 ${location.longitude}")
location.groupId = uuid
try {
location.timeStamp = DateTimeUtil.getTime(location.time).toString()
}catch (e: Exception){
} catch (e: Exception) {
}
traceDataBase.niLocationDao.insert(location)
@@ -244,7 +243,8 @@ class MainViewModel @Inject constructor(
geometry = element.geometry,
name = SignUtil.getSignNameText(element),
bottomRightText = SignUtil.getSignBottomRightText(element),
elementCode = element.code
elementCode = element.code,
moreText = SignUtil.getMoreInfoText(element)
)
when (element.code) {
@@ -292,9 +292,8 @@ class MainViewModel @Inject constructor(
speakMode?.speakText(speechText)
}
linkIdCache = linkId ?: ""
Log.e("jingo", "自动捕捉数据 共${signList.size}")
}
}else{
} else {
mapController.lineHandler.removeLine()
linkIdCache = ""
}

View File

@@ -1,6 +1,7 @@
package com.navinfo.omqs.ui.activity.map
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import com.navinfo.omqs.R
import com.navinfo.omqs.bean.SignBean
@@ -8,8 +9,19 @@ 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, Boolean, SignBean) -> Unit?)? = null) :
interface OnSignAdapterClickListener {
fun onItemClick(signBean: SignBean)
fun onMoreInfoClick(selectTag: String, tag: String, signBean: SignBean)
fun onErrorClick(signBean: SignBean)
fun onHideMoreInfoView()
}
class SignAdapter(private var listener: OnSignAdapterClickListener?) :
BaseRecyclerViewAdapter<SignBean>() {
/**
* 选中的详细信息按钮的tag标签
*/
private var selectMoreInfoTag: String = ""
override fun getItemViewRes(position: Int): Int {
return R.layout.adapter_sign
}
@@ -22,17 +34,40 @@ class SignAdapter(private var itemListener: ((Int, Boolean, SignBean) -> Unit?)?
override fun onBindViewHolder(holder: BaseViewHolder, position: Int) {
val bd = holder.viewBinding as AdapterSignBinding
val item = data[position]
if (item.iconId != 0)
bd.signMainIconBg.setImageResource(item.iconId)
if (item.iconId != 0) bd.signMainIconBg.setImageResource(item.iconId)
bd.signMainIcon.text = item.iconText
bd.signBottomText.text = item.name
bd.signMainFastError.setOnClickListener{
itemListener?.invoke(position, true,item)
holder.tag = item.name + position
//点击错误按钮
bd.signMainFastError.setOnClickListener {
listener?.onErrorClick(item)
}
bd.signBottomRightText.text = item.bottomRightText
bd.root.setOnClickListener {
itemListener?.invoke(position, false,item)
listener?.onItemClick(item)
}
if (item.moreText.isNotEmpty()) {
bd.signMainInfo.visibility = View.VISIBLE
//点击更多信息按钮
bd.signMainInfo.setOnClickListener {
listener?.onMoreInfoClick(selectMoreInfoTag, holder.tag, item)
selectMoreInfoTag = holder.tag
}
} else bd.signMainInfo.visibility = View.GONE
}
override fun refreshData(newData: List<SignBean>) {
super.refreshData(newData)
for (i in newData.indices) {
if (selectMoreInfoTag == newData[i].name + i) {
return
}
}
listener?.onHideMoreInfoView()
}
}