1.修改布局允许水平旋转2.修复主页访问图层管理崩溃问题3.扩充轨迹字段

This commit is contained in:
qiji4215
2023-06-13 17:00:02 +08:00
parent 4884db93fc
commit e0b6d687f6
11 changed files with 116 additions and 55 deletions

View File

@@ -49,7 +49,6 @@
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleTask"
android:screenOrientation="landscape"
android:theme="@style/Theme.OMQualityInspection">
<intent-filter>
<action android:name="android.intent.action.MAIN" />
@@ -61,7 +60,6 @@
android:name=".ui.activity.map.MainActivity"
android:exported="false"
android:launchMode="singleTask"
android:screenOrientation="landscape"
android:theme="@style/Theme.OMQualityInspection" />
<activity
@@ -69,7 +67,6 @@
android:exported="true"
android:label="@string/app_name"
android:launchMode="singleTask"
android:screenOrientation="landscape"
android:theme="@style/Theme.OMQualityInspection">
</activity>

View File

@@ -1,6 +1,11 @@
package com.navinfo.omqs
import android.app.Activity
import android.app.Application
import android.content.pm.ActivityInfo
import android.content.res.Configuration
import android.view.Surface
import android.view.WindowManager
import com.navinfo.omqs.tools.FileManager
import com.navinfo.omqs.ui.manager.TakePhotoManager
import com.navinfo.omqs.util.NetUtils
@@ -23,5 +28,4 @@ class OMQSApplication : Application() {
val hashBytes = messageDigest.digest(inputString.toByteArray())
return hashBytes.joinToString("") { "%02x".format(it) };
}
}

View File

