合并黑夜白天模式等需求
15
.idea/codeStyles/Project.xml
generated
@@ -3,18 +3,9 @@
|
||||
<JetCodeStyleSettings>
|
||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||
<value>
|
||||
<package name="java.util" alias="false" withSubpackages="false" />
|
||||
<package name="kotlinx.android.synthetic" alias="false" withSubpackages="true" />
|
||||
<package name="io.ktor" alias="false" withSubpackages="true" />
|
||||
</value>
|
||||
</option>
|
||||
<option name="PACKAGES_IMPORT_LAYOUT">
|
||||
<value>
|
||||
<package name="" alias="false" withSubpackages="true" />
|
||||
<package name="java" alias="false" withSubpackages="true" />
|
||||
<package name="javax" alias="false" withSubpackages="true" />
|
||||
<package name="kotlin" alias="false" withSubpackages="true" />
|
||||
<package name="" alias="true" withSubpackages="true" />
|
||||
<package name="java.util" withSubpackages="false" static="false" />
|
||||
<package name="kotlinx.android.synthetic" withSubpackages="true" static="false" />
|
||||
<package name="io.ktor" withSubpackages="true" static="false" />
|
||||
</value>
|
||||
</option>
|
||||
</JetCodeStyleSettings>
|
||||
|
||||
15
.idea/gradle.xml
generated
@@ -37,6 +37,7 @@
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-gps-simulator" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-gps-simulator-debug" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-gps-simulator-noop" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-guide" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-left-panel" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-left-panel-noop" />
|
||||
<option value="$PROJECT_DIR$/modules/mogo-module-main" />
|
||||
@@ -58,6 +59,20 @@
|
||||
<option value="$PROJECT_DIR$/services" />
|
||||
<option value="$PROJECT_DIR$/services/mogo-service" />
|
||||
<option value="$PROJECT_DIR$/services/mogo-service-api" />
|
||||
<option value="$PROJECT_DIR$/skin" />
|
||||
<option value="$PROJECT_DIR$/skin/mogo-skin-light" />
|
||||
<option value="$PROJECT_DIR$/skin/mogo-skin-support" />
|
||||
<option value="$PROJECT_DIR$/skin/mogo-skin-support-impl" />
|
||||
<option value="$PROJECT_DIR$/skin/mogo-skin-support-noop" />
|
||||
<option value="$PROJECT_DIR$/skin/skin-support" />
|
||||
<option value="$PROJECT_DIR$/skin/skin-support-appcompat" />
|
||||
<option value="$PROJECT_DIR$/skin/skin-support-cardview" />
|
||||
<option value="$PROJECT_DIR$/skin/skin-support-constraint-layout" />
|
||||
<option value="$PROJECT_DIR$/skin/skin-support-design" />
|
||||
<option value="$PROJECT_DIR$/test" />
|
||||
<option value="$PROJECT_DIR$/test/crashreport" />
|
||||
<option value="$PROJECT_DIR$/test/crashreport-bugly" />
|
||||
<option value="$PROJECT_DIR$/test/crashreport-noop" />
|
||||
</set>
|
||||
</option>
|
||||
<option name="resolveModulePerSourceSet" value="false" />
|
||||
|
||||
2
.idea/misc.xml
generated
@@ -4,7 +4,7 @@
|
||||
<asm skipDebug="false" skipFrames="false" skipCode="false" expandFrames="false" />
|
||||
<groovy codeStyle="LEGACY" />
|
||||
</component>
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -109,6 +109,8 @@ android {
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.fLauncherAmapApiValue]
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
|
||||
// 是否加载引导模块
|
||||
buildConfigField 'boolean', 'LOAD_GUIDE_MODULE', 'false'
|
||||
}
|
||||
// f系列-分体机
|
||||
f80x {
|
||||
@@ -123,6 +125,8 @@ android {
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.fLauncherAmapApiValue]
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
|
||||
// 是否加载引导模块
|
||||
buildConfigField 'boolean', 'LOAD_GUIDE_MODULE', 'false'
|
||||
}
|
||||
// e系列,采用Launcher方案
|
||||
e8xx {
|
||||
@@ -137,6 +141,8 @@ android {
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.commonLauncherAmapApiValue]
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
|
||||
// 是否加载引导模块
|
||||
buildConfigField 'boolean', 'LOAD_GUIDE_MODULE', 'false'
|
||||
}
|
||||
// 同上
|
||||
em4 {
|
||||
@@ -151,6 +157,8 @@ android {
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.commonLauncherAmapApiValue]
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
|
||||
// 是否加载引导模块
|
||||
buildConfigField 'boolean', 'LOAD_GUIDE_MODULE', 'false'
|
||||
}
|
||||
// e系列-2+32,对标D系列2+32,采用独立app的形式
|
||||
em3 {
|
||||
@@ -165,6 +173,8 @@ android {
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.commonIndependentAmapApiValue]
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
|
||||
// 是否加载引导模块
|
||||
buildConfigField 'boolean', 'LOAD_GUIDE_MODULE', 'false'
|
||||
}
|
||||
// e系列-1+16,对标D系列1+16,采用独立app形式
|
||||
em1 {
|
||||
@@ -179,6 +189,8 @@ android {
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.commonIndependentAmapApiValue]
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
|
||||
// 是否加载引导模块
|
||||
buildConfigField 'boolean', 'LOAD_GUIDE_MODULE', 'false'
|
||||
}
|
||||
// d系列
|
||||
d8xx {
|
||||
@@ -193,6 +205,8 @@ android {
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.commonIndependentAmapApiValue]
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
|
||||
// 是否加载引导模块
|
||||
buildConfigField 'boolean', 'LOAD_GUIDE_MODULE', 'true'
|
||||
}
|
||||
// d系列 2 + 32
|
||||
d80x {
|
||||
@@ -207,6 +221,8 @@ android {
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.commonIndependentAmapApiValue]
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
|
||||
// 是否加载引导模块
|
||||
buildConfigField 'boolean', 'LOAD_GUIDE_MODULE', 'true'
|
||||
}
|
||||
// d系列 1+16 版本
|
||||
d82x {
|
||||
@@ -221,6 +237,8 @@ android {
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.commonIndependentAmapApiValue]
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
|
||||
// 是否加载引导模块
|
||||
buildConfigField 'boolean', 'LOAD_GUIDE_MODULE', 'true'
|
||||
}
|
||||
// 比亚迪
|
||||
bydauto {
|
||||
@@ -235,6 +253,8 @@ android {
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.bydautoIndependentApiValue]
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'true'
|
||||
// 是否加载引导模块
|
||||
buildConfigField 'boolean', 'LOAD_GUIDE_MODULE', 'false'
|
||||
}
|
||||
qa {
|
||||
dimension "env"
|
||||
@@ -253,6 +273,12 @@ android {
|
||||
packagingOptions {
|
||||
exclude 'META-INF/io.netty.versions.properties'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
res.srcDirs = ['src/main/res', 'src/main/res-night']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
@@ -269,14 +295,15 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
implementation rootProject.ext.dependencies.boostmultidex
|
||||
debugImplementation rootProject.ext.dependencies.leakcanary
|
||||
testImplementation rootProject.ext.dependencies.leakcanary
|
||||
releaseImplementation rootProject.ext.dependencies.leakcanarynoop
|
||||
debugImplementation rootProject.ext.dependencies.debugleakcanary
|
||||
releaseImplementation rootProject.ext.dependencies.releaseleakcanary
|
||||
|
||||
implementation rootProject.ext.dependencies.carcallprovider
|
||||
implementation rootProject.ext.dependencies.carcall
|
||||
|
||||
implementation rootProject.ext.dependencies.mogologlib
|
||||
compileOnly rootProject.ext.dependencies.adasapi
|
||||
compileOnly rootProject.ext.dependencies.adasconfigapi
|
||||
|
||||
// implementation rootProject.ext.dependencies.modulepushbase
|
||||
// launcherImplementation rootProject.ext.dependencies.modulepush
|
||||
@@ -300,6 +327,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.mogomonitor
|
||||
implementation rootProject.ext.dependencies.mogomodulewidgets
|
||||
implementation rootProject.ext.dependencies.mogomoduleback
|
||||
implementation rootProject.ext.dependencies.guideshow
|
||||
} else {
|
||||
implementation project(':foudations:mogo-commons')
|
||||
implementation project(':modules:mogo-module-common')
|
||||
@@ -317,6 +345,7 @@ dependencies {
|
||||
implementation project(':modules:mogo-module-monitor')
|
||||
implementation project(':modules:mogo-module-widgets')
|
||||
implementation project(':modules:mogo-module-back')
|
||||
implementation project(':modules:mogo-module-guide')
|
||||
}
|
||||
|
||||
apply from: "./functions/perform.gradle"
|
||||
@@ -324,6 +353,8 @@ dependencies {
|
||||
apply from: "./functions/socketpush.gradle"
|
||||
apply from: "./functions/gpssimulator.gradle"
|
||||
apply from: "./functions/leftpanel.gradle"
|
||||
apply from: "./functions/skin.gradle"
|
||||
apply from: "./functions/crashreport.gradle"
|
||||
}
|
||||
|
||||
android.applicationVariants.all { variant ->
|
||||
|
||||
13
app/functions/crashreport.gradle
Normal file
@@ -0,0 +1,13 @@
|
||||
// bugly 上报,目前仅在debug编译下加载bugly
|
||||
|
||||
project.dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.crashreport
|
||||
debugImplementation rootProject.ext.dependencies.crashreportbugly
|
||||
releaseImplementation rootProject.ext.dependencies.crashreportnoop
|
||||
} else {
|
||||
implementation project(':test:crashreport')
|
||||
debugImplementation project(':test:crashreport-bugly')
|
||||
releaseImplementation project(':test:crashreport-noop')
|
||||
}
|
||||
}
|
||||
48
app/functions/skin.gradle
Normal file
@@ -0,0 +1,48 @@
|
||||
project.dependencies {
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
bydautoImplementation rootProject.ext.dependencies.skinsupportnoop
|
||||
d8xxImplementation rootProject.ext.dependencies.skinsupportnoop
|
||||
d82xImplementation rootProject.ext.dependencies.skinsupportnoop
|
||||
em1Implementation rootProject.ext.dependencies.skinsupportnoop
|
||||
d80xImplementation rootProject.ext.dependencies.skinsupportnoop
|
||||
em3Implementation rootProject.ext.dependencies.skinsupportnoop
|
||||
|
||||
f8xxImplementation rootProject.ext.dependencies.skinsupportimpl
|
||||
f80xImplementation rootProject.ext.dependencies.skinsupportimpl
|
||||
em4Implementation rootProject.ext.dependencies.skinsupportimpl
|
||||
e8xxImplementation rootProject.ext.dependencies.skinsupportimpl
|
||||
|
||||
f8xxImplementation rootProject.ext.dependencies.skinsupportlight
|
||||
f80xImplementation rootProject.ext.dependencies.skinsupportlight
|
||||
em4Implementation rootProject.ext.dependencies.skinsupportlight
|
||||
e8xxImplementation rootProject.ext.dependencies.skinsupportlight
|
||||
// d8xxImplementation rootProject.ext.dependencies.skinsupportlight
|
||||
// d82xImplementation rootProject.ext.dependencies.skinsupportlight
|
||||
// em1Implementation rootProject.ext.dependencies.skinsupportlight
|
||||
// d80xImplementation rootProject.ext.dependencies.skinsupportlight
|
||||
// em3Implementation rootProject.ext.dependencies.skinsupportlight
|
||||
} else {
|
||||
bydautoImplementation project(':skin:mogo-skin-support-noop')
|
||||
d8xxImplementation project(':skin:mogo-skin-support-noop')
|
||||
d82xImplementation project(':skin:mogo-skin-support-noop')
|
||||
em1Implementation project(':skin:mogo-skin-support-noop')
|
||||
d80xImplementation project(':skin:mogo-skin-support-noop')
|
||||
em3Implementation project(':skin:mogo-skin-support-noop')
|
||||
|
||||
f8xxImplementation project(':skin:mogo-skin-support-impl')
|
||||
f80xImplementation project(':skin:mogo-skin-support-impl')
|
||||
em4Implementation project(':skin:mogo-skin-support-impl')
|
||||
e8xxImplementation project(':skin:mogo-skin-support-impl')
|
||||
|
||||
f8xxImplementation project(':skin:mogo-skin-light')
|
||||
f80xImplementation project(':skin:mogo-skin-light')
|
||||
em4Implementation project(':skin:mogo-skin-light')
|
||||
e8xxImplementation project(':skin:mogo-skin-light')
|
||||
// d8xxImplementation project(':skin:mogo-skin-light')
|
||||
// d82xImplementation project(':skin:mogo-skin-light')
|
||||
// em1Implementation project(':skin:mogo-skin-light')
|
||||
// d80xImplementation project(':skin:mogo-skin-light')
|
||||
// em3Implementation project(':skin:mogo-skin-light')
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:sharedUserId="android.uid.system"
|
||||
package="com.mogo.launcher">
|
||||
</manifest>
|
||||
@@ -3,4 +3,5 @@
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:sharedUserId="android.uid.system"
|
||||
package="com.mogo.launcher">
|
||||
|
||||
</manifest>
|
||||
@@ -27,13 +27,18 @@ import com.mogo.module.widgets.MogoWidgetsProvider;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.passport.IMogoTicketCallback;
|
||||
import com.mogo.test.crashreport.ITestCrashReportProvider;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.LogLevel;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.squareup.leakcanary.LeakCanary;
|
||||
import com.zhidao.boot.persistent.lib.PersistentManager;
|
||||
import com.zhidao.mogo.module.left.panel.LeftPanelConst;
|
||||
import com.zhidao.mogo.tanlu.api.TanluApiConst;
|
||||
|
||||
import static com.mogo.module.guide.GuideConstant.PATH_GUIDE_FRAGMENT;
|
||||
import static com.mogo.module.guide.GuideConstant.PATH_GUIDE_MODULE_NAME;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
@@ -48,6 +53,9 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
public void onCreate() {
|
||||
initDebugConfig();
|
||||
super.onCreate();
|
||||
if ( !shouldInit() ) {
|
||||
return;
|
||||
}
|
||||
// Crash 日志收集
|
||||
final long start = System.currentTimeMillis();
|
||||
CrashSystem crashSystem = CrashSystem.getInstance( this );
|
||||
@@ -56,7 +64,9 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
crashSystem.setDebug( BuildConfig.DEBUG );
|
||||
Logger.init( BuildConfig.DEBUG ? LogLevel.DEBUG : LogLevel.OFF );
|
||||
|
||||
// MogoModulePaths.addModule(new MogoModule(PATH_GUIDE_FRAGMENT, PATH_GUIDE_MODULE_NAME));
|
||||
if ( DebugConfig.isLoadGuideModule() ) {
|
||||
MogoModulePaths.addModule( new MogoModule( PATH_GUIDE_FRAGMENT, PATH_GUIDE_MODULE_NAME ) );
|
||||
}
|
||||
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_AGREEMENT, AuthorizeConstant.PATH_AGREEMENT_MODULE_NAME ) );
|
||||
|
||||
if ( DebugConfig.isLauncher() ) {
|
||||
@@ -68,16 +78,17 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
if ( DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_BYD ) {
|
||||
MogoModulePaths.addModule( new MogoModule( CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME ) );
|
||||
}
|
||||
|
||||
MogoModulePaths.addModule( new MogoModule( TanluApiConst.MODULE_PATH, TanluApiConst.MODULE_NAME ) );
|
||||
MogoModulePaths.addModule( new MogoModule( TanluConstants.TAG, TanluConstants.MODEL_NAME ) );
|
||||
MogoModulePaths.addBaseModule( new MogoModule( TanluConstants.TAG, TanluConstants.MODEL_NAME ) );
|
||||
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_SHARE, "ShareControl" ) );
|
||||
|
||||
MogoModulePaths.addModule( new MogoModule( LeftPanelConst.PATH_NAME, LeftPanelConst.MODULE_NAME ) );
|
||||
|
||||
MogoModulePaths.addBaseModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
|
||||
MogoModulePaths.addBaseModule( new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.MODULE_NAME ) );
|
||||
MogoModulePaths.addBaseModule(new MogoModule( MogoServicePaths.PATH_STRATEGY_SHARE,"StrategyShare"));
|
||||
MogoModulePaths.addBaseModule(new MogoModule(MogoServicePaths.PATH_MOGO_MONITOR, "MogoMonitor"));
|
||||
MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_STRATEGY_SHARE, "StrategyShare" ) );
|
||||
MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_MOGO_MONITOR, "MogoMonitor" ) );
|
||||
MogoModulePaths.addModule( new MogoModule( V2XConst.PATH_EVENT_PANEL, V2XConst.MODULE_NAME_EVENT_PANEL ) );
|
||||
MogoModulePaths.addModule( new MogoModule( PushUIConstants.PATH, PushUIConstants.NAME ) );
|
||||
|
||||
@@ -86,10 +97,25 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
Intent intent = new Intent( this, MogoMainService.class );
|
||||
startService( intent );
|
||||
}
|
||||
|
||||
LeakCanary.install( this );
|
||||
|
||||
// debug 下初始化 bugly 上报
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
ARouter.getInstance().navigation( ITestCrashReportProvider.class );
|
||||
}
|
||||
Log.i( "timer", "cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected boolean shouldInit() {
|
||||
return !LeakCanary.isInAnalyzerProcess( this );
|
||||
}
|
||||
|
||||
private void initDebugConfig() {
|
||||
if ( !shouldInit() ) {
|
||||
return;
|
||||
}
|
||||
DebugConfig.setNetMode( BuildConfig.NET_ENV );
|
||||
DebugConfig.setDebug( BuildConfig.DEBUG );
|
||||
DebugConfig.setAIType( BuildConfig.AIType );
|
||||
@@ -103,20 +129,28 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
DebugConfig.setProductFlavor( BuildConfig.FLAVOR_product );
|
||||
DebugConfig.setSocketAppId( BuildConfig.SOCKET_APP_ID );
|
||||
DebugConfig.setRoadEventAnimated( BuildConfig.ROAD_EVENT_ANIMATED );
|
||||
DebugConfig.setLoadGuideModule( BuildConfig.LOAD_GUIDE_MODULE );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void asyncInitImpl() {
|
||||
super.asyncInitImpl();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
prepareBaseService( 2_000L );
|
||||
final IMogoServiceApis apis = ARouter.getInstance().navigation( IMogoServiceApis.class );
|
||||
prepareBaseService( apis, 2_000L );
|
||||
// installSkinManager( this, apis );
|
||||
}
|
||||
|
||||
/**
|
||||
* 基础服务:passport、location、socket
|
||||
*/
|
||||
private void prepareBaseService( long delay ) {
|
||||
private void prepareBaseService( IMogoServiceApis apis, long delay ) {
|
||||
|
||||
UiThreadHandler.postDelayed( () -> {
|
||||
final IMogoServiceApis apis = ARouter.getInstance().navigation( IMogoServiceApis.class );
|
||||
// 第三方平台的sn是服务端生成的,所以必须在返回后才能开启
|
||||
if ( TextUtils.isEmpty( Utils.getSn() ) ) {
|
||||
preparePassportEnvironment( apis, () -> {
|
||||
|
||||
@@ -4,20 +4,19 @@ ext {
|
||||
android = [
|
||||
// applicationId : "com.mogo.launcher",
|
||||
// zhidadoApplicationId: "com.zhidao.launcher",
|
||||
launcherApplicationId : "com.mogo.launcher",
|
||||
independentApplicationId : "com.mogo.launcher.app",
|
||||
fLauncherApplicationId : "com.mogo.launcher.f",
|
||||
bydautoIndependentApplicationId: "com.mogo.launcher.app.bydauto",
|
||||
fLauncherAmapApiValue : "aa2c8a0547378ead2f9a37762d9dd179",
|
||||
bydautoIndependentApiValue : "b1e1d527b02a493913c50985827c943a",
|
||||
commonLauncherAmapApiValue : "a36b9f7b086fa3951bb35338a5a06dd3",
|
||||
commonIndependentAmapApiValue : "1c3fbc5f5e183619ffb1e7bc01e6751f",
|
||||
compileSdkVersion : 28,
|
||||
buildToolsVersion : "29.0.2",
|
||||
minSdkVersion : 19,
|
||||
targetSdkVersion : 22,
|
||||
launcherApplicationId : "com.mogo.launcher",
|
||||
independentApplicationId : "com.mogo.launcher.app",
|
||||
fLauncherApplicationId : "com.mogo.launcher.f",
|
||||
bydautoIndependentApplicationId: "com.mogo.launcher.app.bydauto",
|
||||
fLauncherAmapApiValue : "aa2c8a0547378ead2f9a37762d9dd179",
|
||||
bydautoIndependentApiValue : "b1e1d527b02a493913c50985827c943a",
|
||||
commonLauncherAmapApiValue : "a36b9f7b086fa3951bb35338a5a06dd3",
|
||||
commonIndependentAmapApiValue : "1c3fbc5f5e183619ffb1e7bc01e6751f",
|
||||
compileSdkVersion : 28,
|
||||
buildToolsVersion : "29.0.2",
|
||||
minSdkVersion : 19,
|
||||
targetSdkVersion : 22,
|
||||
]
|
||||
|
||||
dependencies = [
|
||||
// androidx
|
||||
androidxappcompat : "androidx.appcompat:appcompat:1.1.0",
|
||||
@@ -85,6 +84,7 @@ ext {
|
||||
// material
|
||||
material : 'com.google.android.material:material:1.1.0',
|
||||
|
||||
indicator : 'com.github.zhpanvip:viewpagerindicator:1.0.4',
|
||||
|
||||
// modules
|
||||
moduletanlu : "com.mogo.module:module-tanlu:${MOGO_MODULE_TANLU_VERSION}",
|
||||
@@ -109,7 +109,7 @@ ext {
|
||||
moduleextensions : "com.mogo.module:module-extensions:${MOGO_MODULE_EXTENSIONS_VERSION}",
|
||||
carcall : "com.mogo.module.carchatting:module-carchatting:${CARCHATTING_VERSION}",
|
||||
carcallprovider : "com.mogo.module.carchatting:module-carchatting-provider:${CARCHATTINGPROVIDER_VERSION}",
|
||||
// guideshow : "com.mogo.module.guideshow:module-guideshow:${MOGO_MODULE_GUIDESHOW_VERSION}",
|
||||
guideshow : "com.mogo.module.guideshow:module-guideshow:${MOGO_MODULE_GUIDESHOW_VERSION}",
|
||||
// guideshowprovider : "com.mogo.module.guideshow:module-guideshow-provider:${MOGO_MODULE_GUIDESHOW_PROVIDER_VERSION}",
|
||||
// 在线车辆
|
||||
moduleonlinecar : "com.mogo.module:module-onlinecar:${MOGO_MODULE_ONLINECAR_VERSION}",
|
||||
@@ -161,6 +161,7 @@ ext {
|
||||
gpssimulatornoop : "com.mogo.module:module-gps-simulator-noop:${MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION}",
|
||||
|
||||
adasapi : "com.zhidao.autopilot.support:adas:1.0.1",
|
||||
adasconfigapi : "com.zhidao.adasconfig:adasconfig:1.1.5",
|
||||
|
||||
// 个人中心的SDK
|
||||
personalsdk : "com.zhidaoauto.person.info:data:1.0.1",
|
||||
@@ -198,6 +199,16 @@ ext {
|
||||
//
|
||||
mogomodulewidgets : "com.mogo.module:module-widgets:${MOGO_MODULE_WIDGETS_VERSION}",
|
||||
|
||||
kotlingradleplugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}"
|
||||
kotlingradleplugin : "org.jetbrains.kotlin:kotlin-gradle-plugin:${kotlin_version}",
|
||||
|
||||
skinsupport : "com.mogo.skin:skin-support:${MOGO_SKIN_SUPPORT_VERSION}",
|
||||
skinsupportimpl : "com.mogo.skin:skin-support-impl:${MOGO_SKIN_SUPPORT_IMPL_VERSION}",
|
||||
skinsupportnoop : "com.mogo.skin:skin-support-noop:${MOGO_SKIN_SUPPORT_NOOP_VERSION}",
|
||||
skinsupportlight : "com.mogo.skin:skin-light:${MOGO_SKIN_LIGHT_VERSION}",
|
||||
|
||||
crashreport : "com.mogo.test:crashrepot:${CRASHREPORT_VERSION}",
|
||||
crashreportbugly : "com.mogo.test:crashreport-bugly:${CRASHREPORT_BUGLY_VERSION}",
|
||||
crashreportnoop : "com.mogo.test:crashreport-noop:${CRASHREPORT_NOOP_VERSION}",
|
||||
]
|
||||
|
||||
}
|
||||
@@ -61,7 +61,7 @@ class PassportManager implements IMogoPassportManager {
|
||||
|
||||
@Override
|
||||
public void onFailure( int code, String msg ) {
|
||||
Logger.d( TAG, "fail" );
|
||||
Logger.d( TAG, "fail code= %s, msg=%s", code, msg );
|
||||
if ( callback != null ) {
|
||||
callback.onError( code, msg );
|
||||
}
|
||||
|
||||
@@ -69,7 +69,7 @@ class PassportManager implements IMogoPassportManager {
|
||||
|
||||
@Override
|
||||
public void onFailure( int code ) {
|
||||
Logger.d( TAG, "fail" );
|
||||
Logger.d( TAG, "fail: code = %s", code );
|
||||
if ( callback != null ) {
|
||||
callback.onError( code, "getTicket error." );
|
||||
}
|
||||
@@ -79,6 +79,7 @@ class PassportManager implements IMogoPassportManager {
|
||||
|
||||
@Override
|
||||
public void onFailure( int code, String msg ) {
|
||||
Logger.d( TAG, "onFailure: code = %s, msg = %s", code, msg );
|
||||
if ( callback != null ) {
|
||||
callback.onError( code, "login: " + msg );
|
||||
}
|
||||
|
||||
@@ -46,12 +46,12 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.accountsdk
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.skinsupport
|
||||
} else {
|
||||
implementation project(":foudations:mogo-utils")
|
||||
implementation project(":skin:mogo-skin-support")
|
||||
}
|
||||
api 'org.greenrobot:eventbus:3.1.1'
|
||||
|
||||
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
@@ -4,6 +4,8 @@ import android.app.Application;
|
||||
import android.text.TextUtils;
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
@@ -17,6 +19,7 @@ import com.mogo.commons.network.ParamsUtil;
|
||||
import com.mogo.commons.network.X509TrustManagerImpl;
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.TipDrawable;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.network.NetConfig;
|
||||
|
||||
@@ -50,7 +53,13 @@ public class AbsMogoApplication extends Application {
|
||||
public void onCreate() {
|
||||
super.onCreate();
|
||||
sApp = this;
|
||||
init();
|
||||
if ( shouldInit() ) {
|
||||
init();
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean shouldInit(){
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void init() {
|
||||
@@ -65,13 +74,26 @@ public class AbsMogoApplication extends Application {
|
||||
ARouter.openLog();
|
||||
}
|
||||
ARouter.init( sApp );
|
||||
TipToast.init( this, ( ( context, message ) -> {
|
||||
TipToast.init( this, ( ( context, message, tipDrawable ) -> {
|
||||
if ( TextUtils.isEmpty( message ) ) {
|
||||
return null;
|
||||
}
|
||||
View contentView = LayoutInflater.from( context ).inflate( R.layout.module_commons_layout_toast, null );
|
||||
TextView txt = contentView.findViewById( R.id.module_commons_toast_msg );
|
||||
txt.setText( message );
|
||||
View contentView;
|
||||
if(tipDrawable==null) {
|
||||
contentView = LayoutInflater.from(context).inflate(R.layout.module_commons_layout_toast, null);
|
||||
TextView txt = contentView.findViewById(R.id.module_commons_toast_msg);
|
||||
txt.setText(message);
|
||||
}else{
|
||||
// 有图片,使用带图片的布局,当前只实现了左侧图片
|
||||
contentView = LayoutInflater.from(context).inflate(R.layout.module_commons_layout_toast_with_left_drawable, null);
|
||||
TextView txt = contentView.findViewById(R.id.module_commons_toast_msg);
|
||||
ImageView img = contentView.findViewById(R.id.module_commons_toast_left_drawable);
|
||||
img.setImageDrawable(tipDrawable.getDrawable());
|
||||
ViewGroup.LayoutParams params = img.getLayoutParams();
|
||||
params.width = tipDrawable.getWidth();
|
||||
params.height = tipDrawable.getHeight();
|
||||
txt.setText(message);
|
||||
}
|
||||
return contentView;
|
||||
} ) );
|
||||
}
|
||||
|
||||
@@ -250,4 +250,21 @@ public class DebugConfig {
|
||||
public static void setRoadEventAnimated( boolean sRoadEventAnimated ) {
|
||||
DebugConfig.sRoadEventAnimated = sRoadEventAnimated;
|
||||
}
|
||||
|
||||
|
||||
private static boolean sLoadGuideModule = false;
|
||||
|
||||
public static void setLoadGuideModule( boolean sLoadGuideModule ) {
|
||||
DebugConfig.sLoadGuideModule = sLoadGuideModule;
|
||||
}
|
||||
|
||||
public static boolean isLoadGuideModule() {
|
||||
return sLoadGuideModule;
|
||||
}
|
||||
|
||||
private static String SP_GUIDE = "SP_GUIDE_2020_09_09";
|
||||
|
||||
public static String getSpGuide(){
|
||||
return SP_GUIDE;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,7 +2,6 @@ package com.mogo.commons.mvp;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
|
||||
import android.view.MotionEvent;
|
||||
import android.view.Window;
|
||||
import android.view.WindowManager;
|
||||
@@ -10,8 +9,10 @@ import android.view.WindowManager;
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
import androidx.appcompat.app.AppCompatActivity;
|
||||
import androidx.appcompat.app.AppCompatDelegate;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.skin.support.MogoSkinManager;
|
||||
import com.mogo.utils.SoftKeyBoardJobber;
|
||||
|
||||
/**
|
||||
@@ -28,9 +29,10 @@ public abstract class MvpActivity< V extends IView, P extends Presenter< V > >
|
||||
@Override
|
||||
protected void onCreate( @Nullable Bundle savedInstanceState ) {
|
||||
super.onCreate( savedInstanceState );
|
||||
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_BYD) {
|
||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||
getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN);
|
||||
beforeSetContentView(savedInstanceState);
|
||||
if ( DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_BYD ) {
|
||||
requestWindowFeature( Window.FEATURE_NO_TITLE );
|
||||
getWindow().setFlags( WindowManager.LayoutParams.FLAG_FULLSCREEN, WindowManager.LayoutParams.FLAG_FULLSCREEN );
|
||||
}
|
||||
setContentView( getLayoutId() );
|
||||
initViews();
|
||||
@@ -38,6 +40,10 @@ public abstract class MvpActivity< V extends IView, P extends Presenter< V > >
|
||||
getLifecycle().addObserver( mPresenter );
|
||||
}
|
||||
|
||||
protected void beforeSetContentView(Bundle savedInstanceState){
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* 布局资源
|
||||
*
|
||||
@@ -76,6 +82,7 @@ public abstract class MvpActivity< V extends IView, P extends Presenter< V > >
|
||||
}
|
||||
return onTouchEvent( ev );
|
||||
}
|
||||
|
||||
protected boolean enableDispatchTouchEventToDismissSoftKeyBoard() {
|
||||
return true;
|
||||
}
|
||||
@@ -89,4 +96,11 @@ public abstract class MvpActivity< V extends IView, P extends Presenter< V > >
|
||||
}
|
||||
mPresenter = null;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public AppCompatDelegate getDelegate() {
|
||||
return MogoSkinManager.getInstance().getInstaller().getSkinAppCompatDelegate(this,
|
||||
super.getDelegate(), this);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,14 +41,12 @@ public abstract class MvpFragment<V extends IView, P extends Presenter<V>> exten
|
||||
viewGroup.removeView( mRootView );
|
||||
}
|
||||
}
|
||||
mRootView = inflater.inflate(getLayoutId(), container, false);
|
||||
return mRootView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
initViews(savedInstanceState);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -62,6 +60,7 @@ public abstract class MvpFragment<V extends IView, P extends Presenter<V>> exten
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
initViews();
|
||||
initViews(savedInstanceState);
|
||||
mPresenter = createPresenter();
|
||||
getViewLifecycleOwner().getLifecycle().addObserver(mPresenter);
|
||||
}
|
||||
@@ -90,7 +89,7 @@ public abstract class MvpFragment<V extends IView, P extends Presenter<V>> exten
|
||||
@Nullable
|
||||
protected <T extends View> T findViewById(int id) {
|
||||
if (mRootView == null) {
|
||||
mRootView = getView().findViewById(id);
|
||||
mRootView = getView();
|
||||
}
|
||||
if (mRootView != null) {
|
||||
return (T) mRootView.findViewById(id);
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.commons.network;
|
||||
|
||||
import com.mogo.commons.data.BaseData;
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.RequestOptions;
|
||||
import com.mogo.utils.network.utils.Util;
|
||||
|
||||
@@ -2,7 +2,7 @@
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="90dp" />
|
||||
<gradient
|
||||
android:angle="270"
|
||||
android:endColor="#F2161616"
|
||||
android:startColor="#F2161616" />
|
||||
android:angle="180"
|
||||
android:endColor="#FF3F4057"
|
||||
android:startColor="#FF5E6079" />
|
||||
</shape>
|
||||
@@ -1,27 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/module_commons_toast_bkg"
|
||||
android:orientation="vertical">
|
||||
android:paddingTop="@dimen/module_commons_toast_marginTop"
|
||||
android:paddingBottom="@dimen/module_commons_toast_marginBottom"
|
||||
android:paddingLeft="@dimen/module_commons_toast_marginLeft"
|
||||
android:paddingRight="@dimen/module_commons_toast_marginRight">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_commons_toast_msg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:layout_marginLeft="@dimen/module_commons_toast_marginLeft"
|
||||
android:layout_marginTop="@dimen/module_commons_toast_marginTop"
|
||||
android:layout_marginRight="@dimen/module_commons_toast_marginRight"
|
||||
android:layout_marginBottom="@dimen/module_commons_toast_marginBottom"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:drawablePadding="@dimen/module_commons_toast_space_between_icon_and_msg"
|
||||
android:maxWidth="@dimen/module_commons_toast_maxWidth"
|
||||
android:maxLength="20"
|
||||
android:maxLines="1"
|
||||
android:minWidth="@dimen/module_commons_toast_minWidth"
|
||||
android:textColor="#FFFF"
|
||||
android:textColor="@color/modules_commons_toast_text_color"
|
||||
android:textSize="@dimen/module_commons_toast_textSize"
|
||||
tools:text="测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试测试" />
|
||||
</LinearLayout>
|
||||
tools:text="测试测试测试" />
|
||||
|
||||
<!-- android:minWidth="@dimen/module_commons_toast_minWidth"-->
|
||||
</FrameLayout>
|
||||
@@ -0,0 +1,39 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="@drawable/module_commons_toast_bkg"
|
||||
android:orientation="horizontal"
|
||||
android:paddingLeft="@dimen/module_commons_toast_with_left_drawable_marginLeft"
|
||||
android:paddingTop="@dimen/module_commons_toast_with_left_drawable_marginTop"
|
||||
android:paddingRight="@dimen/module_commons_toast_marginRight"
|
||||
android:paddingBottom="@dimen/module_commons_toast_with_left_drawable_marginBottom">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_commons_toast_left_drawable"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center" />
|
||||
|
||||
<Space
|
||||
android:layout_width="@dimen/module_commons_toast_space_between_icon_and_msg"
|
||||
android:layout_height="wrap_content" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_commons_toast_msg"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center"
|
||||
android:drawablePadding="@dimen/module_commons_toast_space_between_icon_and_msg"
|
||||
android:ellipsize="end"
|
||||
android:gravity="center"
|
||||
android:maxWidth="@dimen/module_commons_toast_maxWidth"
|
||||
android:maxLength="20"
|
||||
android:maxLines="1"
|
||||
android:textColor="@color/modules_commons_toast_text_color"
|
||||
android:textSize="@dimen/module_commons_toast_textSize"
|
||||
tools:text="测试测试测试" />
|
||||
|
||||
<!-- android:minWidth="@dimen/module_commons_toast_minWidth"-->
|
||||
</LinearLayout>
|
||||
@@ -1,13 +1,18 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_commons_toast_marginLeft">50px</dimen>
|
||||
<dimen name="module_commons_toast_marginRight">50px</dimen>
|
||||
<dimen name="module_commons_toast_marginLeft">63px</dimen>
|
||||
<dimen name="module_commons_toast_with_left_drawable_marginLeft">30px</dimen>
|
||||
<dimen name="module_commons_toast_marginRight">63px</dimen>
|
||||
<dimen name="module_commons_toast_marginTop">32px</dimen>
|
||||
<dimen name="module_commons_toast_marginBottom">32px</dimen>
|
||||
<dimen name="module_commons_toast_with_left_drawable_marginTop">19px</dimen>
|
||||
<dimen name="module_commons_toast_with_left_drawable_marginBottom">19px</dimen>
|
||||
<dimen name="module_commons_toast_textSize">40px</dimen>
|
||||
<dimen name="module_commons_toast_minWidth">698px</dimen>
|
||||
<dimen name="module_commons_toast_maxWidth">900px</dimen>
|
||||
<dimen name="module_commons_toast_y_offset">130px</dimen>
|
||||
<dimen name="module_commons_toast_icon_width">94px</dimen>
|
||||
<dimen name="module_commons_toast_space_between_icon_and_msg">21px</dimen>
|
||||
</resources>
|
||||
|
||||
|
||||
|
||||
@@ -1,2 +1,4 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
||||
<resources>
|
||||
<color name="modules_commons_toast_text_color">#fff</color>
|
||||
</resources>
|
||||
@@ -1,11 +1,16 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_commons_toast_marginLeft">30px</dimen>
|
||||
<dimen name="module_commons_toast_marginRight">30px</dimen>
|
||||
<dimen name="module_commons_toast_marginLeft">33px</dimen>
|
||||
<dimen name="module_commons_toast_with_left_drawable_marginLeft">17px</dimen>
|
||||
<dimen name="module_commons_toast_marginRight">33px</dimen>
|
||||
<dimen name="module_commons_toast_marginTop">16px</dimen>
|
||||
<dimen name="module_commons_toast_marginBottom">16px</dimen>
|
||||
<dimen name="module_commons_toast_with_left_drawable_marginTop">10px</dimen>
|
||||
<dimen name="module_commons_toast_with_left_drawable_marginBottom">10px</dimen>
|
||||
<dimen name="module_commons_toast_textSize">22px</dimen>
|
||||
<dimen name="module_commons_toast_minWidth">371px</dimen>
|
||||
<dimen name="module_commons_toast_maxWidth">500px</dimen>
|
||||
<dimen name="module_commons_toast_y_offset">72px</dimen>
|
||||
<dimen name="module_commons_toast_icon_width">50px</dimen>
|
||||
<dimen name="module_commons_toast_space_between_icon_and_msg">10px</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.mogo.utils;
|
||||
|
||||
import android.graphics.drawable.Drawable;
|
||||
|
||||
/**
|
||||
* TipToast弹出框的图片资源封装类
|
||||
* 当前只支持添加一张图片,可添加到文字的 左{@link #TIP_DRAWABLE_GRAVITY_LEFT}, 上{@link #TIP_DRAWABLE_GRAVITY_TOP}, 右{@link #TIP_DRAWABLE_GRAVITY_RIGHT}, 下{@link #TIP_DRAWABLE_GRAVITY_BOTTOM}
|
||||
*
|
||||
* 当前仅支持添加左侧图片,所以{@link #gravity} 这个参数形同虚设
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class TipDrawable {
|
||||
public static final int TIP_DRAWABLE_GRAVITY_LEFT = 1;
|
||||
public static final int TIP_DRAWABLE_GRAVITY_TOP = 2;
|
||||
public static final int TIP_DRAWABLE_GRAVITY_RIGHT = 3;
|
||||
public static final int TIP_DRAWABLE_GRAVITY_BOTTOM = 4;
|
||||
private Drawable drawable;
|
||||
private int gravity;
|
||||
private int width;
|
||||
private int height;
|
||||
|
||||
/**
|
||||
* 默认图片居左,宽高使用{@link Drawable#getIntrinsicWidth()}和{@link Drawable#getIntrinsicHeight()}
|
||||
* @param drawable 要展示的图片
|
||||
*/
|
||||
public TipDrawable(Drawable drawable) {
|
||||
this(drawable, TIP_DRAWABLE_GRAVITY_LEFT,drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight());
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认图片居左
|
||||
* @param drawable 要展示的图片
|
||||
* @param width 要展示的图片宽度
|
||||
* @param height 要展示的图片高度
|
||||
*/
|
||||
public TipDrawable(Drawable drawable, int width, int height) {
|
||||
this(drawable, TIP_DRAWABLE_GRAVITY_LEFT,width,height);
|
||||
}
|
||||
|
||||
/**
|
||||
* 默认宽高使用{@link Drawable#getIntrinsicWidth()}和{@link Drawable#getIntrinsicHeight()}
|
||||
* @param drawable 要展示的图片
|
||||
* @param gravity 左{@link #TIP_DRAWABLE_GRAVITY_LEFT}, 上{@link #TIP_DRAWABLE_GRAVITY_TOP}, 右{@link #TIP_DRAWABLE_GRAVITY_RIGHT}, 下{@link #TIP_DRAWABLE_GRAVITY_BOTTOM}
|
||||
*/
|
||||
public TipDrawable(Drawable drawable, int gravity) {
|
||||
this(drawable, gravity,drawable.getIntrinsicWidth(),drawable.getIntrinsicHeight());
|
||||
}
|
||||
|
||||
/**
|
||||
* 可自定义展示位置
|
||||
* @param drawable 要展示的图片
|
||||
* @param gravity 左{@link #TIP_DRAWABLE_GRAVITY_LEFT}, 上{@link #TIP_DRAWABLE_GRAVITY_TOP}, 右{@link #TIP_DRAWABLE_GRAVITY_RIGHT}, 下{@link #TIP_DRAWABLE_GRAVITY_BOTTOM}
|
||||
*/
|
||||
public TipDrawable(Drawable drawable, int gravity, int width, int height) {
|
||||
this.drawable = drawable;
|
||||
this.gravity = gravity;
|
||||
this.width = width;
|
||||
this.height = height;
|
||||
}
|
||||
|
||||
public Drawable getDrawable() {
|
||||
return drawable;
|
||||
}
|
||||
|
||||
public int getGravity() {
|
||||
return gravity;
|
||||
}
|
||||
|
||||
public int getWidth() {
|
||||
return width;
|
||||
}
|
||||
|
||||
public int getHeight() {
|
||||
return height;
|
||||
}
|
||||
}
|
||||
@@ -4,6 +4,10 @@ package com.mogo.utils;
|
||||
* 2016/1/1 by congtaowang
|
||||
*
|
||||
* @Version 1.0
|
||||
*
|
||||
* 增加了图片支持
|
||||
*
|
||||
* @Version 1.1
|
||||
*/
|
||||
|
||||
import android.content.Context;
|
||||
@@ -45,17 +49,17 @@ public final class TipToast {
|
||||
sGenerator = null;
|
||||
}
|
||||
|
||||
private static void tip( final String message, int duration ) {
|
||||
private static void tip( final String message, int duration ,TipDrawable tipDrawable) {
|
||||
if ( !checkParams() ) {
|
||||
return;
|
||||
}
|
||||
if ( TextUtils.isEmpty( message ) ) {
|
||||
return;
|
||||
}
|
||||
new ToastThread( new StringToastRunnable( sContext, message, duration ) ).start();
|
||||
new ToastThread(new StringToastRunnable(sContext, message, duration, tipDrawable)).start();
|
||||
}
|
||||
|
||||
private static void tip( final int msgId, int duration ) {
|
||||
private static void tip( final int msgId, int duration,TipDrawable tipDrawable ) {
|
||||
if ( !checkParams() ) {
|
||||
return;
|
||||
}
|
||||
@@ -66,7 +70,7 @@ public final class TipToast {
|
||||
} catch ( Exception e ) {
|
||||
return;
|
||||
}
|
||||
tip( ResourcesHelper.getString( sContext, msgId ), duration );
|
||||
tip( ResourcesHelper.getString( sContext, msgId ), duration ,tipDrawable);
|
||||
}
|
||||
|
||||
private static boolean checkParams() {
|
||||
@@ -82,27 +86,53 @@ public final class TipToast {
|
||||
}
|
||||
|
||||
public static void tip( final String message ) {
|
||||
tip( message, Toast.LENGTH_SHORT );
|
||||
tip( message, Toast.LENGTH_SHORT,null );
|
||||
}
|
||||
|
||||
public static void tip( final int msgId ) {
|
||||
tip( msgId, Toast.LENGTH_SHORT );
|
||||
tip( msgId, Toast.LENGTH_SHORT ,null);
|
||||
}
|
||||
|
||||
public static void longTip( String message ) {
|
||||
tip( message, Toast.LENGTH_LONG );
|
||||
tip( message, Toast.LENGTH_LONG ,null);
|
||||
}
|
||||
|
||||
public static void longTip( int msgId ) {
|
||||
tip( msgId, Toast.LENGTH_LONG );
|
||||
tip( msgId, Toast.LENGTH_LONG ,null);
|
||||
}
|
||||
|
||||
public static void shortTip( String message ) {
|
||||
tip( message, Toast.LENGTH_SHORT );
|
||||
tip( message, Toast.LENGTH_SHORT ,null);
|
||||
}
|
||||
|
||||
public static void shortTip( int msgId ) {
|
||||
tip( msgId, Toast.LENGTH_SHORT );
|
||||
tip( msgId, Toast.LENGTH_SHORT ,null);
|
||||
}
|
||||
|
||||
// -===带图片的方法===-
|
||||
|
||||
public static void tip( final String message,TipDrawable tipDrawable ) {
|
||||
tip( message, Toast.LENGTH_SHORT,tipDrawable );
|
||||
}
|
||||
|
||||
public static void tip( final int msgId,TipDrawable tipDrawable ) {
|
||||
tip( msgId, Toast.LENGTH_SHORT ,tipDrawable);
|
||||
}
|
||||
|
||||
public static void longTip( String message,TipDrawable tipDrawable ) {
|
||||
tip( message, Toast.LENGTH_LONG ,tipDrawable);
|
||||
}
|
||||
|
||||
public static void longTip( int msgId ,TipDrawable tipDrawable) {
|
||||
tip( msgId, Toast.LENGTH_LONG ,tipDrawable);
|
||||
}
|
||||
|
||||
public static void shortTip( String message,TipDrawable tipDrawable ) {
|
||||
tip( message, Toast.LENGTH_SHORT ,tipDrawable);
|
||||
}
|
||||
|
||||
public static void shortTip( int msgId,TipDrawable tipDrawable ) {
|
||||
tip( msgId, Toast.LENGTH_SHORT ,tipDrawable);
|
||||
}
|
||||
|
||||
static class ToastThread extends Thread {
|
||||
@@ -117,11 +147,13 @@ public final class TipToast {
|
||||
Context context;
|
||||
String msg;
|
||||
int duration;
|
||||
TipDrawable tipDrawable;
|
||||
|
||||
public StringToastRunnable( Context context, String msg, int duration ) {
|
||||
public StringToastRunnable( Context context, String msg, int duration,TipDrawable tipDrawable ) {
|
||||
this.context = context;
|
||||
this.msg = msg;
|
||||
this.duration = duration;
|
||||
this.tipDrawable = tipDrawable;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -131,44 +163,40 @@ public final class TipToast {
|
||||
return;
|
||||
}
|
||||
|
||||
sHandler.post( new Runnable() {
|
||||
sHandler.post(() -> {
|
||||
synchronized ( sSyncObject ) {
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
synchronized ( sSyncObject ) {
|
||||
if ( context == null ) {
|
||||
return;
|
||||
}
|
||||
|
||||
if ( context == null ) {
|
||||
return;
|
||||
}
|
||||
if ( sToast != null ) {
|
||||
sToast.cancel();
|
||||
}
|
||||
|
||||
if ( sToast != null ) {
|
||||
sToast.cancel();
|
||||
}
|
||||
|
||||
if ( sGenerator == null ) {
|
||||
sToast = Toast.makeText( context, msg, duration );
|
||||
if ( sGenerator == null ) {
|
||||
sToast = Toast.makeText( context, msg, duration );
|
||||
} else {
|
||||
sToast = new Toast( context );
|
||||
final View view = sGenerator.make( context, msg, tipDrawable );
|
||||
if ( view != null ) {
|
||||
sToast.setView( view );
|
||||
sToast.setGravity( sGenerator.gravity(), sGenerator.xOffset(), sGenerator.yOffset() );
|
||||
sToast.setDuration( duration );
|
||||
} else {
|
||||
sToast = new Toast( context );
|
||||
final View view = sGenerator.make( context, msg );
|
||||
if ( view != null ) {
|
||||
sToast.setView( view );
|
||||
sToast.setGravity( sGenerator.gravity(), sGenerator.xOffset(), sGenerator.yOffset() );
|
||||
sToast.setDuration( duration );
|
||||
} else {
|
||||
sToast = Toast.makeText( context, msg, duration );
|
||||
}
|
||||
}
|
||||
if ( sToast != null ) {
|
||||
sToast.show();
|
||||
sToast = Toast.makeText( context, msg, duration );
|
||||
}
|
||||
}
|
||||
if ( sToast != null ) {
|
||||
sToast.show();
|
||||
}
|
||||
}
|
||||
} );
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
public interface ToastViewGenerator {
|
||||
View make( Context context, String message );
|
||||
View make( Context context, String message,TipDrawable tipDrawable );
|
||||
|
||||
default int gravity() {
|
||||
return Gravity.CENTER;
|
||||
@@ -182,5 +210,4 @@ public final class TipToast {
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -65,7 +65,7 @@ MOGO_BASE_SERVICES_SDK_VERSION = 1.2.1.22
|
||||
# 探路
|
||||
MOGO_MODULE_TANLU_VERSION=1.3.1.24
|
||||
# 车聊聊
|
||||
CARCHATTING_VERSION=1.5.1
|
||||
CARCHATTING_VERSION=1.5.3
|
||||
# 车聊聊接口
|
||||
CARCHATTINGPROVIDER_VERSION=1.3.4
|
||||
# 视频引导
|
||||
@@ -100,12 +100,20 @@ MOGO_MODULE_OBU_VERSION = 1.2.1.10-SNAPSHOT
|
||||
# 闪屏页
|
||||
MOGO_MODULE_SPLASH_VERSION = 1.0.0-SNAPSHOT
|
||||
MOGO_MODULE_SPLASH_NOOP_VERSION = 1.0.0-SNAPSHOT
|
||||
MOGO_SKIN_SUPPORT_VERSION=1.0.0
|
||||
MOGO_SKIN_LIGHT_VERSION=1.0.0
|
||||
MOGO_SKIN_SUPPORT_IMPL_VERSION=1.0.0
|
||||
MOGO_SKIN_SUPPORT_NOOP_VERSION=1.0.0
|
||||
|
||||
# loglib
|
||||
LOGLIB_VERSION = 1.0.4
|
||||
# monitor
|
||||
MOGO_MODULE_MONITOR_VERSION = 1.0.0-SNAPSHOT
|
||||
|
||||
CRASHREPORT_VERSION = 1.0.0
|
||||
CRASHREPORT_BUGLY_VERSION = 1.0.0
|
||||
CRASHREPORT_NOOP_VERSION = 1.0.0
|
||||
|
||||
## 产品库必备配置,产品库自动对versionCode和versionName版本进行升级
|
||||
applicationId=com.mogo.launcer
|
||||
applicationName=IntelligentPilot
|
||||
|
||||
@@ -2,10 +2,10 @@ package com.mogo.map.impl.amap;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.amap.api.navi.AMapNaviView;
|
||||
import com.mogo.map.IMogoMapView;
|
||||
import com.mogo.map.MogoBaseMapView;
|
||||
|
||||
@@ -17,6 +17,8 @@ import com.mogo.map.MogoBaseMapView;
|
||||
*/
|
||||
public class AMapBaseMapView extends MogoBaseMapView {
|
||||
|
||||
private static final String TAG = "AMapBaseMapView";
|
||||
|
||||
public AMapBaseMapView( Context context ) {
|
||||
super( context );
|
||||
}
|
||||
@@ -31,6 +33,11 @@ public class AMapBaseMapView extends MogoBaseMapView {
|
||||
|
||||
@Override
|
||||
protected IMogoMapView createMapView( Context context ) {
|
||||
return new AMapNaviViewWrapper( new AMapNaviView( context ) );
|
||||
IMogoMapView mapView = AMapViewHandler.getMapView();
|
||||
if ( mapView.getMapView().getParent() != null ) {
|
||||
ViewGroup group = ( ViewGroup ) mapView.getMapView().getParent();
|
||||
group.removeView( mapView.getMapView() );
|
||||
}
|
||||
return AMapViewHandler.getMapView();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -93,7 +93,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
|
||||
public AMapNaviViewWrapper( AMapNaviView mapView ) {
|
||||
this.mMapView = mapView;
|
||||
this.mIMap = new AMapWrapper( mMapView.getMap(), mMapView, this );
|
||||
this.mIMap = new AMapWrapper( mMapView.getMap(), mMapView.getContext(), this );
|
||||
try {
|
||||
new BnHooker( mMapView.getMap(), mapView.getContext() );
|
||||
} catch ( Exception e ) {
|
||||
@@ -185,6 +185,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
aMap.setOnCameraChangeListener( this );
|
||||
aMap.setOnMyLocationChangeListener( this );
|
||||
}
|
||||
AMapMessageManager.getInstance().clear();
|
||||
AMapMessageManager.getInstance().registerAMapMessageListener( this );
|
||||
}
|
||||
|
||||
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.mogo.map.impl.amap;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.amap.api.maps.MapView;
|
||||
import com.amap.api.navi.AMapNaviView;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.IMogoMapView;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/9/10
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
class AMapViewHandler {
|
||||
|
||||
private static IMogoMapView sMapView;
|
||||
|
||||
public static void createMapView( Context context ) {
|
||||
if ( DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE ) {
|
||||
sMapView = new AMapViewWrapper( new MapView( context ) );
|
||||
} else {
|
||||
sMapView = new AMapNaviViewWrapper( new AMapNaviView( context ) );
|
||||
}
|
||||
}
|
||||
|
||||
public static IMogoMapView getMapView() {
|
||||
return sMapView;
|
||||
}
|
||||
|
||||
public static void destroy() {
|
||||
sMapView = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,821 @@
|
||||
package com.mogo.map.impl.amap;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.location.Location;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.os.Trace;
|
||||
import android.util.Log;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.AMapUtils;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
import com.amap.api.maps.MapView;
|
||||
import com.amap.api.maps.TextureMapView;
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
import com.amap.api.maps.model.CameraPosition;
|
||||
import com.amap.api.maps.model.CameraPositionCreator;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.maps.model.LatLngBounds;
|
||||
import com.amap.api.maps.model.Marker;
|
||||
import com.amap.api.maps.model.MyLocationStyle;
|
||||
import com.amap.api.maps.model.Poi;
|
||||
import com.amap.api.maps.model.Polyline;
|
||||
import com.amap.api.maps.model.animation.Animation;
|
||||
import com.amap.api.maps.model.animation.TranslateAnimation;
|
||||
import com.amap.api.navi.model.NaviInfo;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.IMogoMap;
|
||||
import com.mogo.map.IMogoMapView;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.impl.amap.hook.BnHooker;
|
||||
import com.mogo.map.impl.amap.marker.AMapMarkerWrapper;
|
||||
import com.mogo.map.impl.amap.message.AMapMessageListener;
|
||||
import com.mogo.map.impl.amap.message.AMapMessageManager;
|
||||
import com.mogo.map.impl.amap.navi.NaviClient;
|
||||
import com.mogo.map.impl.amap.utils.MogoMapUtils;
|
||||
import com.mogo.map.impl.amap.utils.ObjectUtils;
|
||||
import com.mogo.map.listener.MogoMapListenerHandler;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.uicontroller.CarCursorOption;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.map.uicontroller.MapCameraPosition;
|
||||
import com.mogo.map.uicontroller.MapControlResult;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-18
|
||||
* <p>
|
||||
* 代理高德导航地图
|
||||
*/
|
||||
public class AMapViewWrapper implements IMogoMapView,
|
||||
IMogoMapUIController,
|
||||
AMap.OnMarkerClickListener,
|
||||
AMap.OnMapLoadedListener,
|
||||
AMap.OnMapTouchListener,
|
||||
AMap.OnPOIClickListener,
|
||||
AMap.OnMapClickListener,
|
||||
AMap.OnPolylineClickListener,
|
||||
AMapMessageListener,
|
||||
AMap.OnCameraChangeListener,
|
||||
AMap.OnMyLocationChangeListener {
|
||||
|
||||
private static final String TAG = "AMapViewWrapper";
|
||||
|
||||
private final MapView mMapView;
|
||||
private IMogoMap mIMap;
|
||||
|
||||
private AMapMarkerClickHandler mMarkerClickHandler;
|
||||
private EnumMapUI mCurrentUIMode;
|
||||
|
||||
private boolean mIsCarLocked = false;
|
||||
|
||||
private float mDefaultZoomLevel = 16.0f;
|
||||
private final CarCursorOption DEFAULT_OPTION = new CarCursorOption.Builder()
|
||||
.carCursorRes( R.drawable.map_api_ic_current_location2 )
|
||||
.naviCursorRes( R.drawable.ic_amap_navi_cursor )
|
||||
.build();
|
||||
private CarCursorOption mCarCursorOption = DEFAULT_OPTION;
|
||||
|
||||
public AMapViewWrapper( MapView mapView ) {
|
||||
this.mMapView = mapView;
|
||||
this.mIMap = new AMapWrapper( mMapView.getMap(), mMapView.getContext(), this );
|
||||
try {
|
||||
new BnHooker( mMapView.getMap(), mapView.getContext() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void initMapView() {
|
||||
if ( mMapView == null ) {
|
||||
return;
|
||||
}
|
||||
// AMapNaviViewOptions options = mMapView.getViewOptions();
|
||||
// if ( options != null ) {
|
||||
// // 设置是否开启自动黑夜模式切换,默认为false,不自动切换
|
||||
// options.setAutoNaviViewNightMode( false );
|
||||
// // 设置6秒后是否自动锁车
|
||||
// options.setAutoLockCar( false );
|
||||
// // 设置路线上的摄像头气泡是否显示
|
||||
// options.setCameraBubbleShow( true );
|
||||
// // 设置路线相关的配置属性,如:路线的路况颜色,路线上是否显示摄像头气泡等。
|
||||
// // options.setRouteOverlayOptions( MapStyleUtils.getRouteOverlayOptions() );
|
||||
// // 设置自车的图片对象
|
||||
// options.setCarBitmap( BitmapFactory.decodeResource( getContext().getResources(), DEFAULT_OPTION.getNaviCursorRes() ) );
|
||||
// // 设置指南针图标否在导航界面显示,默认显示。true,显示;false,隐藏。
|
||||
// options.setCompassEnabled( false );
|
||||
// // 黑夜模式
|
||||
// options.setNaviNight( true );
|
||||
// //设置路况光柱条是否显示(只适用于驾车导航,需要联网)。
|
||||
// options.setTrafficBarEnabled( false );
|
||||
// // 设置[实时交通图层开关按钮]是否显示(只适用于驾车导航,需要联网)。
|
||||
// options.setTrafficLayerEnabled( false );
|
||||
// // 设置导航界面是否显示路线全览按钮。
|
||||
// options.setRouteListButtonShow( false );
|
||||
// // 设置屏幕是否常亮,默认开启
|
||||
// options.setScreenAlwaysBright( false );
|
||||
// // 设置交通播报是否打开(只适用于驾车导航,需要联网)。
|
||||
// options.setTrafficInfoUpdateEnabled( true );
|
||||
// // 设置摄像头播报是否打开(只适用于驾车导航)。
|
||||
// options.setCameraInfoUpdateEnabled( true );
|
||||
// // 设置菜单按钮是否在导航界面显示。
|
||||
// options.setSettingMenuEnabled( false );
|
||||
// // 设置是否绘制显示交通路况的线路(彩虹线),拥堵-红色,畅通-绿色,缓慢-黄色,未知-蓝色。默认不绘制彩虹线。
|
||||
// options.setTrafficLine( true );
|
||||
// // 设置是否绘制牵引线(当前位置到目的地的指引线)。默认不绘制牵引线。
|
||||
// options.setLeaderLineEnabled( -1 );
|
||||
// // 设置导航界面UI是否显示。
|
||||
// options.setLayoutVisible( false );
|
||||
// // 设置是否自动画路
|
||||
// options.setAutoDrawRoute( false );
|
||||
// // 设置是否显示路口放大图(实景图)
|
||||
// options.setRealCrossDisplayShow( false );
|
||||
// // 设置是否显示路口放大图(路口模型图)
|
||||
// options.setModeCrossDisplayShow( false );
|
||||
// // 设置是否显示道路信息view
|
||||
// options.setLaneInfoShow( false );
|
||||
// // 设置是否自动改变缩放等级
|
||||
// options.setAutoChangeZoom( false );
|
||||
// // 设置是否自动全览模式,即在算路成功后自动进入全览模式
|
||||
// options.setAutoDisplayOverview( false );
|
||||
// // 设置路线转向箭头隐藏和显示
|
||||
// options.setNaviArrowVisible( false );
|
||||
// // 通过路线是否自动置灰,仅支持驾车导航
|
||||
// options.setAfterRouteAutoGray( true );
|
||||
// options.setZoom( ( ( int ) mDefaultZoomLevel ) );
|
||||
// options.setPointToCenter( 0.7D, 0.5D );
|
||||
// // 2D模式
|
||||
// options.setTilt( 0 );
|
||||
// mMapView.setViewOptions( options );
|
||||
// }
|
||||
// mMapView.setRouteOverlayVisible( false );
|
||||
// mMapView.setCarOverlayVisible( false );
|
||||
changeMapMode( EnumMapUI.CarUp_2D );
|
||||
setTrafficEnabled( true );
|
||||
mMapView.getMap().moveCamera( CameraUpdateFactory.zoomTo( mDefaultZoomLevel ) );
|
||||
}
|
||||
|
||||
private void initListeners() {
|
||||
|
||||
mMarkerClickHandler = new AMapMarkerClickHandler();
|
||||
final AMap aMap = mMapView.getMap();
|
||||
if ( aMap != null ) {
|
||||
aMap.setOnMarkerClickListener( this );
|
||||
aMap.setOnMapLoadedListener( this );
|
||||
aMap.setOnMapTouchListener( this );
|
||||
aMap.setOnPolylineClickListener( this );
|
||||
aMap.setOnCameraChangeListener( this );
|
||||
aMap.setOnPOIClickListener( this );
|
||||
aMap.setOnMapClickListener( this );
|
||||
aMap.setOnCameraChangeListener( this );
|
||||
aMap.setOnMyLocationChangeListener( this );
|
||||
}
|
||||
AMapMessageManager.getInstance().clear();
|
||||
AMapMessageManager.getInstance().registerAMapMessageListener( this );
|
||||
}
|
||||
|
||||
private Context getContext() {
|
||||
return mMapView.getContext();
|
||||
}
|
||||
|
||||
@Override
|
||||
public View getMapView() {
|
||||
return mMapView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMap getMap() {
|
||||
return mIMap;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate( Bundle bundle ) {
|
||||
if ( mMapView != null ) {
|
||||
mMapView.onCreate( bundle );
|
||||
Logger.d( TAG, "map onCreate" );
|
||||
initMapView();
|
||||
initListeners();
|
||||
initMyLocation();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
if ( mMapView != null ) {
|
||||
mMapView.onResume();
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
Logger.d( TAG, "map onResume" );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
if ( mMapView != null ) {
|
||||
mMapView.onPause();
|
||||
Logger.d( TAG, "map onPause" );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
if ( mMapView != null ) {
|
||||
mMapView.onDestroy();
|
||||
Logger.d( TAG, "map onDestroy" );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSaveInstanceState( Bundle outState ) {
|
||||
if ( mMapView != null ) {
|
||||
mMapView.onSaveInstanceState( outState );
|
||||
Logger.d( TAG, "map onSaveInstanceState" );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLowMemory() {
|
||||
if ( mMapView != null ) {
|
||||
mMapView.onLowMemory();
|
||||
}
|
||||
Logger.d( TAG, "map onLowMemory" );
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图marker点击
|
||||
*/
|
||||
@Override
|
||||
public boolean onMarkerClick( Marker marker ) {
|
||||
return mMarkerClickHandler.handleMarkerClicked( marker );
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图加载完毕
|
||||
*/
|
||||
@Override
|
||||
public void onMapLoaded() {
|
||||
MogoMapListenerHandler.getInstance().onMapLoaded();
|
||||
}
|
||||
|
||||
/**
|
||||
* 地图点击回调
|
||||
*/
|
||||
@Override
|
||||
public void onTouch( MotionEvent motionEvent ) {
|
||||
MogoMapListenerHandler.getInstance().onTouch( motionEvent );
|
||||
if ( mIsCarLocked ) {
|
||||
loseLockMode();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* POI 点击
|
||||
*/
|
||||
@Override
|
||||
public void onPOIClick( Poi poi ) {
|
||||
if ( InterceptorHandler.getInstance().ignorePoiClicked( getContext() ) ) {
|
||||
return;
|
||||
}
|
||||
MogoMapListenerHandler.getInstance().onPOIClick( ObjectUtils.fromAMap( poi ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapClick( LatLng latLng ) {
|
||||
if ( InterceptorHandler.getInstance().ignoreMapClicked( getContext() ) ) {
|
||||
return;
|
||||
}
|
||||
MogoMapListenerHandler.getInstance().onMapClick( ObjectUtils.fromAMap( latLng ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPolylineClick( Polyline polyline ) {
|
||||
if ( !NaviClient.getInstance( getContext() ).isNaviing() ) {
|
||||
NaviClient.getInstance( getContext() ).handleClickedPolyline( polyline );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTrafficEnabled( boolean visible ) {
|
||||
if ( checkMapView() ) {
|
||||
mMapView.getMap().setTrafficEnabled( true );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapControlResult changeZoom( boolean zoom ) {
|
||||
if ( checkMapView() ) {
|
||||
mDefaultZoomLevel = ( int ) ( getMap().getZoomLevel() + 0.5f );
|
||||
|
||||
if ( zoom ) {
|
||||
if ( mDefaultZoomLevel >= 20 ) {
|
||||
return MapControlResult.TARGET;
|
||||
}
|
||||
} else {
|
||||
if ( mDefaultZoomLevel <= 3 ) {
|
||||
return MapControlResult.TARGET;
|
||||
}
|
||||
}
|
||||
|
||||
if ( zoom ) {
|
||||
mDefaultZoomLevel += 2f;
|
||||
if ( mDefaultZoomLevel > 20 ) {
|
||||
mDefaultZoomLevel = 20;
|
||||
}
|
||||
} else {
|
||||
mDefaultZoomLevel -= 2f;
|
||||
if ( mDefaultZoomLevel < 1 ) {
|
||||
mDefaultZoomLevel = 1;
|
||||
}
|
||||
}
|
||||
changeZoom( ( int ) mDefaultZoomLevel );
|
||||
}
|
||||
return MapControlResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapControlResult changeZoom( float zoom ) {
|
||||
Logger.d( TAG, "changeZoom %s", zoom );
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
}
|
||||
getMap().changeZoom( zoom );
|
||||
return MapControlResult.SUCCESS;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMapMode( EnumMapUI ui ) {
|
||||
if ( ui == null ) {
|
||||
return;
|
||||
}
|
||||
if ( checkMapView() ) {
|
||||
switch ( ui ) {
|
||||
|
||||
case CarUp_3D:
|
||||
mMapView.getMap().moveCamera( CameraUpdateFactory.changeTilt( 60 ) );
|
||||
break;
|
||||
case NorthUP_2D:
|
||||
mMapView.getMap().moveCamera( CameraUpdateFactory.changeTilt( 0 ) );
|
||||
break;
|
||||
case CarUp_2D:
|
||||
mMapView.getMap().moveCamera( CameraUpdateFactory.changeTilt( 0 ) );
|
||||
break;
|
||||
case Type_Light:
|
||||
mMapView.getMap().setMapType( AMap.MAP_TYPE_NORMAL );
|
||||
break;
|
||||
case Type_Night:
|
||||
mMapView.getMap().setMapType( AMap.MAP_TYPE_NIGHT );
|
||||
break;
|
||||
case Type_AUTO_LIGHT_Night:
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
private boolean checkMapView() {
|
||||
if ( mMapView == null || mMapView.getMap() == null ) {
|
||||
Logger.e( TAG, "高德mapView实例为空,请检查" );
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void moveToCenter( MogoLatLng latLng, boolean animate ) {
|
||||
Logger.d( TAG, "move to center %s", latLng );
|
||||
if ( latLng == null || latLng.lat == 0.0d || latLng.lng == 0.0d ) {
|
||||
Logger.e( TAG, "latlng = null or is illegal" );
|
||||
return;
|
||||
}
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
}
|
||||
loseLockMode();
|
||||
if ( animate ) {
|
||||
mMapView.getMap().animateCamera( CameraUpdateFactory.newLatLng( new LatLng( latLng.lat, latLng.lng ) ) );
|
||||
} else {
|
||||
mMapView.getMap().moveCamera( CameraUpdateFactory.newLatLng( new LatLng( latLng.lat, latLng.lng ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMyLocation( boolean visible ) {
|
||||
Logger.d( TAG, "showMyLocation1 %s", visible );
|
||||
if ( visible && NaviClient.getInstance( getContext() ).isNaviing() ) {
|
||||
return;
|
||||
}
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
}
|
||||
if ( checkMapView() ) {
|
||||
MyLocationStyle style = getMyLocationStyle();
|
||||
if ( style == null ) {
|
||||
style = new MyLocationStyle();
|
||||
}
|
||||
style.showMyLocation( visible );
|
||||
if ( visible ) {
|
||||
// 强制刷新一遍车标
|
||||
style.myLocationIcon( BitmapDescriptorFactory.fromResource( mCarCursorOption.getCarCursorRes() ) );
|
||||
}
|
||||
mMapView.getMap().setMyLocationStyle( style );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showMyLocation( View view ) {
|
||||
if ( NaviClient.getInstance( getContext() ).isNaviing() ) {
|
||||
return;
|
||||
}
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
}
|
||||
if ( checkMapView() ) {
|
||||
MyLocationStyle style = getMyLocationStyle();
|
||||
if ( style == null ) {
|
||||
style = new MyLocationStyle();
|
||||
}
|
||||
style.showMyLocation( true );
|
||||
style.myLocationIcon( BitmapDescriptorFactory.fromView( view ) );
|
||||
mMapView.getMap().setMyLocationStyle( style );
|
||||
}
|
||||
}
|
||||
|
||||
public void initMyLocation() {
|
||||
if ( checkMapView() ) {
|
||||
mMapView.getMap().setMyLocationEnabled( true );
|
||||
MyLocationStyle style = getMyLocationStyle();
|
||||
style.myLocationType( MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER );
|
||||
style.interval( 1000 );
|
||||
style.anchor( 0.5F, 0.5F );
|
||||
style.strokeColor( Color.TRANSPARENT );
|
||||
style.strokeWidth( 0 );
|
||||
style.radiusFillColor( Color.TRANSPARENT );
|
||||
mMapView.getMap().setMyLocationStyle( style );
|
||||
}
|
||||
}
|
||||
|
||||
private MyLocationStyle getMyLocationStyle() {
|
||||
try {
|
||||
return mMapView.getMap().getMyLocationStyle();
|
||||
} catch ( Exception e ) {
|
||||
return new MyLocationStyle();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void recoverLockMode() {
|
||||
if ( checkMapView() ) {
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
}
|
||||
Logger.d( TAG, "锁车" );
|
||||
Location target = NaviClient.getInstance( getContext() ).getCarLocation2();
|
||||
if ( target != null ) {
|
||||
mMapView.getMap().animateCamera( CameraUpdateFactory.newCameraPosition(
|
||||
new CameraPosition( new LatLng( target.getLatitude(), target.getLongitude() ),
|
||||
mDefaultZoomLevel,
|
||||
0,
|
||||
0
|
||||
)
|
||||
), new AMap.CancelableCallback() {
|
||||
@Override
|
||||
public void onFinish() {
|
||||
changeMyLocationStyle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCancel() {
|
||||
changeMyLocationStyle();
|
||||
}
|
||||
} );
|
||||
} else {
|
||||
changeMyLocationStyle();
|
||||
}
|
||||
mIsCarLocked = true;
|
||||
}
|
||||
}
|
||||
|
||||
private void changeMyLocationStyle() {
|
||||
MyLocationStyle style = getMyLocationStyle();
|
||||
if ( style == null ) {
|
||||
style = new MyLocationStyle();
|
||||
}
|
||||
style.myLocationType( MyLocationStyle.LOCATION_TYPE_FOLLOW );
|
||||
mMapView.getMap().setMyLocationStyle( style );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loseLockMode() {
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
}
|
||||
Logger.d( TAG, "解锁锁车" );
|
||||
MyLocationStyle style = getMyLocationStyle();
|
||||
style.myLocationType( MyLocationStyle.LOCATION_TYPE_FOLLOW_NO_CENTER );
|
||||
mMapView.getMap().setMyLocationStyle( style );
|
||||
mIsCarLocked = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* 模拟点击事件,达到锁车->普通事件
|
||||
*/
|
||||
private void mockTouchEvent() {
|
||||
long downTime = SystemClock.uptimeMillis();
|
||||
long eventTime = downTime + 1;
|
||||
int metaState = 0;
|
||||
MotionEvent motionEvent = MotionEvent.obtain( downTime, eventTime, MotionEvent.ACTION_DOWN, 0, 0, metaState );
|
||||
mMapView.dispatchTouchEvent( motionEvent );
|
||||
MotionEvent upEvent = MotionEvent.obtain( downTime + 1, eventTime + 2, MotionEvent.ACTION_UP, 0, 0, metaState );
|
||||
mMapView.dispatchTouchEvent( upEvent );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLockZoom( int var1 ) {
|
||||
if ( checkMapView() ) {
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
}
|
||||
Logger.d( TAG, "Zoom锁定锁车比例尺 %s", var1 );
|
||||
// TODO: 2020/8/27 设置锁车比例尺
|
||||
// mMapView.setLockZoom( var1 );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void displayOverview( Rect bounds ) {
|
||||
if ( checkMapView() ) {
|
||||
if ( NaviClient.getInstance( getContext() ).isNaviing() ) {
|
||||
loseLockMode();
|
||||
NaviClient.getInstance( getContext() ).displayOverview( bounds );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getScalePerPixel() {
|
||||
return getMap().getScalePerPixel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getZoomLevel() {
|
||||
return getMap().getZoomLevel();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviStarted() {
|
||||
if ( checkMapView() ) {
|
||||
showMyLocation( false );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviStopped() {
|
||||
if ( checkMapView() ) {
|
||||
showMyLocation( true );
|
||||
NaviClient.getInstance( getContext() ).startAimlessMode();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdat( NaviInfo naviInfo ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalculateSuccess() {
|
||||
loseLockMode();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraChange( CameraPosition cameraPosition ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCameraChangeFinish( CameraPosition cameraPosition ) {
|
||||
if ( cameraPosition != null ) {
|
||||
Trace.beginSection( "timer.onCameraChangeFinish" );
|
||||
MogoMapListenerHandler.getInstance().onMapChanged( ObjectUtils.fromAMap( cameraPosition.target ),
|
||||
cameraPosition.zoom,
|
||||
cameraPosition.tilt,
|
||||
cameraPosition.bearing );
|
||||
Trace.endSection();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraNorthEastPosition() {
|
||||
try {
|
||||
return ObjectUtils.fromAMap( mMapView.getMap().getProjection().getVisibleRegion().latLngBounds.northeast );
|
||||
} catch ( Exception e ) {
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraSouthWestPosition() {
|
||||
try {
|
||||
return ObjectUtils.fromAMap( mMapView.getMap().getProjection().getVisibleRegion().latLngBounds.southwest );
|
||||
} catch ( Exception e ) {
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getWindowCenterLocation() {
|
||||
try {
|
||||
return ObjectUtils.fromAMap( mMapView.getMap().getCameraPosition().target );
|
||||
} catch ( Exception e ) {
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPointToCenter( double mapCenterX, double mapCenterY ) {
|
||||
if ( checkMapView() ) {
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
}
|
||||
Logger.d( TAG, "setPointToCenter(%s, %s)", mapCenterX, mapCenterY );
|
||||
mMapView.getMap().setPointToCenter( ( ( int ) ( mapCenterX * WindowUtils.getScreenWidth( getContext() ) ) ),
|
||||
( ( int ) ( mapCenterY * WindowUtils.getScreenHeight( getContext() ) ) ) );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public Point getLocationPointInScreen( MogoLatLng latLng ) {
|
||||
if ( checkMapView() ) {
|
||||
try {
|
||||
return mMapView.getMap()
|
||||
.getProjection()
|
||||
.toScreenLocation( ObjectUtils.fromMogo2( latLng ) );
|
||||
} catch ( Exception e ) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getLocationMogoLatLngInScreen( Point point ) {
|
||||
if ( checkMapView() ) {
|
||||
try {
|
||||
return ObjectUtils.fromAMap(
|
||||
mMapView.getMap().getProjection().fromScreenLocation( point ) );
|
||||
} catch ( Exception e ) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startJumpAnimation( IMogoMarker marker, float high, Interpolator interpolator,
|
||||
long duration ) {
|
||||
if ( marker == null || high <= 0.0f || interpolator == null || duration < 0 ) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
final LatLng latLng = ObjectUtils.fromMogo2( marker.getPosition() );
|
||||
Point point = mMapView.getMap().getProjection().toScreenLocation( latLng );
|
||||
point.y -= WindowUtils.dip2px( getContext(), high );
|
||||
LatLng target = mMapView.getMap().getProjection().fromScreenLocation( point );
|
||||
//使用TranslateAnimation,填写一个需要移动的目标点
|
||||
Animation animation = new TranslateAnimation( target );
|
||||
animation.setInterpolator( interpolator );
|
||||
//整个移动所需要的时间
|
||||
animation.setDuration( duration );
|
||||
//设置动画
|
||||
if ( marker instanceof AMapMarkerWrapper ) {
|
||||
( ( AMapMarkerWrapper ) marker ).getMarker().setAnimation( animation );
|
||||
( ( AMapMarkerWrapper ) marker ).getMarker().startAnimation();
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setRenderFps( int fps ) {
|
||||
if ( checkMapView() ) {
|
||||
if ( mMapView.getMap() != null ) {
|
||||
mMapView.getMap().setRenderFps( fps );
|
||||
Logger.d( TAG, "设置刷新帧率 fps = %s", fps );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showBounds( String tag, MogoLatLng carPosition, List< MogoLatLng > lonLats, Rect bound, boolean lockCarPosition ) {
|
||||
if ( !checkMapView() ) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
if ( DebugConfig.isDebug() ) {
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
}
|
||||
LatLngBounds latLngBounds = MogoMapUtils.getLatLngBounds( carPosition, lonLats, lockCarPosition );
|
||||
if ( !lockCarPosition ) {
|
||||
loseLockMode();
|
||||
}
|
||||
mMapView.getMap().moveCamera( CameraUpdateFactory.newLatLngBoundsRect( latLngBounds, bound.left, bound.right, bound.top, bound.bottom ) );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "%s error.", tag );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void forceRender() {
|
||||
if ( checkMapView() ) {
|
||||
mMapView.getMap().runOnDrawFrame();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float calculateLineDistance( MogoLatLng p1, MogoLatLng p2 ) throws Exception {
|
||||
if ( p1 == null || p2 == null ) {
|
||||
throw new Exception( "计算距离的点不能为 null" );
|
||||
}
|
||||
return AMapUtils.calculateLineDistance( ObjectUtils.fromMogo2( p1 ), ObjectUtils.fromMogo2( p2 ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMyLocationChange( Location location ) {
|
||||
NaviClient.getInstance( getContext() ).syncCarLocation( location );
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumMapUI getCurrentUiMode() {
|
||||
return mCurrentUIMode;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeMyLocation( Location location ) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public synchronized boolean isCarLocked() {
|
||||
return mIsCarLocked;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setCarCursorOption( CarCursorOption option ) {
|
||||
if ( mCarCursorOption != null && mCarCursorOption != DEFAULT_OPTION ) {
|
||||
mCarCursorOption.destroy();
|
||||
}
|
||||
if ( option != null ) {
|
||||
try {
|
||||
mCarCursorOption = option.clone();
|
||||
} catch ( Exception e ) {
|
||||
mCarCursorOption = DEFAULT_OPTION;
|
||||
}
|
||||
} else {
|
||||
mCarCursorOption = DEFAULT_OPTION;
|
||||
}
|
||||
if ( !checkMapView() ) {
|
||||
return;
|
||||
}
|
||||
if ( mMapView.getMap() == null ) {
|
||||
return;
|
||||
}
|
||||
MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
|
||||
if ( mCarCursorOption.getCarCursorBmp() != null && !mCarCursorOption.getCarCursorBmp().isRecycled() ) {
|
||||
style.myLocationIcon( BitmapDescriptorFactory.fromBitmap( mCarCursorOption.getCarCursorBmp() ) );
|
||||
} else {
|
||||
if ( mCarCursorOption.getCarCursorRes() != 0 ) {
|
||||
style.myLocationIcon( BitmapDescriptorFactory.fromResource( mCarCursorOption.getCarCursorRes() ) );
|
||||
} else {
|
||||
style.myLocationIcon( BitmapDescriptorFactory.fromResource( DEFAULT_OPTION.getCarCursorRes() ) );
|
||||
}
|
||||
}
|
||||
mMapView.getMap().setMyLocationStyle( style );
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapCameraPosition getMapCameraPosition() {
|
||||
if ( checkMapView() ) {
|
||||
CameraPosition cameraPosition = mMapView.getMap().getCameraPosition();
|
||||
return ObjectUtils.fromAMap( cameraPosition );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void changeBearing( float bearing ) {
|
||||
if ( checkMapView() ) {
|
||||
mMapView.getMap().moveCamera( CameraUpdateFactory.changeBearing( bearing ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,6 @@ import android.content.Context;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
import com.amap.api.maps.LocationSource;
|
||||
import com.amap.api.maps.model.Marker;
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
import com.amap.api.maps.model.Polyline;
|
||||
@@ -14,7 +13,6 @@ import com.mogo.map.IMogoMap;
|
||||
import com.mogo.map.IMogoUiSettings;
|
||||
import com.mogo.map.impl.amap.marker.AMapInfoWindowAdapter;
|
||||
import com.mogo.map.impl.amap.marker.AMapMarkerWrapper;
|
||||
import com.mogo.map.impl.amap.navi.NaviClient;
|
||||
import com.mogo.map.impl.amap.overlay.AMapPolylineWrapper;
|
||||
import com.mogo.map.impl.amap.uicontroller.AMapUIController;
|
||||
import com.mogo.map.impl.amap.utils.ObjectUtils;
|
||||
@@ -39,15 +37,15 @@ public class AMapWrapper implements IMogoMap {
|
||||
private static final String TAG = "AMapWrapper";
|
||||
|
||||
private static AMap sAMap;
|
||||
private final Context mContext;
|
||||
private IMogoMapUIController mUIcontroller;
|
||||
private AMap mAMap;
|
||||
private AMapNaviView mMapView;
|
||||
private IMogoUiSettings mUiSettings;
|
||||
|
||||
public AMapWrapper( AMap map, AMapNaviView mapView, IMogoMapUIController controller ) {
|
||||
public AMapWrapper( AMap map, Context context, IMogoMapUIController controller ) {
|
||||
this.mAMap = map;
|
||||
sAMap = map;
|
||||
this.mMapView = mapView;
|
||||
mContext = context;
|
||||
mUIcontroller = controller;
|
||||
// 设置实现自定义 info window
|
||||
mAMap.setInfoWindowAdapter( new AMapInfoWindowAdapter() );
|
||||
@@ -250,6 +248,6 @@ public class AMapWrapper implements IMogoMap {
|
||||
}
|
||||
|
||||
private Context getContext() {
|
||||
return mMapView.getContext();
|
||||
return mContext;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -145,7 +145,7 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
synchronized ( sListeners ) {
|
||||
Iterator< IMogoLocationListener > listenerIterator = sListeners.iterator();
|
||||
while ( listenerIterator.hasNext() ) {
|
||||
listenerIterator.next().onLocationChanged( mLastLocation.clone() );
|
||||
listenerIterator.next().onLocationChanged( mLastLocation );
|
||||
}
|
||||
}
|
||||
Trace.endSection();
|
||||
|
||||
@@ -398,7 +398,7 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
|
||||
AnimationSet animationSet = new AnimationSet( true );
|
||||
animationSet.setDuration( duration );
|
||||
animationSet.setInterpolator( interpolator);
|
||||
animationSet.setInterpolator( interpolator );
|
||||
animationSet.setAnimationListener( new Animation.AnimationListener() {
|
||||
@Override
|
||||
public void onAnimationStart() {
|
||||
@@ -510,4 +510,11 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
mMovingPointOverlay.startSmoothMove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInfoWindowShowing() {
|
||||
if ( mMarker == null ) {
|
||||
return false;
|
||||
}
|
||||
return mMarker.isInfoWindowShown();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,6 +47,12 @@ public class AMapMessageManager {
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void clear(){
|
||||
if ( mListeners != null ) {
|
||||
mListeners.clear();
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void unregisterAMapMessageListener( AMapMessageListener listener ) {
|
||||
mListeners.remove( listener );
|
||||
}
|
||||
|
||||
@@ -9,6 +9,7 @@ import com.amap.api.maps.model.Polyline;
|
||||
import com.amap.api.navi.AMapNavi;
|
||||
import com.amap.api.navi.enums.AimLessMode;
|
||||
import com.amap.api.navi.enums.NaviType;
|
||||
import com.amap.api.navi.model.AMapNaviPath;
|
||||
import com.amap.api.navi.model.NaviLatLng;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
@@ -30,6 +31,7 @@ import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -48,10 +50,9 @@ public class NaviClient implements IMogoNavi {
|
||||
private final Context mContext;
|
||||
|
||||
private AMapNavi mAMapNavi;
|
||||
private final NaviListenerAdapter mAMapNaviListener;
|
||||
private NaviListenerAdapter mAMapNaviListener;
|
||||
|
||||
|
||||
private final AimlessModeListenerAdapter mAimlessModeListener;
|
||||
private AimlessModeListenerAdapter mAimlessModeListener;
|
||||
|
||||
/**
|
||||
* 导航策略配置
|
||||
@@ -77,10 +78,23 @@ public class NaviClient implements IMogoNavi {
|
||||
|
||||
private NaviClient( Context context ) {
|
||||
mContext = context;
|
||||
mAMapNavi = AMapNavi.getInstance( context );
|
||||
if ( DebugConfig.isUseCustomNavi() ) {
|
||||
// 按需初始化导航组件
|
||||
initAMapNavi();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化导航组件
|
||||
*/
|
||||
private void initAMapNavi() {
|
||||
if ( mAMapNavi != null ) {
|
||||
return;
|
||||
}
|
||||
mAMapNavi = AMapNavi.getInstance( mContext );
|
||||
mAMapNavi.setEmulatorNaviSpeed( 120 );
|
||||
mAMapNavi.setUseInnerVoice( DebugConfig.isUseCustomNavi(), true );
|
||||
mAMapNaviListener = new NaviListenerAdapter( context, mAMapNavi, this );
|
||||
mAMapNavi.setUseInnerVoice( DebugConfig.isUseCustomNavi(), false );
|
||||
mAMapNaviListener = new NaviListenerAdapter( mContext, this );
|
||||
mAimlessModeListener = new AimlessModeListenerAdapter() {
|
||||
};
|
||||
mAMapNavi.addAMapNaviListener( mAMapNaviListener );
|
||||
@@ -165,10 +179,28 @@ public class NaviClient implements IMogoNavi {
|
||||
}
|
||||
}
|
||||
|
||||
public void stopAMapNavi() {
|
||||
if ( mAMapNavi != null ) {
|
||||
mAMapNavi.stopNavi();
|
||||
}
|
||||
}
|
||||
|
||||
public void selectAMapRouteId( int routeId ) {
|
||||
if ( mAMapNavi != null ) {
|
||||
mAMapNavi.selectRouteId( routeId );
|
||||
}
|
||||
}
|
||||
|
||||
public Map< Integer, AMapNaviPath > getAMapNaviPaths() {
|
||||
if ( mAMapNavi != null ) {
|
||||
return mAMapNavi.getNaviPaths();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void startNavi( boolean isRealNavi ) {
|
||||
if ( mAMapNaviListener.isStopped() ) {
|
||||
if ( mAMapNaviListener != null && mAMapNaviListener.isStopped() ) {
|
||||
return;
|
||||
}
|
||||
mIsRealNavi = isRealNavi;
|
||||
@@ -243,6 +275,9 @@ public class NaviClient implements IMogoNavi {
|
||||
|
||||
@Override
|
||||
public boolean setBroadcastMode( int mode ) {
|
||||
if ( checkAMapNavi() ) {
|
||||
return false;
|
||||
}
|
||||
return mAMapNavi.setBroadcastMode( mode );
|
||||
}
|
||||
|
||||
@@ -300,6 +335,9 @@ public class NaviClient implements IMogoNavi {
|
||||
|
||||
@Override
|
||||
public void startAimlessMode() {
|
||||
if ( checkAMapNavi() ) {
|
||||
return;
|
||||
}
|
||||
if ( mAimlessModeStatus && !isNaviing() ) {
|
||||
mAMapNavi.startAimlessMode( AimLessMode.CAMERA_AND_SPECIALROAD_DETECTED );
|
||||
mAimlessStatus = true;
|
||||
@@ -312,6 +350,9 @@ public class NaviClient implements IMogoNavi {
|
||||
|
||||
@Override
|
||||
public void stopAimlessMode() {
|
||||
if ( checkAMapNavi() ) {
|
||||
return;
|
||||
}
|
||||
mAMapNavi.stopAimlessMode();
|
||||
mAimlessStatus = false;
|
||||
Logger.d( TAG, "关闭巡航成功" );
|
||||
@@ -341,6 +382,15 @@ public class NaviClient implements IMogoNavi {
|
||||
|
||||
@Override
|
||||
public void setUseExtraGPSData( boolean use ) {
|
||||
// 如果使用平台模拟位置变化,需要用到导航组件
|
||||
if ( use ) {
|
||||
initAMapNavi();
|
||||
} else {
|
||||
destroyAMapNavi();
|
||||
}
|
||||
if ( checkAMapNavi() ) {
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "设置外部gps源状态 %s", use );
|
||||
mAMapNavi.setIsUseExtraGPSData( use );
|
||||
if ( AMapWrapper.getAMap() == null ) {
|
||||
@@ -364,8 +414,22 @@ public class NaviClient implements IMogoNavi {
|
||||
AMapWrapper.getAMap().setMyLocationEnabled( true );
|
||||
}
|
||||
|
||||
/**
|
||||
* 销毁导航组件
|
||||
*/
|
||||
private void destroyAMapNavi() {
|
||||
if ( mAMapNavi != null ) {
|
||||
mAMapNavi.removeAMapNaviListener( mAMapNaviListener );
|
||||
mAMapNavi.removeAimlessModeListener( mAimlessModeListener );
|
||||
mAMapNavi.destroy();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setExtraGPSData( double lon, double lat, float speed, float accuracy, float bearing, long timestamp ) {
|
||||
if ( checkAMapNavi() ) {
|
||||
return;
|
||||
}
|
||||
if ( !mAMapNavi.getIsUseExtraGPSData() ) {
|
||||
Logger.d( TAG, "拒绝外部GPS数据" );
|
||||
return;
|
||||
|
||||
@@ -6,15 +6,10 @@ import android.os.Trace;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.amap.api.maps.model.Polyline;
|
||||
import com.amap.api.navi.AMapNavi;
|
||||
import com.amap.api.navi.AimlessModeListener;
|
||||
import com.amap.api.navi.enums.AimLessMode;
|
||||
import com.amap.api.navi.enums.CameraType;
|
||||
import com.amap.api.navi.enums.CarEnterCameraStatus;
|
||||
import com.amap.api.navi.enums.NaviType;
|
||||
import com.amap.api.navi.model.AMapCalcRouteResult;
|
||||
import com.amap.api.navi.model.AMapNaviCameraInfo;
|
||||
import com.amap.api.navi.model.AMapNaviInfo;
|
||||
import com.amap.api.navi.model.AMapNaviLocation;
|
||||
import com.amap.api.navi.model.NaviInfo;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
@@ -27,7 +22,6 @@ import com.mogo.map.navi.MogoNaviListenerHandler;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.navi.OnCalculatePathItemClickInteraction;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.WorkThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
@@ -43,7 +37,6 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
|
||||
private static final String TAG = "NaviListenerAdapter";
|
||||
|
||||
private Context mContext;
|
||||
private AMapNavi mAMapNavi;
|
||||
private NaviClient mClient;
|
||||
/**
|
||||
* 导航状态:true - 导航 onStartNavi(int) 被调用, false - 到达目的地、手动挺固执
|
||||
@@ -60,11 +53,10 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
|
||||
*/
|
||||
private NaviOverlayHelper mNaviOverlayHelper;
|
||||
|
||||
public NaviListenerAdapter( Context mContext, AMapNavi mAMapNavi, NaviClient client ) {
|
||||
public NaviListenerAdapter( Context mContext, NaviClient client ) {
|
||||
this.mContext = mContext;
|
||||
this.mAMapNavi = mAMapNavi;
|
||||
this.mClient = client;
|
||||
mNaviOverlayHelper = new NaviOverlayHelper( mAMapNavi, AMapWrapper.getAMap(), mContext );
|
||||
mNaviOverlayHelper = new NaviOverlayHelper( AMapWrapper.getAMap(), mContext );
|
||||
}
|
||||
|
||||
public void setNaviing( boolean mIsNaviing ) {
|
||||
@@ -240,16 +232,15 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
|
||||
mNaviOverlayHelper.clearCalculatedOverlay();
|
||||
setStopped( true );
|
||||
setNaviing( false );
|
||||
mAMapNavi.stopNavi();
|
||||
mClient.stopAMapNavi();
|
||||
MogoNaviListenerHandler.getInstance().onStopNavi();
|
||||
AMapMessageManager.getInstance().postNaviStopped();
|
||||
}
|
||||
|
||||
public void handleClickedPolyline( Polyline polyline ) {
|
||||
if ( mNaviOverlayHelper != null ) {
|
||||
|
||||
mNaviOverlayHelper.handleClickedPolyline( polyline, isNaviing() );
|
||||
mAMapNavi.selectRouteId( mNaviOverlayHelper.getSelectedPathId() );
|
||||
mClient.selectAMapRouteId( mNaviOverlayHelper.getSelectedPathId() );
|
||||
mNaviOverlayHelper.showBoundsWithSettingBounds();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.amap.api.maps.model.LatLngBounds;
|
||||
import com.amap.api.maps.model.Marker;
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
import com.amap.api.maps.model.Polyline;
|
||||
import com.amap.api.navi.AMapNavi;
|
||||
import com.amap.api.navi.model.AMapNaviLocation;
|
||||
import com.amap.api.navi.model.AMapNaviPath;
|
||||
import com.amap.api.navi.model.NaviInfo;
|
||||
@@ -55,7 +54,6 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
*/
|
||||
public static final float AMAP_ROUTE_OVERLAY_TRANSPARENCY_UNSELECTED = 0.3f;
|
||||
|
||||
private AMapNavi mAMapNavi;
|
||||
private AMap mAMap;
|
||||
private Context mContext;
|
||||
// 规划的路线显示边距
|
||||
@@ -73,8 +71,7 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
*/
|
||||
private List< Marker > mMarkers = new ArrayList<>();
|
||||
|
||||
public NaviOverlayHelper( AMapNavi mAMapNavi, AMap mAMap, Context mContext ) {
|
||||
this.mAMapNavi = mAMapNavi;
|
||||
public NaviOverlayHelper( AMap mAMap, Context mContext ) {
|
||||
this.mAMap = mAMap;
|
||||
this.mContext = mContext;
|
||||
calculateBoundArea();
|
||||
@@ -125,7 +122,7 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
*/
|
||||
private List< CalculatePathItem > getSortedPaths() {
|
||||
checkAMapInstance();
|
||||
final Map< Integer, AMapNaviPath > pathMap = mAMapNavi.getNaviPaths();
|
||||
final Map< Integer, AMapNaviPath > pathMap = NaviClient.getInstance( mContext ).getAMapNaviPaths();
|
||||
if ( pathMap == null || pathMap.isEmpty() ) {
|
||||
return null;
|
||||
}
|
||||
@@ -219,7 +216,7 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
mSelectedCalculatePathItem = item;
|
||||
//wrapper.setStartBitmap( R.drawable.ic_navi_start )
|
||||
// .setEndBitmap( R.drawable.ic_navi_target );
|
||||
mAMapNavi.selectRouteId( item.getId() );
|
||||
NaviClient.getInstance( mContext ).selectAMapRouteId( item.getId() );
|
||||
Logger.d( TAG, "renderPathOverlay set default path" );
|
||||
}
|
||||
wrapper.addToMap();
|
||||
@@ -435,7 +432,7 @@ public class NaviOverlayHelper implements OnCalculatePathItemClickInteraction {
|
||||
@Override
|
||||
public void onItemClicked( String tagId ) {
|
||||
handleClickedPolyline( tagId );
|
||||
mAMapNavi.selectRouteId( getSelectedPathId() );
|
||||
NaviClient.getInstance( mContext ).selectAMapRouteId( getSelectedPathId() );
|
||||
showBounds( mBoundRect );
|
||||
}
|
||||
|
||||
|
||||
@@ -26,6 +26,9 @@ public class AutoNaviReceiver extends BroadcastReceiver {
|
||||
private static AutoNaviReceiver autoNaviReceiver;
|
||||
private static boolean sRegisterFlag = false;
|
||||
|
||||
private static MogoNaviInfo sNaviInfo;
|
||||
private static MogoTraffic sTraffic;
|
||||
|
||||
|
||||
public static void register( Context context ) {
|
||||
IntentFilter filter = new IntentFilter();
|
||||
@@ -85,23 +88,28 @@ public class AutoNaviReceiver extends BroadcastReceiver {
|
||||
MapState.getInstance().setNaving( true );
|
||||
MogoNaviListenerHandler.getInstance().onStartNavi();
|
||||
}
|
||||
MogoNaviInfo naviInfo = new MogoNaviInfo();
|
||||
naviInfo.setCurrentLimitSpeed( cameraSpeed );
|
||||
naviInfo.setCurrentRoadName( intent.getStringExtra( GuideInfoExtraKey.CUR_ROAD_NAME ) );
|
||||
naviInfo.setCurrentSpeed( intent.getIntExtra( GuideInfoExtraKey.CUR_SPEED, 0 ) );
|
||||
naviInfo.setCurStepRetainDistance( intent.getIntExtra( GuideInfoExtraKey.SEG_REMAIN_DIS, 0 ) );
|
||||
naviInfo.setCurStepRetainTime( intent.getIntExtra( GuideInfoExtraKey.SEG_REMAIN_TIME, 0 ) );
|
||||
naviInfo.setIconResId( IconTypeUtils.getResIdByIconType( context, intent.getIntExtra( GuideInfoExtraKey.NEW_ICON, 0 ) ) );
|
||||
naviInfo.setNextRoadName( intent.getStringExtra( GuideInfoExtraKey.NEXT_ROAD_NAME ) );
|
||||
naviInfo.setPathRetainDistance( intent.getIntExtra( GuideInfoExtraKey.ROUTE_REMAIN_DIS, 0 ) );
|
||||
naviInfo.setPathRetainTime( intent.getIntExtra( GuideInfoExtraKey.ROUTE_REMAIN_TIME, 0 ) );
|
||||
MogoNaviListenerHandler.getInstance().onNaviInfoUpdate( naviInfo );
|
||||
if ( sNaviInfo == null ) {
|
||||
sNaviInfo = new MogoNaviInfo();
|
||||
}
|
||||
sNaviInfo.setCurrentLimitSpeed( cameraSpeed );
|
||||
sNaviInfo.setCurrentRoadName( intent.getStringExtra( GuideInfoExtraKey.CUR_ROAD_NAME ) );
|
||||
sNaviInfo.setCurrentSpeed( intent.getIntExtra( GuideInfoExtraKey.CUR_SPEED, 0 ) );
|
||||
sNaviInfo.setCurStepRetainDistance( intent.getIntExtra( GuideInfoExtraKey.SEG_REMAIN_DIS, 0 ) );
|
||||
sNaviInfo.setCurStepRetainTime( intent.getIntExtra( GuideInfoExtraKey.SEG_REMAIN_TIME, 0 ) );
|
||||
sNaviInfo.setIconResId( IconTypeUtils.getResIdByIconType( context, intent.getIntExtra( GuideInfoExtraKey.NEW_ICON, 0 ) ) );
|
||||
sNaviInfo.setNextRoadName( intent.getStringExtra( GuideInfoExtraKey.NEXT_ROAD_NAME ) );
|
||||
sNaviInfo.setPathRetainDistance( intent.getIntExtra( GuideInfoExtraKey.ROUTE_REMAIN_DIS, 0 ) );
|
||||
sNaviInfo.setPathRetainTime( intent.getIntExtra( GuideInfoExtraKey.ROUTE_REMAIN_TIME, 0 ) );
|
||||
MogoNaviListenerHandler.getInstance().onNaviInfoUpdate( sNaviInfo );
|
||||
}
|
||||
MogoTraffic mogoTraffic = new MogoTraffic( MapState.getInstance().isAimless() ? MogoTraffic.TYPE_AIM : MogoTraffic.TYPE_NAVI );
|
||||
mogoTraffic.setDistance( cameraDisc );
|
||||
mogoTraffic.setSpeedLimit( cameraSpeed );
|
||||
mogoTraffic.setTrafficType( cameraType );
|
||||
MogoNaviListenerHandler.getInstance().onUpdateTraffic2( mogoTraffic );
|
||||
if ( sTraffic == null ) {
|
||||
sTraffic = new MogoTraffic( MapState.getInstance().isAimless() ? MogoTraffic.TYPE_AIM : MogoTraffic.TYPE_NAVI );
|
||||
}
|
||||
sTraffic.setFromType( MapState.getInstance().isAimless() ? MogoTraffic.TYPE_AIM : MogoTraffic.TYPE_NAVI );
|
||||
sTraffic.setDistance( cameraDisc );
|
||||
sTraffic.setSpeedLimit( cameraSpeed );
|
||||
sTraffic.setTrafficType( cameraType );
|
||||
MogoNaviListenerHandler.getInstance().onUpdateTraffic2( sTraffic );
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/9/10
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
interface IMogoMapViewInstanceHandler extends IDestroyable {
|
||||
|
||||
void createMapViewInstance( Context context );
|
||||
}
|
||||
@@ -37,7 +37,7 @@ public abstract class MogoBaseMapView extends FrameLayout implements ILifeCycle
|
||||
init( context );
|
||||
}
|
||||
|
||||
private void init( Context context ) {
|
||||
protected void init( Context context ) {
|
||||
mMapView = createMapView( context );
|
||||
if ( mMapView != null ) {
|
||||
final View mapView = mMapView.getMapView();
|
||||
|
||||
@@ -318,4 +318,10 @@ public interface IMogoMarker {
|
||||
* @param duration 时长
|
||||
*/
|
||||
void startSmooth( List< MogoLatLng > points, int duration );
|
||||
|
||||
/**
|
||||
* info window 是否正在显示
|
||||
* @return
|
||||
*/
|
||||
boolean isInfoWindowShowing();
|
||||
}
|
||||
|
||||
@@ -3,9 +3,12 @@ package com.mogo.map;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.amap.api.col.n3.lg;
|
||||
import com.mogo.map.impl.amap.AMapBaseMapView;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -30,6 +33,11 @@ public class MogoMapView extends AMapBaseMapView implements ILifeCycle {
|
||||
super( context, attrs, defStyleAttr );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init( Context context ) {
|
||||
super.init( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMap getMap() {
|
||||
return super.getMap();
|
||||
|
||||
@@ -0,0 +1,49 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.impl.amap.AMapViewHandler;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/9/10
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class MogoMapViewInstanceHandler implements IMogoMapViewInstanceHandler {
|
||||
|
||||
private static volatile MogoMapViewInstanceHandler sInstance;
|
||||
|
||||
private MogoMapViewInstanceHandler(){}
|
||||
|
||||
public static MogoMapViewInstanceHandler getInstance(){
|
||||
if( sInstance == null ){
|
||||
synchronized( MogoMapViewInstanceHandler.class ) {
|
||||
if( sInstance == null ){
|
||||
sInstance = new MogoMapViewInstanceHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release(){
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void createMapViewInstance( Context context ) {
|
||||
AMapViewHandler.createMapView( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
AMapViewHandler.destroy();
|
||||
}
|
||||
}
|
||||
@@ -68,6 +68,11 @@ const val UPLOAD_FROM_STRATEGY_CLOUD_CHECK = "4"
|
||||
*/
|
||||
const val UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO = "5"
|
||||
|
||||
/**
|
||||
* 策略上报集合
|
||||
*/
|
||||
val STRATEGY_UPLOAD_TYPE_ARRAY = arrayOf(UPLOAD_FROM_STRATEGY_BLOCK_AUTO,
|
||||
UPLOAD_FROM_STRATEGY_CLOUD_CHECK, UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO)
|
||||
/**
|
||||
* 默认视频抓取时长,单位是秒
|
||||
*/
|
||||
|
||||
@@ -9,7 +9,6 @@ import com.mogo.utils.NetworkUtils
|
||||
import com.zhidao.auto.carcorder.callback.TakePhotoCallback
|
||||
import com.zhidao.auto.carcorder.callback.TakeVideoCallback
|
||||
import com.zhidao.auto.carcorder.controller.ZdCarCoderController
|
||||
import com.zhidao.roadcondition.BuildConfig
|
||||
import com.zhidao.roadcondition.constant.*
|
||||
import com.zhidao.roadcondition.event.GetImageSuccessEvent
|
||||
import com.zhidao.roadcondition.event.LatLngStickyEventBus
|
||||
@@ -109,7 +108,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
this.mLatitude = latitude
|
||||
if (DebugConfig.getCarMachineType() == 0) { //自研车机
|
||||
outputVideoPath = getCompressVideoPath()
|
||||
CustomStatusHandler.offerVideoStatus(TakeEntity(isCustom, id))
|
||||
CustomStatusHandler.offerVideoStatus(TakeEntity(isCustom, id,fromType))
|
||||
zdCarCoderController.takeVideo(cameraId, duration)
|
||||
trackGetVideo(1)
|
||||
} else { //比亚迪
|
||||
@@ -118,7 +117,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
// TipToast.shortTip("分享失败,请检查网络")
|
||||
// } else {
|
||||
//失败了,传空地址,发起请求
|
||||
val entity = TakeEntity(isCustom, id)
|
||||
val entity = TakeEntity(isCustom, id,fromType)
|
||||
videoAndThumbMap["video"] = ""
|
||||
videoAndThumbMap["thumb"] = ""
|
||||
|
||||
@@ -272,6 +271,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//获取视频成功
|
||||
override fun onTakeVideoSuccess(camera: Int, videoPath: String?) {
|
||||
var thumbnailPath =
|
||||
@@ -283,8 +283,11 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
)
|
||||
|
||||
val entity = CustomStatusHandler.pollVideoStatus()
|
||||
if (!entity?.isCustom) {
|
||||
trackNormalEvent(CarNet_auto_upload_video, null)
|
||||
|
||||
entity?.let {
|
||||
if (!entity.isCustom) {
|
||||
trackNormalEvent(CarNet_auto_upload_video, null)
|
||||
}
|
||||
}
|
||||
|
||||
if (isSuccess) {
|
||||
@@ -297,32 +300,31 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
getStrategyType("video")
|
||||
)
|
||||
var speed = LocationUtil.getInstance().getSpeed()
|
||||
//TODO
|
||||
if (BuildConfig.DEBUG) {
|
||||
//获取视频以及缩略图成功,开始上报
|
||||
compressVideo(videoPath, thumbnailPath, entity)
|
||||
return
|
||||
}
|
||||
|
||||
if (entity?.isCustom) {
|
||||
compressVideo(videoPath, thumbnailPath, entity)
|
||||
} else {
|
||||
Log.d(
|
||||
TAG,
|
||||
"onTakeVideoSuccess maxSpeedVideo = $maxSpeedVideo --->speed= $speed + minSpeedVideo = $minSpeedVideo"
|
||||
)
|
||||
if (maxSpeedVideo == -1) {
|
||||
Log.d(TAG, "onTakeVideoSuccess 111 abs =" + (Math.abs(minSpeedVideo) / 3.6f))
|
||||
if (speed >= (Math.abs(minSpeedVideo) / 3.6f)) {
|
||||
//获取视频以及缩略图成功,开始上报
|
||||
compressVideo(videoPath, thumbnailPath, entity)
|
||||
entity?.let {
|
||||
if (entity.isCustom) {
|
||||
compressVideo(videoPath, thumbnailPath, entity)
|
||||
}else if (entity.fromType in STRATEGY_UPLOAD_TYPE_ARRAY) {
|
||||
// 属于策略上报
|
||||
compressVideo(videoPath, thumbnailPath, entity)
|
||||
} else {
|
||||
Log.d(
|
||||
TAG,
|
||||
"onTakeVideoSuccess maxSpeedVideo = $maxSpeedVideo --->speed= $speed + minSpeedVideo = $minSpeedVideo"
|
||||
)
|
||||
if (maxSpeedVideo == -1) {
|
||||
Log.d(TAG, "onTakeVideoSuccess 111 abs =" + (Math.abs(minSpeedVideo) / 3.6f))
|
||||
if (speed >= (Math.abs(minSpeedVideo) / 3.6f)) {
|
||||
//获取视频以及缩略图成功,开始上报
|
||||
compressVideo(videoPath, thumbnailPath, entity)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (minSpeedVideo > 0 && maxSpeedVideo > 0) {
|
||||
Log.d(TAG, "onTakeVideoSuccess minSpeedVideo > 0 -- speed = $speed")
|
||||
if ((speed >= (minSpeedVideo / 3.6f)) && speed <= (maxSpeedVideo / 3.6f)) {
|
||||
compressVideo(videoPath, thumbnailPath, entity)
|
||||
if (minSpeedVideo > 0 && maxSpeedVideo > 0) {
|
||||
Log.d(TAG, "onTakeVideoSuccess minSpeedVideo > 0 -- speed = $speed")
|
||||
if ((speed >= (minSpeedVideo / 3.6f)) && speed <= (maxSpeedVideo / 3.6f)) {
|
||||
compressVideo(videoPath, thumbnailPath, entity)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -339,10 +341,13 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
Log.e(TAG, "getVideo onTakeVideoFail")
|
||||
getVideoFailed?.invoke()
|
||||
val entity = CustomStatusHandler.pollVideoStatus()
|
||||
InformationUploadController.release(entity?.id)
|
||||
Log.e(TAG, "getVideo onTakeVideoFail entity?.isCustom =" + entity?.isCustom)
|
||||
if (entity?.isCustom) {
|
||||
|
||||
entity?.let {
|
||||
InformationUploadController.release(entity.id)
|
||||
Log.e(TAG, "getVideo onTakeVideoFail entity?.isCustom =" + entity?.isCustom)
|
||||
if (entity?.isCustom) {
|
||||
// sendGetInfoFailedReceiver(mType)
|
||||
}
|
||||
}
|
||||
|
||||
//失败了,传空地址,发起请求
|
||||
|
||||
@@ -121,7 +121,6 @@ class CosStatusController : CosStatusCallback {
|
||||
downloadUrl: String?,
|
||||
localPath: String?
|
||||
) {
|
||||
Log.d(TAG, "uploadFile mType= $mType")
|
||||
Log.d(TAG, "uploadCosCompleted localPath = $localPath")
|
||||
Log.d(TAG, "uploadCosCompleted downloadUrl = $downloadUrl")
|
||||
Log.d(TAG, "uploadCosCompleted cosPath = $cosPath")
|
||||
@@ -137,6 +136,7 @@ class CosStatusController : CosStatusCallback {
|
||||
}
|
||||
Log.d(TAG, "videoAndThumbMap ${videoAndThumbMap}")
|
||||
if (videoAndThumbMap.size == 2) {
|
||||
trackUploadCos(4)
|
||||
Log.d(TAG, "videoAndThumbMap.size == 2 ")
|
||||
var locationInfo = LocationUtil.getInstance().getLocationInfo()
|
||||
val locationStr: String = Gson().toJson(locationInfo)
|
||||
@@ -156,11 +156,12 @@ class CosStatusController : CosStatusCallback {
|
||||
//上传录像以及缩略图成功
|
||||
sendInformation(INFO_TYPE_VIDEO, videoAndThumbMap)
|
||||
}
|
||||
} else {
|
||||
trackUploadCos(5)
|
||||
}
|
||||
} else {
|
||||
//上传图片成功, 如果是上报路况,直接上传,TODO
|
||||
Log.d(TAG, "uploadCosCompleted 分享成功 ----mType = $mType")
|
||||
// if (mType.equals("1") || mType.equals("-1")) {
|
||||
Log.d(TAG, "uploadCosCompleted 分享成功 ---- mType = $mType")
|
||||
sendInformationDirectly(
|
||||
INFO_TYPE_IMG,
|
||||
mutableMapOf("pic" to downloadUrl as String),
|
||||
@@ -170,7 +171,6 @@ class CosStatusController : CosStatusCallback {
|
||||
mLongitude,
|
||||
mLatitude
|
||||
)
|
||||
// }
|
||||
}
|
||||
Log.d(TAG, "delete file: ${localPath!!}")
|
||||
CosCallbackMapController.unregisterCallback(localPath)
|
||||
@@ -195,17 +195,18 @@ class CosStatusController : CosStatusCallback {
|
||||
type: Int,
|
||||
map: Map<String, String>,
|
||||
poiType: String,
|
||||
entity: TakeEntity,
|
||||
entity: TakeEntity?,
|
||||
mainInfoId: Long,
|
||||
longitude: Double,
|
||||
latitude: Double
|
||||
) {
|
||||
Log.d(TAG, "sendInformationDirectly isCustomSend = ${entity?.isCustom}")
|
||||
Log.d(TAG, "sendInformationDirectly poiType= $poiType ---- mainInfoId= $mainInfoId")
|
||||
mainServiceHttpModel.sendInformationMessage(
|
||||
//开始上传
|
||||
entity?.isCustom?.let {
|
||||
mainServiceHttpModel.sendInformationMessage(
|
||||
type = type,
|
||||
url = map,
|
||||
isCustom = entity?.isCustom,
|
||||
isCustom = it,
|
||||
poiType = poiType,
|
||||
mainInfoId = mainInfoId,
|
||||
longitude = longitude,
|
||||
@@ -216,6 +217,7 @@ class CosStatusController : CosStatusCallback {
|
||||
CosCallbackMapController.mainService?.sendCustomResult(success)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
override fun onProgress(localPath: String?, progress: Float) {
|
||||
|
||||
@@ -23,9 +23,9 @@ object CustomStatusHandler {
|
||||
takeVideoStatusQueue.offer(entity)
|
||||
}
|
||||
|
||||
fun pollVideoStatus(): TakeEntity = takeVideoStatusQueue.poll()
|
||||
fun pollVideoStatus(): TakeEntity? = takeVideoStatusQueue.poll()
|
||||
}
|
||||
|
||||
class TakeEntity(
|
||||
var isCustom: Boolean, var id: Long
|
||||
var isCustom: Boolean, var id: Long, var fromType: String = "0"
|
||||
)
|
||||
@@ -98,10 +98,11 @@ class MainService : Service() {
|
||||
|| shareType == TANLU_ROAD_ACCIDENT || shareType == TANLU_ROAD_WORK
|
||||
) {
|
||||
// takePhoto(1, false, true)
|
||||
if (fromType != UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO) { // 是策略触发,不提示
|
||||
takeVideo(it.duration, isCustom = true, id = id)
|
||||
} else {
|
||||
if (fromType == UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO || fromType == UPLOAD_FROM_STRATEGY_BLOCK_AUTO) {
|
||||
// 如果是策略上报,isCustom = false
|
||||
takeVideo(it.duration)
|
||||
} else {
|
||||
takeVideo(it.duration, isCustom = true, id = id)
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -247,6 +248,7 @@ class MainService : Service() {
|
||||
getStrategyType("video")
|
||||
)
|
||||
Log.d("MainService", "handleReportStrategy picType = $picType ---videoType = $videoType")
|
||||
shareType = TANLU_ROAD_CURRENT
|
||||
if (picType == 1) {
|
||||
takePhoto(1)
|
||||
} else if (picType == 2) {
|
||||
@@ -301,7 +303,7 @@ class MainService : Service() {
|
||||
Log.d("MainService", "takeVideo --------1---->")
|
||||
// if (isAuthorization(BaseApplication.getAppContext())) {
|
||||
// log(TAG, "takeVideo --------2---->")
|
||||
CarCorderController.takeVideo(1, duration, isCustom, id, if (isCustom) shareType else TANLU_ROAD_CURRENT, mainInfoId, fromType, mLongitude, mLatitude)
|
||||
CarCorderController.takeVideo(1, duration, isCustom, id, shareType, mainInfoId, fromType, mLongitude, mLatitude)
|
||||
// }
|
||||
postVideoAlarmTask(isInterval)
|
||||
|
||||
|
||||
@@ -231,10 +231,12 @@ class MainServiceController {
|
||||
latitude: Double,
|
||||
customSend: ((Boolean) -> Unit)? = null
|
||||
) {
|
||||
Log.d(TAG, " sendInformationMessage poiType = $poiType");
|
||||
Log.d(TAG, " sendInformationMessage poiType = $poiType")
|
||||
//删除测试数据
|
||||
var locationInfo = LocationUtil.getInstance().getLocationInfo();
|
||||
var locationInfo = LocationUtil.getInstance().getLocationInfo()
|
||||
if (locationInfo.address.isNullOrEmpty()) {
|
||||
Log.d(TAG, " sendInformationMessage locationInfo.address = $locationInfo.address")
|
||||
trackUploadGeo(1)
|
||||
geoLocation(type, url, locationInfo, isCustom,trafficInfoType, isShare, customSend,poiType,mainInfoId,longitude,latitude)
|
||||
} else {
|
||||
postInformationMessage(
|
||||
@@ -270,8 +272,10 @@ class MainServiceController {
|
||||
//转换失败的情况下再重试一次
|
||||
geoRetryed = if (!geoRetryed) {
|
||||
geoLocation(type, url, locationInfo, isCustom, trafficInfoType, isShare, customSend, poiType,mainInfoId,longitude,latitude)
|
||||
|
||||
true
|
||||
} else {
|
||||
|
||||
false
|
||||
}
|
||||
})
|
||||
@@ -310,4 +314,11 @@ class MainServiceController {
|
||||
)
|
||||
}
|
||||
|
||||
//上传
|
||||
private fun trackUploadGeo(type: Int) {
|
||||
trackNormalEvent(
|
||||
CarNet_Geo, mutableMapOf("type" to type)
|
||||
)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -28,11 +28,13 @@ const val CarNet_Get_Strategy:String = "CarNet_Get_Strategy" //策略拉取成
|
||||
const val CarNet_Create_Task:String = "CarNet_Create_Task" //创建定时任务
|
||||
const val CarNet_Get_Picture:String = "CarNet_Get_Picture" //获取图片,type=1 调用, type=2 成功, type=3 失败
|
||||
const val CarNet_Get_Video:String = "CarNet_Get_Video" //获取视频,type=1 调用,type=2 成功,type=3 失败
|
||||
const val CarNet_Cos_Upload:String = "CarNet_Cos_Upload" //上传COS, type=1 成功, type=2 失败, type=3 开始
|
||||
const val CarNet_Cos_Upload:String = "CarNet_Cos_Upload" //上传COS, type=1 成功, type=2 失败, type=3 开始, type=4 成功返回视频和缩略图,type=5 成功没有返回全视频和缩略图
|
||||
const val CarNet_Servers_Upload:String = "CarNet_Servers_Upload" //上传服务端, type=1 成功,type=2 失败, type=3 开始
|
||||
const val CarNet_Voice_Search:String = "CarNet_Voice_Search" //语音搜索路况,type=1 成功,type=2 失败
|
||||
const val CarNet_USER_SHOW:String = "CarNet_user_show" //情报展示时长,showtime 加载列表时长
|
||||
const val CarNet_USER_LOAD:String = "CarNet_user_load" //情报加载时长,type=1 视频,2图片
|
||||
const val CarNet_Geo:String = "CarNet_Geo_Location" //上传服务端, type=1开始 ,type=2 成功, type=3 失败
|
||||
|
||||
|
||||
const val CarNet_live_broadcast = "CarNet_live_broadcast" // 地图页面点击直播(在线可直播车机)
|
||||
//自定义埋点
|
||||
|
||||
@@ -183,12 +183,14 @@ class LocationUtil private constructor() {
|
||||
geocoderSearch.setOnGeocodeSearchListener(object : GeocodeSearch.OnGeocodeSearchListener {
|
||||
override fun onRegeocodeSearched(p0: RegeocodeResult?, p1: Int) {
|
||||
if (p1 == 1000) {
|
||||
trackUploadGeo(2);
|
||||
var regeocodeAddress = p0?.regeocodeAddress
|
||||
regeocodeAddress?.let {
|
||||
var locInfo = regeocodeAddress.toLocInfo(regeocodeAddress, latlngPoint)
|
||||
locGeoCode.invoke(locInfo)
|
||||
}
|
||||
} else {
|
||||
trackUploadGeo(3);
|
||||
onError.invoke("geoCode -> $p1")
|
||||
}
|
||||
}
|
||||
@@ -198,6 +200,13 @@ class LocationUtil private constructor() {
|
||||
})
|
||||
}
|
||||
|
||||
//上传
|
||||
private fun trackUploadGeo(type: Int) {
|
||||
trackNormalEvent(
|
||||
CarNet_Geo, mutableMapOf("type" to type)
|
||||
)
|
||||
}
|
||||
|
||||
fun getSpeed():Float{
|
||||
return speed
|
||||
}
|
||||
|
||||
@@ -31,8 +31,8 @@ fun getInformationBody(
|
||||
isShare:Boolean,
|
||||
poiType: String,
|
||||
mainInfoId: Long,
|
||||
latitude: Double,
|
||||
longitude: Double
|
||||
longitude: Double,
|
||||
latitude: Double
|
||||
): InformationBody {
|
||||
var jsonArray = JsonArray()
|
||||
var type: Int
|
||||
|
||||
@@ -65,7 +65,7 @@ public class MainIndependentActivity extends MainActivity {
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mServiceApis.getAdasControllerApi().setUseAlgorithm( false );
|
||||
mServiceApis.getAdasControllerApi().setUseAlgorithm( true );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -20,7 +20,6 @@ import com.mogo.service.intent.IMogoIntentListener;
|
||||
public class MainLauncherActivity extends MainActivity implements IMogoIntentListener {
|
||||
|
||||
protected boolean mIsHomeKeyDown = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate( @Nullable Bundle savedInstanceState ) {
|
||||
super.onCreate( savedInstanceState );
|
||||
|
||||
@@ -14,21 +14,24 @@ public class AppsListChangedLiveData extends MutableLiveData {
|
||||
|
||||
private Observer mObserver;
|
||||
|
||||
private AppsListChangedLiveData(){
|
||||
// private constructor
|
||||
}
|
||||
private static volatile AppsListChangedLiveData sInstance;
|
||||
|
||||
private static final class InstanceHolder{
|
||||
private static final AppsListChangedLiveData INSTANCE = new AppsListChangedLiveData();
|
||||
}
|
||||
private AppsListChangedLiveData(){}
|
||||
|
||||
public static AppsListChangedLiveData getInstance(){
|
||||
return InstanceHolder.INSTANCE;
|
||||
if( sInstance == null ){
|
||||
synchronized( AppsListChangedLiveData.class ) {
|
||||
if( sInstance == null ){
|
||||
sInstance = new AppsListChangedLiveData();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private Object readResolve(){
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return InstanceHolder.INSTANCE;
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -37,7 +40,9 @@ public class AppsListChangedLiveData extends MutableLiveData {
|
||||
mObserver = observer;
|
||||
}
|
||||
|
||||
public void release(){
|
||||
public synchronized void release(){
|
||||
removeObserver( mObserver );
|
||||
mObserver = null;
|
||||
sInstance = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -174,12 +174,7 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
int page = 0;
|
||||
int counter = 0;
|
||||
for ( AppInfo appInfo : list ) {
|
||||
if ( counter < AppsConst.TOTAL_SIZE_EACH_PAGE ) {
|
||||
counter++;
|
||||
} else {
|
||||
page++;
|
||||
counter = 0;
|
||||
}
|
||||
page = counter++ / AppsConst.TOTAL_SIZE_EACH_PAGE;
|
||||
if ( !result.containsKey( page ) ) {
|
||||
result.put( page, new ArrayList<>() );
|
||||
}
|
||||
@@ -221,6 +216,12 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
AppsListChangedLiveData.getInstance().release();
|
||||
mView = null;
|
||||
mLauncher.destroy();
|
||||
mAnalytics = null;
|
||||
mCardManager = null;
|
||||
if ( mLauncher != null ) {
|
||||
mLauncher.destroy();
|
||||
}
|
||||
mLauncher = null;
|
||||
}
|
||||
|
||||
public void exit() {
|
||||
|
||||
@@ -28,17 +28,8 @@ public class AnimWrapper implements Anim {
|
||||
public void initAnim( ImageView target ) {
|
||||
mTarget = target;
|
||||
if ( CarSeries.getSeries() == CarSeries.CAR_SERIES_F80X ) {
|
||||
ThreadPoolService.execute( () -> {
|
||||
final AnimationDrawable drawable = new AnimationDrawable();
|
||||
for ( int i = 0; i < AnimRes.sRes.length; i++ ) {
|
||||
drawable.addFrame( target.getResources().getDrawable( AnimRes.sRes[i] ), 100 );
|
||||
}
|
||||
UiThreadHandler.post( () -> {
|
||||
target.setBackground( drawable );
|
||||
mDelegate = new OthersAnim( drawable );
|
||||
start();
|
||||
} );
|
||||
} );
|
||||
mDelegate = new OthersAnim( target );
|
||||
start();
|
||||
} else {
|
||||
mTarget.setImageResource( R.drawable.mogo_tts_icon_00000 );
|
||||
}
|
||||
|
||||
@@ -1,6 +1,9 @@
|
||||
package com.mogo.module.apps.anim;
|
||||
|
||||
import android.graphics.drawable.AnimationDrawable;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.widget.ImageView;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -8,25 +11,44 @@ import android.graphics.drawable.AnimationDrawable;
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class OthersAnim implements Anim{
|
||||
public class OthersAnim implements Anim {
|
||||
|
||||
private AnimationDrawable mDrawable;
|
||||
private int mStartIndex = 0;
|
||||
|
||||
public OthersAnim( AnimationDrawable drawable ) {
|
||||
this.mDrawable = drawable;
|
||||
private final static int MSG_LOOP = 3003;
|
||||
public static final long INTERVAL = 100L;
|
||||
private boolean mStarted = false;
|
||||
|
||||
private final ImageView mImageView;
|
||||
|
||||
private Handler mHandler = new Handler( Looper.getMainLooper() ) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
switch ( msg.what ) {
|
||||
case MSG_LOOP:
|
||||
if ( mStarted ) {
|
||||
mImageView.setImageResource( AnimRes.sRes[mStartIndex++ % AnimRes.sRes.length] );
|
||||
mHandler.sendEmptyMessageDelayed( MSG_LOOP, INTERVAL );
|
||||
}
|
||||
break;
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
public OthersAnim( ImageView imageView ) {
|
||||
this.mImageView = imageView;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
if ( mDrawable != null ) {
|
||||
mDrawable.start();
|
||||
}
|
||||
mStarted = true;
|
||||
mHandler.sendEmptyMessage( MSG_LOOP );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
if ( mDrawable != null ) {
|
||||
mDrawable.stop();
|
||||
}
|
||||
mStarted = false;
|
||||
mHandler.removeMessages( MSG_LOOP );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -103,6 +103,7 @@ public class InternalFunctionLauncher extends BaseAppLauncher {
|
||||
public void destroy() {
|
||||
if ( getNext() != null ) {
|
||||
getNext().destroy();
|
||||
setNext( null );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -36,7 +36,7 @@ public class AppsModel {
|
||||
private Map< Integer, List< AppInfo > > mPagedApps = new HashMap<>();
|
||||
|
||||
private AppsModel( Context context ) {
|
||||
mContext = context;
|
||||
mContext = context.getApplicationContext();
|
||||
}
|
||||
|
||||
public static AppsModel getInstance( Context context ) {
|
||||
|
||||
|
After Width: | Height: | Size: 500 B |
BIN
modules/mogo-module-apps/src/main/res/drawable-mdpi/module_apps_ic_navigator_applist.png
Normal file → Executable file
|
Before Width: | Height: | Size: 4.3 KiB After Width: | Height: | Size: 2.4 KiB |
BIN
modules/mogo-module-apps/src/main/res/drawable-mdpi/module_apps_ic_navigator_im.png
Normal file → Executable file
|
Before Width: | Height: | Size: 2.3 KiB After Width: | Height: | Size: 2.4 KiB |
BIN
modules/mogo-module-apps/src/main/res/drawable-mdpi/module_apps_ic_navigator_media.png
Normal file → Executable file
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 1.9 KiB |
BIN
modules/mogo-module-apps/src/main/res/drawable-mdpi/module_apps_ic_navigator_navi.png
Normal file → Executable file
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 2.2 KiB |
BIN
modules/mogo-module-apps/src/main/res/drawable-mdpi/module_apps_ic_navigator_navi_disable.png
Normal file → Executable file
|
Before Width: | Height: | Size: 3.8 KiB After Width: | Height: | Size: 2.2 KiB |
BIN
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_ai_assist_bkg.png
Normal file → Executable file
|
Before Width: | Height: | Size: 4.0 KiB After Width: | Height: | Size: 880 B |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_apps.png
Executable file → Normal file
|
Before Width: | Height: | Size: 5.0 KiB After Width: | Height: | Size: 5.0 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_chat_icon.png
Executable file → Normal file
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_chat_unchecked.png
Executable file → Normal file
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_equlizer.png
Executable file → Normal file
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_fm.png
Executable file → Normal file
|
Before Width: | Height: | Size: 15 KiB After Width: | Height: | Size: 15 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_fota.png
Executable file → Normal file
|
Before Width: | Height: | Size: 14 KiB After Width: | Height: | Size: 14 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_icon_map.png
Executable file → Normal file
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_interest.png
Executable file → Normal file
|
Before Width: | Height: | Size: 9.0 KiB After Width: | Height: | Size: 9.0 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_interest_unchecked.png
Executable file → Normal file
|
Before Width: | Height: | Size: 3.7 KiB After Width: | Height: | Size: 3.7 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_lrts.png
Executable file → Normal file
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_media_center.png
Executable file → Normal file
|
Before Width: | Height: | Size: 12 KiB After Width: | Height: | Size: 12 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_media_center_checked.png
Executable file → Normal file
|
Before Width: | Height: | Size: 6.6 KiB After Width: | Height: | Size: 6.6 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_music.png
Executable file → Normal file
|
Before Width: | Height: | Size: 8.8 KiB After Width: | Height: | Size: 8.8 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_navigation.png
Executable file → Normal file
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 5.3 KiB |
BIN
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_navigator_im.png
Executable file → Normal file
|
Before Width: | Height: | Size: 6.3 KiB After Width: | Height: | Size: 10 KiB |
|
Before Width: | Height: | Size: 10 KiB After Width: | Height: | Size: 4.5 KiB |
|
Before Width: | Height: | Size: 11 KiB After Width: | Height: | Size: 4.8 KiB |
BIN
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_navigator_navi_disable.png
Normal file → Executable file
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 3.9 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_news.png
Executable file → Normal file
|
Before Width: | Height: | Size: 8.6 KiB After Width: | Height: | Size: 8.6 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_news_unchecked.png
Executable file → Normal file
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_online_car.png
Executable file → Normal file
|
Before Width: | Height: | Size: 13 KiB After Width: | Height: | Size: 13 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_online_car_unchecked.png
Executable file → Normal file
|
Before Width: | Height: | Size: 4.9 KiB After Width: | Height: | Size: 4.9 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_qiyi.png
Executable file → Normal file
|
Before Width: | Height: | Size: 18 KiB After Width: | Height: | Size: 18 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_qq_music.png
Executable file → Normal file
|
Before Width: | Height: | Size: 7.3 KiB After Width: | Height: | Size: 7.3 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_retract.png
Executable file → Normal file
|
Before Width: | Height: | Size: 1.1 KiB After Width: | Height: | Size: 1.1 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_stee_product.png
Executable file → Normal file
|
Before Width: | Height: | Size: 23 KiB After Width: | Height: | Size: 23 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_tanlu.png
Executable file → Normal file
|
Before Width: | Height: | Size: 8.1 KiB After Width: | Height: | Size: 8.1 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_tanlu_unchecked.png
Executable file → Normal file
|
Before Width: | Height: | Size: 4.6 KiB After Width: | Height: | Size: 4.6 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_welfare.png
Executable file → Normal file
|
Before Width: | Height: | Size: 19 KiB After Width: | Height: | Size: 19 KiB |
0
modules/mogo-module-apps/src/main/res/drawable-xhdpi/module_apps_ic_ximalaya.png
Executable file → Normal file
|
Before Width: | Height: | Size: 24 KiB After Width: | Height: | Size: 24 KiB |
@@ -4,7 +4,7 @@
|
||||
android:id="@+id/module_apps_id_apps_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="#0C0C0C">
|
||||
android:background="@color/module_app_page_bkg_color">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_apps_id_apps_exit"
|
||||
|
||||