parent
4b32a7f50a
commit
a518a928b2
32 changed files with 152 additions and 202 deletions
@ -1,144 +0,0 @@ |
|||||||
package com.project.survey; |
|
||||||
|
|
||||||
import static com.bingce.AppChannel.customChannel; |
|
||||||
|
|
||||||
import android.app.Application; |
|
||||||
import android.util.Log; |
|
||||||
|
|
||||||
import com.bingce.AppChannel; |
|
||||||
import com.bingce.BaseApp; |
|
||||||
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.data.surveyor.designdata.project.ProjectRecord; |
|
||||||
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.SdkUtils; |
|
||||||
import com.bingce.utils.ThreadPoolUtil; |
|
||||||
import com.tencent.mmkv.MMKV; |
|
||||||
|
|
||||||
import org.polaric.colorful.Colorful; |
|
||||||
|
|
||||||
import blankj.utilcode.util.Utils; |
|
||||||
import cn.liuyanbing.surveyor.BCSdk; |
|
||||||
import io.reactivex.functions.Consumer; |
|
||||||
import io.reactivex.plugins.RxJavaPlugins; |
|
||||||
|
|
||||||
public class App extends BaseApp { |
|
||||||
private final CoordinatorSystemNotifierImpl coordinatorSystemNotifier = new CoordinatorSystemNotifierImpl(); |
|
||||||
|
|
||||||
private static App app; |
|
||||||
|
|
||||||
public boolean isThemeDark; |
|
||||||
/** |
|
||||||
* 磁偏角,用于校正指南针 |
|
||||||
*/ |
|
||||||
public float magneticDeclination = 0; |
|
||||||
|
|
||||||
public int lastRecordBrowseType = 0; |
|
||||||
|
|
||||||
/** |
|
||||||
* 是否在记录界面显示当前工程全部数据 |
|
||||||
*/ |
|
||||||
public boolean isShowAllRecordInCurrentProject = true; |
|
||||||
|
|
||||||
public boolean isLandscape() { |
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public void onCreate() { |
|
||||||
customChannel = AppChannel.CUSTOM_CONTROL_PRO;//AppChannel.CUSTOM_PUBLIC;
|
|
||||||
super.onCreate(); |
|
||||||
app = this; |
|
||||||
MMKV.initialize(this); |
|
||||||
|
|
||||||
RxJavaPlugins.setErrorHandler(new Consumer<Throwable>() { |
|
||||||
@Override |
|
||||||
public void accept(Throwable throwable) { |
|
||||||
Log.e("rxThrowable", String.valueOf(throwable)); |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
initThemeDark(); |
|
||||||
Utils.init(this); |
|
||||||
initDatabase(); |
|
||||||
initDevice(); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
protected void initTtsManager() { |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public String applicationId() { |
|
||||||
return ""; |
|
||||||
} |
|
||||||
|
|
||||||
private void initDevice() { |
|
||||||
|
|
||||||
//初始化设备相关代码
|
|
||||||
Device.init( |
|
||||||
DeviceProgressDialogBuilderImpl.builder(), |
|
||||||
coordinatorSystemNotifier, |
|
||||||
coordinateSystem -> { |
|
||||||
ThreadPoolUtil.execute(() -> { |
|
||||||
//查询当前项目
|
|
||||||
String currentProjectId = KeyValueDb.currentProjectId(); |
|
||||||
ProjectRecord currentProject = ProjectDb.getInstance() |
|
||||||
.rawQueryData(DBQueryConstant.findById(ProjectConstants.DB_NAME, currentProjectId)); |
|
||||||
if (currentProject != null) { |
|
||||||
currentProject.coordinateSystem = coordinateSystem; |
|
||||||
ProjectDb.getInstance().save(currentProject); |
|
||||||
} |
|
||||||
}); |
|
||||||
}); |
|
||||||
RTK.init(coordinatorSystemNotifier); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
private void initDatabase() { |
|
||||||
ProjectCoordinateDatabase.openDb(this, null); |
|
||||||
SurveyRecordDatabase.openDb(this, null); |
|
||||||
SyncRecordDatabase.openDb(this, null); |
|
||||||
RoadJobLineDatabase.openDb(this, null); |
|
||||||
} |
|
||||||
|
|
||||||
public boolean isThemeDark() { |
|
||||||
return false; |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public int angleNotNumber() { |
|
||||||
return 6; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
private void initThemeDark() { |
|
||||||
Colorful.defaults() |
|
||||||
// .primaryColor(Colorful.ThemeColor.SHANG_HAI_PROJECT)
|
|
||||||
// .accentColor(Colorful.ThemeColor.SHANG_HAI_PROJECT)
|
|
||||||
.translucent(false) |
|
||||||
.dark(false); |
|
||||||
Colorful.init(this); |
|
||||||
|
|
||||||
// Colorful.config(this).primaryColor(Colorful.ThemeColor.BROWN).apply();
|
|
||||||
// Colorful.config(this).accentColor(Colorful.ThemeColor.BROWN).apply();
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public static App getApp() { |
|
||||||
return app; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -0,0 +1,100 @@ |
|||||||
|
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 |
||||||
|
} |
Loading…
Reference in new issue