@@ -13,10 +13,15 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
open class BaseActivity : AppCompatActivity() {
private var loadingDialog: AlertDialog? = null
override fun onCreate(savedInstanceState: Bundle?) {
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE//横屏
super.onCreate(savedInstanceState)
}
override fun onResume() {
super.onResume()
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
}
/**
* 显示loading dialog
*/

View File

@@ -1,6 +1,7 @@
package com.navinfo.omqs.ui.activity.console
import android.content.Intent
import android.content.pm.ActivityInfo
import android.os.Bundle
import android.util.Log
import android.view.View
@@ -199,7 +200,7 @@ class ConsoleActivity : BaseActivity(), OnClickListener {
* 图层设置
*/
R.id.console_layer_setting_bg, R.id.console_layer_setting_icon_bg -> {
/* if (sceneFlag) {
if (sceneFlag) {
mFragment = LayermanagerFragment()
sceneFlag = false
TransitionManager.go(bScene, bTransition)
@@ -210,7 +211,7 @@ class ConsoleActivity : BaseActivity(), OnClickListener {
.replace(fragmentId, mFragment!!).commit()
}
return
}*/
}
}
/**
* 测评结果列表

View File

@@ -78,6 +78,9 @@ class MainViewModel @Inject constructor(
// var testPoint = GeoPoint(0, 0)
//uuid标识用于记录轨迹组
val uuid = UUID.randomUUID().toString()
//语音窗体
private var pop: PopupWindow? = null
@@ -160,15 +163,9 @@ class MainViewModel @Inject constructor(
}
private fun initLocation() {
// mapController.locationLayerHandler.setNiLocationListener(NiLocationListener {
// addSaveTrace(it)
//
// })
//用于定位点存储到数据库
viewModelScope.launch(Dispatchers.Default) {
mapController.locationLayerHandler.niLocationFlow.collect { location ->
// location.longitude = testPoint.longitude
// location.latitude = testPoint.latitude
val geometry = GeometryTools.createGeometry(
GeoPoint(
location.latitude, location.longitude
@@ -186,7 +183,13 @@ class MainViewModel @Inject constructor(
location.tiley = y
}
}
Log.e("jingo", "定位点插入 ${Thread.currentThread().name}")
Log.e("jingo", "定位点插入 ${location.longitude}")
location.groupId = uuid
try {
location.timeStamp = DateTimeUtil.getTime(location.time).toString()
}catch (e: Exception){
}
traceDataBase.niLocationDao.insert(location)
mapController.mMapView.vtmMap.updateMap(true)
}
@@ -194,8 +197,6 @@ class MainViewModel @Inject constructor(
//用于定位点捕捉道路
viewModelScope.launch(Dispatchers.Default) {
mapController.locationLayerHandler.niLocationFlow.collectLatest { location ->
// location.longitude = testPoint.longitude
// location.latitude = testPoint.latitude
if (!isSelectRoad()) captureLink(GeoPoint(location.latitude, location.longitude))
}
}

View File

@@ -1,5 +1,7 @@
package com.navinfo.omqs.ui.fragment.layermanager
import android.content.Context
import android.widget.Toast
import androidx.lifecycle.ViewModel
import androidx.lifecycle.viewModelScope
import com.blankj.utilcode.util.FileIOUtils
@@ -10,7 +12,9 @@ import com.navinfo.omqs.Constant
import com.navinfo.omqs.bean.ImportConfig
import com.navinfo.omqs.tools.LayerConfigUtils
import com.navinfo.omqs.util.FlowEventBus
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
import kotlinx.coroutines.withContext
import java.io.File
class LayerManagerViewModel(): ViewModel() {
@@ -21,11 +25,15 @@ class LayerManagerViewModel(): ViewModel() {
return LayerConfigUtils.getLayerConfigList()
}
fun saveLayerConfigList(listData: List<ImportConfig>) {
fun saveLayerConfigList(context: Context, listData: List<ImportConfig>) {
SPStaticUtils.put(Constant.EVENT_LAYER_MANAGER_CHANGE, gson.toJson(listData))
// 发送新的配置数据
viewModelScope.launch {
FlowEventBus.post(Constant.EVENT_LAYER_MANAGER_CHANGE, listData)
withContext(Dispatchers.Main) {
Toast.makeText(context, "设置成功", Toast.LENGTH_SHORT)
.show()
}
}
}

View File

@@ -4,7 +4,10 @@ import android.os.Bundle
import android.view.LayoutInflater
import android.view.View
import android.view.ViewGroup
import android.widget.Toast
import androidx.fragment.app.Fragment
import androidx.fragment.app.FragmentActivity
import androidx.fragment.app.FragmentController
import androidx.fragment.app.viewModels
import androidx.navigation.fragment.findNavController
import com.blankj.utilcode.util.SPStaticUtils
@@ -30,7 +33,9 @@ class LayermanagerFragment : BaseFragment(){
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
super.onViewCreated(view, savedInstanceState)
val adapter = LayerManagerExpandableListAdapter(requireContext(), viewModel.getLayerConfigList())
binding.elvLayerManager.setAdapter(adapter)
// 默认显示第一个父项下的子类
binding.elvLayerManager.expandGroup(0)
@@ -43,15 +48,15 @@ class LayermanagerFragment : BaseFragment(){
}
}
binding.imgConfirm.setOnClickListener {
viewModel.saveLayerConfigList(requireContext(),adapter.parentItems)
}
binding.imgBack.setOnClickListener {
findNavController().navigateUp()
}
binding.tvTitle.text = findNavController().currentDestination?.label
binding.imgConfirm.setOnClickListener { // 用户点击确认,重新设置当前的图层显隐控制
viewModel.saveLayerConfigList(adapter.parentItems)
}
binding.tvTitle.text = "图层管理"
}
override fun onDestroyView() {

View File

@@ -1,64 +1,68 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:tools="http://schemas.android.com/tools"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:background="@color/bg_left_pannel"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
android:layout_height="match_parent"
android:background="@color/bg_left_pannel"
android:orientation="vertical">
<androidx.constraintlayout.widget.ConstraintLayout
android:id="@+id/title_layout"
style="@style/left_pannel_title_layout"
android:layout_width="match_parent"
android:layout_height="wrap_content"
app:layout_constraintTop_toTopOf="parent"
style="@style/left_pannel_title_layout">
app:layout_constraintTop_toTopOf="parent">
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/img_back"
style="@style/btn_round"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
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"
android:src="@drawable/ic_baseline_keyboard_arrow_left_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toTopOf="parent"></androidx.appcompat.widget.AppCompatImageView>
<androidx.appcompat.widget.AppCompatImageView
android:id="@+id/img_confirm"
style="@style/btn_round"
android:src="@drawable/ic_baseline_keyboard_arrow_left_24"></androidx.appcompat.widget.AppCompatImageView>
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="5dp"
android:background="@drawable/selector_bg_round_button"
android:foreground="@drawable/ripple_btn_press"
android:src="@drawable/ic_baseline_check_24"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"></androidx.appcompat.widget.AppCompatImageView>
<androidx.appcompat.widget.AppCompatTextView
android:id="@+id/tv_title"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:textSize="@dimen/left_pannel_title_font"
android:textColor="@color/highFontColor"
android:textSize="@dimen/left_pannel_title_font"
app:layout_constraintBottom_toBottomOf="parent"
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.appcompat.widget.AppCompatImageView
android:id="@+id/img_confirm"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
app:layout_constraintRight_toRightOf="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_check_24"></androidx.appcompat.widget.AppCompatImageView>
app:layout_constraintTop_toTopOf="parent"></androidx.appcompat.widget.AppCompatTextView>
</androidx.constraintlayout.widget.ConstraintLayout>
<androidx.cardview.widget.CardView
style="@style/default_card_view"
android:layout_width="match_parent"
android:layout_height="match_parent"
app:layout_constraintTop_toBottomOf="@id/title_layout"
style="@style/default_card_view">
app:layout_constraintTop_toBottomOf="@id/title_layout">
<ExpandableListView
android:id="@+id/elv_layer_manager"
android:divider="@android:drawable/divider_horizontal_dim_dark"
android:dividerHeight="0.1dp"
android:layout_width="match_parent"
android:layout_height="match_parent"/>
android:layout_height="match_parent"
android:divider="@android:drawable/divider_horizontal_dim_dark"
android:dividerHeight="0.1dp" />
</androidx.cardview.widget.CardView>
</LinearLayout>