[Upload]
迁移mogo-module-map代码MoGoEagleEye.core.function-impl.mogo-core-function-map Signed-off-by: donghongyu <donghongyu@zhidaoauto.com>
This commit is contained in:
1
modules/mogo-module-map/.gitignore
vendored
1
modules/mogo-module-map/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -1,8 +0,0 @@
|
||||
# 地图模块
|
||||
|
||||
## 地图 Fragment
|
||||
|
||||
## 地图状态和小智交互部分
|
||||
|
||||
## 语音控制地图
|
||||
|
||||
@@ -1,76 +0,0 @@
|
||||
plugins {
|
||||
id 'com.android.library'
|
||||
id 'kotlin-android'
|
||||
id 'kotlin-android-extensions'
|
||||
id 'kotlin-kapt'
|
||||
id 'com.alibaba.arouter'
|
||||
}
|
||||
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
|
||||
//ARouter apt 参数
|
||||
kapt {
|
||||
useBuildCache = false
|
||||
arguments {
|
||||
arg("AROUTER_MODULE_NAME", project.getName())
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
targetCompatibility 1.8
|
||||
sourceCompatibility 1.8
|
||||
}
|
||||
|
||||
}
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
if (Boolean.valueOf(USE_MAVEN_PACKAGE)) {
|
||||
api rootProject.ext.dependencies.mogomap
|
||||
api rootProject.ext.dependencies.mogomapapi
|
||||
api rootProject.ext.dependencies.mogo_core_utils
|
||||
api rootProject.ext.dependencies.mogocommons
|
||||
api rootProject.ext.dependencies.mogoserviceapi
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
|
||||
implementation rootProject.ext.dependencies.mogo_core_utils
|
||||
implementation rootProject.ext.dependencies.mogo_core_data
|
||||
} else {
|
||||
api project(":libraries:mogo-map")
|
||||
api project(":libraries:mogo-map-api")
|
||||
api project(':core:mogo-core-utils')
|
||||
api project(":foudations:mogo-commons")
|
||||
api project(':services:mogo-service-api')
|
||||
implementation project(':modules:mogo-module-common')
|
||||
|
||||
implementation project(':core:mogo-core-utils')
|
||||
implementation project(':core:mogo-core-data')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -1 +0,0 @@
|
||||
#-----ModuleMap-----
|
||||
@@ -1,3 +0,0 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=module-map
|
||||
VERSION_CODE=1
|
||||
24
modules/mogo-module-map/proguard-rules.pro
vendored
24
modules/mogo-module-map/proguard-rules.pro
vendored
@@ -1,24 +0,0 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
#-----ModuleMap-----
|
||||
-keep class com.mogo.module.map.NavConstants
|
||||
@@ -1,2 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.module.map" />
|
||||
@@ -1,253 +0,0 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.eagle.core.data.constants.MoGoFragmentPaths;
|
||||
import com.mogo.eagle.core.function.api.map.hd.IMoGoMapFragmentProvider;
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger;
|
||||
import com.mogo.map.IMogoMap;
|
||||
import com.mogo.map.IMogoUiSettings;
|
||||
import com.mogo.map.MogoMapView;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.map.IMogoMapFrameController;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
* @since 2021-11-09
|
||||
* 高精度地图层UI
|
||||
* <p>
|
||||
* 地图图层,地图操作都在这个图层完成
|
||||
*/
|
||||
@Route(path = MoGoFragmentPaths.PATH_FRAGMENT_MAP)
|
||||
public class MapFragment extends MvpFragment< MapView, MapPresenter >
|
||||
implements MapView, IMogoMapFrameController, IMoGoMapFragmentProvider {
|
||||
|
||||
private static final String TAG = "MapFragment";
|
||||
|
||||
private MogoMapView mMogoMapView;
|
||||
private IMogoMap mMogoMap;
|
||||
|
||||
private boolean mIsControllerByOthersStatus = false;
|
||||
|
||||
@Override
|
||||
protected int getLayoutId() {
|
||||
return R.layout.module_map_fragment_map;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getTagName() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().initDelegate( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initDelegate( IMogoMapFrameController controller ) {
|
||||
// do not implement
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeTo2dMode() {
|
||||
try {
|
||||
mMogoMapView.getMap().getUIController()
|
||||
.changeMapMode(
|
||||
MogoApisHandler.getInstance()
|
||||
.getApis()
|
||||
.getAdasControllerApi()
|
||||
.getCurrentSkinMode()
|
||||
);
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeToVRMode() {
|
||||
try {
|
||||
mMogoMapView.getMap().getUIController().changeMapMode( EnumMapUI.Type_VR);
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
// do not implement
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void initViews( Bundle savedInstanceState ) {
|
||||
super.initViews( savedInstanceState );
|
||||
mMogoMapView = findViewById( R.id.module_map_id_map );
|
||||
mMogoMapView.onCreate( savedInstanceState );
|
||||
mMogoMap = mMogoMapView.getMap();
|
||||
if ( mMogoMap != null ) {
|
||||
mMogoMap.getUIController().showMyLocation( true );
|
||||
}
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected MapPresenter createPresenter() {
|
||||
return new MapPresenter( this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated( @Nullable Bundle savedInstanceState ) {
|
||||
super.onActivityCreated( savedInstanceState );
|
||||
Logger.d( TAG, "onActivityCreated" );
|
||||
initMapView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState( @NonNull Bundle outState ) {
|
||||
super.onSaveInstanceState( outState );
|
||||
if ( mMogoMapView != null ) {
|
||||
mMogoMapView.onSaveInstanceState( outState );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
if ( mIsControllerByOthersStatus ) {
|
||||
return;
|
||||
}
|
||||
if ( mMogoMapView != null ) {
|
||||
mMogoMapView.onPause();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
if ( mIsControllerByOthersStatus ) {
|
||||
return;
|
||||
}
|
||||
if ( mMogoMapView != null ) {
|
||||
mMogoMapView.onResume();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
super.onLowMemory();
|
||||
if ( mMogoMapView != null ) {
|
||||
mMogoMapView.onLowMemory();
|
||||
}
|
||||
}
|
||||
|
||||
private void initMapView() {
|
||||
mMogoMap = mMogoMapView.getMap();
|
||||
if ( mMogoMap == null ) {
|
||||
return;
|
||||
}
|
||||
IMogoUiSettings uiSettings = mMogoMap.getUiSettings();
|
||||
if ( uiSettings != null ) {
|
||||
//设置所有手势是否可用
|
||||
uiSettings.setAllGesturesEnabled( true );
|
||||
//设置指南针是否可见。
|
||||
uiSettings.setCompassEnabled( false );
|
||||
//设置室内地图楼层切换控件是否可见。
|
||||
uiSettings.setIndoorSwitchEnabled( true );
|
||||
//设置定位按钮是否可见。
|
||||
uiSettings.setMyLocationButtonEnabled( false );
|
||||
//设置旋转手势是否可用。
|
||||
uiSettings.setRotateGesturesEnabled( false );
|
||||
//设置比例尺控件是否可见
|
||||
uiSettings.setScaleControlsEnabled( true );
|
||||
//设置拖拽手势是否可用。
|
||||
uiSettings.setScrollGesturesEnabled( true );
|
||||
//设置倾斜手势是否可用。
|
||||
uiSettings.setTiltGesturesEnabled( true );
|
||||
//设置缩放按钮是否可见。
|
||||
uiSettings.setZoomControlsEnabled( false );
|
||||
//设置双指缩放手势是否可用。
|
||||
uiSettings.setZoomGesturesEnabled( true );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapUIController getUIController() {
|
||||
return mMogoMap.getUIController();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
MogoApisHandler.getInstance().getApis().getMapFrameControllerApi().destroy();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
if ( mMogoMapView != null ) {
|
||||
mMogoMapView.onDestroy();
|
||||
mMogoMapView = null;
|
||||
mMogoMap = null;
|
||||
}
|
||||
destroy();
|
||||
super.onDestroyView();
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String getFunctionName() {
|
||||
return TAG;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMaoViewAngle(int type) {
|
||||
mMogoMapView.getMap().getUIController().changeMapViewAngle(type);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeCurrentIcon(int iconId) {
|
||||
mMogoMapView.getMap().getUIController().changeCurrentIcon(iconId);
|
||||
}
|
||||
|
||||
/**
|
||||
* sight mode
|
||||
* @param mode
|
||||
*/
|
||||
public static final int SIGHT_MODE_NORMAL = 0;
|
||||
public static final int SIGHT_MODE_TOP = 1;
|
||||
public static final int SIGHT_MODE_BACK = 2;
|
||||
public static final int SIGHT_MODE_CROSS = 3;
|
||||
public static final int SIGHT_MODE_FAR = 4;
|
||||
|
||||
@Override
|
||||
public void setMapDAngle(int mode) {
|
||||
float angle = getSightModeAngle(mode);
|
||||
mMogoMapView.getMap().getUIController().setMapDAngle(angle);
|
||||
}
|
||||
|
||||
private float getSightModeAngle(int mode) {
|
||||
float angle = 0.0f;
|
||||
switch (mode){
|
||||
case SIGHT_MODE_NORMAL:
|
||||
angle = 16.5f;
|
||||
case SIGHT_MODE_TOP:
|
||||
angle = 16.5f;
|
||||
case SIGHT_MODE_BACK:
|
||||
angle = 16.5f;
|
||||
case SIGHT_MODE_CROSS:
|
||||
angle = 16.5f;
|
||||
case SIGHT_MODE_FAR:
|
||||
angle = 16.5f;
|
||||
}
|
||||
return angle;
|
||||
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,50 +0,0 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths;
|
||||
import com.mogo.service.map.IMogoMapFrameController;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/10/23
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
|
||||
@Route( path = MogoServicePaths.PATH_MAP_FRAME_CONTROLLER )
|
||||
class MapFrameController implements IMogoMapFrameController {
|
||||
|
||||
private IMogoMapFrameController mController;
|
||||
|
||||
@Override
|
||||
public void initDelegate( IMogoMapFrameController controller ) {
|
||||
mController = controller;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeTo2dMode() {
|
||||
if ( mController != null ) {
|
||||
mController.changeTo2dMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeToVRMode() {
|
||||
if ( mController != null ) {
|
||||
mController.changeToVRMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
mController = null;
|
||||
}
|
||||
}
|
||||
@@ -1,19 +0,0 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MapPresenter extends Presenter<MapView> {
|
||||
|
||||
private static final String TAG = "MapPresenter";
|
||||
|
||||
public MapPresenter(MapView view) {
|
||||
super(view);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -1,20 +0,0 @@
|
||||
package com.mogo.module.map;
|
||||
|
||||
import com.mogo.commons.mvp.IView;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-23
|
||||
* <p>
|
||||
* 地图view
|
||||
*/
|
||||
public interface MapView extends IView {
|
||||
|
||||
/**
|
||||
* 地图控制接口
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
IMogoMapUIController getUIController();
|
||||
}
|
||||
@@ -1,12 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<com.mogo.map.MogoMapView
|
||||
android:id="@+id/module_map_id_map"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_map_calculate_path_display_overview_left_margin">977px</dimen>
|
||||
<dimen name="module_map_calculate_path_display_overview_top_margin">249px</dimen>
|
||||
<dimen name="module_map_calculate_path_display_overview_bottom_margin">61px</dimen>
|
||||
<dimen name="module_map_calculate_path_display_overview_right_margin">80px</dimen>
|
||||
|
||||
<!-- 导航查看全程显示范围-->
|
||||
<dimen name="module_map_display_overview_left_margin">1000px</dimen>
|
||||
<dimen name="module_map_display_overview_top_margin">390px</dimen>
|
||||
<dimen name="module_map_display_overview_bottom_margin">200px</dimen>
|
||||
<dimen name="module_map_display_overview_right_margin">200px</dimen>
|
||||
</resources>
|
||||
@@ -1,13 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_map_calculate_path_display_overview_left_margin">558px</dimen>
|
||||
<dimen name="module_map_calculate_path_display_overview_top_margin">174px</dimen>
|
||||
<dimen name="module_map_calculate_path_display_overview_bottom_margin">32px</dimen>
|
||||
<dimen name="module_map_calculate_path_display_overview_right_margin">80px</dimen>
|
||||
|
||||
<!-- 导航查看全程显示范围-->
|
||||
<dimen name="module_map_display_overview_left_margin">550px</dimen>
|
||||
<dimen name="module_map_display_overview_top_margin">208px</dimen>
|
||||
<dimen name="module_map_display_overview_bottom_margin">100px</dimen>
|
||||
<dimen name="module_map_display_overview_right_margin">100px</dimen>
|
||||
</resources>
|
||||
@@ -1,3 +0,0 @@
|
||||
<resources>
|
||||
<string name="app_name">mogo-module-map</string>
|
||||
</resources>
|
||||
@@ -1,36 +0,0 @@
|
||||
package com.mogo.module.service.dispatch.bean;
|
||||
|
||||
public class StartLatLon {
|
||||
|
||||
private double lat;
|
||||
private double lon;
|
||||
|
||||
public StartLatLon(double lat, double lon) {
|
||||
this.lat = lat;
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
public double getLat() {
|
||||
return lat;
|
||||
}
|
||||
|
||||
public void setLat(double lat) {
|
||||
this.lat = lat;
|
||||
}
|
||||
|
||||
public double getLon() {
|
||||
return lon;
|
||||
}
|
||||
|
||||
public void setLon(double lon) {
|
||||
this.lon = lon;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "StartLatLon{" +
|
||||
"lat=" + lat +
|
||||
", lon=" + lon +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
@@ -48,12 +48,6 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
private var mCityCode: String = ""
|
||||
|
||||
|
||||
private var getVideoFailed: (() -> Unit)? = null
|
||||
|
||||
fun getVideoFailed(getVideoFailed: (() -> Unit)) {
|
||||
this.getVideoFailed = getVideoFailed
|
||||
}
|
||||
|
||||
fun initCarCorderController() {
|
||||
try {
|
||||
zdCarCoderController =
|
||||
@@ -140,17 +134,6 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
} else { //比亚迪
|
||||
Logger.d(TANLU, "takeVideo ------ isnet = " + NetworkUtils.isConnected(AbsMogoApplication.getApp().applicationContext))
|
||||
getInfo("", mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 1, mFromType, CarCorderController.mainInfoId)?.let { uploadRoadInfo(it) }
|
||||
|
||||
//地图上打点
|
||||
taskAsync(3_000) {
|
||||
try {
|
||||
// LatLngStickyEventBus.getInstance()
|
||||
// .postSticky(GetImageSuccessEvent("", mType))
|
||||
} catch (e: java.lang.Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
}
|
||||
|
||||
@@ -166,9 +149,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
//获取图片失败也上报,图片不打点
|
||||
if (isCustom) {
|
||||
getInfo("", mAddress, mLongitude, mLatitude, mType, mDirection, mAreaCode, mCityCode, 0, mFromType, mainInfoId)?.let { uploadRoadInfo(it) }
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
//拍照成功回调返回图片本地路径
|
||||
|
||||
@@ -12,15 +12,13 @@ import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.elegant.analytics.Analytics
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.eagle.core.data.constants.MogoServicePaths
|
||||
import com.mogo.eagle.core.utilcode.mogo.logger.Logger
|
||||
import com.mogo.eagle.core.utilcode.mogo.storage.SharedPrefsMgr
|
||||
import com.mogo.module.common.MogoApisHandler
|
||||
import com.mogo.module.share.BuildConfig
|
||||
import com.mogo.module.share.bean.event.GetImageSuccessEvent
|
||||
import com.mogo.module.share.bean.event.LatLngStickyEventBus
|
||||
import com.zhidao.cosupload.manager.CosUploadManagerImpl
|
||||
import com.mogo.module.share.BuildConfig
|
||||
import com.mogo.module.share.constant.*
|
||||
import com.mogo.module.share.constant.ShareConstants.TANLU
|
||||
import com.mogo.module.share.utils.*
|
||||
@@ -28,6 +26,8 @@ import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.clearStrateg
|
||||
import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.getStrategyFrequency
|
||||
import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.getStrategyInterval
|
||||
import com.mogo.module.share.utils.StrategyPreferenceUtil.Companion.getStrategyType
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.zhidao.cosupload.manager.CosUploadManagerImpl
|
||||
import io.reactivex.Observable
|
||||
import io.reactivex.android.schedulers.AndroidSchedulers
|
||||
import org.greenrobot.eventbus.Subscribe
|
||||
@@ -56,6 +56,7 @@ class MainService : Service() {
|
||||
|
||||
//是否已经获取过策略
|
||||
var isGetStrategies: Boolean = false
|
||||
|
||||
//1是一次性,2是周期性
|
||||
private var picType: Int = 0
|
||||
private var videoType: Int = 0
|
||||
@@ -167,7 +168,6 @@ class MainService : Service() {
|
||||
CarCorderController.initCarCorderController()
|
||||
mainServiceHttpModel = MainServiceController()
|
||||
registReceiver()
|
||||
// CosCallbackMapController.init(this)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -252,14 +252,12 @@ class MainService : Service() {
|
||||
private fun takePhoto(isInterval: Boolean = false, isCustom: Boolean = false) {
|
||||
Logger.d(TANLU, "takePhoto -----1----->")
|
||||
//判断是否授权
|
||||
// if (isAuthorization(BaseApplication.getAppContext())) {
|
||||
//目前不支持连拍,只能定时2秒拍一张 第一期每次只拍一张
|
||||
Observable.intervalRange(0, 1, 0, 2_000, TimeUnit.MILLISECONDS)
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe {
|
||||
CarCorderController.takePhoto(1, 1, false, isCustom, TANLU_ROAD_CURRENT, mainInfoId, fromType, mLongitude, mLatitude, speed, mAddress, mDirection, mAreaCode, mCityCode)
|
||||
}
|
||||
// }
|
||||
|
||||
postPhotoAlarmTask(isInterval)
|
||||
|
||||
@@ -274,9 +272,7 @@ class MainService : Service() {
|
||||
id: Long = 0
|
||||
) {
|
||||
Logger.d(TANLU, "takeVideo --------1----> fromType = $fromType --isCustom = $isCustom")
|
||||
// if (isAuthorization(BaseApplication.getAppContext())) {
|
||||
CarCorderController.takeVideo(1, duration, isCustom, id, shareType, mainInfoId, fromType, mLongitude, mLatitude, speed, mAddress, mDirection, mAreaCode, mCityCode)
|
||||
// }
|
||||
postVideoAlarmTask(isInterval)
|
||||
|
||||
this@MainService.isCustom = isCustom
|
||||
@@ -304,8 +300,7 @@ class MainService : Service() {
|
||||
AbsMogoApplication.getApp().applicationContext,
|
||||
"pic",
|
||||
getStrategyType("pic")
|
||||
)
|
||||
, pendingIntent
|
||||
), pendingIntent
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -336,8 +331,7 @@ class MainService : Service() {
|
||||
AbsMogoApplication.getApp().applicationContext,
|
||||
"video",
|
||||
getStrategyType("video")
|
||||
)
|
||||
, videoPendingIntent
|
||||
), videoPendingIntent
|
||||
)
|
||||
}
|
||||
}
|
||||
@@ -345,9 +339,7 @@ class MainService : Service() {
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
unregisterReceiver(mAlarmBroadCast)
|
||||
// unregisterReceiver(mCustomSendBroadCast)
|
||||
CarCorderController.release()
|
||||
// CosCallbackMapController.release()
|
||||
LatLngStickyEventBus.getInstance().unregister(this)
|
||||
LatLngStickyEventBus.getInstance().removeAllStickyEvents()
|
||||
trackNormalEvent(CarNet_MainService_Destory, null)
|
||||
|
||||
Reference in New Issue
Block a user