You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
100 lines
3.2 KiB
100 lines
3.2 KiB
package com.project.survey
|
|
|
|
import android.util.Log
|
|
import blankj.utilcode.util.Utils
|
|
import com.bingce.AppChannel
|
|
import com.bingce.BaseApp
|
|
import com.bingce.coordlib.model.CoordinateSystem
|
|
import com.bingce.data.database.DBQueryConstant
|
|
import com.bingce.data.database.KeyValueDb
|
|
import com.bingce.data.database.ProjectCoordinateDatabase
|
|
import com.bingce.data.database.ProjectDb
|
|
import com.bingce.data.database.RoadJobLineDatabase
|
|
import com.bingce.data.database.SurveyRecordDatabase
|
|
import com.bingce.data.database.SyncRecordDatabase
|
|
import com.bingce.data.surveyor.designdata.project.ProjectConstants
|
|
import com.bingce.device.Device
|
|
import com.bingce.device.DeviceProgressDialogBuilderImpl
|
|
import com.bingce.rtk.command.RTK
|
|
import com.bingce.utils.CoordinatorSystemNotifierImpl
|
|
import com.bingce.utils.ThreadPoolUtil
|
|
import com.tencent.mmkv.MMKV
|
|
import io.reactivex.plugins.RxJavaPlugins
|
|
import org.polaric.colorful.Colorful
|
|
|
|
class App : BaseApp() {
|
|
|
|
companion object {
|
|
lateinit var instance: App
|
|
|
|
// 磁偏角,用于校正指南针
|
|
const val magneticDeclination: Float = 0f
|
|
|
|
// 是否在记录界面显示当前工程全部数据
|
|
const val isShowAllRecordInCurrentProject = true
|
|
|
|
}
|
|
|
|
var lastRecordBrowseType: Int = 0
|
|
private val coordinatorSystemNotifier = CoordinatorSystemNotifierImpl()
|
|
|
|
override fun onCreate() {
|
|
AppChannel.customChannel = AppChannel.CUSTOM_CONTROL_PRO
|
|
super.onCreate()
|
|
instance = this
|
|
|
|
// MMKV初始化
|
|
MMKV.initialize(this)
|
|
RxJavaPlugins.setErrorHandler { throwable ->
|
|
Log.e("rxThrowable", throwable.toString())
|
|
}
|
|
Colorful.defaults()
|
|
// .primaryColor(Colorful.ThemeColor.SHANG_HAI_PROJECT)
|
|
// .accentColor(Colorful.ThemeColor.SHANG_HAI_PROJECT)
|
|
.translucent(false)
|
|
.dark(false)
|
|
Colorful.init(this)
|
|
|
|
Utils.init(this)
|
|
initDatabase()
|
|
initDevice()
|
|
}
|
|
|
|
private fun initDatabase() {
|
|
ProjectCoordinateDatabase.openDb(this, null)
|
|
SurveyRecordDatabase.openDb(this, null)
|
|
SyncRecordDatabase.openDb(this, null)
|
|
RoadJobLineDatabase.openDb(this, null)
|
|
}
|
|
|
|
private fun initDevice() {
|
|
//初始化设备相关代码
|
|
Device.init(
|
|
DeviceProgressDialogBuilderImpl.builder(),
|
|
coordinatorSystemNotifier
|
|
) { coordinateSystem ->
|
|
ThreadPoolUtil.execute {
|
|
//查询当前项目
|
|
val currentProjectId = KeyValueDb.currentProjectId()
|
|
val currentProject = ProjectDb.getInstance().rawQueryData(
|
|
DBQueryConstant.findById(ProjectConstants.DB_NAME, currentProjectId)
|
|
)
|
|
if (currentProject != null) {
|
|
currentProject.coordinateSystem = coordinateSystem
|
|
ProjectDb.getInstance().save(currentProject)
|
|
}
|
|
}
|
|
}
|
|
RTK.init(coordinatorSystemNotifier)
|
|
}
|
|
|
|
override fun isLandscape(): Boolean = false
|
|
|
|
override fun initTtsManager() {}
|
|
|
|
override fun applicationId(): String = ""
|
|
|
|
override fun isThemeDark(): Boolean = false
|
|
|
|
override fun angleNotNumber(): Int = 6
|
|
} |