1.修改布局允许水平旋转2.修复主页访问图层管理崩溃问题3.扩充轨迹字段
This commit is contained in:
parent
4884db93fc
commit
e0b6d687f6
@ -49,7 +49,6 @@
|
|||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:screenOrientation="landscape"
|
|
||||||
android:theme="@style/Theme.OMQualityInspection">
|
android:theme="@style/Theme.OMQualityInspection">
|
||||||
<intent-filter>
|
<intent-filter>
|
||||||
<action android:name="android.intent.action.MAIN" />
|
<action android:name="android.intent.action.MAIN" />
|
||||||
@ -61,7 +60,6 @@
|
|||||||
android:name=".ui.activity.map.MainActivity"
|
android:name=".ui.activity.map.MainActivity"
|
||||||
android:exported="false"
|
android:exported="false"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:screenOrientation="landscape"
|
|
||||||
android:theme="@style/Theme.OMQualityInspection" />
|
android:theme="@style/Theme.OMQualityInspection" />
|
||||||
|
|
||||||
<activity
|
<activity
|
||||||
@ -69,7 +67,6 @@
|
|||||||
android:exported="true"
|
android:exported="true"
|
||||||
android:label="@string/app_name"
|
android:label="@string/app_name"
|
||||||
android:launchMode="singleTask"
|
android:launchMode="singleTask"
|
||||||
android:screenOrientation="landscape"
|
|
||||||
android:theme="@style/Theme.OMQualityInspection">
|
android:theme="@style/Theme.OMQualityInspection">
|
||||||
|
|
||||||
</activity>
|
</activity>
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
package com.navinfo.omqs
|
package com.navinfo.omqs
|
||||||
|
|
||||||
|
import android.app.Activity
|
||||||
import android.app.Application
|
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.tools.FileManager
|
||||||
import com.navinfo.omqs.ui.manager.TakePhotoManager
|
import com.navinfo.omqs.ui.manager.TakePhotoManager
|
||||||
import com.navinfo.omqs.util.NetUtils
|
import com.navinfo.omqs.util.NetUtils
|
||||||
@ -23,5 +28,4 @@ class OMQSApplication : Application() {
|
|||||||
val hashBytes = messageDigest.digest(inputString.toByteArray())
|
val hashBytes = messageDigest.digest(inputString.toByteArray())
|
||||||
return hashBytes.joinToString("") { "%02x".format(it) };
|
return hashBytes.joinToString("") { "%02x".format(it) };
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
@ -13,10 +13,15 @@ import com.google.android.material.dialog.MaterialAlertDialogBuilder
|
|||||||
open class BaseActivity : AppCompatActivity() {
|
open class BaseActivity : AppCompatActivity() {
|
||||||
private var loadingDialog: AlertDialog? = null
|
private var loadingDialog: AlertDialog? = null
|
||||||
override fun onCreate(savedInstanceState: Bundle?) {
|
override fun onCreate(savedInstanceState: Bundle?) {
|
||||||
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE//横屏
|
|
||||||
super.onCreate(savedInstanceState)
|
super.onCreate(savedInstanceState)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
override fun onResume() {
|
||||||
|
super.onResume()
|
||||||
|
requestedOrientation = ActivityInfo.SCREEN_ORIENTATION_SENSOR_LANDSCAPE;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 显示loading dialog
|
* 显示loading dialog
|
||||||
*/
|
*/
|
||||||
|
@ -1,6 +1,7 @@
|
|||||||
package com.navinfo.omqs.ui.activity.console
|
package com.navinfo.omqs.ui.activity.console
|
||||||
|
|
||||||
import android.content.Intent
|
import android.content.Intent
|
||||||
|
import android.content.pm.ActivityInfo
|
||||||
import android.os.Bundle
|
import android.os.Bundle
|
||||||
import android.util.Log
|
import android.util.Log
|
||||||
import android.view.View
|
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 -> {
|
R.id.console_layer_setting_bg, R.id.console_layer_setting_icon_bg -> {
|
||||||
/* if (sceneFlag) {
|
if (sceneFlag) {
|
||||||
mFragment = LayermanagerFragment()
|
mFragment = LayermanagerFragment()
|
||||||
sceneFlag = false
|
sceneFlag = false
|
||||||
TransitionManager.go(bScene, bTransition)
|
TransitionManager.go(bScene, bTransition)
|
||||||
@ -210,7 +211,7 @@ class ConsoleActivity : BaseActivity(), OnClickListener {
|
|||||||
.replace(fragmentId, mFragment!!).commit()
|
.replace(fragmentId, mFragment!!).commit()
|
||||||
}
|
}
|
||||||
return
|
return
|
||||||
}*/
|
}
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* 测评结果列表
|
* 测评结果列表
|
||||||
|
@ -78,6 +78,9 @@ class MainViewModel @Inject constructor(
|
|||||||
|
|
||||||
// var testPoint = GeoPoint(0, 0)
|
// var testPoint = GeoPoint(0, 0)
|
||||||
|
|
||||||
|
//uuid标识,用于记录轨迹组
|
||||||
|
val uuid = UUID.randomUUID().toString()
|
||||||
|
|
||||||
//语音窗体
|
//语音窗体
|
||||||
private var pop: PopupWindow? = null
|
private var pop: PopupWindow? = null
|
||||||
|
|
||||||
@ -160,15 +163,9 @@ class MainViewModel @Inject constructor(
|
|||||||
}
|
}
|
||||||
|
|
||||||
private fun initLocation() {
|
private fun initLocation() {
|
||||||
// mapController.locationLayerHandler.setNiLocationListener(NiLocationListener {
|
|
||||||
// addSaveTrace(it)
|
|
||||||
//
|
|
||||||
// })
|
|
||||||
//用于定位点存储到数据库
|
//用于定位点存储到数据库
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.Default) {
|
||||||
mapController.locationLayerHandler.niLocationFlow.collect { location ->
|
mapController.locationLayerHandler.niLocationFlow.collect { location ->
|
||||||
// location.longitude = testPoint.longitude
|
|
||||||
// location.latitude = testPoint.latitude
|
|
||||||
val geometry = GeometryTools.createGeometry(
|
val geometry = GeometryTools.createGeometry(
|
||||||
GeoPoint(
|
GeoPoint(
|
||||||
location.latitude, location.longitude
|
location.latitude, location.longitude
|
||||||
@ -186,7 +183,13 @@ class MainViewModel @Inject constructor(
|
|||||||
location.tiley = y
|
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)
|
traceDataBase.niLocationDao.insert(location)
|
||||||
mapController.mMapView.vtmMap.updateMap(true)
|
mapController.mMapView.vtmMap.updateMap(true)
|
||||||
}
|
}
|
||||||
@ -194,8 +197,6 @@ class MainViewModel @Inject constructor(
|
|||||||
//用于定位点捕捉道路
|
//用于定位点捕捉道路
|
||||||
viewModelScope.launch(Dispatchers.Default) {
|
viewModelScope.launch(Dispatchers.Default) {
|
||||||
mapController.locationLayerHandler.niLocationFlow.collectLatest { location ->
|
mapController.locationLayerHandler.niLocationFlow.collectLatest { location ->
|
||||||
// location.longitude = testPoint.longitude
|
|
||||||
// location.latitude = testPoint.latitude
|
|
||||||
if (!isSelectRoad()) captureLink(GeoPoint(location.latitude, location.longitude))
|
if (!isSelectRoad()) captureLink(GeoPoint(location.latitude, location.longitude))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -1,5 +1,7 @@
|
|||||||
package com.navinfo.omqs.ui.fragment.layermanager
|
package com.navinfo.omqs.ui.fragment.layermanager
|
||||||
|
|
||||||
|
import android.content.Context
|
||||||
|
import android.widget.Toast
|
||||||
import androidx.lifecycle.ViewModel
|
import androidx.lifecycle.ViewModel
|
||||||
import androidx.lifecycle.viewModelScope
|
import androidx.lifecycle.viewModelScope
|
||||||
import com.blankj.utilcode.util.FileIOUtils
|
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.bean.ImportConfig
|
||||||
import com.navinfo.omqs.tools.LayerConfigUtils
|
import com.navinfo.omqs.tools.LayerConfigUtils
|
||||||
import com.navinfo.omqs.util.FlowEventBus
|
import com.navinfo.omqs.util.FlowEventBus
|
||||||
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
|
import kotlinx.coroutines.withContext
|
||||||
import java.io.File
|
import java.io.File
|
||||||
|
|
||||||
class LayerManagerViewModel(): ViewModel() {
|
class LayerManagerViewModel(): ViewModel() {
|
||||||
@ -21,11 +25,15 @@ class LayerManagerViewModel(): ViewModel() {
|
|||||||
return LayerConfigUtils.getLayerConfigList()
|
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))
|
SPStaticUtils.put(Constant.EVENT_LAYER_MANAGER_CHANGE, gson.toJson(listData))
|
||||||
// 发送新的配置数据
|
// 发送新的配置数据
|
||||||
viewModelScope.launch {
|
viewModelScope.launch {
|
||||||
FlowEventBus.post(Constant.EVENT_LAYER_MANAGER_CHANGE, listData)
|
FlowEventBus.post(Constant.EVENT_LAYER_MANAGER_CHANGE, listData)
|
||||||
|
withContext(Dispatchers.Main) {
|
||||||
|
Toast.makeText(context, "设置成功", Toast.LENGTH_SHORT)
|
||||||
|
.show()
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,10 @@ import android.os.Bundle
|
|||||||
import android.view.LayoutInflater
|
import android.view.LayoutInflater
|
||||||
import android.view.View
|
import android.view.View
|
||||||
import android.view.ViewGroup
|
import android.view.ViewGroup
|
||||||
|
import android.widget.Toast
|
||||||
import androidx.fragment.app.Fragment
|
import androidx.fragment.app.Fragment
|
||||||
|
import androidx.fragment.app.FragmentActivity
|
||||||
|
import androidx.fragment.app.FragmentController
|
||||||
import androidx.fragment.app.viewModels
|
import androidx.fragment.app.viewModels
|
||||||
import androidx.navigation.fragment.findNavController
|
import androidx.navigation.fragment.findNavController
|
||||||
import com.blankj.utilcode.util.SPStaticUtils
|
import com.blankj.utilcode.util.SPStaticUtils
|
||||||
@ -30,7 +33,9 @@ class LayermanagerFragment : BaseFragment(){
|
|||||||
|
|
||||||
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
||||||
super.onViewCreated(view, savedInstanceState)
|
super.onViewCreated(view, savedInstanceState)
|
||||||
|
|
||||||
val adapter = LayerManagerExpandableListAdapter(requireContext(), viewModel.getLayerConfigList())
|
val adapter = LayerManagerExpandableListAdapter(requireContext(), viewModel.getLayerConfigList())
|
||||||
|
|
||||||
binding.elvLayerManager.setAdapter(adapter)
|
binding.elvLayerManager.setAdapter(adapter)
|
||||||
// 默认显示第一个父项下的子类
|
// 默认显示第一个父项下的子类
|
||||||
binding.elvLayerManager.expandGroup(0)
|
binding.elvLayerManager.expandGroup(0)
|
||||||
@ -43,15 +48,15 @@ class LayermanagerFragment : BaseFragment(){
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
binding.imgConfirm.setOnClickListener {
|
||||||
|
viewModel.saveLayerConfigList(requireContext(),adapter.parentItems)
|
||||||
|
}
|
||||||
|
|
||||||
binding.imgBack.setOnClickListener {
|
binding.imgBack.setOnClickListener {
|
||||||
findNavController().navigateUp()
|
findNavController().navigateUp()
|
||||||
}
|
}
|
||||||
|
|
||||||
binding.tvTitle.text = findNavController().currentDestination?.label
|
binding.tvTitle.text = "图层管理"
|
||||||
|
|
||||||
binding.imgConfirm.setOnClickListener { // 用户点击确认,重新设置当前的图层显隐控制
|
|
||||||
viewModel.saveLayerConfigList(adapter.parentItems)
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
override fun onDestroyView() {
|
override fun onDestroyView() {
|
||||||
|
@ -1,64 +1,68 @@
|
|||||||
<?xml version="1.0" encoding="utf-8"?>
|
<?xml version="1.0" encoding="utf-8"?>
|
||||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
<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"
|
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_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
|
<androidx.constraintlayout.widget.ConstraintLayout
|
||||||
android:id="@+id/title_layout"
|
android:id="@+id/title_layout"
|
||||||
|
style="@style/left_pannel_title_layout"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent">
|
||||||
style="@style/left_pannel_title_layout">
|
|
||||||
<androidx.appcompat.widget.AppCompatImageView
|
<androidx.appcompat.widget.AppCompatImageView
|
||||||
android:id="@+id/img_back"
|
android:id="@+id/img_back"
|
||||||
|
style="@style/btn_round"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
|
||||||
android:layout_marginTop="5dp"
|
android:layout_marginTop="5dp"
|
||||||
app:layout_constraintBottom_toBottomOf="parent"
|
|
||||||
android:background="@drawable/selector_bg_round_button"
|
android:background="@drawable/selector_bg_round_button"
|
||||||
android:foreground="@drawable/ripple_btn_press"
|
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"
|
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
|
<androidx.appcompat.widget.AppCompatTextView
|
||||||
android:id="@+id/tv_title"
|
android:id="@+id/tv_title"
|
||||||
android:layout_width="wrap_content"
|
android:layout_width="wrap_content"
|
||||||
android:layout_height="wrap_content"
|
android:layout_height="wrap_content"
|
||||||
android:textSize="@dimen/left_pannel_title_font"
|
|
||||||
android:textColor="@color/highFontColor"
|
android:textColor="@color/highFontColor"
|
||||||
|
android:textSize="@dimen/left_pannel_title_font"
|
||||||
|
app:layout_constraintBottom_toBottomOf="parent"
|
||||||
app:layout_constraintLeft_toLeftOf="parent"
|
app:layout_constraintLeft_toLeftOf="parent"
|
||||||
app:layout_constraintRight_toRightOf="parent"
|
app:layout_constraintRight_toRightOf="parent"
|
||||||
app:layout_constraintTop_toTopOf="parent"
|
app:layout_constraintTop_toTopOf="parent"></androidx.appcompat.widget.AppCompatTextView>
|
||||||
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>
|
|
||||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||||
|
|
||||||
<androidx.cardview.widget.CardView
|
<androidx.cardview.widget.CardView
|
||||||
|
style="@style/default_card_view"
|
||||||
android:layout_width="match_parent"
|
android:layout_width="match_parent"
|
||||||
android:layout_height="match_parent"
|
android:layout_height="match_parent"
|
||||||
app:layout_constraintTop_toBottomOf="@id/title_layout"
|
app:layout_constraintTop_toBottomOf="@id/title_layout">
|
||||||
style="@style/default_card_view">
|
|
||||||
<ExpandableListView
|
<ExpandableListView
|
||||||
android:id="@+id/elv_layer_manager"
|
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_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>
|
</androidx.cardview.widget.CardView>
|
||||||
</LinearLayout>
|
</LinearLayout>
|
@ -8,6 +8,7 @@ import androidx.annotation.NonNull;
|
|||||||
import androidx.room.Database;
|
import androidx.room.Database;
|
||||||
import androidx.room.Room;
|
import androidx.room.Room;
|
||||||
import androidx.room.RoomDatabase;
|
import androidx.room.RoomDatabase;
|
||||||
|
import androidx.room.migration.Migration;
|
||||||
import androidx.sqlite.db.SupportSQLiteDatabase;
|
import androidx.sqlite.db.SupportSQLiteDatabase;
|
||||||
|
|
||||||
import com.navinfo.collect.library.data.entity.NiLocation;
|
import com.navinfo.collect.library.data.entity.NiLocation;
|
||||||
@ -18,7 +19,7 @@ import com.tencent.wcdb.repair.RecoverKit;
|
|||||||
import com.tencent.wcdb.room.db.WCDBDatabase;
|
import com.tencent.wcdb.room.db.WCDBDatabase;
|
||||||
import com.tencent.wcdb.room.db.WCDBOpenHelperFactory;
|
import com.tencent.wcdb.room.db.WCDBOpenHelperFactory;
|
||||||
|
|
||||||
@Database(entities = { NiLocation.class},version = 1, exportSchema = false)
|
@Database(entities = { NiLocation.class},version = 2, exportSchema = false)
|
||||||
public abstract class TraceDataBase extends RoomDatabase {
|
public abstract class TraceDataBase extends RoomDatabase {
|
||||||
// marking the instance as volatile to ensure atomic access to the variable
|
// marking the instance as volatile to ensure atomic access to the variable
|
||||||
/**
|
/**
|
||||||
@ -63,7 +64,7 @@ public abstract class TraceDataBase extends RoomDatabase {
|
|||||||
// Wipes and rebuilds instead of migrating if no Migration object.
|
// Wipes and rebuilds instead of migrating if no Migration object.
|
||||||
// Migration is not part of this codelab.
|
// Migration is not part of this codelab.
|
||||||
.fallbackToDestructiveMigration()
|
.fallbackToDestructiveMigration()
|
||||||
.addCallback(sRoomDatabaseCallback)
|
.addCallback(sRoomDatabaseCallback).addMigrations(MIGRATION_1_2)
|
||||||
.build();
|
.build();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -71,6 +72,18 @@ public abstract class TraceDataBase extends RoomDatabase {
|
|||||||
return INSTANCE;
|
return INSTANCE;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*扩充字段
|
||||||
|
*/
|
||||||
|
public static final Migration MIGRATION_1_2 = new Migration(1, 2) {
|
||||||
|
@Override
|
||||||
|
public void migrate(SupportSQLiteDatabase database) {
|
||||||
|
// 增加字段
|
||||||
|
database.execSQL("ALTER TABLE niLocation " + " ADD COLUMN groupId " + " TEXT");
|
||||||
|
database.execSQL("ALTER TABLE niLocation " + " ADD COLUMN timeStamp " + " TEXT");
|
||||||
|
}
|
||||||
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Override the onOpen method to populate the database.
|
* Override the onOpen method to populate the database.
|
||||||
* For this sample, we clear the database every time it is created or opened.
|
* For this sample, we clear the database every time it is created or opened.
|
||||||
|
@ -61,6 +61,11 @@ public class NiLocation extends Feature{
|
|||||||
private int tilex;
|
private int tilex;
|
||||||
@ColumnInfo(name = "tiley")
|
@ColumnInfo(name = "tiley")
|
||||||
private int tiley;
|
private int tiley;
|
||||||
|
@ColumnInfo(name = "groupId")
|
||||||
|
private String groupId;
|
||||||
|
@ColumnInfo(name = "timeStamp")
|
||||||
|
private String timeStamp;
|
||||||
|
|
||||||
private boolean isAccouracy;
|
private boolean isAccouracy;
|
||||||
private boolean isSpeed;
|
private boolean isSpeed;
|
||||||
private boolean isAltitude;
|
private boolean isAltitude;
|
||||||
@ -297,4 +302,20 @@ public class NiLocation extends Feature{
|
|||||||
public void setErrorCode(String errorCode) {
|
public void setErrorCode(String errorCode) {
|
||||||
this.errorCode = errorCode;
|
this.errorCode = errorCode;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public String getGroupId() {
|
||||||
|
return groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setGroupId(String groupId) {
|
||||||
|
this.groupId = groupId;
|
||||||
|
}
|
||||||
|
|
||||||
|
public String getTimeStamp() {
|
||||||
|
return timeStamp;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void setTimeStamp(String timeStamp) {
|
||||||
|
this.timeStamp = timeStamp;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import com.baidu.location.LocationClientOption
|
|||||||
import com.baidu.location.LocationClientOption.LocationMode
|
import com.baidu.location.LocationClientOption.LocationMode
|
||||||
import com.navinfo.collect.library.data.entity.NiLocation
|
import com.navinfo.collect.library.data.entity.NiLocation
|
||||||
import com.navinfo.collect.library.map.NIMapView
|
import com.navinfo.collect.library.map.NIMapView
|
||||||
|
import com.navinfo.collect.library.utils.DateUtils
|
||||||
import kotlinx.coroutines.flow.MutableSharedFlow
|
import kotlinx.coroutines.flow.MutableSharedFlow
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import org.oscim.core.GeoPoint
|
import org.oscim.core.GeoPoint
|
||||||
@ -195,6 +196,7 @@ class LocationLayerHandler(context: AppCompatActivity, mapView: NIMapView) :
|
|||||||
niLocation.address = mCurrentLocation!!.addrStr
|
niLocation.address = mCurrentLocation!!.addrStr
|
||||||
niLocation.street = mCurrentLocation!!.street
|
niLocation.street = mCurrentLocation!!.street
|
||||||
niLocation.town = mCurrentLocation!!.town
|
niLocation.town = mCurrentLocation!!.town
|
||||||
|
niLocation.speed = mCurrentLocation!!.speed
|
||||||
niLocation.streetNumber = mCurrentLocation!!.streetNumber
|
niLocation.streetNumber = mCurrentLocation!!.streetNumber
|
||||||
niLocation.errorCode = mCurrentLocation!!.locType.toString()
|
niLocation.errorCode = mCurrentLocation!!.locType.toString()
|
||||||
return niLocation
|
return niLocation
|
||||||
|
Loading…
x
Reference in New Issue
Block a user