opt
9
.idea/codeStyles/Project.xml
generated
@@ -1,5 +1,14 @@
|
||||
<component name="ProjectCodeStyleConfiguration">
|
||||
<code_scheme name="Project" version="173">
|
||||
<JetCodeStyleSettings>
|
||||
<option name="PACKAGES_TO_USE_STAR_IMPORTS">
|
||||
<value>
|
||||
<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>
|
||||
<codeStyleSettings language="XML">
|
||||
<indentOptions>
|
||||
<option name="CONTINUATION_INDENT_SIZE" value="4" />
|
||||
|
||||
22
.idea/gradle.xml
generated
@@ -4,9 +4,11 @@
|
||||
<component name="GradleSettings">
|
||||
<option name="linkedExternalProjectsSettings">
|
||||
<GradleProjectSettings>
|
||||
<option name="delegatedBuild" value="true" />
|
||||
<option name="testRunner" value="PLATFORM" />
|
||||
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
||||
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
||||
<option name="gradleJvm" value="1.8" />
|
||||
<option name="modules">
|
||||
<set>
|
||||
<option value="$PROJECT_DIR$" />
|
||||
@@ -36,6 +38,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" />
|
||||
@@ -57,6 +60,25 @@
|
||||
<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" />
|
||||
<option value="$PROJECT_DIR$/tts" />
|
||||
<option value="$PROJECT_DIR$/tts/tts-base" />
|
||||
<option value="$PROJECT_DIR$/tts/tts-di" />
|
||||
<option value="$PROJECT_DIR$/tts/tts-noop" />
|
||||
<option value="$PROJECT_DIR$/tts/tts-zhi" />
|
||||
</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>
|
||||
<component name="SuppressionsComponent">
|
||||
|
||||
133
app/build.gradle
@@ -76,12 +76,13 @@ android {
|
||||
em4 {
|
||||
manifest.srcFile 'src/em4/AndroidManifest.xml'
|
||||
}
|
||||
f8xxLauncherOnlineRelease {
|
||||
manifest.srcFile 'src/f8xxLauncherOnlineRelease/AndroidManifest.xml'
|
||||
}
|
||||
// 演示分支,暂时不需要这一项
|
||||
// f8xxLauncherOnlineRelease {
|
||||
// manifest.srcFile 'src/f8xxLauncherOnlineRelease/AndroidManifest.xml'
|
||||
// }
|
||||
}
|
||||
|
||||
flavorDimensions "product", "basic", "env"
|
||||
flavorDimensions "site","product", "basic", "env"
|
||||
|
||||
productFlavors {
|
||||
//独立app
|
||||
@@ -92,6 +93,9 @@ android {
|
||||
// 是否作为 launcher 运行
|
||||
buildConfigField 'boolean', 'IS_LAUNCHER', 'false'
|
||||
buildConfigField 'String', 'SOCKET_APP_ID', '\"com.mogo.launcher\"'
|
||||
// 是否支持目的地导航策略
|
||||
buildConfigField 'boolean', 'IS_SUPPORT_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH', 'true'
|
||||
|
||||
}
|
||||
// launcher app
|
||||
launcher {
|
||||
@@ -101,13 +105,13 @@ android {
|
||||
// 是否作为 launcher 运行
|
||||
buildConfigField 'boolean', 'IS_LAUNCHER', 'true'
|
||||
buildConfigField 'String', 'SOCKET_APP_ID', '\"com.mogo.launcher\"'
|
||||
// 是否支持目的地导航策略
|
||||
buildConfigField 'boolean', 'IS_SUPPORT_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH', 'false'
|
||||
}
|
||||
// f系列-分体机全系列,未细分
|
||||
f8xx {
|
||||
applicationId rootProject.ext.android.fLauncherApplicationId
|
||||
dimension "product"
|
||||
// 使用思必驰语音
|
||||
buildConfigField 'int', 'AIType', '2'
|
||||
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'false'
|
||||
// 车机类型,主要用于区分自研车机还是别人家的车机,自研车机类型为0
|
||||
buildConfigField 'int', 'CAR_MACHINE_TYPE', '0'
|
||||
@@ -115,13 +119,17 @@ android {
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.fLauncherAmapApiValue]
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
|
||||
// 是否支持换肤
|
||||
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'true'
|
||||
// 是否支持查询导航目的地车友
|
||||
buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
|
||||
// 是否支持桌面卡片刷新
|
||||
buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'false'
|
||||
}
|
||||
// f系列-分体机
|
||||
f80x {
|
||||
applicationId rootProject.ext.android.fLauncherApplicationId
|
||||
dimension "product"
|
||||
// 使用思必驰语音
|
||||
buildConfigField 'int', 'AIType', '2'
|
||||
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'false'
|
||||
// 车机类型,主要用于区分自研车机还是别人家的车机,自研车机类型为0
|
||||
buildConfigField 'int', 'CAR_MACHINE_TYPE', '0'
|
||||
@@ -129,13 +137,17 @@ android {
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.fLauncherAmapApiValue]
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
|
||||
// 是否支持换肤
|
||||
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'true'
|
||||
// 是否支持查询导航目的地车友
|
||||
buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
|
||||
// 是否支持桌面卡片刷新
|
||||
buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'false'
|
||||
}
|
||||
// e系列,采用Launcher方案
|
||||
e8xx {
|
||||
applicationId rootProject.ext.android.launcherApplicationId
|
||||
dimension "product"
|
||||
// 使用思必驰语音
|
||||
buildConfigField 'int', 'AIType', '2'
|
||||
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'false'
|
||||
// 车机类型,主要用于区分自研车机还是别人家的车机,自研车机类型为0
|
||||
buildConfigField 'int', 'CAR_MACHINE_TYPE', '0'
|
||||
@@ -143,13 +155,17 @@ android {
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.commonLauncherAmapApiValue]
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
|
||||
// 是否支持换肤
|
||||
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'true'
|
||||
// 是否支持查询导航目的地车友
|
||||
buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
|
||||
// 是否支持桌面卡片刷新
|
||||
buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'false'
|
||||
}
|
||||
// 同上
|
||||
em4 {
|
||||
applicationId rootProject.ext.android.launcherApplicationId
|
||||
dimension "product"
|
||||
// 使用思必驰语音
|
||||
buildConfigField 'int', 'AIType', '2'
|
||||
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'false'
|
||||
// 车机类型,主要用于区分自研车机还是别人家的车机,自研车机类型为0
|
||||
buildConfigField 'int', 'CAR_MACHINE_TYPE', '0'
|
||||
@@ -157,13 +173,17 @@ android {
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.commonLauncherAmapApiValue]
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
|
||||
// 是否支持换肤
|
||||
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'true'
|
||||
// 是否支持查询导航目的地车友
|
||||
buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
|
||||
// 是否支持桌面卡片刷新
|
||||
buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'false'
|
||||
}
|
||||
// e系列-2+32,对标D系列2+32,采用独立app的形式
|
||||
em3 {
|
||||
applicationId rootProject.ext.android.independentApplicationId
|
||||
dimension "product"
|
||||
// 使用思必驰语音
|
||||
buildConfigField 'int', 'AIType', '2'
|
||||
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'false'
|
||||
// 车机类型,主要用于区分自研车机还是别人家的车机,自研车机类型为0
|
||||
buildConfigField 'int', 'CAR_MACHINE_TYPE', '0'
|
||||
@@ -171,13 +191,17 @@ android {
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.commonIndependentAmapApiValue]
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
|
||||
// 是否支持换肤
|
||||
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'true'
|
||||
// 是否支持查询导航目的地车友
|
||||
buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
|
||||
// 是否支持桌面卡片刷新
|
||||
buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'true'
|
||||
}
|
||||
// e系列-1+16,对标D系列1+16,采用独立app形式
|
||||
em1 {
|
||||
applicationId rootProject.ext.android.independentApplicationId
|
||||
dimension "product"
|
||||
// 使用思必驰语音
|
||||
buildConfigField 'int', 'AIType', '2'
|
||||
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'false'
|
||||
// 车机类型,主要用于区分自研车机还是别人家的车机,自研车机类型为0
|
||||
buildConfigField 'int', 'CAR_MACHINE_TYPE', '0'
|
||||
@@ -185,13 +209,17 @@ android {
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.commonIndependentAmapApiValue]
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
|
||||
// 是否支持换肤
|
||||
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'true'
|
||||
// 是否支持查询导航目的地车友
|
||||
buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
|
||||
// 是否支持桌面卡片刷新
|
||||
buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'true'
|
||||
}
|
||||
// d系列
|
||||
d8xx {
|
||||
applicationId rootProject.ext.android.independentApplicationId
|
||||
dimension "product"
|
||||
// 使用同行者语音
|
||||
buildConfigField 'int', 'AIType', '1'
|
||||
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'false'
|
||||
// 车机类型,主要用于区分自研车机还是别人家的车机,自研车机类型为0
|
||||
buildConfigField 'int', 'CAR_MACHINE_TYPE', '0'
|
||||
@@ -199,13 +227,17 @@ android {
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.commonIndependentAmapApiValue]
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
|
||||
// 是否支持换肤
|
||||
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'true'
|
||||
// 是否支持查询导航目的地车友
|
||||
buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
|
||||
// 是否支持桌面卡片刷新
|
||||
buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'true'
|
||||
}
|
||||
// d系列 2 + 32
|
||||
d80x {
|
||||
applicationId rootProject.ext.android.independentApplicationId
|
||||
dimension "product"
|
||||
// 使用同行者语音
|
||||
buildConfigField 'int', 'AIType', '1'
|
||||
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'false'
|
||||
// 车机类型,主要用于区分自研车机还是别人家的车机,自研车机类型为0
|
||||
buildConfigField 'int', 'CAR_MACHINE_TYPE', '0'
|
||||
@@ -213,13 +245,17 @@ android {
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.commonIndependentAmapApiValue]
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
|
||||
// 是否支持换肤
|
||||
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'true'
|
||||
// 是否支持查询导航目的地车友
|
||||
buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
|
||||
// 是否支持桌面卡片刷新
|
||||
buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'true'
|
||||
}
|
||||
// d系列 1+16 版本
|
||||
d82x {
|
||||
applicationId rootProject.ext.android.independentApplicationId
|
||||
dimension "product"
|
||||
// 使用同行者语音
|
||||
buildConfigField 'int', 'AIType', '1'
|
||||
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'false'
|
||||
// 车机类型,主要用于区分自研车机还是别人家的车机,自研车机类型为0
|
||||
buildConfigField 'int', 'CAR_MACHINE_TYPE', '0'
|
||||
@@ -227,13 +263,17 @@ android {
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.commonIndependentAmapApiValue]
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'false'
|
||||
// 是否支持换肤
|
||||
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'true'
|
||||
// 是否支持查询导航目的地车友
|
||||
buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'true'
|
||||
// 是否支持桌面卡片刷新
|
||||
buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'true'
|
||||
}
|
||||
// 比亚迪
|
||||
bydauto {
|
||||
applicationId rootProject.ext.android.bydautoIndependentApplicationId
|
||||
dimension "product"
|
||||
// 不使用语音
|
||||
buildConfigField 'int', 'AIType', '0'
|
||||
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'false'
|
||||
// 车机类型,主要用于区分自研车机还是别人家的车机,其他车机,比亚迪定为1
|
||||
buildConfigField 'int', 'CAR_MACHINE_TYPE', '1'
|
||||
@@ -241,6 +281,24 @@ android {
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.bydautoIndependentApiValue]
|
||||
// 是否使用高德sdk自定义导航
|
||||
buildConfigField 'boolean', 'USE_CUSTOM_NAVI', 'true'
|
||||
// 是否支持换肤
|
||||
buildConfigField 'boolean', 'IS_SKIN_SUPPORTED', 'false'
|
||||
// 是否支持查询导航目的地车友
|
||||
buildConfigField 'boolean', 'IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST', 'false'
|
||||
// 是否支持桌面卡片刷新
|
||||
buildConfigField 'boolean', 'IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY', 'false'
|
||||
}
|
||||
// 演示地点-顺义
|
||||
shunyi{
|
||||
dimension "site"
|
||||
// 西迪obu
|
||||
buildConfigField 'int', "OBU_TYPE", '1'
|
||||
}
|
||||
// 演示地点-苏州
|
||||
suzhou{
|
||||
dimension "site"
|
||||
// 华砺智行obu
|
||||
buildConfigField 'int', "OBU_TYPE", '2'
|
||||
}
|
||||
qa {
|
||||
dimension "env"
|
||||
@@ -259,6 +317,12 @@ android {
|
||||
packagingOptions {
|
||||
exclude 'META-INF/io.netty.versions.properties'
|
||||
}
|
||||
|
||||
sourceSets {
|
||||
main {
|
||||
res.srcDirs = ['src/main/res', 'src/main/res-night']
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
repositories {
|
||||
@@ -275,14 +339,19 @@ 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
|
||||
// independentImplementation rootProject.ext.dependencies.modulepushnoop
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
@@ -292,6 +361,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.mogomoduleauth
|
||||
implementation rootProject.ext.dependencies.modulemedia
|
||||
implementation rootProject.ext.dependencies.moduleservice
|
||||
// implementation rootProject.ext.dependencies.moduleobu
|
||||
implementation rootProject.ext.dependencies.modulesplash
|
||||
implementation rootProject.ext.dependencies.moduleV2x
|
||||
implementation rootProject.ext.dependencies.moduletanlu, {
|
||||
@@ -299,8 +369,8 @@ dependencies {
|
||||
}
|
||||
implementation rootProject.ext.dependencies.moduletanluapi
|
||||
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')
|
||||
@@ -308,6 +378,7 @@ dependencies {
|
||||
implementation project(':modules:mogo-module-authorize')
|
||||
implementation project(':modules:mogo-module-media')
|
||||
implementation project(':modules:mogo-module-service')
|
||||
// implementation project(':modules:mogo-module-obu')
|
||||
implementation project(':modules:mogo-module-splash')
|
||||
implementation project(':modules:mogo-module-v2x')
|
||||
implementation project(':modules:mogo-module-tanlu'), {
|
||||
@@ -315,8 +386,8 @@ dependencies {
|
||||
}
|
||||
implementation project(':libraries:mogo-tanlu-api')
|
||||
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 +395,10 @@ 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"
|
||||
apply from: "./functions/widgets.gradle"
|
||||
apply from: "./functions/tts.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')
|
||||
}
|
||||
}
|
||||
49
app/functions/skin.gradle
Normal file
@@ -0,0 +1,49 @@
|
||||
project.dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
bydautoImplementation rootProject.ext.dependencies.skinsupportnoop
|
||||
|
||||
d82xImplementation rootProject.ext.dependencies.skinsupportimpl
|
||||
em1Implementation rootProject.ext.dependencies.skinsupportimpl
|
||||
em3Implementation rootProject.ext.dependencies.skinsupportimpl
|
||||
d8xxImplementation rootProject.ext.dependencies.skinsupportimpl
|
||||
d80xImplementation rootProject.ext.dependencies.skinsupportimpl
|
||||
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
|
||||
d80xImplementation rootProject.ext.dependencies.skinsupportlight
|
||||
em3Implementation rootProject.ext.dependencies.skinsupportlight
|
||||
d82xImplementation rootProject.ext.dependencies.skinsupportlight
|
||||
em1Implementation rootProject.ext.dependencies.skinsupportlight
|
||||
} else {
|
||||
|
||||
|
||||
bydautoImplementation project(':skin:mogo-skin-support-noop')
|
||||
|
||||
d82xImplementation project(':skin:mogo-skin-support-impl')
|
||||
em1Implementation project(':skin:mogo-skin-support-impl')
|
||||
em3Implementation project(':skin:mogo-skin-support-impl')
|
||||
d8xxImplementation project(':skin:mogo-skin-support-impl')
|
||||
d80xImplementation project(':skin:mogo-skin-support-impl')
|
||||
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')
|
||||
d80xImplementation project(':skin:mogo-skin-light')
|
||||
d82xImplementation project(':skin:mogo-skin-light')
|
||||
em1Implementation project(':skin:mogo-skin-light')
|
||||
em3Implementation project(':skin:mogo-skin-light')
|
||||
}
|
||||
}
|
||||
25
app/functions/tts.gradle
Normal file
@@ -0,0 +1,25 @@
|
||||
project.dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
bydautoImplementation rootProject.ext.dependencies.ttsdi
|
||||
d82xImplementation rootProject.ext.dependencies.ttszhi
|
||||
em1Implementation rootProject.ext.dependencies.ttszhi
|
||||
em3Implementation rootProject.ext.dependencies.ttszhi
|
||||
d8xxImplementation rootProject.ext.dependencies.ttszhi
|
||||
d80xImplementation rootProject.ext.dependencies.ttszhi
|
||||
f8xxImplementation rootProject.ext.dependencies.ttszhi
|
||||
f80xImplementation rootProject.ext.dependencies.ttszhi
|
||||
em4Implementation rootProject.ext.dependencies.ttszhi
|
||||
e8xxImplementation rootProject.ext.dependencies.ttszhi
|
||||
} else {
|
||||
bydautoImplementation project(':tts:tts-di')
|
||||
d82xImplementation project(':tts:tts-zhi')
|
||||
em1Implementation project(':tts:tts-zhi')
|
||||
em3Implementation project(':tts:tts-zhi')
|
||||
d8xxImplementation project(':tts:tts-zhi')
|
||||
d80xImplementation project(':tts:tts-zhi')
|
||||
f8xxImplementation project(':tts:tts-zhi')
|
||||
f80xImplementation project(':tts:tts-zhi')
|
||||
em4Implementation project(':tts:tts-zhi')
|
||||
e8xxImplementation project(':tts:tts-zhi')
|
||||
}
|
||||
}
|
||||
11
app/functions/widgets.gradle
Normal file
@@ -0,0 +1,11 @@
|
||||
// 悬浮控件:独立 app 和 launcher
|
||||
|
||||
project.dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
independentImplementation rootProject.ext.dependencies.mogomodulewidgets
|
||||
implementation rootProject.ext.dependencies.mogomodulewidgets
|
||||
} else {
|
||||
independentImplementation project(':modules:mogo-module-widgets')
|
||||
implementation project(':modules:mogo-module-widgets')
|
||||
}
|
||||
}
|
||||
@@ -2,8 +2,8 @@
|
||||
|
||||
afterEvaluate {
|
||||
|
||||
def independent = ["em3", "em1", "d80x", "d82x", "bydauto"]
|
||||
def launcher = ["f80x", "em4"]
|
||||
def independent = []
|
||||
def launcher = ["f80x"]
|
||||
|
||||
it.getTasks().iterator().forEachRemaining {
|
||||
def task = it
|
||||
|
||||
@@ -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>
|
||||
@@ -14,6 +14,7 @@ import com.mogo.commons.network.Utils;
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant;
|
||||
import com.mogo.module.back.BackToLauncherConst;
|
||||
import com.mogo.module.carchatting.card.CallChatConstant;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.main.service.MogoMainService;
|
||||
@@ -22,17 +23,22 @@ import com.mogo.module.push.base.PushUIConstants;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.module.tanlu.constant.TanluConstants;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.widgets.MogoWidgetsProvider;
|
||||
import com.mogo.module.v2x.utils.ObuConfig;
|
||||
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
|
||||
@@ -47,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 );
|
||||
@@ -55,65 +64,96 @@ 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));
|
||||
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() ) {
|
||||
MogoModulePaths.addModule( new MogoModule( BackToLauncherConst.MODULE_PATH, BackToLauncherConst.MODULE_NAME ) );
|
||||
MogoModulePaths.addModule( new MogoModule( MediaConstants.TAG, MediaConstants.MODULE_TYPE ) );
|
||||
} else {
|
||||
MogoModulePaths.addBaseModule( new MogoModule( MogoWidgetsProvider.PATH, MogoWidgetsProvider.NAME ) );
|
||||
}
|
||||
MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_WIDGETS, MogoServicePaths.PATH_WIDGETS ) );
|
||||
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.addBaseModule( new MogoModule( TanluConstants.TAG, TanluConstants.MODEL_NAME ) );
|
||||
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_SHARE, "ShareControl" ) );
|
||||
MogoModulePaths.addBaseModule( 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.addModule( new MogoModule( V2XConst.PATH_EVENT_PANEL, V2XConst.MODULE_NAME_EVENT_PANEL ) );
|
||||
MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_STRATEGY_SHARE, "StrategyShare" ) );
|
||||
MogoModulePaths.addBaseModule( new MogoModule( MogoServicePaths.PATH_MOGO_MONITOR, "MogoMonitor" ) );
|
||||
MogoModulePaths.addModule( new MogoModule( PushUIConstants.PATH, PushUIConstants.NAME ) );
|
||||
// 碰撞报警模块
|
||||
MogoModulePaths.addModule(new MogoModule(MogoServicePaths.PATH_CRASH_WARNING,
|
||||
"CrashWarning"));
|
||||
|
||||
if ( !DebugConfig.isLauncher() ) {
|
||||
PersistentManager.getInstance().initManager( this );
|
||||
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 );
|
||||
DebugConfig.setLaunchLocationService( BuildConfig.LAUNCH_LOCATION_SERVICE );
|
||||
DebugConfig.setUseCustomNavi( BuildConfig.USE_CUSTOM_NAVI );
|
||||
DebugConfig.setLauncher( BuildConfig.IS_LAUNCHER );
|
||||
DebugConfig.setActiveAIAssistFlag( BuildConfig.AI_ASSIST_ACTIVE_STAUTS );
|
||||
DebugConfig.setUseMockObuData(false);
|
||||
ObuConfig.useObuLocation = false;
|
||||
DebugConfig.setCarMachineType( BuildConfig.CAR_MACHINE_TYPE );
|
||||
DebugConfig.setProductFlavor( BuildConfig.FLAVOR_product );
|
||||
DebugConfig.setSocketAppId( BuildConfig.SOCKET_APP_ID );
|
||||
DebugConfig.setRoadEventAnimated( BuildConfig.ROAD_EVENT_ANIMATED );
|
||||
DebugConfig.setSkinSupported( BuildConfig.IS_SKIN_SUPPORTED );
|
||||
DebugConfig.setSupportedSearchDestinationOnlineCarList( BuildConfig.IS_SUPPORTED_SEARCH_DESTINATION_ONLINE_CAR_LIST );
|
||||
DebugConfig.setScheduleCalculateNotHomeCompanyDistanceForPush( BuildConfig.IS_SUPPORT_SCHEDULE_CALCULATE_NOT_HOME_COMPANY_DISTANCE_FOR_PUSH );
|
||||
DebugConfig.setSupportLauncherCardRefreshStrategy( BuildConfig.IS_SUPPORT_LAUNCHER_CARD_REFRESH_STRATEGY );
|
||||
DebugConfig.setObuType(BuildConfig.OBU_TYPE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void asyncInitImpl() {
|
||||
super.asyncInitImpl();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void init() {
|
||||
super.init();
|
||||
prepareBaseService( 2_000L );
|
||||
final IMogoServiceApis apis = MogoApisHandler.getInstance().getApis();
|
||||
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, () -> {
|
||||
|
||||
280
config.gradle
@@ -4,201 +4,215 @@ 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",
|
||||
androidxccorektx : "androidx.core:core-ktx:1.3.0",
|
||||
androidxconstraintlayout : "androidx.constraintlayout:constraintlayout:1.1.3",
|
||||
boostmultidex : "com.bytedance.boost_multidex:boost_multidex:1.0.1",
|
||||
androidxviewpager2 : "androidx.viewpager2:viewpager2:1.0.0",
|
||||
androidxrecyclerview : "androidx.recyclerview:recyclerview:1.1.0",
|
||||
androidxcardview : "androidx.cardview:cardview:1.0.0",
|
||||
localbroadcastmanager : "androidx.localbroadcastmanager:localbroadcastmanager:1.0.0",
|
||||
androidxappcompat : "androidx.appcompat:appcompat:1.1.0",
|
||||
androidxccorektx : "androidx.core:core-ktx:1.3.0",
|
||||
androidxconstraintlayout : "androidx.constraintlayout:constraintlayout:1.1.3",
|
||||
boostmultidex : "com.bytedance.boost_multidex:boost_multidex:1.0.1",
|
||||
androidxviewpager2 : "androidx.viewpager2:viewpager2:1.0.0",
|
||||
androidxrecyclerview : "androidx.recyclerview:recyclerview:1.1.0",
|
||||
androidxcardview : "androidx.cardview:cardview:1.0.0",
|
||||
localbroadcastmanager : "androidx.localbroadcastmanager:localbroadcastmanager:1.0.0",
|
||||
// flexbox
|
||||
flexbox : 'com.google.android:flexbox:2.0.1',
|
||||
flexbox : 'com.google.android:flexbox:2.0.1',
|
||||
// 测试
|
||||
junit : "junit:junit:4.12",
|
||||
androidxjunit : "androidx.test.ext:junit:1.1.0",
|
||||
androidxespressocore : "androidx.test.espresso:espresso-core:3.1.1",
|
||||
junit : "junit:junit:4.12",
|
||||
androidxjunit : "androidx.test.ext:junit:1.1.0",
|
||||
androidxespressocore : "androidx.test.espresso:espresso-core:3.1.1",
|
||||
// 地图
|
||||
amapnavi3dmap : "com.amap.api:navi-3dmap:7.2.0_3dmap7.2.0",
|
||||
amapsearch : "com.amap.api:search:7.1.0",
|
||||
amaplocation : "com.amap.api:location:4.9.0",
|
||||
amapnavi3dmap : "com.amap.api:navi-3dmap:7.2.0_3dmap7.2.0",
|
||||
amapsearch : "com.amap.api:search:7.1.0",
|
||||
amaplocation : "com.amap.api:location:4.9.0",
|
||||
// json 转换
|
||||
gson : "com.google.code.gson:gson:2.8.4",
|
||||
gson : "com.google.code.gson:gson:2.8.4",
|
||||
// 内存泄漏检测
|
||||
debugleakcanary : "com.squareup.leakcanary:leakcanary-android:1.6.1",
|
||||
releaseleakcanary : "com.squareup.leakcanary:leakcanary-android-no-op:1.6.1",
|
||||
testleakcanary : "com.squareup.leakcanary:leakcanary-android-no-op:1.6.1",
|
||||
debugleakcanary : "com.squareup.leakcanary:leakcanary-android:1.6.1",
|
||||
releaseleakcanary : "com.squareup.leakcanary:leakcanary-android-no-op:1.6.1",
|
||||
testleakcanary : "com.squareup.leakcanary:leakcanary-android-no-op:1.6.1",
|
||||
//rxJava
|
||||
rxjava : "io.reactivex.rxjava2:rxjava:2.2.2",
|
||||
rxandroid : "io.reactivex.rxjava2:rxandroid:2.1.0",
|
||||
rxjava : "io.reactivex.rxjava2:rxjava:2.2.2",
|
||||
rxandroid : "io.reactivex.rxjava2:rxandroid:2.1.0",
|
||||
// arouter
|
||||
arouter : "com.alibaba:arouter-api:1.5.0",
|
||||
aroutercompiler : "com.alibaba:arouter-compiler:1.2.2",
|
||||
arouter : "com.alibaba:arouter-api:1.5.0",
|
||||
aroutercompiler : "com.alibaba:arouter-compiler:1.2.2",
|
||||
// glide
|
||||
glide : 'com.github.bumptech.glide:glide:4.8.0',
|
||||
glideokhttp3 : 'com.github.bumptech.glide:okhttp3-integration:4.8.0',
|
||||
glideanno : 'com.github.bumptech.glide:annotations:4.8.0',
|
||||
glidecompiler : 'com.github.bumptech.glide:compiler:4.8.0',
|
||||
supportannos : "com.android.support:support-annotations:28.0.0",
|
||||
glide : 'com.github.bumptech.glide:glide:4.8.0',
|
||||
glideokhttp3 : 'com.github.bumptech.glide:okhttp3-integration:4.8.0',
|
||||
glideanno : 'com.github.bumptech.glide:annotations:4.8.0',
|
||||
glidecompiler : 'com.github.bumptech.glide:compiler:4.8.0',
|
||||
supportannos : "com.android.support:support-annotations:28.0.0",
|
||||
// fresco
|
||||
fresco : 'com.facebook.fresco:fresco:1.1.0',
|
||||
fresco : 'com.facebook.fresco:fresco:1.1.0',
|
||||
// 公司服务 - 语音
|
||||
aiassist : "com.zhidaoauto.common:service:1.0.4.10",
|
||||
aiassist : "com.zhidaoauto.common:service:1.0.8.4",
|
||||
// 语音替换方案 暂时只用TTS 解决焦点问题
|
||||
aiassistReplace : "com.zhidao.mogoVoicesdk:voice:1.0.5",
|
||||
aiassistReplace : "com.zhidao.mogoVoicesdk:voice:1.0.5",
|
||||
// 公司服务 - 埋点
|
||||
analytics : "com.elegant.analytics:analytics:1.1.19",
|
||||
analytics : "com.elegant.analytics:analytics:1.1.19",
|
||||
|
||||
retrofit : "com.squareup.retrofit2:retrofit:2.6.0",
|
||||
retrofitadapter : "com.squareup.retrofit2:adapter-rxjava2:2.6.0",
|
||||
retrofitconvertergson : "com.squareup.retrofit2:converter-gson:2.6.0",
|
||||
retrofitconverterscalars : "com.squareup.retrofit2:converter-scalars:2.1.0",
|
||||
retrofit : "com.squareup.retrofit2:retrofit:2.6.0",
|
||||
retrofitadapter : "com.squareup.retrofit2:adapter-rxjava2:2.6.0",
|
||||
retrofitconvertergson : "com.squareup.retrofit2:converter-gson:2.6.0",
|
||||
retrofitconverterscalars : "com.squareup.retrofit2:converter-scalars:2.1.0",
|
||||
|
||||
|
||||
// leakcanary
|
||||
leakcanary : 'com.squareup.leakcanary:leakcanary-android:1.5.4',
|
||||
leakcanarynoop : 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4',
|
||||
leakcanary : 'com.squareup.leakcanary:leakcanary-android:1.5.4',
|
||||
leakcanarynoop : 'com.squareup.leakcanary:leakcanary-android-no-op:1.5.4',
|
||||
|
||||
// add for room
|
||||
room : "android.arch.persistence.room:runtime:1.1.1",
|
||||
roomAnnotationProcessor : 'android.arch.persistence.room:compiler:1.1.1',
|
||||
room : "android.arch.persistence.room:runtime:1.1.1",
|
||||
roomAnnotationProcessor : 'android.arch.persistence.room:compiler:1.1.1',
|
||||
|
||||
// rxjava2 with room
|
||||
roomRxjava : "android.arch.persistence.room:rxjava2:1.1.1",
|
||||
roomRxjava : "android.arch.persistence.room:rxjava2:1.1.1",
|
||||
|
||||
// material
|
||||
material : 'com.google.android.material:material:1.1.0',
|
||||
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}",
|
||||
moduletanluapi : "com.mogo.module:module-tanlu-api:${MOGO_TANLU_API_VERSION}",
|
||||
moduleshare : "com.mogo.module:module-share:${MOGO_MODULE_SHARE_VERSION}",
|
||||
mogocommons : "com.mogo.commons:mogo-commons:${MOGO_COMMONS_VERSION}",
|
||||
mogoutils : "com.mogo.commons:mogo-utils:${MOGO_UTILS_VERSION}",
|
||||
mapamap : "com.mogo.map:map-amap:${MAP_AMAP_VERSION}",
|
||||
mapautomap : "com.mogo.map:map-autonavi:${MAP_AUTONAVI_VERSION}",
|
||||
moduletanlu : "com.mogo.module:module-tanlu:${MOGO_MODULE_TANLU_VERSION}",
|
||||
moduletanluapi : "com.mogo.module:module-tanlu-api:${MOGO_TANLU_API_VERSION}",
|
||||
moduleshare : "com.mogo.module:module-share:${MOGO_MODULE_SHARE_VERSION}",
|
||||
mogocommons : "com.mogo.commons:mogo-commons:${MOGO_COMMONS_VERSION}",
|
||||
mogoutils : "com.mogo.commons:mogo-utils:${MOGO_UTILS_VERSION}",
|
||||
mapamap : "com.mogo.map:map-amap:${MAP_AMAP_VERSION}",
|
||||
mapautomap : "com.mogo.map:map-autonavi:${MAP_AUTONAVI_VERSION}",
|
||||
mapcustom : "com.mogo.map:map-custom:${MAP_CUSTOM_VERSION}",
|
||||
mogomap : "com.mogo.map:mogo-map:${MOGO_MAP_VERSION}",
|
||||
mogomapapi : "com.mogo.map:mogo-map-api:${MOGO_MAP_API_VERSION}",
|
||||
modulecommon : "com.mogo.module:module-common:${MOGO_MODULE_COMMON_VERSION}",
|
||||
modulemain : "com.mogo.module:module-main:${MOGO_MODULE_MAIN_VERSION}",
|
||||
modulemainlauncher : "com.mogo.module:module-main-launcher:${MOGO_MODULE_MAIN_LAUNCHER_VERSION}",
|
||||
modulemainindependent : "com.mogo.module:module-main-independent:${MOGO_MODULE_MAIN_INDEPENDENT_VERSION}",
|
||||
modulemap : "com.mogo.module:module-map:${MOGO_MODULE_MAP_VERSION}",
|
||||
moduleservice : "com.mogo.module:module-service:${MOGO_MODULE_SERVICE_VERSION}",
|
||||
mogoservice : "com.mogo.service:mogo-service:${MOGO_SERVICE_VERSION}",
|
||||
mogoserviceapi : "com.mogo.service:mogo-service-api:${MOGO_SERVICE_API_VERSION}",
|
||||
moduleapps : "com.mogo.module:module-apps:${MOGO_MODULE_APPS_VERSION}",
|
||||
mogoconnection : "com.mogo.connection:mogo-connection:${MOGO_CONNECTION_VERSION}",
|
||||
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}",
|
||||
// guideshowprovider : "com.mogo.module.guideshow:module-guideshow-provider:${MOGO_MODULE_GUIDESHOW_PROVIDER_VERSION}",
|
||||
// 在线车辆
|
||||
moduleonlinecar : "com.mogo.module:module-onlinecar:${MOGO_MODULE_ONLINECAR_VERSION}",
|
||||
mogomap : "com.mogo.map:mogo-map:${MOGO_MAP_VERSION}",
|
||||
mogomapapi : "com.mogo.map:mogo-map-api:${MOGO_MAP_API_VERSION}",
|
||||
modulecommon : "com.mogo.module:module-common:${MOGO_MODULE_COMMON_VERSION}",
|
||||
modulemain : "com.mogo.module:module-main:${MOGO_MODULE_MAIN_VERSION}",
|
||||
modulemainlauncher : "com.mogo.module:module-main-launcher:${MOGO_MODULE_MAIN_LAUNCHER_VERSION}",
|
||||
modulemainindependent : "com.mogo.module:module-main-independent:${MOGO_MODULE_MAIN_INDEPENDENT_VERSION}",
|
||||
modulemap : "com.mogo.module:module-map:${MOGO_MODULE_MAP_VERSION}",
|
||||
moduleservice : "com.mogo.module:module-service:${MOGO_MODULE_SERVICE_VERSION}",
|
||||
mogoservice : "com.mogo.service:mogo-service:${MOGO_SERVICE_VERSION}",
|
||||
mogoserviceapi : "com.mogo.service:mogo-service-api:${MOGO_SERVICE_API_VERSION}",
|
||||
moduleapps : "com.mogo.module:module-apps:${MOGO_MODULE_APPS_VERSION}",
|
||||
mogoconnection : "com.mogo.connection:mogo-connection:${MOGO_CONNECTION_VERSION}",
|
||||
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:module-guide:${MOGO_MODULE_GUIDESHOW_VERSION}",
|
||||
// V2X
|
||||
moduleV2x : "com.mogo.module:module-v2x:${MOGO_MODULE_V2X_VERSION}",
|
||||
modulemedia : "com.mogo.module:module-media:${MOGO_MODULE_MEDIA_VERSION}",
|
||||
modulesearch : "com.mogo.module:module-search:${MOGO_MODULE_SEARCH_VERSION}",
|
||||
moduleV2x : "com.mogo.module:module-v2x:${MOGO_MODULE_V2X_VERSION}",
|
||||
modulemedia : "com.mogo.module:module-media:${MOGO_MODULE_MEDIA_VERSION}",
|
||||
modulesearch : "com.mogo.module:module-search:${MOGO_MODULE_SEARCH_VERSION}",
|
||||
// push
|
||||
modulepush : "com.mogo.module:module-push:${MOGO_MODULE_PUSH_VERSION}",
|
||||
modulepushbase : "com.mogo.module:module-push-base:${MOGO_MODULE_PUSH_BASE_VERSION}",
|
||||
modulepushnoop : "com.mogo.module:module-push-noop:${MOGO_MODULE_PUSH_NOOP_VERSION}",
|
||||
//运营位卡片
|
||||
moduleadcard : "com.mogo.module:module-adcard:${MOGO_MODULE_AD_CARD_VERSION}",
|
||||
modulepush : "com.mogo.module:module-push:${MOGO_MODULE_PUSH_VERSION}",
|
||||
modulepushbase : "com.mogo.module:module-push-base:${MOGO_MODULE_PUSH_BASE_VERSION}",
|
||||
modulepushnoop : "com.mogo.module:module-push-noop:${MOGO_MODULE_PUSH_NOOP_VERSION}",
|
||||
//统一返回键
|
||||
mogomoduleback : "com.mogo.module:module-back:${MOGO_MODULE_BACK_VERSION}",
|
||||
mogomoduleauth : "com.mogo.module:module-authorize:${MOGO_MODULE_AUTHORIZE_VERSION}",
|
||||
mogomoduleguide : "com.mogo.module:module-guide:${MOGO_MODULE_GUIDE_VERSION}",
|
||||
mogomoduleback : "com.mogo.module:module-back:${MOGO_MODULE_BACK_VERSION}",
|
||||
mogomoduleauth : "com.mogo.module:module-authorize:${MOGO_MODULE_AUTHORIZE_VERSION}",
|
||||
mogomoduleguide : "com.mogo.module:module-guide:${MOGO_MODULE_GUIDE_VERSION}",
|
||||
// 长链
|
||||
socketsdk : 'com.zhidao.socketsdk:socketsdk:2.1.4',
|
||||
socketsdkconnsvrprotoco : 'com.zhidao.ptech:connsvr-protoco:0.1.23',
|
||||
socketsdkprotobufjava : 'com.google.protobuf:protobuf-java:3.5.1',
|
||||
socketsdk : 'com.zhidao.socketsdk:socketsdk:2.1.4',
|
||||
socketsdkconnsvrprotoco : 'com.zhidao.ptech:connsvr-protoco:0.1.23',
|
||||
socketsdkprotobufjava : 'com.google.protobuf:protobuf-java:3.5.1',
|
||||
// OBU
|
||||
moduleobu : "com.mogo.module:module-obu:${MOGO_MODULE_OBU_VERSION}",
|
||||
moduleobu : "com.mogo.module:module-obu:${MOGO_MODULE_OBU_VERSION}",
|
||||
|
||||
//
|
||||
jetbrainsannotationsjava5: "org.jetbrains:annotations-java5:15.0",
|
||||
jetbrainsannotationsjava5 : "org.jetbrains:annotations-java5:15.0",
|
||||
|
||||
// 统一登录
|
||||
accountsdk : "com.zhidao.accountservice:account-sdk:1.0.11",
|
||||
accountsdk : "com.zhidao.accountservice:account-sdk:1.0.14",
|
||||
// crash
|
||||
crashSdk : "com.zhidaoauto.crash.log:library:1.0.5",
|
||||
kotlinstdlibjdk7 : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlin_version}",
|
||||
crashSdk : "com.zhidaoauto.crash.log:library:1.0.5",
|
||||
kotlinstdlibjdk7 : "org.jetbrains.kotlin:kotlin-stdlib-jdk7:${kotlin_version}",
|
||||
|
||||
//探路
|
||||
videoarmv7 : "com.shuyu:gsyVideoPlayer-armv7a:7.1.2",
|
||||
videoarm64 : "com.shuyu:gsyVideoPlayer-arm64:7.1.2",
|
||||
videojava : "com.shuyu:gsyVideoPlayer-java:7.1.2",
|
||||
eventbus : "org.greenrobot:eventbus:3.1.1",
|
||||
videoprocessor : "com.zhidao.video:video-processor:1.0.2.1",
|
||||
videoarmv7 : "com.shuyu:gsyVideoPlayer-armv7a:7.1.2",
|
||||
videoarm64 : "com.shuyu:gsyVideoPlayer-arm64:7.1.2",
|
||||
videojava : "com.shuyu:gsyVideoPlayer-java:7.1.2",
|
||||
eventbus : "org.greenrobot:eventbus:3.1.1",
|
||||
videoprocessor : "com.zhidao.video:video-processor:1.0.2.1",
|
||||
|
||||
coroutinescore : "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1",
|
||||
coroutinesandroid : "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1",
|
||||
coroutinescore : "org.jetbrains.kotlinx:kotlinx-coroutines-core:1.1.1",
|
||||
coroutinesandroid : "org.jetbrains.kotlinx:kotlinx-coroutines-android:1.1.1",
|
||||
|
||||
aspectj : "org.aspectj:aspectjrt:1.8.9",
|
||||
aspectj : "org.aspectj:aspectjrt:1.8.9",
|
||||
|
||||
// gps 模拟
|
||||
gpssimulator : "com.mogo.module:module-gps-simulator:${MOGO_MODULE_GPS_SIMULATOR_VERSION}",
|
||||
gpssimulatordebug : "com.mogo.module:module-gps-simulator-debug:${MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION}",
|
||||
gpssimulatornoop : "com.mogo.module:module-gps-simulator-noop:${MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION}",
|
||||
gpssimulator : "com.mogo.module:module-gps-simulator:${MOGO_MODULE_GPS_SIMULATOR_VERSION}",
|
||||
gpssimulatordebug : "com.mogo.module:module-gps-simulator-debug:${MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION}",
|
||||
gpssimulatornoop : "com.mogo.module:module-gps-simulator-noop:${MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION}",
|
||||
|
||||
adasapi : "com.zhidao.autopilot.support:adas:1.0.1",
|
||||
adasapi : "com.zhidao.autopilot.support:adas:1.0.5",
|
||||
adasconfigapi : "com.zhidao.adasconfig:adasconfig:1.1.5",
|
||||
|
||||
// 个人中心的SDK
|
||||
personalsdk : "com.zhidaoauto.person.info:data:1.0.1",
|
||||
tanluupload : "com.mogo.module:module-tanlu-upload:${TANLULIB_VERSION}",
|
||||
personalsdk : "com.zhidaoauto.person.info:data:1.0.1",
|
||||
tanluupload : "com.mogo.module:module-tanlu-upload:${TANLULIB_VERSION}",
|
||||
|
||||
// obu sdk
|
||||
obusdk : "com.zhidao.enterprise.smartv2x:smartv2x:1.0.0.1",
|
||||
//事件面板
|
||||
moduleventpanel : "com.mogo.module:module-event-panel:${MOGO_MODULE_EVENT_PANEL_VERSION}",
|
||||
// 事件面板空实现
|
||||
moduleventpanelnoop : "com.mogo.module:module-event-panel-noop:${MOGO_MODULE_EVENT_PANEL_VERSION}",
|
||||
obusdk : "com.zhidao.enterprise.smartv2x:smartv2x:1.0.0.3",
|
||||
// 左侧面板
|
||||
moduleleftpanel : "com.mogo.module:module-left-panel:${MOGO_MODULE_LEFT_PANEL_VERSION}",
|
||||
moduleleftpanel : "com.mogo.module:module-left-panel:${MOGO_MODULE_LEFT_PANEL_VERSION}",
|
||||
// 左侧面板空实现
|
||||
moduleleftpanelnoop : "com.mogo.module:module-left-panel-noop:${MOGO_MODULE_LEFT_PANEL_VERSION}",
|
||||
moduleleftpanelnoop : "com.mogo.module:module-left-panel-noop:${MOGO_MODULE_LEFT_PANEL_VERSION}",
|
||||
// 闪屏页
|
||||
modulesplash : "com.mogo.module:module-splash:${MOGO_MODULE_SPLASH_VERSION}",
|
||||
modulesplash : "com.mogo.module:module-splash:${MOGO_MODULE_SPLASH_VERSION}",
|
||||
// 基础服务实现
|
||||
mogobaseservicesdk : "com.mogo.base:services-sdk:${MOGO_BASE_SERVICES_SDK_VERSION}",
|
||||
mogobaseserviceapk : "com.mogo.base:services-apk:${MOGO_BASE_SERVICES_APK_VERSION}",
|
||||
mogobaseservicesdk : "com.mogo.base:services-sdk:${MOGO_BASE_SERVICES_SDK_VERSION}",
|
||||
mogobaseserviceapk : "com.mogo.base:services-apk:${MOGO_BASE_SERVICES_APK_VERSION}",
|
||||
// loglib
|
||||
mogologlib : "com.mogo.module:module-loglib:${LOGLIB_VERSION}",
|
||||
mogologlib : "com.mogo.module:module-loglib:${LOGLIB_VERSION}",
|
||||
// monitor
|
||||
mogomonitor : "com.mogo.module:module-monitor:${MOGO_MODULE_MONITOR_VERSION}",
|
||||
mogomonitor : "com.mogo.module:module-monitor:${MOGO_MODULE_MONITOR_VERSION}",
|
||||
|
||||
// google
|
||||
googlezxing : "com.google.zxing:core:3.3.3",
|
||||
litezxing : "com.google.zxing:litezxing:1.0.29.8",
|
||||
googlezxing : "com.google.zxing:core:3.3.3",
|
||||
litezxing : "com.google.zxing:litezxing:1.0.29.8",
|
||||
|
||||
// android - room
|
||||
androidxroomruntime : "androidx.room:room-runtime:2.2.3",
|
||||
androidxroomcompiler : "androidx.room:room-compiler:2.2.3",
|
||||
androidxroomktx : "androidx.room:room-ktx:2.2.3",
|
||||
androidxroomruntime : "androidx.room:room-runtime:2.2.3",
|
||||
androidxroomcompiler : "androidx.room:room-compiler:2.2.3",
|
||||
androidxroomktx : "androidx.room:room-ktx:2.2.3",
|
||||
|
||||
//
|
||||
mogomodulewidgets : "com.mogo.module:module-widgets:${MOGO_MODULE_WIDGETS_VERSION}",
|
||||
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:crashreport:${CRASHREPORT_VERSION}",
|
||||
crashreportbugly : "com.mogo.test:crashreport-bugly:${CRASHREPORT_BUGLY_VERSION}",
|
||||
crashreportnoop : "com.mogo.test:crashreport-noop:${CRASHREPORT_NOOP_VERSION}",
|
||||
|
||||
|
||||
skinsupportbase : "com.mogo.skin:skin-support-base:${SKIN_SUPPORT_VERSION}",
|
||||
skinsupportappcompat : "com.mogo.skin:skin-support-appcompat:${SKIN_SUPPORT_APPCOMPAT_VERSION}",
|
||||
skinsupportcardview : "com.mogo.skin:skin-support-cardview:${SKIN_SUPPORT_CARDVIEW_VERSION}",
|
||||
skinsupportconstraintlayout: "com.mogo.skin:skin-support-constraint-layout:${SKIN_SUPPORT_CONSTRAINT_LAYOUT_VERSION}",
|
||||
skinsupportdesign : "com.mogo.skin:skin-support-design:${SKIN_SUPPORT_DESIGN_VERSION}",
|
||||
|
||||
ttsbase : "com.mogo.tts:tts-base:${TTS_BASE_VERSION}",
|
||||
ttsdi : "com.mogo.tts:tts-di:${TTS_DI_VERSION}",
|
||||
ttszhi : "com.mogo.tts:tts-zhi:${TTS_ZHI_VERSION}",
|
||||
ttsnoop : "com.mogo.tts:tts-noop:${TTS_NOOP_VERSION}",
|
||||
]
|
||||
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import com.mogo.service.passport.IMogoPassportManager;
|
||||
import com.mogo.service.passport.IMogoTicketCallback;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.account.sdk.AccountClientManager;
|
||||
import com.zhidao.account.sdk.BusinessType;
|
||||
import com.zhidao.account.sdk.Environment;
|
||||
import com.zhidao.account.sdk.callback.TicketInfoCallback;
|
||||
import com.zhidao.account.sdk.network.NetEnvironManager;
|
||||
@@ -61,7 +62,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 );
|
||||
}
|
||||
@@ -70,16 +71,12 @@ class PassportManager implements IMogoPassportManager {
|
||||
}
|
||||
|
||||
private static void getTicket( TicketInfoCallback callback ) {
|
||||
if ( DebugConfig.isLauncher() ) {
|
||||
AccountClientManager.getTicket( callback );
|
||||
} else {
|
||||
AccountClientManager.getAppTicket( callback );
|
||||
}
|
||||
AccountClientManager.getTicket( callback );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
AccountClientManager.init( context.getApplicationContext(), getNetEnvironment(), NetEnvironManager.OS_2C, "os2.0-launcher" );
|
||||
AccountClientManager.init( context.getApplicationContext(), getNetEnvironment(), BusinessType.toc_login, "os2.0-launcher" );
|
||||
}
|
||||
|
||||
private Environment getNetEnvironment() {
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -36,8 +36,6 @@ android {
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
api rootProject.ext.dependencies.aiassist
|
||||
api rootProject.ext.dependencies.aiassistReplace
|
||||
api rootProject.ext.dependencies.androidxappcompat
|
||||
api rootProject.ext.dependencies.analytics
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
@@ -46,12 +44,14 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.accountsdk
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
api rootProject.ext.dependencies.ttsbase
|
||||
implementation rootProject.ext.dependencies.skinsupport
|
||||
} else {
|
||||
implementation project(":foudations:mogo-utils")
|
||||
api project(":tts:tts-base")
|
||||
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;
|
||||
import com.mogo.utils.storage.SharedPrefsMgr;
|
||||
@@ -54,7 +57,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() {
|
||||
@@ -69,13 +78,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;
|
||||
} ) );
|
||||
DebugConfig.setUseCustomMap( SharedPrefsMgr.getInstance( this ).getBoolean( "useCustomMap", false ) );
|
||||
|
||||
@@ -0,0 +1,20 @@
|
||||
package com.mogo.commons.context;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
public class ContextHolderUtil {
|
||||
|
||||
private static Context mContext;
|
||||
|
||||
public static void holdContext(Context context) {
|
||||
mContext = context;
|
||||
}
|
||||
|
||||
public static void releaseContext() {
|
||||
mContext = null;
|
||||
}
|
||||
|
||||
public static Context getContext(){
|
||||
return mContext;
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ public class DebugConfig {
|
||||
*
|
||||
* @param sDebug true - 调试模式 false - 非调试模式
|
||||
*/
|
||||
public static void setDebug( boolean sDebug ) {
|
||||
public static void setDebug(boolean sDebug) {
|
||||
DebugConfig.sDebug = sDebug;
|
||||
}
|
||||
|
||||
@@ -83,6 +83,15 @@ public class DebugConfig {
|
||||
|
||||
private static int sCarMachineType = CAR_MACHINE_TYPE_SELF_INNOVATE;
|
||||
|
||||
/**
|
||||
* 西迪obu
|
||||
*/
|
||||
public static final int OBU_TYPE_CIDI = 1;
|
||||
/**
|
||||
* 华砺智行obu
|
||||
*/
|
||||
public static final int OBU_TYPE_HUALI = 2;
|
||||
|
||||
/**
|
||||
* 获取网络环境类型
|
||||
*
|
||||
@@ -102,7 +111,7 @@ public class DebugConfig {
|
||||
* {@link #NET_MODE_DEMO}
|
||||
* {@link #NET_MODE_RELEASE}
|
||||
*/
|
||||
public static void setNetMode( int netMode ) {
|
||||
public static void setNetMode(int netMode) {
|
||||
DebugConfig.sNetMode = netMode;
|
||||
}
|
||||
|
||||
@@ -115,7 +124,7 @@ public class DebugConfig {
|
||||
return sLaunchLocationService;
|
||||
}
|
||||
|
||||
public static void setLaunchLocationService( boolean launchLocationService ) {
|
||||
public static void setLaunchLocationService(boolean launchLocationService) {
|
||||
DebugConfig.sLaunchLocationService = launchLocationService;
|
||||
}
|
||||
|
||||
@@ -128,33 +137,16 @@ public class DebugConfig {
|
||||
return sUseCustomNavi;
|
||||
}
|
||||
|
||||
public static void setUseCustomNavi( boolean sUseCustomNavi ) {
|
||||
public static void setUseCustomNavi(boolean sUseCustomNavi) {
|
||||
DebugConfig.sUseCustomNavi = sUseCustomNavi;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置使用哪个语音助手
|
||||
*
|
||||
* @param aiType {@link #AI_TYPE_NOOP} {@link #AI_TYPE_TXZ} {@link #AI_TYPE_SPEECH}
|
||||
*/
|
||||
public static void setAIType( int aiType ) {
|
||||
Logger.d( "DebugConfig", "setAiType: " + aiType );
|
||||
sAIType = aiType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用哪个语音助手 {@link #AI_TYPE_NOOP} {@link #AI_TYPE_TXZ} {@link #AI_TYPE_SPEECH}
|
||||
*/
|
||||
public static int getAIType() {
|
||||
return sAIType;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置当前车机类型
|
||||
*
|
||||
* @param type {@link #CAR_MACHINE_TYPE_SELF_INNOVATE} {@link #CAR_MACHINE_TYPE_BYD}
|
||||
*/
|
||||
public static void setCarMachineType( int type ) {
|
||||
public static void setCarMachineType(int type) {
|
||||
sCarMachineType = type;
|
||||
}
|
||||
|
||||
@@ -176,7 +168,7 @@ public class DebugConfig {
|
||||
return sIsLauncher;
|
||||
}
|
||||
|
||||
public static void setLauncher( boolean isLauncher ) {
|
||||
public static void setLauncher(boolean isLauncher) {
|
||||
DebugConfig.sIsLauncher = isLauncher;
|
||||
}
|
||||
|
||||
@@ -186,7 +178,7 @@ public class DebugConfig {
|
||||
return sRequestOnlineCarData;
|
||||
}
|
||||
|
||||
public static void setRequestOnlineCarData( boolean sRequestOnlineCarData ) {
|
||||
public static void setRequestOnlineCarData(boolean sRequestOnlineCarData) {
|
||||
DebugConfig.sRequestOnlineCarData = sRequestOnlineCarData;
|
||||
}
|
||||
|
||||
@@ -208,13 +200,13 @@ public class DebugConfig {
|
||||
return sActiveAIAssistFlag;
|
||||
}
|
||||
|
||||
public static void setActiveAIAssistFlag( boolean sActiveAIAssistFlag ) {
|
||||
public static void setActiveAIAssistFlag(boolean sActiveAIAssistFlag) {
|
||||
DebugConfig.sActiveAIAssistFlag = sActiveAIAssistFlag;
|
||||
}
|
||||
|
||||
private static boolean useMockObuData;
|
||||
|
||||
public static void setUseMockObuData( boolean use ) {
|
||||
public static void setUseMockObuData(boolean use) {
|
||||
useMockObuData = use;
|
||||
}
|
||||
|
||||
@@ -233,13 +225,13 @@ public class DebugConfig {
|
||||
*
|
||||
* @param sProductFlavor
|
||||
*/
|
||||
public static void setProductFlavor( String sProductFlavor ) {
|
||||
public static void setProductFlavor(String sProductFlavor) {
|
||||
DebugConfig.sProductFlavor = sProductFlavor;
|
||||
}
|
||||
|
||||
private static String sSocketAppId;
|
||||
|
||||
public static void setSocketAppId( String sSocketAppId ) {
|
||||
public static void setSocketAppId(String sSocketAppId) {
|
||||
DebugConfig.sSocketAppId = sSocketAppId;
|
||||
}
|
||||
|
||||
@@ -256,7 +248,83 @@ public class DebugConfig {
|
||||
return sRoadEventAnimated;
|
||||
}
|
||||
|
||||
public static void setRoadEventAnimated( boolean sRoadEventAnimated ) {
|
||||
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;
|
||||
}
|
||||
|
||||
private static boolean isSkinSupported = false;
|
||||
|
||||
public static void setSkinSupported(boolean isSkinSupported) {
|
||||
DebugConfig.isSkinSupported = isSkinSupported;
|
||||
}
|
||||
|
||||
public static boolean isSkinSupported() {
|
||||
return isSkinSupported;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否支持支持查询导航目的地车友信息
|
||||
*/
|
||||
private static boolean isSupportedSearchDestinationOnlineCarList = false;
|
||||
|
||||
public static void setSupportedSearchDestinationOnlineCarList( boolean isSupportedSearchDestinationOnlineCarList ) {
|
||||
DebugConfig.isSupportedSearchDestinationOnlineCarList = isSupportedSearchDestinationOnlineCarList;
|
||||
}
|
||||
|
||||
public static boolean isSupportedSearchDestinationOnlineCarList() {
|
||||
return isSupportedSearchDestinationOnlineCarList;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否支持目的地导航推送策略
|
||||
*/
|
||||
private static boolean isScheduleCalculateNotHomeCompanyDistanceForPush = false;
|
||||
|
||||
public static void setScheduleCalculateNotHomeCompanyDistanceForPush( boolean isScheduleCalculateNotHomeCompanyDistanceForPush ) {
|
||||
DebugConfig.isScheduleCalculateNotHomeCompanyDistanceForPush = isScheduleCalculateNotHomeCompanyDistanceForPush;
|
||||
}
|
||||
|
||||
public static boolean isIsScheduleCalculateNotHomeCompanyDistanceForPush() {
|
||||
return isScheduleCalculateNotHomeCompanyDistanceForPush;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否支持刷新桌面卡片
|
||||
*/
|
||||
private static boolean isSupportLauncherCardRefreshStrategy = false;
|
||||
|
||||
public static void setSupportLauncherCardRefreshStrategy( boolean isSupportLauncherCardRefreshStrategy ) {
|
||||
DebugConfig.isSupportLauncherCardRefreshStrategy = isSupportLauncherCardRefreshStrategy;
|
||||
}
|
||||
|
||||
public static boolean isIsSupportLauncherCardRefreshStrategy() {
|
||||
return isSupportLauncherCardRefreshStrategy;
|
||||
}
|
||||
|
||||
private static int obuType = OBU_TYPE_HUALI;
|
||||
|
||||
public static int getObuType() {
|
||||
return obuType;
|
||||
}
|
||||
|
||||
public static void setObuType(int type) {
|
||||
obuType = type;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -47,7 +47,6 @@ public abstract class MvpFragment<V extends IView, P extends Presenter<V>> exten
|
||||
@Override
|
||||
public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
|
||||
super.onViewCreated(view, savedInstanceState);
|
||||
initViews(savedInstanceState);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -61,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);
|
||||
}
|
||||
@@ -89,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);
|
||||
|
||||
@@ -14,7 +14,6 @@ import com.mogo.utils.DeviceIdUtils;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.zhidao.auto.platform.util.DeviceUtil;
|
||||
|
||||
import java.io.UnsupportedEncodingException;
|
||||
import java.net.URLEncoder;
|
||||
@@ -37,7 +36,7 @@ public class ParamsUtil {
|
||||
params.put( ServerParam.NET_TYPE, CommonUtils.getNetworkType( AbsMogoApplication.getApp() ) );
|
||||
params.put( ServerParam.CELL_ID, Utils.getCellId( AbsMogoApplication.getApp() ) );
|
||||
|
||||
params.put( ServerParam.DISPLAY_ID, DeviceUtil.getSystemVersion() );
|
||||
// params.put( ServerParam.DISPLAY_ID, DeviceUtil.getSystemVersion() );
|
||||
params.put( ServerParam.SN, Utils.getSn() );
|
||||
params.put( ServerParam.TICKET, SpStorage.getTicket() );
|
||||
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -18,4 +18,12 @@ public class SpStorage {
|
||||
public static void setTicket( String ticket ) {
|
||||
SharedPrefsMgr.getInstance( AbsMogoApplication.getApp() ).putString( "ticket", ticket );
|
||||
}
|
||||
|
||||
public static String getNavigationTarget(){
|
||||
return SharedPrefsMgr.getInstance( AbsMogoApplication.getApp() ).getString( "naviTarget" );
|
||||
}
|
||||
|
||||
public static void setNavigationTarget( String naviTarget ) {
|
||||
SharedPrefsMgr.getInstance( AbsMogoApplication.getApp() ).putString( "naviTarget", naviTarget );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,25 +1,11 @@
|
||||
package com.mogo.commons.voice;
|
||||
|
||||
import android.app.ActivityManager;
|
||||
import android.content.Context;
|
||||
import android.content.Intent;
|
||||
import android.content.pm.ApplicationInfo;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.auto.platform.voice.VoiceClient;
|
||||
import com.zhidao.voicesdk.MogoVoiceManager;
|
||||
import com.zhidao.voicesdk.MogoVoiceManagerImpl;
|
||||
import com.zhidao.voicesdk.callback.OnConnStatusListener;
|
||||
import com.zhidao.voicesdk.callback.OnTtsListener;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.tts.base.IMogoTTS;
|
||||
import com.mogo.tts.base.MogoTTSConstants;
|
||||
import com.mogo.tts.base.PreemptType;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -27,14 +13,11 @@ import java.util.concurrent.ConcurrentHashMap;
|
||||
* <p>
|
||||
* 语音助手通信助手
|
||||
*/
|
||||
public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
public class AIAssist {
|
||||
|
||||
private static final String TAG = "AIAssist";
|
||||
private static volatile AIAssist sInstance;
|
||||
private String mLastQAndASpeakText;
|
||||
|
||||
private boolean mHasFlush = false;
|
||||
private boolean mInitReady = false;
|
||||
private IMogoTTS mTTS;
|
||||
|
||||
public static AIAssist getInstance( Context context ) {
|
||||
if ( sInstance == null ) {
|
||||
@@ -48,61 +31,15 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
Logger.d( TAG, "release" );
|
||||
if ( mCmdMap != null && !mCmdMap.isEmpty() && mVoiceClient != null ) {
|
||||
for ( String cmd : mCmdMap.keySet() ) {
|
||||
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
|
||||
}
|
||||
if ( mTTS != null ) {
|
||||
mTTS.release();
|
||||
}
|
||||
mQAndAMap.clear();
|
||||
mVoiceClient.release();
|
||||
mSpeakVoiceMap.clear();
|
||||
mCacheUnWakeupCommands.clear();
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private final VoiceClient mVoiceClient;
|
||||
private MogoVoiceManager mogoVoiceManager;
|
||||
// 免唤醒指令
|
||||
private Map< String, List< IMogoVoiceCmdCallBack > > mCmdMap = new HashMap<>();
|
||||
// 问答指令
|
||||
private Map< String, IMogoVoiceCmdCallBack > mQAndAMap = new HashMap<>();
|
||||
// 单独的语音播放
|
||||
private Map< String, IMogoVoiceCmdCallBack > mSpeakVoiceMap = new HashMap<>();
|
||||
|
||||
private Map< String, String[] > mCacheUnWakeupCommands = new ConcurrentHashMap<>();
|
||||
|
||||
private AIAssist( Context context ) {
|
||||
// private constructor
|
||||
mVoiceClient = new VoiceClient( context.getApplicationContext() );
|
||||
mVoiceClient.setCallBack( this );
|
||||
initFlushStatus( context );
|
||||
initSpeech( context );
|
||||
Logger.w( TAG, "voice is ready = %s", mHasFlush );
|
||||
}
|
||||
|
||||
private void initFlushStatus( Context context ) {
|
||||
if ( !mHasFlush ) {
|
||||
mHasFlush = isVoiceServiceReady( context );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 初始化
|
||||
*/
|
||||
private void initSpeech( Context context ) {
|
||||
mogoVoiceManager = MogoVoiceManagerImpl.getInstance();
|
||||
mogoVoiceManager.init( context, new OnConnStatusListener() {
|
||||
@Override
|
||||
public void onSuccess() {
|
||||
mInitReady = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailed() {
|
||||
|
||||
}
|
||||
} );
|
||||
mTTS = ( IMogoTTS ) ARouter.getInstance().build( MogoTTSConstants.API_PATH ).navigation( context.getApplicationContext() );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,83 +48,10 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @return
|
||||
*/
|
||||
public boolean hasFlush() {
|
||||
return mHasFlush;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdSelected( String cmd ) {
|
||||
if ( !mCmdMap.containsKey( cmd ) ) {
|
||||
return;
|
||||
}
|
||||
Logger.d( TAG, "received command: %s", cmd );
|
||||
|
||||
Iterator< IMogoVoiceCmdCallBack > iterator = null;
|
||||
try {
|
||||
List< IMogoVoiceCmdCallBack > cmdCallBacks = mCmdMap.get( cmd );
|
||||
iterator = new ArrayList<>( cmdCallBacks ).iterator();
|
||||
} catch ( Exception e ) {
|
||||
|
||||
}
|
||||
while ( iterator != null && iterator.hasNext() ) {
|
||||
IMogoVoiceCmdCallBack callBack = iterator.next();
|
||||
if ( callBack != null ) {
|
||||
callBack.onCmdSelected( cmd );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdAction( String speakText ) {
|
||||
if ( !TextUtils.isEmpty( mLastQAndASpeakText ) ) {
|
||||
IMogoVoiceCmdCallBack cmdCallBack = mQAndAMap.remove( mLastQAndASpeakText );
|
||||
if ( cmdCallBack != null ) {
|
||||
cmdCallBack.onCmdAction( speakText );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdCancel( String speakText ) {
|
||||
if ( !TextUtils.isEmpty( mLastQAndASpeakText ) ) {
|
||||
IMogoVoiceCmdCallBack cmdCallBack = mQAndAMap.remove( mLastQAndASpeakText );
|
||||
if ( cmdCallBack != null ) {
|
||||
cmdCallBack.onCmdCancel( speakText );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpeakEnd( String speakText ) {
|
||||
if ( mQAndAMap.containsKey( speakText ) ) {
|
||||
mLastQAndASpeakText = speakText;
|
||||
IMogoVoiceCmdCallBack cmdCallBack = mQAndAMap.get( speakText );
|
||||
if ( cmdCallBack != null ) {
|
||||
cmdCallBack.onSpeakEnd( speakText );
|
||||
return;
|
||||
}
|
||||
}
|
||||
IMogoVoiceCmdCallBack callBack = mSpeakVoiceMap.remove( speakText );
|
||||
if ( callBack != null ) {
|
||||
callBack.onSpeakEnd( speakText );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpeakSelectTimeOut( String speakText ) {
|
||||
if ( mQAndAMap.containsKey( speakText ) ) {
|
||||
if ( TextUtils.equals( speakText, mLastQAndASpeakText ) ) {
|
||||
mLastQAndASpeakText = null;
|
||||
}
|
||||
IMogoVoiceCmdCallBack cmdCallBack = mQAndAMap.remove( speakText );
|
||||
if ( cmdCallBack != null ) {
|
||||
cmdCallBack.onSpeakSelectTimeOut( speakText );
|
||||
return;
|
||||
}
|
||||
}
|
||||
IMogoVoiceCmdCallBack callBack = mSpeakVoiceMap.remove( speakText );
|
||||
if ( callBack != null ) {
|
||||
callBack.onSpeakSelectTimeOut( speakText );
|
||||
if ( mTTS != null ) {
|
||||
return mTTS.hasFlush();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -196,13 +60,8 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param text
|
||||
*/
|
||||
public void speakTTSVoice( String text, IMogoVoiceCmdCallBack callBack ) {
|
||||
try {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mSpeakVoiceMap.put( text, callBack );
|
||||
mVoiceClient.speakDefault( text );
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
if ( mTTS != null ) {
|
||||
mTTS.speakTTSVoice( text, callBack );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -212,12 +71,8 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param text
|
||||
*/
|
||||
public void speakTTSVoice( String text ) {
|
||||
try {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mVoiceClient.speakDefault( text );
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
if ( mTTS != null ) {
|
||||
mTTS.speakTTSVoice( text );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -228,13 +83,25 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param type 播报策略
|
||||
*/
|
||||
public void speakTTSVoice( String text, VoicePreemptType type, IMogoVoiceCmdCallBack callBack ) {
|
||||
try {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mSpeakVoiceMap.put( text, callBack );
|
||||
mVoiceClient.speakTypeText( text, type.getPreemptType() );
|
||||
if ( mTTS != null ) {
|
||||
PreemptType preemptType = PreemptType.PREEMPT_TYPE_NONE;
|
||||
if ( type != null ) {
|
||||
switch ( type ) {
|
||||
case PREEMPT_TYPE_FLUSH:
|
||||
preemptType = PreemptType.PREEMPT_TYPE_FLUSH;
|
||||
break;
|
||||
case PREEMPT_TYPE_NEXT:
|
||||
preemptType = PreemptType.PREEMPT_TYPE_NEXT;
|
||||
break;
|
||||
case PREEMPT_TYPE_IMMEADIATELY:
|
||||
preemptType = PreemptType.PREEMPT_TYPE_IMMEDIATELY;
|
||||
break;
|
||||
case PREEMPT_TYPE_IMMEADIATELY_WITHOUT_CANCLE:
|
||||
preemptType = PreemptType.PREEMPT_TYPE_IMMEDIATELY_WITHOUT_CANCEL;
|
||||
break;
|
||||
}
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
mTTS.speakTTSVoice( text, preemptType, callBack );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -244,10 +111,8 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param tts 播报内容
|
||||
*/
|
||||
public void speakQAndACmd( String tts, IMogoVoiceCmdCallBack callBack ) {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mQAndAMap.put( tts, callBack );
|
||||
mVoiceClient.speakTtsAndRegistCmd( tts );
|
||||
if ( mTTS != null ) {
|
||||
mTTS.speakQAndACmd( tts, callBack );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -259,10 +124,8 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param cancelCmds 取消命令唤醒词
|
||||
*/
|
||||
public void speakQAndACmd( String tts, String[] okCmds, String[] cancelCmds, IMogoVoiceCmdCallBack callBack ) {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mQAndAMap.put( tts, callBack );
|
||||
mVoiceClient.speakTtsAndRegistCmd( tts, okCmds, cancelCmds );
|
||||
if ( mTTS != null ) {
|
||||
mTTS.speakQAndACmd( tts, okCmds, cancelCmds, callBack );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -274,47 +137,9 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param callBack
|
||||
*/
|
||||
public void registerUnWakeupCommand( String cmd, String[] cmdWords, IMogoVoiceCmdCallBack callBack ) {
|
||||
if ( !mCmdMap.containsKey( cmd ) ) {
|
||||
mCmdMap.put( cmd, new ArrayList<>() );
|
||||
if ( mTTS != null ) {
|
||||
mTTS.registerUnWakeupCommand( cmd, cmdWords, callBack );
|
||||
}
|
||||
mCmdMap.get( cmd ).add( callBack );
|
||||
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mVoiceClient.registerCustomWakeupCmd( cmd, cmdWords );
|
||||
mCacheUnWakeupCommands.remove( cmd );
|
||||
}
|
||||
Logger.i( TAG, "cache un wakeup command2. %s", cmd );
|
||||
mCacheUnWakeupCommands.put( cmd, cmdWords );
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册免唤醒命令
|
||||
*
|
||||
* @param cmd
|
||||
* @param cmdWords
|
||||
*/
|
||||
public void registerUnWakeupCommand( String cmd, String[] cmdWords ) {
|
||||
initFlushStatus( AbsMogoApplication.getApp() );
|
||||
if ( mHasFlush ) {
|
||||
mVoiceClient.registerCustomWakeupCmd( cmd, cmdWords );
|
||||
mCacheUnWakeupCommands.remove( cmd );
|
||||
}
|
||||
Logger.i( TAG, "cache un wakeup command. %s", cmd );
|
||||
mCacheUnWakeupCommands.put( cmd, cmdWords );
|
||||
}
|
||||
|
||||
/**
|
||||
* 注册免唤醒命令回调
|
||||
*
|
||||
* @param cmd
|
||||
* @param callBack
|
||||
*/
|
||||
public synchronized void registerUnWakeupCommandCallback( String cmd, IMogoVoiceCmdCallBack callBack ) {
|
||||
if ( !mCmdMap.containsKey( cmd ) ) {
|
||||
mCmdMap.put( cmd, new ArrayList<>() );
|
||||
}
|
||||
mCmdMap.get( cmd ).add( callBack );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -323,9 +148,9 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param cmd
|
||||
*/
|
||||
public synchronized void unregisterUnWakeupCommand( String cmd ) {
|
||||
mCmdMap.remove( cmd );
|
||||
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
|
||||
mCacheUnWakeupCommands.remove( cmd );
|
||||
if ( mTTS != null ) {
|
||||
mTTS.unregisterUnWakeupCommand( cmd );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -334,20 +159,12 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param cmd
|
||||
*/
|
||||
public synchronized void unregisterUnWakeupCommand( String cmd, IMogoVoiceCmdCallBack callBack ) {
|
||||
if ( mCmdMap.containsKey( cmd ) ) {
|
||||
List< IMogoVoiceCmdCallBack > callBacks = mCmdMap.get( cmd );
|
||||
if ( callBacks != null ) {
|
||||
callBacks.remove( callBack );
|
||||
}
|
||||
if ( callBacks.isEmpty() ) {
|
||||
mCmdMap.remove( cmd );
|
||||
mVoiceClient.unRegisterCustomWakeupCmd( cmd );
|
||||
mCacheUnWakeupCommands.remove( cmd );
|
||||
}
|
||||
if ( mTTS != null ) {
|
||||
mTTS.unregisterUnWakeupCommand( cmd, callBack );
|
||||
}
|
||||
}
|
||||
|
||||
public static void startAssistant( Context context ) {
|
||||
public void startAssistant( Context context ) {
|
||||
startAssistant( context, 1 );
|
||||
}
|
||||
|
||||
@@ -355,160 +172,49 @@ public class AIAssist implements VoiceClient.VoiceCmdCallBack, OnTtsListener {
|
||||
* @param context
|
||||
* @param status window_start_cancel 0 - 结束, 1 - 显示, 2 - 未激活调试进入
|
||||
*/
|
||||
public static void startAssistant( Context context, int status ) {
|
||||
final Intent intent = new Intent();
|
||||
intent.setFlags( Intent.FLAG_INCLUDE_STOPPED_PACKAGES );
|
||||
intent.setAction( "pvetec.intent.action.txz.switch" );
|
||||
intent.putExtra( "window_start_cancel", status );
|
||||
intent.putExtra( "extra_switch_type", "window_start_cancel" );
|
||||
Logger.d( TAG, "status = %d", status );
|
||||
context.sendBroadcast( intent );
|
||||
public void startAssistant( Context context, int status ) {
|
||||
if ( mTTS != null ) {
|
||||
mTTS.startAIAssist( context, status );
|
||||
}
|
||||
}
|
||||
|
||||
public synchronized void flush() {
|
||||
if ( mCacheUnWakeupCommands.isEmpty() ) {
|
||||
return;
|
||||
if ( mTTS != null ) {
|
||||
mTTS.flush();
|
||||
}
|
||||
mHasFlush = true;
|
||||
Logger.d( TAG, "flush cache voice command when voice service ready." );
|
||||
final Map< String, String[] > tmp = new HashMap<>( mCacheUnWakeupCommands );
|
||||
for ( String cmd : tmp.keySet() ) {
|
||||
registerUnWakeupCommand( cmd, tmp.get( cmd ) );
|
||||
}
|
||||
}
|
||||
|
||||
private boolean isVoiceServiceReady( Context context ) {
|
||||
if ( isProcessRunning( context, getPackageUid( context, "com.zhidao.speech" ) )
|
||||
&& isProcessRunning( context, getPackageUid( context, "com.zhidao.speech.adapter" ) ) ) {
|
||||
return true;
|
||||
} else if (isProcessRunning(context, getPackageUid(context, "com.txznet.txz")) && isProcessRunning(context, getPackageUid(context, "com.txznet.adapter"))) {
|
||||
Logger.d(TAG, "txz is voiceServiceReady");
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
// private boolean isRunningTaskExist( Context context, String processName ) {
|
||||
//// ActivityManager am = ( ActivityManager ) context.getSystemService( Context.ACTIVITY_SERVICE );
|
||||
//// List< ActivityManager.RunningAppProcessInfo > processList = am.getRunningAppProcesses();
|
||||
//// for ( ActivityManager.RunningAppProcessInfo info : processList ) {
|
||||
//// if ( info.processName.equals( processName ) ) {
|
||||
//// return true;
|
||||
//// }
|
||||
//// }
|
||||
//// return false;
|
||||
//// }
|
||||
|
||||
/**
|
||||
* 方法描述:判断某一应用是否正在运行
|
||||
* Created by cafeting on 2017/2/4.
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param packageName 应用的包名
|
||||
* @return true 表示正在运行,false 表示没有运行
|
||||
*/
|
||||
public static boolean isAppRunning( Context context, String packageName ) {
|
||||
ActivityManager am = ( ActivityManager ) context.getSystemService( Context.ACTIVITY_SERVICE );
|
||||
List< ActivityManager.RunningTaskInfo > list = am.getRunningTasks( 100 );
|
||||
if ( list.size() <= 0 ) {
|
||||
return false;
|
||||
}
|
||||
for ( ActivityManager.RunningTaskInfo info : list ) {
|
||||
if ( info.baseActivity.getPackageName().equals( packageName ) ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
//获取已安装应用的 uid,-1 表示未安装此应用或程序异常
|
||||
public static int getPackageUid( Context context, String packageName ) {
|
||||
try {
|
||||
ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo( packageName, 0 );
|
||||
if ( applicationInfo != null ) {
|
||||
return applicationInfo.uid;
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断某一 uid 的程序是否有正在运行的进程,即是否存活
|
||||
* Created by cafeting on 2017/2/4.
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param uid 已安装应用的 uid
|
||||
* @return true 表示正在运行,false 表示没有运行
|
||||
*/
|
||||
public static boolean isProcessRunning( Context context, int uid ) {
|
||||
ActivityManager am = ( ActivityManager ) context.getSystemService( Context.ACTIVITY_SERVICE );
|
||||
List< ActivityManager.RunningServiceInfo > runningServiceInfos = am.getRunningServices( 200 );
|
||||
if ( runningServiceInfos.size() > 0 ) {
|
||||
for ( ActivityManager.RunningServiceInfo appProcess : runningServiceInfos ) {
|
||||
if ( uid == appProcess.uid ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public void speakTTSAndDuck( String text ) {
|
||||
speakTTSAndDuck( text, null );
|
||||
if ( mTTS != null ) {
|
||||
mTTS.speakTTSAndDuck( text );
|
||||
}
|
||||
}
|
||||
|
||||
public void speakTTSAndDuck( String text, IMogoVoiceCmdCallBack callBack ) {
|
||||
try {
|
||||
if ( mInitReady ) {
|
||||
mSpeakVoiceMap.put( text, callBack );
|
||||
mogoVoiceManager.toSpeak( text, -3, this );
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
if ( mTTS != null ) {
|
||||
mTTS.speakTTSAndDuck( text, callBack );
|
||||
}
|
||||
}
|
||||
|
||||
public void shutUp( String ttsId, String text ) {
|
||||
try {
|
||||
mSpeakVoiceMap.remove( text );
|
||||
mogoVoiceManager.shutUp( ttsId );
|
||||
} catch ( Exception e ) {
|
||||
if ( mTTS != null ) {
|
||||
mTTS.shutUp( ttsId, text );
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 打断上一条正在播报的语音内容,仅在Speech上生效,TXZ为空实现
|
||||
* 语音SDK生效版本从1.0.8.4版本起
|
||||
*/
|
||||
public void breakOffSpeak() {
|
||||
if ( mTTS != null ) {
|
||||
mTTS.breakOffSpeak();
|
||||
}
|
||||
}
|
||||
|
||||
public void clearTTSCallback( String text ) {
|
||||
try {
|
||||
mSpeakVoiceMap.remove( text );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
if ( mTTS != null ) {
|
||||
mTTS.clearTTSCallback( text );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTtsStart( String ttsId, String text ) {
|
||||
IMogoVoiceCmdCallBack callBack = mSpeakVoiceMap.get( text );
|
||||
if ( callBack != null ) {
|
||||
callBack.onTTSStart( ttsId, text );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTtsFinish( String ttsId, String text ) {
|
||||
IMogoVoiceCmdCallBack callBack = mSpeakVoiceMap.remove( text );
|
||||
if ( callBack != null ) {
|
||||
callBack.onTTSEnd( ttsId, text );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTtsError( String ttsId, String text ) {
|
||||
IMogoVoiceCmdCallBack callBack = mSpeakVoiceMap.remove( text );
|
||||
if ( callBack != null ) {
|
||||
callBack.onTTSError( ttsId, text );
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,66 +1,7 @@
|
||||
package com.mogo.commons.voice;
|
||||
|
||||
public interface IMogoVoiceCmdCallBack {
|
||||
import com.mogo.tts.base.IMogoTTSCallback;
|
||||
|
||||
/**
|
||||
* 新SDK接口
|
||||
*
|
||||
* @param ttsId
|
||||
* @param tts
|
||||
*/
|
||||
default void onTTSStart( String ttsId, String tts ) {
|
||||
}
|
||||
public interface IMogoVoiceCmdCallBack extends IMogoTTSCallback {
|
||||
|
||||
/**
|
||||
* 新SDK接口
|
||||
*
|
||||
* @param ttsId
|
||||
* @param tts
|
||||
*/
|
||||
default void onTTSEnd( String ttsId, String tts ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 新SDK接口
|
||||
*
|
||||
* @param ttsId
|
||||
* @param tts
|
||||
*/
|
||||
default void onTTSError( String ttsId, String tts ) {
|
||||
}
|
||||
|
||||
/**
|
||||
* 免唤醒命令响应回调
|
||||
*
|
||||
* @param cmd
|
||||
*/
|
||||
default void onCmdSelected( String cmd ){}
|
||||
|
||||
/**
|
||||
* 语音播报临时免唤醒“确定”命令
|
||||
*
|
||||
* @param speakText 播报内容
|
||||
*/
|
||||
default void onCmdAction( String speakText ){}
|
||||
|
||||
/**
|
||||
* 语音播报临时免唤醒“取消”命令
|
||||
*
|
||||
* @param speakText 播报内容
|
||||
*/
|
||||
default void onCmdCancel( String speakText ){}
|
||||
|
||||
/**
|
||||
* 语音播报完毕
|
||||
*
|
||||
* @param speakText 播报内容
|
||||
*/
|
||||
default void onSpeakEnd( String speakText ){}
|
||||
|
||||
/**
|
||||
* 语音播报完临时命令选择超时
|
||||
*
|
||||
* @param speakText 播报内容
|
||||
*/
|
||||
default void onSpeakSelectTimeOut( String speakText ){}
|
||||
}
|
||||
@@ -1,23 +1,9 @@
|
||||
package com.mogo.commons.voice;
|
||||
|
||||
import com.zhidao.auto.platform.voice.VoiceClient;
|
||||
|
||||
public enum VoicePreemptType {
|
||||
|
||||
|
||||
PREEMPT_TYPE_NONE( VoiceClient.PreemptType.PREEMPT_TYPE_NONE ), //不打断
|
||||
PREEMPT_TYPE_IMMEADIATELY( VoiceClient.PreemptType.PREEMPT_TYPE_IMMEADIATELY ), //立即打断,取消当前的tts插队播放
|
||||
PREEMPT_TYPE_NEXT( VoiceClient.PreemptType.PREEMPT_TYPE_NEXT ), //下一个插入,不取消当前的tts,插队下一个播放
|
||||
PREEMPT_TYPE_FLUSH( VoiceClient.PreemptType.PREEMPT_TYPE_FLUSH ), //清空队列
|
||||
PREEMPT_TYPE_IMMEADIATELY_WITHOUT_CANCLE( VoiceClient.PreemptType.PREEMPT_TYPE_IMMEADIATELY_WITHOUT_CANCLE ); //立即打断,不取消当前tts
|
||||
|
||||
public VoiceClient.PreemptType preemptType;
|
||||
|
||||
VoicePreemptType( VoiceClient.PreemptType preemptType ) {
|
||||
this.preemptType = preemptType;
|
||||
}
|
||||
|
||||
public VoiceClient.PreemptType getPreemptType() {
|
||||
return preemptType;
|
||||
}
|
||||
PREEMPT_TYPE_NONE, //不打断
|
||||
PREEMPT_TYPE_IMMEADIATELY, //立即打断,取消当前的tts插队播放
|
||||
PREEMPT_TYPE_NEXT, //下一个插入,不取消当前的tts,插队下一个播放
|
||||
PREEMPT_TYPE_FLUSH, //清空队列
|
||||
PREEMPT_TYPE_IMMEADIATELY_WITHOUT_CANCLE; //立即打断,不取消当前tts
|
||||
}
|
||||
@@ -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>
|
||||
@@ -87,4 +87,38 @@ public class AppUtils {
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
//获取已安装应用的 uid,-1 表示未安装此应用或程序异常
|
||||
public static int getPackageUid( Context context, String packageName ) {
|
||||
try {
|
||||
ApplicationInfo applicationInfo = context.getPackageManager().getApplicationInfo( packageName, 0 );
|
||||
if ( applicationInfo != null ) {
|
||||
return applicationInfo.uid;
|
||||
}
|
||||
} catch ( Exception e ) {
|
||||
return -1;
|
||||
}
|
||||
return -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* 判断某一 uid 的程序是否有正在运行的进程,即是否存活
|
||||
* Created by cafeting on 2017/2/4.
|
||||
*
|
||||
* @param context 上下文
|
||||
* @param uid 已安装应用的 uid
|
||||
* @return true 表示正在运行,false 表示没有运行
|
||||
*/
|
||||
public static boolean isProcessRunning( Context context, int uid ) {
|
||||
ActivityManager am = ( ActivityManager ) context.getSystemService( Context.ACTIVITY_SERVICE );
|
||||
List< ActivityManager.RunningServiceInfo > runningServiceInfos = am.getRunningServices( 200 );
|
||||
if ( runningServiceInfos.size() > 0 ) {
|
||||
for ( ActivityManager.RunningServiceInfo appProcess : runningServiceInfos ) {
|
||||
if ( uid == appProcess.uid ) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
}
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -29,87 +29,90 @@ PASSWORD=xintai2018
|
||||
RELEASE=false
|
||||
# 模块版本
|
||||
## 工程内模块
|
||||
MOGO_COMMONS_VERSION=1.2.1.22
|
||||
MOGO_UTILS_VERSION=1.2.1.22
|
||||
MAP_AMAP_VERSION=1.2.1.22
|
||||
MAP_AUTONAVI_VERSION=1.2.1.22
|
||||
MOGO_MAP_VERSION=1.2.1.22
|
||||
MOGO_MAP_API_VERSION=1.2.1.22
|
||||
MOGO_SERVICE_VERSION=1.2.1.22
|
||||
MOGO_SERVICE_API_VERSION=1.2.1.22
|
||||
MOGO_CONNECTION_VERSION=1.2.1.22
|
||||
MOGO_MODULE_APPS_VERSION=1.2.1.22
|
||||
MOGO_MODULE_NAVI_VERSION=1.2.1.22
|
||||
MOGO_MODULE_SHARE_VERSION=1.2.1.22
|
||||
MOGO_MODULE_COMMON_VERSION=1.2.1.22
|
||||
MOGO_MODULE_MAIN_VERSION=1.2.1.22
|
||||
MOGO_MODULE_MAP_VERSION=1.2.1.22
|
||||
MOGO_MODULE_SERVICE_VERSION=1.2.1.22
|
||||
MOGO_MODULE_EXTENSIONS_VERSION=1.2.1.22
|
||||
MOGO_MODULE_SEARCH_VERSION=1.2.1.22
|
||||
MOGO_MODULE_BACK_VERSION=1.2.1.22
|
||||
MOGO_MODULE_GPS_SIMULATOR_VERSION=1.2.1.22
|
||||
MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION=1.2.1.22
|
||||
MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION=1.2.1.22
|
||||
MOGO_MODULE_AUTHORIZE_VERSION=1.2.1.22
|
||||
MOGO_MODULE_GUIDE_VERSION=1.2.1.22
|
||||
MOGO_MODULE_MEDIA_VERSION=1.2.1.22
|
||||
MOGO_MODULE_MAIN_LAUNCHER_VERSION = 1.2.1.22
|
||||
MOGO_MODULE_MAIN_INDEPENDENT_VERSION = 1.2.1.22
|
||||
MOGO_MODULE_V2X_VERSION=1.2.1.22
|
||||
MOGO_COMMONS_VERSION=2.0.2
|
||||
MOGO_UTILS_VERSION=2.0.0
|
||||
MAP_AMAP_VERSION=2.0.0
|
||||
MAP_AUTONAVI_VERSION=2.0.0
|
||||
MOGO_MAP_VERSION=2.0.0
|
||||
MOGO_MAP_API_VERSION=2.0.0
|
||||
MOGO_SERVICE_VERSION=2.0.0
|
||||
MOGO_SERVICE_API_VERSION=2.0.2
|
||||
MOGO_CONNECTION_VERSION=2.0.0
|
||||
MOGO_MODULE_APPS_VERSION=2.0.0
|
||||
MOGO_MODULE_NAVI_VERSION=2.0.0
|
||||
MOGO_MODULE_SHARE_VERSION=2.0.0
|
||||
MOGO_MODULE_COMMON_VERSION=2.0.0
|
||||
MOGO_MODULE_MAIN_VERSION=2.0.0
|
||||
MOGO_MODULE_MAP_VERSION=2.0.0
|
||||
MOGO_MODULE_SERVICE_VERSION=2.0.0
|
||||
MOGO_MODULE_EXTENSIONS_VERSION=2.0.0
|
||||
MOGO_MODULE_SEARCH_VERSION=2.0.0
|
||||
MOGO_MODULE_BACK_VERSION=2.0.0
|
||||
MOGO_MODULE_GPS_SIMULATOR_VERSION=2.0.0
|
||||
MOGO_MODULE_GPS_SIMULATOR_DEBUG_VERSION=2.0.0
|
||||
MOGO_MODULE_GPS_SIMULATOR_NOOP_VERSION=2.0.0
|
||||
MOGO_MODULE_AUTHORIZE_VERSION=2.0.0
|
||||
MOGO_MODULE_GUIDE_VERSION=2.0.0
|
||||
MOGO_MODULE_MEDIA_VERSION=2.0.0
|
||||
MOGO_MODULE_MAIN_LAUNCHER_VERSION = 2.0.0
|
||||
MOGO_MODULE_MAIN_INDEPENDENT_VERSION = 2.0.0
|
||||
MOGO_MODULE_V2X_VERSION=2.0.0
|
||||
# 基础服务实现:passport、socket、location
|
||||
MOGO_BASE_SERVICES_APK_VERSION = 1.2.1.22
|
||||
MOGO_BASE_SERVICES_SDK_VERSION = 1.2.1.22
|
||||
MAP_CUSTOM_VERSION=1.2.1.9
|
||||
|
||||
MOGO_BASE_SERVICES_APK_VERSION = 2.0.0
|
||||
MOGO_BASE_SERVICES_SDK_VERSION = 2.0.0
|
||||
## 工程外部模块
|
||||
# 探路
|
||||
MOGO_MODULE_TANLU_VERSION=1.3.1.24
|
||||
# 车聊聊
|
||||
CARCHATTING_VERSION=1.5.1
|
||||
# 车聊聊接口
|
||||
CARCHATTINGPROVIDER_VERSION=1.3.4
|
||||
MOGO_MODULE_TANLU_VERSION=2.0.0
|
||||
# 视频引导
|
||||
MOGO_MODULE_GUIDESHOW_VERSION=1.0.2-SNAPSHOT
|
||||
# 视频引导接口
|
||||
|
||||
MOGO_MODULE_GUIDESHOW_PROVIDER_VERSION=1.0.2-SNAPSHOT
|
||||
# 在线车辆F
|
||||
MOGO_MODULE_ONLINECAR_VERSION=1.0.3.2
|
||||
MOGO_MODULE_GUIDESHOW_VERSION=2.0.0
|
||||
# 推送
|
||||
MOGO_MODULE_PUSH_VERSION=1.1.6.2
|
||||
MOGO_MODULE_PUSH_BASE_VERSION=1.1.5.5
|
||||
MOGO_MODULE_PUSH_NOOP_VERSION=1.1.5.6
|
||||
# 广告资源位
|
||||
MOGO_MODULE_AD_CARD_VERSION=1.0.1
|
||||
MOGO_MODULE_PUSH_VERSION=2.0.0
|
||||
MOGO_MODULE_PUSH_BASE_VERSION=2.0.0
|
||||
MOGO_MODULE_PUSH_NOOP_VERSION=2.0.0
|
||||
# 探路上报和分享模块
|
||||
TANLULIB_VERSION=1.3.1.24
|
||||
MOGO_TANLU_API_VERSION = 1.0.0-SNAPSHOT
|
||||
|
||||
MOGO_MODULE_EVENT_PANEL_VERSION = 1.0.0-SNAPSHOT
|
||||
MOGO_MODULE_EVENT_PANEL_NOOP_VERSION = 1.0.0-SNAPSHOT
|
||||
TANLULIB_VERSION=2.0.0
|
||||
MOGO_TANLU_API_VERSION=2.0.0
|
||||
#左侧面板模块
|
||||
MOGO_MODULE_LEFT_PANEL_VERSION = 1.2.1.10-SNAPSHOT
|
||||
MOGO_MODULE_LEFT_PANEL_NOOP_VERSION = 1.2.1.10-SNAPSHOT
|
||||
MOGO_MODULE_LEFT_PANEL_VERSION=2.0.0
|
||||
MOGO_MODULE_LEFT_PANEL_NOOP_VERSION=2.0.0
|
||||
# 小控件
|
||||
MOGO_MODULE_WIDGETS_VERSION = 1.2.1.10-SNAPSHOT
|
||||
|
||||
# Boost分包
|
||||
BOOST_MULTIDEX_VERSION=1.0.0
|
||||
# hook ARouter分包实现
|
||||
HOOKPLUGIN_VERSION=1.0.0
|
||||
|
||||
MOGO_MODULE_WIDGETS_VERSION=2.0.0
|
||||
# obu
|
||||
MOGO_MODULE_OBU_VERSION = 1.2.1.10-SNAPSHOT
|
||||
|
||||
MOGO_MODULE_OBU_VERSION=2.0.0
|
||||
# 皮肤
|
||||
MOGO_SKIN_SUPPORT_VERSION=2.0.0
|
||||
MOGO_SKIN_LIGHT_VERSION=2.0.0
|
||||
MOGO_SKIN_SUPPORT_IMPL_VERSION=2.0.0
|
||||
MOGO_SKIN_SUPPORT_NOOP_VERSION=2.0.0
|
||||
SKIN_SUPPORT_VERSION=2.0.0
|
||||
SKIN_SUPPORT_APPCOMPAT_VERSION=2.0.0
|
||||
SKIN_SUPPORT_CARDVIEW_VERSION=2.0.0
|
||||
SKIN_SUPPORT_CONSTRAINT_LAYOUT_VERSION=2.0.0
|
||||
SKIN_SUPPORT_DESIGN_VERSION=2.0.0
|
||||
# 闪屏页
|
||||
MOGO_MODULE_SPLASH_VERSION = 1.0.0-SNAPSHOT
|
||||
MOGO_MODULE_SPLASH_NOOP_VERSION = 1.0.0-SNAPSHOT
|
||||
MOGO_MODULE_SPLASH_VERSION=2.0.0
|
||||
MOGO_MODULE_SPLASH_NOOP_VERSION=2.0.0
|
||||
# monitor
|
||||
MOGO_MODULE_MONITOR_VERSION=2.0.0
|
||||
# bugly
|
||||
CRASHREPORT_VERSION=2.0.0
|
||||
CRASHREPORT_BUGLY_VERSION=2.0.0
|
||||
CRASHREPORT_NOOP_VERSION=2.0.0
|
||||
## tts
|
||||
TTS_BASE_VERSION=1.0.0
|
||||
TTS_DI_VERSION=1.0.0
|
||||
TTS_ZHI_VERSION=1.0.0
|
||||
TTS_NOOP_VERSION=1.0.0
|
||||
# 自研地图
|
||||
MAP_CUSTOM_VERSION=1.2.1.9
|
||||
|
||||
######## 外部依赖引用
|
||||
# 车聊聊
|
||||
CARCHATTING_VERSION=1.9.7.1
|
||||
# 车聊聊接口
|
||||
CARCHATTINGPROVIDER_VERSION=1.4.1
|
||||
# loglib
|
||||
LOGLIB_VERSION = 1.0.4
|
||||
# monitor
|
||||
MOGO_MODULE_MONITOR_VERSION = 1.0.0-SNAPSHOT
|
||||
|
||||
## 产品库必备配置,产品库自动对versionCode和versionName版本进行升级
|
||||
applicationId=com.mogo.launcer
|
||||
|
||||
@@ -1,14 +1,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.IMogoMapViewCreator;
|
||||
import com.mogo.map.MogoBaseMapView;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -18,8 +14,17 @@ import com.mogo.map.MogoBaseMapView;
|
||||
*/
|
||||
public class AMapBaseMapView implements IMogoMapViewCreator {
|
||||
|
||||
private static final String TAG = "AMapBaseMapView";
|
||||
|
||||
@Override
|
||||
public IMogoMapView create( Context context ) {
|
||||
return new AMapNaviViewWrapper( new AMapNaviView( context ) );
|
||||
IMogoMapView mapView = AMapViewHandler.getMapView();
|
||||
if ( mapView != null
|
||||
&& mapView.getMapView() != null
|
||||
&& mapView.getMapView().getParent() != null ) {
|
||||
ViewGroup group = ( ViewGroup ) mapView.getMapView().getParent();
|
||||
group.removeView( mapView.getMapView() );
|
||||
}
|
||||
return mapView;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -41,6 +41,7 @@ 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.uicontroller.AMapUIController;
|
||||
import com.mogo.map.impl.amap.utils.MogoMapUtils;
|
||||
import com.mogo.map.impl.amap.utils.ObjectUtils;
|
||||
import com.mogo.map.listener.MogoMapListenerHandler;
|
||||
@@ -91,11 +92,16 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
.build();
|
||||
private CarCursorOption mCarCursorOption = DEFAULT_OPTION;
|
||||
|
||||
private BnHooker bnHooker;
|
||||
|
||||
private Location mLastDriveLocationShadow = null;
|
||||
private Marker mMyLocationMarker;
|
||||
|
||||
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() );
|
||||
bnHooker = new BnHooker( mMapView.getMap() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
@@ -185,6 +191,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
aMap.setOnCameraChangeListener( this );
|
||||
aMap.setOnMyLocationChangeListener( this );
|
||||
}
|
||||
AMapMessageManager.getInstance().clear();
|
||||
AMapMessageManager.getInstance().registerAMapMessageListener( this );
|
||||
}
|
||||
|
||||
@@ -233,6 +240,8 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
public void onDestroy() {
|
||||
if ( mMapView != null ) {
|
||||
mMapView.onDestroy();
|
||||
AMapUIController.getInstance().release();
|
||||
AMapWrapper.release();
|
||||
Logger.d( TAG, "map onDestroy" );
|
||||
}
|
||||
}
|
||||
@@ -272,6 +281,16 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
@Override
|
||||
public void onTouch( MotionEvent motionEvent ) {
|
||||
MogoMapListenerHandler.getInstance().onTouch( motionEvent );
|
||||
if ( motionEvent.getAction() == MotionEvent.ACTION_DOWN ) {
|
||||
changeMyLocationType2UnFollow();
|
||||
}
|
||||
if ( motionEvent.getAction() != MotionEvent.ACTION_UP ) {
|
||||
try {
|
||||
bnHooker.clearAllMessages();
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -455,6 +474,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
break;
|
||||
}
|
||||
mMapView.setViewOptions( options );
|
||||
changeMyLocationType2Follow();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,11 +541,17 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
}
|
||||
if ( checkAMapView() ) {
|
||||
MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
|
||||
MyLocationStyle style = getMyLocationStyle();
|
||||
if ( style == null ) {
|
||||
style = new MyLocationStyle();
|
||||
}
|
||||
style.showMyLocation( visible );
|
||||
if ( mCurrentUIMode == EnumMapUI.CarUp_2D
|
||||
|| mCurrentUIMode == EnumMapUI.CarUp_3D ) {
|
||||
style.myLocationType( MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER );
|
||||
} else {
|
||||
style.myLocationType( MyLocationStyle.LOCATION_TYPE_FOLLOW );
|
||||
}
|
||||
if ( visible ) {
|
||||
// 强制刷新一遍车标
|
||||
style.myLocationIcon( BitmapDescriptorFactory.fromResource( mCarCursorOption.getCarCursorRes() ) );
|
||||
@@ -543,21 +569,71 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
}
|
||||
if ( checkAMapView() ) {
|
||||
MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
|
||||
MyLocationStyle style = getMyLocationStyle();
|
||||
if ( style == null ) {
|
||||
style = new MyLocationStyle();
|
||||
}
|
||||
if ( mCurrentUIMode == EnumMapUI.CarUp_2D
|
||||
|| mCurrentUIMode == EnumMapUI.CarUp_3D ) {
|
||||
style.myLocationType( MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER );
|
||||
} else {
|
||||
style.myLocationType( MyLocationStyle.LOCATION_TYPE_FOLLOW );
|
||||
}
|
||||
style.showMyLocation( true );
|
||||
style.myLocationIcon( BitmapDescriptorFactory.fromView( view ) );
|
||||
mMapView.getMap().setMyLocationStyle( style );
|
||||
}
|
||||
}
|
||||
|
||||
private void changeMyLocationType2UnFollow(){
|
||||
if ( mCurrentUIMode == null ) {
|
||||
return;
|
||||
}
|
||||
if ( !checkAMapView() ) {
|
||||
return;
|
||||
}
|
||||
MyLocationStyle style = getMyLocationStyle();
|
||||
switch ( mCurrentUIMode ) {
|
||||
case NorthUP_2D:
|
||||
style.myLocationType( MyLocationStyle.LOCATION_TYPE_FOLLOW_NO_CENTER );
|
||||
break;
|
||||
case CarUp_2D:
|
||||
case CarUp_3D:
|
||||
style.myLocationType( MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER );
|
||||
break;
|
||||
}
|
||||
mMapView.getMap().setMyLocationStyle( style );
|
||||
Logger.d( TAG, "设置" );
|
||||
}
|
||||
|
||||
private void changeMyLocationType2Follow() {
|
||||
if ( mCurrentUIMode == null ) {
|
||||
return;
|
||||
}
|
||||
if ( !checkAMapView() ) {
|
||||
return;
|
||||
}
|
||||
MyLocationStyle style = getMyLocationStyle();
|
||||
if ( style == null ) {
|
||||
style = new MyLocationStyle();
|
||||
}
|
||||
switch ( mCurrentUIMode ) {
|
||||
case NorthUP_2D:
|
||||
style.myLocationType( MyLocationStyle.LOCATION_TYPE_FOLLOW );
|
||||
break;
|
||||
case CarUp_2D:
|
||||
case CarUp_3D:
|
||||
style.myLocationType( MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE );
|
||||
break;
|
||||
}
|
||||
mMapView.getMap().setMyLocationStyle( style );
|
||||
}
|
||||
|
||||
public void initMyLocation() {
|
||||
if ( checkAMapView() ) {
|
||||
mMapView.getMap().setMyLocationEnabled( true );
|
||||
MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
|
||||
style.myLocationType( MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE_NO_CENTER );
|
||||
MyLocationStyle style = getMyLocationStyle();
|
||||
style.myLocationType( MyLocationStyle.LOCATION_TYPE_LOCATION_ROTATE );
|
||||
style.interval( 1000 );
|
||||
style.anchor( 0.5F, 0.5F );
|
||||
style.strokeColor( Color.TRANSPARENT );
|
||||
@@ -575,6 +651,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
}
|
||||
Logger.d( TAG, "锁车" );
|
||||
mMapView.recoverLockMode();
|
||||
changeMyLocationType2Follow();
|
||||
mIsCarLocked = true;
|
||||
}
|
||||
}
|
||||
@@ -585,8 +662,8 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
}
|
||||
Logger.d( TAG, "解锁锁车" );
|
||||
mockTouchEvent();
|
||||
mIsCarLocked = false;
|
||||
mockTouchEvent();
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -609,7 +686,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
}
|
||||
Logger.d( TAG, "Zoom锁定锁车比例尺 %s", var1 );
|
||||
mMapView.setLockZoom( var1 );
|
||||
// mMapView.setLockZoom( var1 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -818,9 +895,35 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
|
||||
@Override
|
||||
public void onMyLocationChange( Location location ) {
|
||||
if ( ( int ) location.getSpeed() > 0 ) {
|
||||
mLastDriveLocationShadow = location;
|
||||
} else {
|
||||
if ( ( int ) location.getBearing() == 0
|
||||
&& mCurrentUIMode == EnumMapUI.NorthUP_2D
|
||||
&& mLastDriveLocationShadow != null ) {
|
||||
if ( mMyLocationMarker == null ) {
|
||||
initMyLocationMarker();
|
||||
}
|
||||
if ( mMyLocationMarker != null ) {
|
||||
mMyLocationMarker.setRotateAngle( 360 - mLastDriveLocationShadow.getBearing() );
|
||||
}
|
||||
}
|
||||
}
|
||||
NaviClient.getInstance( getContext() ).syncCarLocation( location );
|
||||
}
|
||||
|
||||
private void initMyLocationMarker() {
|
||||
List< Marker > markers = mMapView.getMap().getMapScreenMarkers();
|
||||
if ( markers != null ) {
|
||||
for ( Marker marker : markers ) {
|
||||
if ( marker != null && marker.getObject() == null ) {
|
||||
this.mMyLocationMarker = marker;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public EnumMapUI getCurrentUiMode() {
|
||||
return mCurrentUIMode;
|
||||
@@ -863,7 +966,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
if ( mMapView.getMap() == null ) {
|
||||
return;
|
||||
}
|
||||
MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
|
||||
MyLocationStyle style = getMyLocationStyle();
|
||||
if ( mCarCursorOption.getCarCursorBmp() != null && !mCarCursorOption.getCarCursorBmp().isRecycled() ) {
|
||||
style.myLocationIcon( BitmapDescriptorFactory.fromBitmap( mCarCursorOption.getCarCursorBmp() ) );
|
||||
} else {
|
||||
@@ -876,6 +979,20 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
mMapView.getMap().setMyLocationStyle( style );
|
||||
}
|
||||
|
||||
private MyLocationStyle getMyLocationStyle() {
|
||||
MyLocationStyle style = null;
|
||||
try {
|
||||
style = mMapView.getMap().getMyLocationStyle();
|
||||
} catch ( Exception e ) {
|
||||
style = new MyLocationStyle();
|
||||
} finally {
|
||||
if ( style == null ) {
|
||||
style = new MyLocationStyle();
|
||||
}
|
||||
return style;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MapCameraPosition getMapCameraPosition() {
|
||||
if ( checkAMapView() ) {
|
||||
|
||||
@@ -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 AMapNaviViewWrapper( new AMapNaviView( context ) );
|
||||
} else {
|
||||
sMapView = new AMapNaviViewWrapper( new AMapNaviView( context ) );
|
||||
}
|
||||
}
|
||||
|
||||
public static IMogoMapView getMapView() {
|
||||
return sMapView;
|
||||
}
|
||||
|
||||
public static void destroy() {
|
||||
sMapView = null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,834 @@
|
||||
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.uicontroller.AMapUIController;
|
||||
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.NetworkUtils;
|
||||
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() );
|
||||
} 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 );
|
||||
if ( NetworkUtils.isConnected( mMapView.getContext() ) ) {
|
||||
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 ) {
|
||||
Logger.d( TAG, Log.getStackTraceString( new Throwable( ) ) );
|
||||
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();
|
||||
AMapUIController.getInstance().release();
|
||||
AMapWrapper.release();
|
||||
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() ) {
|
||||
Logger.d( TAG, "setTrafficEnabled" );
|
||||
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() {
|
||||
MyLocationStyle style = null;
|
||||
try {
|
||||
style = mMapView.getMap().getMyLocationStyle();
|
||||
} catch ( Exception e ) {
|
||||
style = new MyLocationStyle();
|
||||
} finally {
|
||||
if ( style == null ) {
|
||||
style = new MyLocationStyle();
|
||||
}
|
||||
return style;
|
||||
}
|
||||
}
|
||||
|
||||
@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 );
|
||||
// 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 = 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 ) );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -37,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() );
|
||||
@@ -56,6 +56,10 @@ public class AMapWrapper implements IMogoMap {
|
||||
return sAMap;
|
||||
}
|
||||
|
||||
public static void release(){
|
||||
sAMap = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoUiSettings getUiSettings() {
|
||||
if ( !checkAMap() ) {
|
||||
@@ -248,6 +252,6 @@ public class AMapWrapper implements IMogoMap {
|
||||
}
|
||||
|
||||
private Context getContext() {
|
||||
return mMapView.getContext();
|
||||
return mContext;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,18 +1,16 @@
|
||||
package com.mogo.map.impl.amap.hook;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.amap.api.maps.AMap;
|
||||
import com.autonavi.amap.mapcore.interfaces.IAMap;
|
||||
import com.autonavi.base.ae.gmap.GLMapEngine;
|
||||
import com.autonavi.base.amap.api.mapcore.IAMapDelegate;
|
||||
import com.autonavi.base.amap.mapcore.interfaces.IAMapListener;
|
||||
import com.mogo.map.impl.amap.navi.NaviClient;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.lang.reflect.InvocationHandler;
|
||||
import java.lang.reflect.Method;
|
||||
import java.lang.reflect.Proxy;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -23,13 +21,12 @@ import java.lang.reflect.Proxy;
|
||||
public class BnHooker implements InvocationHandler {
|
||||
|
||||
private static final String TAG = "BnHooker";
|
||||
private final Context mContext;
|
||||
|
||||
private Object host;
|
||||
private Method getGLMapEngineMethod;
|
||||
private GLMapEngine glMapEngineObject;
|
||||
|
||||
public BnHooker( AMap map, Context context ) throws Exception {
|
||||
|
||||
mContext = context;
|
||||
public BnHooker( AMap map ) throws Exception {
|
||||
|
||||
if ( map == null ) {
|
||||
return;
|
||||
@@ -48,6 +45,28 @@ public class BnHooker implements InvocationHandler {
|
||||
this
|
||||
);
|
||||
field.set( map, object );
|
||||
|
||||
}
|
||||
|
||||
public void clearAllMessages() throws Exception {
|
||||
if ( glMapEngineObject == null ) {
|
||||
if ( getGLMapEngineMethod == null ) {
|
||||
getGLMapEngineMethod = host.getClass().getDeclaredMethod( "getGLMapEngine" );
|
||||
getGLMapEngineMethod.setAccessible( true );
|
||||
}
|
||||
glMapEngineObject = ( GLMapEngine ) getGLMapEngineMethod.invoke( host );
|
||||
}
|
||||
if ( glMapEngineObject != null ) {
|
||||
clearMessageList( "mStateMessageList", glMapEngineObject );
|
||||
clearMessageList( "mAnimateStateMessageList", glMapEngineObject );
|
||||
}
|
||||
}
|
||||
|
||||
private void clearMessageList( String filedName, Object obj ) throws Exception {
|
||||
Field stateMessageListField = obj.getClass().getDeclaredField( filedName );
|
||||
stateMessageListField.setAccessible( true );
|
||||
List valList = ( List ) stateMessageListField.get( obj );
|
||||
valList.clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -82,8 +82,8 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
mMogoMarkerOptions = null;
|
||||
}
|
||||
if ( mMarker != null ) {
|
||||
mMarker.remove();
|
||||
mMarker.setObject( null );
|
||||
mMarker.remove();
|
||||
mMarker = null;
|
||||
}
|
||||
if ( mMovingPointOverlay != null ) {
|
||||
@@ -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 );
|
||||
}
|
||||
|
||||
@@ -77,7 +77,7 @@ public class NaviClient implements IMogoNavi {
|
||||
private boolean mAimlessStatus;
|
||||
|
||||
private NaviClient( Context context ) {
|
||||
mContext = context;
|
||||
mContext = context.getApplicationContext();
|
||||
if ( DebugConfig.isUseCustomNavi() ) {
|
||||
// 按需初始化导航组件
|
||||
initAMapNavi();
|
||||
|
||||
@@ -4,7 +4,6 @@ import android.text.TextUtils;
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
|
||||
|
||||
import java.util.LinkedList;
|
||||
|
||||
@@ -16,7 +15,7 @@ import java.util.LinkedList;
|
||||
* <p>
|
||||
* 策略:队列缓存预播报的 tts,然后上一句播完后
|
||||
*/
|
||||
public class TTSSpeaker implements IMogoVoiceCmdCallBack {
|
||||
public class TTSSpeaker {
|
||||
|
||||
private static volatile TTSSpeaker sInstance;
|
||||
|
||||
@@ -48,7 +47,6 @@ public class TTSSpeaker implements IMogoVoiceCmdCallBack {
|
||||
return;
|
||||
}
|
||||
mWaiting.add( tts );
|
||||
peekAndSpeak();
|
||||
}
|
||||
|
||||
public synchronized void shutUp() {
|
||||
@@ -60,61 +58,5 @@ public class TTSSpeaker implements IMogoVoiceCmdCallBack {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdSelected( String cmd ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdAction( String speakText ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCmdCancel( String speakText ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpeakEnd( String speakText ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onSpeakSelectTimeOut( String speakText ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTTSStart( String ttsId, String tts ) {
|
||||
if ( TextUtils.equals( mLastTts, tts ) ) {
|
||||
mLastTtsId = ttsId;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTTSEnd( String ttsId, String tts ) {
|
||||
mLastTtsId = null;
|
||||
peekAndSpeak();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTTSError( String ttsId, String tts ) {
|
||||
mLastTtsId = null;
|
||||
peekAndSpeak();
|
||||
}
|
||||
|
||||
private synchronized void peekAndSpeak() {
|
||||
if ( mWaiting.isEmpty() ) {
|
||||
mLastTts = null;
|
||||
mLastTtsId = null;
|
||||
return;
|
||||
}
|
||||
if ( mLastTtsId != null ) {
|
||||
// 上一句还没有播完
|
||||
return;
|
||||
}
|
||||
mLastTts = mWaiting.pop();
|
||||
AIAssist.getInstance( AbsMogoApplication.getApp() ).speakTTSAndDuck( mLastTts, this );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -51,6 +51,7 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
mClient = null;
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
|
||||
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 22 KiB |
@@ -6,6 +6,7 @@ import android.content.Intent;
|
||||
import android.content.IntentFilter;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.map.impl.amap.utils.IconTypeUtils;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoNaviListenerHandler;
|
||||
@@ -26,6 +27,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();
|
||||
@@ -63,6 +67,11 @@ public class AutoNaviReceiver extends BroadcastReceiver {
|
||||
int state = intent.getIntExtra( "EXTRA_STATE", -1 );
|
||||
handleMapStatusChanged( state );
|
||||
break;
|
||||
case 10056:
|
||||
String json = intent.getStringExtra( "EXTRA_ROAD_INFO" );
|
||||
SpStorage.setNavigationTarget(json);
|
||||
Logger.d( TAG, json );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -85,23 +94,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 );
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -118,6 +132,7 @@ public class AutoNaviReceiver extends BroadcastReceiver {
|
||||
case MapStateValue.START_NAVI:
|
||||
case MapStateValue.START_EMULATOR_NAVI:
|
||||
if ( MapState.getInstance().isNaving() ) {
|
||||
Logger.w( TAG, "naving..." );
|
||||
return;
|
||||
}
|
||||
MapState.getInstance().setNaving( true );
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
package com.mogo.map.impl.custom;
|
||||
|
||||
import android.content.Context;
|
||||
import android.util.Log;
|
||||
|
||||
import com.mogo.map.IMogoMapView;
|
||||
import com.mogo.map.IMogoMapViewCreator;
|
||||
@@ -23,11 +22,11 @@ public class AMapBaseMapView implements IMogoMapViewCreator {
|
||||
|
||||
@Override
|
||||
public IMogoMapView create( Context context ) {
|
||||
MapAutoApi.INSTANCE.init(context, MapParams.Companion.init().setDebugMode( false )
|
||||
MapAutoApi.INSTANCE.init( context, MapParams.Companion.init().setDebugMode( false )
|
||||
.setCoordinateType( MapParams.COORDINATETYPE_GCJ02 )
|
||||
.setPerspectiveMode( MapParams.MAP_PERSPECTIVE_2D )
|
||||
.setZoom( 16 )
|
||||
.setPointToCenter(0.5f,0.5f)
|
||||
.setPointToCenter( 0.5f, 0.5f )
|
||||
.setStyleMode( MapParams.MAP_STYLE_NIGHT ) );
|
||||
mapAutoView = new MapAutoView( context );
|
||||
return new AMapViewWrapper( mapAutoView );
|
||||
|
||||
@@ -1,886 +0,0 @@
|
||||
//package com.mogo.map.impl.custom;
|
||||
//
|
||||
//import android.content.Context;
|
||||
//import android.graphics.BitmapFactory;
|
||||
//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.mogo.commons.debug.DebugConfig;
|
||||
//import com.mogo.map.IMogoMap;
|
||||
//import com.mogo.map.IMogoMapView;
|
||||
//import com.mogo.map.MogoLatLng;
|
||||
//import com.mogo.map.impl.custom.hook.BnHooker;
|
||||
//import com.mogo.map.impl.custom.marker.AMapMarkerWrapper;
|
||||
//import com.mogo.map.impl.custom.message.AMapMessageListener;
|
||||
//import com.mogo.map.impl.custom.message.AMapMessageManager;
|
||||
//import com.mogo.map.impl.custom.navi.NaviClient;
|
||||
//import com.mogo.map.impl.custom.utils.MogoMapUtils;
|
||||
//import com.mogo.map.impl.custom.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 com.zhidaoauto.map.sdk.open.MapParams;
|
||||
//import com.zhidaoauto.map.sdk.open.camera.CameraUpdate;
|
||||
//import com.zhidaoauto.map.sdk.open.location.LocationListener;
|
||||
//import com.zhidaoauto.map.sdk.open.location.MyLocationStyle;
|
||||
//import com.zhidaoauto.map.sdk.open.tools.MapTools;
|
||||
//import com.zhidaoauto.map.sdk.open.view.MapAutoView;
|
||||
//import com.zhidaoauto.map.sdk.open.view.MapAutoViewHelper;
|
||||
//
|
||||
//import org.jetbrains.annotations.NotNull;
|
||||
//
|
||||
//import java.util.List;
|
||||
//
|
||||
///**
|
||||
// * @author congtaowang
|
||||
// * @since 2019-12-18
|
||||
// * <p>
|
||||
// * 代理自研导航地图
|
||||
// */
|
||||
//public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
// IMogoMapUIController,
|
||||
// OnMarkClickListener,
|
||||
//// AMap.OnMapLoadedListener,
|
||||
//// AMap.OnMapTouchListener,
|
||||
//// AMap.OnPOIClickListener,
|
||||
//// AMap.OnMapClickListener,
|
||||
//// AMap.OnPolylineClickListener,
|
||||
//// AMapNaviViewListener,
|
||||
//// AMapMessageListener,
|
||||
//// AMap.OnCameraChangeListener,
|
||||
// LocationListener {
|
||||
//
|
||||
// private static final String TAG = "AMapNaviViewWrapper";
|
||||
//
|
||||
// private final MapAutoView 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 AMapNaviViewWrapper( MapAutoView mapView ) {
|
||||
// this.mMapView = mapView;
|
||||
// this.mIMap = new AMapWrapper( mMapView.getMapAutoViewHelper(), mMapView, this );
|
||||
// try {
|
||||
// new BnHooker( mMapView.getMapAutoViewHelper(), mapView.getContext() );
|
||||
// } catch ( Exception e ) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void initMapView() {
|
||||
// if ( mMapView == null ) {
|
||||
// return;
|
||||
// }
|
||||
// MapAutoViewHelper options = mMapView.getMapAutoViewHelper();
|
||||
// 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.hiddenDirection();
|
||||
// // 黑夜模式
|
||||
// options.setMapStyle(MapParams.MAP_STYLE_NIGHT);
|
||||
// //设置路况光柱条是否显示(只适用于驾车导航,需要联网)。
|
||||
//// options.setTrafficBarEnabled( false );
|
||||
// // 设置[实时交通图层开关按钮]是否显示(只适用于驾车导航,需要联网)。
|
||||
//// options.setTrafficLayerEnabled( false );
|
||||
// // 设置导航界面是否显示路线全览按钮。
|
||||
//// options.setRouteListButtonShow( false );
|
||||
// // 设置导航状态下屏幕是否一直开启。
|
||||
//// options.setScreenAlwaysBright( true );
|
||||
// // 设置交通播报是否打开(只适用于驾车导航,需要联网)。
|
||||
//// 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.5D, 0.5D );
|
||||
// // 2D模式
|
||||
// options.setTilt( 0 );
|
||||
// mMapView.setViewOptions( options );
|
||||
// }
|
||||
// mMapView.setRouteOverlayVisible( false );
|
||||
// mMapView.setCarOverlayVisible( false );
|
||||
// setUIMode( EnumMapUI.CarUp_2D, null );
|
||||
// }
|
||||
//
|
||||
// private void initListeners() {
|
||||
//
|
||||
// mMapView.setOnMarkerClickListener( this );
|
||||
// mMarkerClickHandler = new AMapMarkerClickHandler();
|
||||
// mMapView.setOnMapLoadedListener( this );
|
||||
// mMapView.setOnMapTouchListener( this );
|
||||
// mMapView.setOnPolylineClickListener( this );
|
||||
// mMapView.setAMapNaviViewListener( this );
|
||||
// mMapView.setOnCameraChangeListener( this );
|
||||
//
|
||||
// final AMap aMap = mMapView.getMap();
|
||||
// if ( aMap != null ) {
|
||||
// aMap.setOnPOIClickListener( this );
|
||||
// aMap.setOnMapClickListener( this );
|
||||
// aMap.setOnCameraChangeListener( this );
|
||||
// aMap.setOnMyLocationChangeListener( this );
|
||||
// }
|
||||
// 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, "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() {
|
||||
// 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 );
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * 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 onNaviSetting() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviCancel() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public boolean onNaviBackClick() {
|
||||
// return true;
|
||||
// }
|
||||
//
|
||||
// /**
|
||||
// * @param mode 0:车头朝上状态;1:正北朝上模式
|
||||
// */
|
||||
// @Override
|
||||
// public void onNaviMapMode( int mode ) {
|
||||
// Logger.i( TAG, "mode=" + mode );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviTurnClick() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNextRoadClick() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onScanViewButtonClick() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onLockMap( boolean isLock ) {
|
||||
// Logger.d( TAG, "lock status = %s", isLock );
|
||||
// mIsCarLocked = isLock;
|
||||
// Trace.beginSection( "timer.onCameraChangeFinish" );
|
||||
// MogoMapListenerHandler.getInstance().onLockMap( isLock );
|
||||
// Trace.endSection();
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviViewLoaded() {
|
||||
//
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onMapTypeChanged( int type ) {
|
||||
// if ( type == 4 ) {
|
||||
// MogoMapListenerHandler.getInstance().onMapModeChanged( EnumMapUI.Type_Light );
|
||||
// } else if ( type == 3 ) {
|
||||
// MogoMapListenerHandler.getInstance().onMapModeChanged( EnumMapUI.Type_Night );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviViewShowMode( int i ) {
|
||||
//
|
||||
// long delay = mMapView.getViewOptions().getLockMapDelayed();
|
||||
// switch ( i ) {
|
||||
// case AMapNaviViewShowMode.SHOW_MODE_DEFAULT:
|
||||
// Logger.d( TAG, "普通模式" );
|
||||
// break;
|
||||
// case AMapNaviViewShowMode.SHOW_MODE_DISPLAY_OVERVIEW:
|
||||
// Logger.d( TAG, "全览模式" );
|
||||
// break;
|
||||
// case AMapNaviViewShowMode.SHOW_MODE_LOCK_CAR:
|
||||
// Logger.d( TAG, "锁车模式: %s", delay );
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void setTrafficEnabled( boolean visible ) {
|
||||
// if ( checkAMapView() ) {
|
||||
// mMapView.setTrafficLine( visible );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public MapControlResult changeZoom( boolean zoom ) {
|
||||
// if ( checkAMapView() ) {
|
||||
// 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 ( checkAMapView() ) {
|
||||
// AMapNaviViewOptions options = mMapView.getViewOptions();
|
||||
// if ( options == null ) {
|
||||
// options = new AMapNaviViewOptions();
|
||||
// }
|
||||
// switch ( ui ) {
|
||||
// case CarUp_2D:
|
||||
// case CarUp_3D:
|
||||
// case NorthUP_2D:
|
||||
// setUIMode( ui, options );
|
||||
// return;
|
||||
// case Type_Light:
|
||||
// options.setNaviNight( false );
|
||||
// break;
|
||||
// case Type_Night:
|
||||
// options.setNaviNight( true );
|
||||
// break;
|
||||
// case Type_AUTO_LIGHT_Night:
|
||||
// options.setNaviNight( false );
|
||||
// options.setAutoNaviViewNightMode( true );
|
||||
// break;
|
||||
// }
|
||||
// mMapView.setViewOptions( options );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private void setUIMode( EnumMapUI ui, AMapNaviViewOptions options ) {
|
||||
// this.mCurrentUIMode = ui;
|
||||
// switch ( ui ) {
|
||||
// case CarUp_2D:
|
||||
// case CarUp_3D:
|
||||
// mMapView.setNaviMode( AMapNaviView.CAR_UP_MODE );
|
||||
// break;
|
||||
// case NorthUP_2D:
|
||||
// mMapView.setNaviMode( AMapNaviView.NORTH_UP_MODE );
|
||||
// break;
|
||||
// }
|
||||
//
|
||||
// Logger.d( TAG, "mCurrentUIMode--->" + mCurrentUIMode.name() );
|
||||
// if ( options == null ) {
|
||||
// return;
|
||||
// }
|
||||
// switch ( ui ) {
|
||||
// case CarUp_2D:
|
||||
// case NorthUP_2D:
|
||||
// options.setTilt( 0 );
|
||||
// break;
|
||||
// case CarUp_3D:
|
||||
// options.setTilt( 60 );
|
||||
// break;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// private boolean checkAMapView() {
|
||||
// if ( mMapView == 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 ( checkAMapView() ) {
|
||||
// MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
|
||||
// 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 ( checkAMapView() ) {
|
||||
// MyLocationStyle style = mMapView.getMap().getMyLocationStyle();
|
||||
// style.showMyLocation( true );
|
||||
// style.myLocationIcon( BitmapDescriptorFactory.fromView( view ) );
|
||||
// mMapView.getMap().setMyLocationStyle( style );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// public void initMyLocation() {
|
||||
// if ( checkAMapView() ) {
|
||||
// mMapView.getMap().setMyLocationEnabled( true );
|
||||
// MyLocationStyle style = mMapView.getMap().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 );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void recoverLockMode() {
|
||||
// if ( checkAMapView() ) {
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
// Logger.d( TAG, "锁车" );
|
||||
// mMapView.recoverLockMode();
|
||||
// mIsCarLocked = true;
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void loseLockMode() {
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
// Logger.d( TAG, "解锁锁车" );
|
||||
// mockTouchEvent();
|
||||
// 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 ( checkAMapView() ) {
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
// Logger.d( TAG, "Zoom锁定锁车比例尺 %s", var1 );
|
||||
// mMapView.setLockZoom( var1 );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void displayOverview( Rect bounds ) {
|
||||
// if ( checkAMapView() ) {
|
||||
// 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 ( checkAMapView() ) {
|
||||
// mMapView.setCarOverlayVisible( true );
|
||||
// showMyLocation( false );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onNaviStopped() {
|
||||
// if ( checkAMapView() ) {
|
||||
// mMapView.setCarOverlayVisible( false );
|
||||
// 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 ( checkAMapView() ) {
|
||||
// if ( DebugConfig.isDebug() ) {
|
||||
// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
// }
|
||||
// Logger.d( TAG, "setPointToCenter(%s, %s)", mapCenterX, mapCenterY );
|
||||
//// AMapNaviViewOptions options = mMapView.getViewOptions();
|
||||
//// options.setPointToCenter( mapCenterX, mapCenterY );
|
||||
//// mMapView.setViewOptions( options );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public Point getLocationPointInScreen( MogoLatLng latLng ) {
|
||||
// if ( checkAMapView() ) {
|
||||
// try {
|
||||
// return MapTools.INSTANCE.toScreenLocation( ObjectUtils.fromMogo( latLng ) );
|
||||
// } catch ( Exception e ) {
|
||||
// return null;
|
||||
// }
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public MogoLatLng getLocationMogoLatLngInScreen( Point point ) {
|
||||
// if ( checkAMapView() ) {
|
||||
// try {
|
||||
// return ObjectUtils.fromAMap(
|
||||
// MapTools.INSTANCE.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 ( checkAMapView() ) {
|
||||
// if ( mMapView.getMapAutoViewHelper() != null ) {
|
||||
//// mMapView.getMapAutoViewHelper().setRenderFps( fps );
|
||||
// Logger.d( TAG, "设置刷新帧率 fps = %s", fps );
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void showBounds( String tag, MogoLatLng carPosition, List< MogoLatLng > lonLats, Rect bound, boolean lockCarPosition ) {
|
||||
// if ( !checkAMapView() ) {
|
||||
// return;
|
||||
// }
|
||||
// try {
|
||||
//// if ( DebugConfig.isDebug() ) {
|
||||
//// Logger.d( TAG, Log.getStackTraceString( new Throwable() ) );
|
||||
//// }
|
||||
//// LatLngBounds latLngBounds = MogoMapUtils.getLatLngBounds( carPosition, lonLats, lockCarPosition );
|
||||
//// if ( !lockCarPosition ) {
|
||||
//// loseLockMode();
|
||||
//// }
|
||||
//// mMapView.getMapAutoViewHelper().moveCamera( new CameraUpdate(new MapCameraMessage( latLngBounds, bound.left, bound.right, bound.top, bound.bottom ) ));
|
||||
// } catch ( Exception e ) {
|
||||
// Logger.e( TAG, e, "%s error.", tag );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void forceRender() {
|
||||
// if ( checkAMapView() ) {
|
||||
// mMapView.getMapAutoViewHelper().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 ( !checkAMapView() ) {
|
||||
// return;
|
||||
// }
|
||||
//// AMapNaviViewOptions options = mMapView.getViewOptions();
|
||||
//// if ( options != null && mCarCursorOption.getNaviCursorRes() != 0 ) {
|
||||
//// options.setCarBitmap( BitmapFactory.decodeResource( getContext().getResources(), mCarCursorOption.getNaviCursorRes() ) );
|
||||
//// } else {
|
||||
//// options.setCarBitmap( BitmapFactory.decodeResource( getContext().getResources(), DEFAULT_OPTION.getNaviCursorRes() ) );
|
||||
//// }
|
||||
//// mMapView.setViewOptions( options );
|
||||
//
|
||||
// if ( mMapView.getMapAutoViewHelper() == null ) {
|
||||
// return;
|
||||
// }
|
||||
// MyLocationStyle style = mMapView.getMapAutoViewHelper().getMyLocationStyle();
|
||||
// if ( mCarCursorOption.getCarCursorBmp() != null && !mCarCursorOption.getCarCursorBmp().isRecycled() ) {
|
||||
//// style.myLocationIcon( BitmapDescriptorFactory.fromBitmap( mCarCursorOption.getCarCursorBmp() ) );
|
||||
// } else {
|
||||
// if ( mCarCursorOption.getCarCursorRes() != 0 ) {
|
||||
// style.myLocationIcon( mCarCursorOption.getCarCursorRes());
|
||||
// } else {
|
||||
// style.myLocationIcon( mCarCursorOption.getCarCursorRes());
|
||||
// }
|
||||
// }
|
||||
// mMapView.getMapAutoViewHelper().setMyLocationStyle( style );
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public MapCameraPosition getMapCameraPosition() {
|
||||
// if ( checkAMapView() ) {
|
||||
//// CameraPosition cameraPosition = mMapView.getMap().getCameraPosition();
|
||||
//// return ObjectUtils.fromAMap( cameraPosition );
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void changeBearing( float bearing ) {
|
||||
// if ( checkAMapView() ) {
|
||||
//// mMapView.getMap().moveCamera( CameraUpdateFactory.changeBearing( bearing ) );
|
||||
// }
|
||||
// }
|
||||
//
|
||||
// @Override
|
||||
// public void onLocationChanged(@NotNull com.zhidaoauto.map.sdk.open.location.Location location) {
|
||||
// Location sysLocation = new Location(location.getProvider());
|
||||
// sysLocation.setAltitude(location.getAltitude());
|
||||
// sysLocation.setLatitude(location.getLat());
|
||||
// sysLocation.setLongitude(location.getLon());
|
||||
// sysLocation.setSpeed(location.getSpeed());
|
||||
// NaviClient.getInstance( getContext() ).syncCarLocation(sysLocation);
|
||||
// }
|
||||
//}
|
||||
@@ -480,4 +480,9 @@ public class AMapMarkerWrapper implements IMogoMarker, Observer {
|
||||
public void startScaleAnimationWithAlpha( float fromX, float toX, float fromY, float toY, float fromAlpha, float toAlpha, int duration, Interpolator interpolator, OnMarkerAnimationListener listener ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isInfoWindowShowing() {
|
||||
return mMarker.isInfoWindowShown();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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 );
|
||||
}
|
||||
@@ -86,6 +86,7 @@ public abstract class MogoBaseMapView extends FrameLayout implements ILifeCycle
|
||||
if ( mMapView != null ) {
|
||||
mMapView.onDestroy();
|
||||
}
|
||||
MogoMap.getInstance().clear();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -46,4 +46,9 @@ public class MogoMap {
|
||||
public IMogoMap getMogoMap() {
|
||||
return mMap;
|
||||
}
|
||||
|
||||
public void clear(){
|
||||
mContext = null;
|
||||
mMap = null;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -318,4 +318,10 @@ public interface IMogoMarker {
|
||||
* @param duration 时长
|
||||
*/
|
||||
void startSmooth( List< MogoLatLng > points, int duration );
|
||||
|
||||
/**
|
||||
* info window 是否正在显示
|
||||
* @return
|
||||
*/
|
||||
boolean isInfoWindowShowing();
|
||||
}
|
||||
|
||||
@@ -10,6 +10,7 @@ import java.util.Collection;
|
||||
import java.util.HashMap;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -33,7 +34,7 @@ public class MogoMarkersHandler implements IMogoMarkerClickListener, IMogoMarker
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private Map< String, List< IMogoMarker > > mServicesMarkers = new HashMap<>();
|
||||
private Map< String, List< IMogoMarker > > mServicesMarkers = new ConcurrentHashMap<>();
|
||||
|
||||
private MogoMarkersHandler() {
|
||||
}
|
||||
|
||||
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 4.8 KiB After Width: | Height: | Size: 33 KiB |
|
Before Width: | Height: | Size: 21 KiB After Width: | Height: | Size: 22 KiB |
@@ -66,12 +66,23 @@ class MogoMapDelegateFactory {
|
||||
return AMapUIController.getInstance();
|
||||
}
|
||||
|
||||
public static IMogoMapViewCreator getMapViewCreatorDelegate() {
|
||||
private static IMogoMapView sMapView;
|
||||
|
||||
public static void createMapView( Context context ) {
|
||||
if ( DebugConfig.isUseCustomMap() ) {
|
||||
Logger.d( TAG, "use custom IMogoMapViewCreator" );
|
||||
return new com.mogo.map.impl.custom.AMapBaseMapView();
|
||||
sMapView = new com.mogo.map.impl.custom.AMapBaseMapView().create( context );
|
||||
} else {
|
||||
sMapView = new AMapBaseMapView().create( context );
|
||||
}
|
||||
return new AMapBaseMapView();
|
||||
}
|
||||
|
||||
public static void destroy() {
|
||||
sMapView = null;
|
||||
}
|
||||
|
||||
public static IMogoMapView getMapView() {
|
||||
return sMapView;
|
||||
}
|
||||
|
||||
public static IMogoNavi getNaviDelegate( Context context ) {
|
||||
|
||||
@@ -6,7 +6,6 @@ import android.util.AttributeSet;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.map.impl.amap.AMapBaseMapView;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
@@ -18,6 +17,7 @@ import com.mogo.utils.logger.Logger;
|
||||
public class MogoMapView extends MogoBaseMapView implements ILifeCycle {
|
||||
|
||||
private static final String TAG = "MogoMapView";
|
||||
|
||||
public MogoMapView( Context context ) {
|
||||
super( context );
|
||||
}
|
||||
@@ -30,40 +30,40 @@ public class MogoMapView extends MogoBaseMapView implements ILifeCycle {
|
||||
super( context, attrs, defStyleAttr );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IMogoMapView createMapView( Context context ) {
|
||||
return MogoMapDelegateFactory.getMapViewCreatorDelegate().create( context );
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMap getMap() {
|
||||
return super.getMap();
|
||||
}
|
||||
|
||||
@Override
|
||||
protected IMogoMapView createMapView( Context context ) {
|
||||
MogoMapDelegateFactory.createMapView( context );
|
||||
return MogoMapDelegateFactory.getMapView();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCreate( Bundle bundle ) {
|
||||
super.onCreate( bundle );
|
||||
Logger.d(TAG,"onCreate");
|
||||
Logger.d( TAG, "onCreate" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
Logger.d(TAG,"onResume");
|
||||
|
||||
Logger.d( TAG, "onResume" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPause() {
|
||||
super.onPause();
|
||||
Logger.d(TAG,"onPause");
|
||||
Logger.d( TAG, "onPause" );
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroy() {
|
||||
super.onDestroy();
|
||||
Logger.d(TAG,"onDestroy");
|
||||
Logger.d( TAG, "onDestroy" );
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -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();
|
||||
}
|
||||
}
|
||||
@@ -3,15 +3,10 @@ package com.zhidao.mogo.tanlu.api;
|
||||
import android.content.Context;
|
||||
import android.util.ArrayMap;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.analytics.AnalyticsUtils;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.tanlu.IMogoTanluProvider;
|
||||
import com.mogo.service.tanlu.TanluUploadParams;
|
||||
import com.mogo.service.share.IMogoTanluProvider;
|
||||
import com.mogo.service.share.TanluUploadParams;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.roadcondition.service.MainService;
|
||||
import com.zhidao.roadcondition.service.UploadParams;
|
||||
|
||||
@@ -46,12 +46,11 @@ dependencies {
|
||||
implementation 'com.squareup.okhttp3:okhttp:3.10.0'
|
||||
implementation 'com.squareup.okhttp3:logging-interceptor:3.6.0'
|
||||
implementation 'com.zhidaoauto.controller:api:1.0.8'
|
||||
implementation 'com.zhidao.cosupload:cosuploadsdk:1.1.6'
|
||||
implementation 'com.zhidao.cosupload:cosuploadsdk:1.1.6', {
|
||||
exclude group: 'com.zhidao.utils', module: 'utils'
|
||||
}
|
||||
implementation 'com.zhidao.video:video-processor:1.0.2.1'
|
||||
implementation 'com.foundation.utils:common-utils:1.0.7'
|
||||
|
||||
implementation rootProject.ext.dependencies.eventbus
|
||||
compileOnly rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.eventbus
|
||||
implementation rootProject.ext.dependencies.coroutinescore
|
||||
implementation rootProject.ext.dependencies.coroutinesandroid
|
||||
@@ -60,9 +59,16 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.gson
|
||||
implementation rootProject.ext.dependencies.rxjava
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
compileOnly rootProject.ext.dependencies.mogomap
|
||||
implementation rootProject.ext.dependencies.aspectj
|
||||
implementation rootProject.ext.dependencies.analytics
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
compileOnly rootProject.ext.dependencies.mogocommons
|
||||
compileOnly rootProject.ext.dependencies.mogomap
|
||||
} else {
|
||||
implementation project(':modules:mogo-module-common')
|
||||
implementation project(':libraries:mogo-map')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
|
||||
@@ -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)
|
||||
/**
|
||||
* 默认视频抓取时长,单位是秒
|
||||
*/
|
||||
|
||||
@@ -108,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 { //比亚迪
|
||||
@@ -117,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"] = ""
|
||||
|
||||
@@ -159,16 +159,16 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
val entity = TakeEntity(isCustom, 0L)
|
||||
Log.e(TAG, "onTakePhotoFail -----mType = $mType --- isCustom = $isCustom")
|
||||
//语音播报 1:上报路况,2:交通检查,3:封路 默认 mType 应该为null
|
||||
if (mType.equals(TANLU_ROAD_CONGESTION) || mType.equals(TANLU_TRAFFIC_CHECK) || mType.equals(
|
||||
TANLU_ROAD_CLOSURE
|
||||
)
|
||||
|| mType.equals(TANLU_ROAD_CURRENT) || mType.equals(TANLU_ROAD_PONDING) || mType.equals(
|
||||
TANLU_ROAD_ICING
|
||||
)
|
||||
|| mType.equals(TANLU_ROAD_HEAVY_FOG) || mType.equals(TANLU_ROAD_ACCIDENT) || mType.equals(
|
||||
TANLU_ROAD_WORK
|
||||
)
|
||||
) {
|
||||
// if (mType.equals(TANLU_ROAD_CONGESTION) || mType.equals(TANLU_TRAFFIC_CHECK) || mType.equals(
|
||||
// TANLU_ROAD_CLOSURE
|
||||
// )
|
||||
// || mType.equals(TANLU_ROAD_CURRENT) || mType.equals(TANLU_ROAD_PONDING) || mType.equals(
|
||||
// TANLU_ROAD_ICING
|
||||
// )
|
||||
// || mType.equals(TANLU_ROAD_HEAVY_FOG) || mType.equals(TANLU_ROAD_ACCIDENT) || mType.equals(
|
||||
// TANLU_ROAD_WORK
|
||||
// )
|
||||
// ) {
|
||||
taskAsync(1_500) {
|
||||
try {
|
||||
// VoiceController.speakVoice("上报失败")
|
||||
@@ -190,9 +190,9 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
mainInfoId,
|
||||
mLongitude,
|
||||
mLatitude
|
||||
);
|
||||
)
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
|
||||
//拍照成功回调返回图片本地路径
|
||||
@@ -271,6 +271,7 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
//获取视频成功
|
||||
override fun onTakeVideoSuccess(camera: Int, videoPath: String?) {
|
||||
var thumbnailPath =
|
||||
@@ -282,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,25 +301,30 @@ object CarCorderController : TakePhotoCallback, TakeVideoCallback {
|
||||
)
|
||||
var speed = LocationUtil.getInstance().getSpeed()
|
||||
|
||||
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)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -332,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)
|
||||
}
|
||||
}
|
||||
|
||||
//失败了,传空地址,发起请求
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Intent
|
||||
import android.util.Log
|
||||
import com.google.gson.Gson
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.utils.TipToast
|
||||
import com.zhidao.cosupload.DbPriorityConfig
|
||||
import com.zhidao.cosupload.callback.CosStatusCallback
|
||||
import com.zhidao.cosupload.manager.CosUploadManagerImpl
|
||||
@@ -91,9 +92,9 @@ class CosStatusController : CosStatusCallback {
|
||||
) {
|
||||
// VoiceController.speakVoice("cos上报失败")
|
||||
Log.d(TAG, "uploadCosFailed mType = $mType")
|
||||
if (entity?.isCustom && mFromType != UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO) {
|
||||
sendGetInfoFailedReceiver("100")
|
||||
}
|
||||
// if (entity?.isCustom && mFromType != UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO) {
|
||||
// sendGetInfoFailedReceiver("100")
|
||||
// }
|
||||
}
|
||||
|
||||
if (!isRetry) {
|
||||
@@ -121,7 +122,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,30 +137,30 @@ 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)
|
||||
Log.d(TAG, "locationStr = " + locationStr)
|
||||
//如果失败,需要提示失败弹框
|
||||
if (locationInfo.address.isNullOrEmpty() || locationInfo.cityName.isNullOrEmpty() || locationInfo.cityCode.isNullOrEmpty()
|
||||
|| locationInfo.latitude == 0.0 || locationInfo.areaName.isNullOrEmpty() || locationInfo.street.isNullOrEmpty()
|
||||
|| locationInfo.areaCode.isNullOrEmpty() || locationInfo.provinceName.isNullOrEmpty()
|
||||
) {
|
||||
if (entity?.isCustom && mFromType != UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO) {
|
||||
sendGetInfoFailedReceiver("100")
|
||||
}
|
||||
} else {
|
||||
//分享成功,并打点,如果是上报拥堵,需要takeVideo
|
||||
LatLngStickyEventBus.getInstance()
|
||||
.postSticky(GetImageSuccessEvent(downloadUrl, mType))
|
||||
//上传录像以及缩略图成功
|
||||
sendInformation(INFO_TYPE_VIDEO, videoAndThumbMap)
|
||||
}
|
||||
// if (locationInfo.address.isNullOrEmpty() || locationInfo.cityName.isNullOrEmpty() || locationInfo.cityCode.isNullOrEmpty()
|
||||
// || locationInfo.latitude == 0.0 || locationInfo.areaName.isNullOrEmpty() || locationInfo.street.isNullOrEmpty()
|
||||
// || locationInfo.areaCode.isNullOrEmpty() || locationInfo.provinceName.isNullOrEmpty()
|
||||
// ) {
|
||||
// if (entity?.isCustom && mFromType != UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO) {
|
||||
// sendGetInfoFailedReceiver("100")
|
||||
// }
|
||||
// } else {
|
||||
|
||||
//上传录像以及缩略图成功
|
||||
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 +170,6 @@ class CosStatusController : CosStatusCallback {
|
||||
mLongitude,
|
||||
mLatitude
|
||||
)
|
||||
// }
|
||||
}
|
||||
Log.d(TAG, "delete file: ${localPath!!}")
|
||||
CosCallbackMapController.unregisterCallback(localPath)
|
||||
@@ -195,25 +194,44 @@ 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(
|
||||
type = type,
|
||||
url = map,
|
||||
isCustom = entity?.isCustom,
|
||||
poiType = poiType,
|
||||
mainInfoId = mainInfoId,
|
||||
longitude = longitude,
|
||||
latitude = latitude
|
||||
) { success ->
|
||||
CosCallbackMapController.unregisterCallbacks(map)
|
||||
CosCallbackMapController.mainService?.let {
|
||||
CosCallbackMapController.mainService?.sendCustomResult(success)
|
||||
//开始上传
|
||||
entity?.isCustom?.let {
|
||||
mainServiceHttpModel.sendInformationMessage(
|
||||
type = type,
|
||||
url = map,
|
||||
isCustom = it,
|
||||
poiType = poiType,
|
||||
mainInfoId = mainInfoId,
|
||||
longitude = longitude,
|
||||
latitude = latitude
|
||||
) { success ->
|
||||
CosCallbackMapController.unregisterCallbacks(map)
|
||||
// CosCallbackMapController.mainService?.let {
|
||||
// CosCallbackMapController.mainService?.sendCustomResult(success)
|
||||
// }
|
||||
Log.d(TAG, "type = $type ----success = $success")
|
||||
if (success) {
|
||||
//分享成功,并打点,如果是上报拥堵,需要takeVideo
|
||||
if (type == INFO_TYPE_VIDEO) {
|
||||
try {
|
||||
LatLngStickyEventBus.getInstance()
|
||||
.postSticky(GetImageSuccessEvent("", poiType))
|
||||
} catch (e: java.lang.Exception) {
|
||||
e.printStackTrace()
|
||||
}
|
||||
}
|
||||
} else {
|
||||
// if (type == INFO_TYPE_VIDEO) {
|
||||
// TipToast.shortTip("分享失败,请检查网络")
|
||||
// }
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
@@ -11,10 +11,14 @@ import android.os.IBinder
|
||||
import android.util.Log
|
||||
import com.elegant.analytics.Analytics
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.mogo.utils.storage.SharedPrefsMgr
|
||||
import com.zhidao.cosupload.manager.CosUploadManagerImpl
|
||||
import com.zhidao.roadcondition.BuildConfig
|
||||
import com.zhidao.roadcondition.constant.*
|
||||
import com.zhidao.roadcondition.constant.DEFAULT_VIDEO_DURATION
|
||||
import com.zhidao.roadcondition.constant.TANLU_ROAD_CURRENT
|
||||
import com.zhidao.roadcondition.constant.UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO
|
||||
import com.zhidao.roadcondition.constant.UPLOAD_FROM_STRATEGY_BLOCK_AUTO
|
||||
import com.zhidao.roadcondition.event.GetImageSuccessEvent
|
||||
import com.zhidao.roadcondition.event.LatLngStickyEventBus
|
||||
import com.zhidao.roadcondition.util.*
|
||||
@@ -66,11 +70,11 @@ class MainService : Service() {
|
||||
private var mLatitude: Double = 0.0
|
||||
|
||||
//发送主动上报结果广播给外部
|
||||
fun sendCustomResult(result: Boolean) {
|
||||
var intent = Intent(customResultAction)
|
||||
intent.putExtra("isSuccess", result)
|
||||
sendBroadcast(intent)
|
||||
}
|
||||
// fun sendCustomResult(result: Boolean) {
|
||||
// var intent = Intent(customResultAction)
|
||||
// intent.putExtra("isSuccess", result)
|
||||
// sendBroadcast(intent)
|
||||
// }
|
||||
|
||||
override fun onStartCommand(intent: Intent?, flags: Int, startId: Int): Int {
|
||||
Log.d(TAG, "onStartCommand -----------> ")
|
||||
@@ -80,7 +84,7 @@ class MainService : Service() {
|
||||
Analytics.getInstance().start(this)
|
||||
//参数说明:appKey: app唯一标识(比如:包名)
|
||||
CosUploadManagerImpl.getInstance(AbsMogoApplication.getApp().applicationContext)
|
||||
.init(BuildConfig.APPLICATION_ID, 2)
|
||||
.init(BuildConfig.APPLICATION_ID, 0)
|
||||
//初始化语音
|
||||
VoiceController.initVoice()
|
||||
|
||||
@@ -93,10 +97,10 @@ class MainService : Service() {
|
||||
mLongitude = it.lon
|
||||
mLatitude = it.lat
|
||||
Log.d(TAG, "onStartCommand shareType = $shareType --fromType = $fromType --mainInfoId = $mainInfoId -- mLongitude = $mLongitude --mLatitude = $mLatitude --it.duration = ${it.duration} ")
|
||||
if (shareType == TANLU_ROAD_CONGESTION || shareType == TANLU_TRAFFIC_CHECK || shareType == TANLU_ROAD_CLOSURE || shareType == TANLU_ROAD_CURRENT
|
||||
|| shareType == TANLU_ROAD_PONDING || shareType == TANLU_ROAD_ICING || shareType == TANLU_ROAD_HEAVY_FOG
|
||||
|| shareType == TANLU_ROAD_ACCIDENT || shareType == TANLU_ROAD_WORK
|
||||
) {
|
||||
// if (shareType == TANLU_ROAD_CONGESTION || shareType == TANLU_TRAFFIC_CHECK || shareType == TANLU_ROAD_CLOSURE || shareType == TANLU_ROAD_CURRENT
|
||||
// || shareType == TANLU_ROAD_PONDING || shareType == TANLU_ROAD_ICING || shareType == TANLU_ROAD_HEAVY_FOG
|
||||
// || shareType == TANLU_ROAD_ACCIDENT || shareType == TANLU_ROAD_WORK
|
||||
// ) {
|
||||
// takePhoto(1, false, true)
|
||||
if (fromType == UPLOAD_FROM_STRATEGY_ACCIDENT_AUTO || fromType == UPLOAD_FROM_STRATEGY_BLOCK_AUTO) {
|
||||
// 如果是策略上报,isCustom = false
|
||||
@@ -104,7 +108,7 @@ class MainService : Service() {
|
||||
} else {
|
||||
takeVideo(it.duration, isCustom = true, id = id)
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
} else {
|
||||
Log.e(TAG, "intent == null ")
|
||||
@@ -200,18 +204,18 @@ class MainService : Service() {
|
||||
}
|
||||
|
||||
private fun sendMarkerInfoReceiver(lat: Double, lon: Double, imageUrl: String?, type: String?) {
|
||||
Log.e("MainService", "sendMarkerInfoReceiver ------> type = $type ")
|
||||
Log.e("MainService", "sendMarkerInfoReceiver ------> fromType = $fromType ")
|
||||
Log.e("MainService", "sendMarkerInfoReceiver ------> isCustom = $isCustom ")
|
||||
var intent = Intent()
|
||||
intent.action = "com.zhidao.roadcondition.marker.info"
|
||||
intent.putExtra("type", type)
|
||||
intent.putExtra("imageUrl", imageUrl)
|
||||
intent.putExtra("lat", lat)
|
||||
intent.putExtra("lon", lon)
|
||||
intent.putExtra("custom", isCustom)
|
||||
intent.putExtra("fromType", fromType)
|
||||
sendBroadcast(intent)
|
||||
// Log.e("MainService", "sendMarkerInfoReceiver ------> type = $type ")
|
||||
// Log.e("MainService", "sendMarkerInfoReceiver ------> fromType = $fromType ")
|
||||
// Log.e("MainService", "sendMarkerInfoReceiver ------> isCustom = $isCustom ")
|
||||
// var intent = Intent()
|
||||
// intent.action = "com.zhidao.roadcondition.marker.info"
|
||||
// intent.putExtra("type", type)
|
||||
// intent.putExtra("imageUrl", imageUrl)
|
||||
// intent.putExtra("lat", lat)
|
||||
// intent.putExtra("lon", lon)
|
||||
// intent.putExtra("custom", isCustom)
|
||||
// intent.putExtra("fromType", fromType)
|
||||
// sendBroadcast(intent)
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -221,12 +225,16 @@ class MainService : Service() {
|
||||
//开始开始监听速度,只要超过一次5公里每小时则即开始获取策略进行本地上报 只有release才加此判断,qa环境方便测试
|
||||
LocationUtil.getInstance().setonSpeedlistenner(object : LocationUtil.SpeedListener {
|
||||
override fun onSpeedGet(speed: Float) {
|
||||
if (speed > (5 / 3.6f) && !isGetStrategies) {
|
||||
mainServiceHttpModel.initStrategies {
|
||||
handleReportStrategy()
|
||||
var isOpen = SharedPrefsMgr.getInstance(AbsMogoApplication.getApp().applicationContext).getBoolean("KEY_SERVER_REPORTSTRATEGY_SWITCH", false)
|
||||
Logger.d("EntrancePresenter", " -------- isOpen = $isOpen")
|
||||
if (isOpen) {
|
||||
if (speed > (5 / 3.6f) && !isGetStrategies) {
|
||||
mainServiceHttpModel.initStrategies {
|
||||
handleReportStrategy()
|
||||
}
|
||||
Log.d("MainService", "initLocationListener more than 5 start upload speed = $speed")
|
||||
isGetStrategies = true
|
||||
}
|
||||
Log.d("MainService", "initLocationListener more than 5 start upload speed = $speed")
|
||||
isGetStrategies = true
|
||||
}
|
||||
}
|
||||
})
|
||||
@@ -248,6 +256,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) {
|
||||
@@ -302,7 +311,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)
|
||||
|
||||
|
||||
@@ -2,7 +2,10 @@ package com.zhidao.roadcondition.service
|
||||
|
||||
import android.util.Log
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.zhidao.roadcondition.event.GetImageSuccessEvent
|
||||
import com.zhidao.roadcondition.event.LatLngStickyEventBus
|
||||
import com.zhidao.roadcondition.model.*
|
||||
import com.zhidao.roadcondition.model.proxy.INFO_TYPE_VIDEO
|
||||
import com.zhidao.roadcondition.net.request
|
||||
import com.zhidao.roadcondition.util.*
|
||||
import com.zhidao.roadcondition.util.StrategyPreferenceUtil.Companion.setStrategyFrequency
|
||||
@@ -231,10 +234,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(
|
||||
@@ -259,19 +264,28 @@ class MainServiceController {
|
||||
longitude: Double,
|
||||
latitude: Double
|
||||
) {
|
||||
Log.d(TAG, " geoLocation -- poiType = $poiType");
|
||||
Log.d(TAG, " geoLocation -- poiType = $poiType")
|
||||
LocationUtil.getInstance()
|
||||
.geoCodeLocation(locationInfo.toLatLngPoint(), { locInfo: LocationInfo ->
|
||||
Log.d(TAG, "geoLocation -------start -->")
|
||||
postInformationMessage(
|
||||
getInformationBody(type, url, locationInfo, isCustom, trafficInfoType, isShare, poiType,mainInfoId,longitude,latitude),
|
||||
customSend
|
||||
)
|
||||
}, {
|
||||
//转换失败的情况下再重试一次
|
||||
Log.d(TAG, "geoLocation -------true-->")
|
||||
geoRetryed = if (!geoRetryed) {
|
||||
geoLocation(type, url, locationInfo, isCustom, trafficInfoType, isShare, customSend, poiType,mainInfoId,longitude,latitude)
|
||||
true
|
||||
} else {
|
||||
//如果两次都失败,直接上报服务端
|
||||
Log.d(TAG, "geoLocation ---- postInformationMessage ---false-->")
|
||||
postInformationMessage(
|
||||
getInformationBody(type, url, locationInfo, isCustom, trafficInfoType, isShare, poiType,mainInfoId,longitude,latitude),
|
||||
customSend
|
||||
)
|
||||
|
||||
false
|
||||
}
|
||||
})
|
||||
@@ -292,7 +306,6 @@ class MainServiceController {
|
||||
trackUploadServer(1)
|
||||
// CosStatusController().videoAndThumbMap.clear()
|
||||
customSend?.invoke(true)
|
||||
|
||||
}
|
||||
onError {
|
||||
Log.i(TAG, "$it upload message ${it.message}")
|
||||
@@ -310,4 +323,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
|
||||
}
|
||||
|
||||
@@ -39,16 +39,18 @@ public class MainIndependentActivity extends MainActivity {
|
||||
eventPanelParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_entrance_fragment_container_marginLeft );
|
||||
mEntrance.setLayoutParams( eventPanelParams );
|
||||
|
||||
mLeftShadowFrame.setVisibility(View.VISIBLE);
|
||||
// 事件面板
|
||||
FrameLayout.LayoutParams historyMessagePanelParams = ( ( FrameLayout.LayoutParams ) mEventPanel.getLayoutParams() );
|
||||
historyMessagePanelParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_entrance_fragment_container_marginLeft );
|
||||
mHistoryMessagePanel.setLayoutParams( historyMessagePanelParams );
|
||||
|
||||
mLeftShadowFrame.setVisibility(View.INVISIBLE);
|
||||
mApps.setVisibility( View.GONE );
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onResume() {
|
||||
super.onResume();
|
||||
if ( mCoverUpLayout.getVisibility() != View.VISIBLE ) {
|
||||
mServiceApis.getAdasControllerApi().setUseAlgorithm( true );
|
||||
}
|
||||
if( Build.VERSION.SDK_INT >= Build.VERSION_CODES.N){
|
||||
fixInMultiWindowMode();
|
||||
}
|
||||
@@ -61,11 +63,9 @@ public class MainIndependentActivity extends MainActivity {
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
protected void onPause() {
|
||||
super.onPause();
|
||||
mServiceApis.getAdasControllerApi().setUseAlgorithm( false );
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft">358px</dimen>
|
||||
<dimen name="module_main_header_fragment_container_marginLeft">366px</dimen>
|
||||
</resources>
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft">358px</dimen>
|
||||
<dimen name="module_main_header_fragment_container_marginLeft">366px</dimen>
|
||||
</resources>
|
||||
@@ -1,5 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft">350px</dimen>
|
||||
<dimen name="module_main_entrance_fragment_container_marginLeft">358px</dimen>
|
||||
<dimen name="module_main_header_fragment_container_marginLeft">366px</dimen>
|
||||
</resources>
|
||||
@@ -2,15 +2,18 @@ package com.zhidao.mogo.module.main.launcher;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.os.Process;
|
||||
import android.text.TextUtils;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.extensions.utils.ExtensionsConfig;
|
||||
import com.mogo.module.main.MainActivity;
|
||||
import com.mogo.module.main.cards.MogoModulesManager;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* 针对作为Launcher的情况,做个性化操作
|
||||
@@ -82,4 +85,29 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
protected boolean shouldCloseADASPanelWhenPause() {
|
||||
return !mIsHomeKeyDown;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onDestroy() {
|
||||
super.onDestroy();
|
||||
try {
|
||||
// acc off 之后会出现进程还在,但是页面被杀的情况,这个直接杀掉进程,然后让整个进程重启
|
||||
Process.killProcess( Process.myPid() );
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapUiModeChanged( EnumMapUI mapUI ) {
|
||||
super.onMapUiModeChanged( mapUI );
|
||||
Intent intent = new Intent( "com.mogo.style.SKIN_CHANGED" );
|
||||
intent.putExtra( "type", -1 );
|
||||
if ( mapUI == EnumMapUI.Type_Light ) {
|
||||
intent.putExtra( "type", 1 );
|
||||
} else if( mapUI == EnumMapUI.Type_Night ){
|
||||
intent.putExtra( "type", 0 );
|
||||
}
|
||||
sendBroadcast( intent );
|
||||
Logger.d( TAG, "send msg to AI Voice" );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,9 +1,7 @@
|
||||
package com.mogo.module.apps;
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.service.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
|
||||
/**
|
||||
* author : zyz
|
||||
@@ -20,7 +18,7 @@ public class AppServiceHandler {
|
||||
|
||||
public static IMogoServiceApis getApis() {
|
||||
if ( mApis == null ) {
|
||||
mApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation( AbsMogoApplication.getApp() );
|
||||
mApis = MogoApisHandler.getInstance().getApis();
|
||||
}
|
||||
return mApis;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -6,14 +6,12 @@ import androidx.lifecycle.LifecycleOwner;
|
||||
import com.mogo.commons.mvp.Presenter;
|
||||
import com.mogo.module.apps.applaunch.AppLaunchFilter;
|
||||
import com.mogo.module.apps.applaunch.AppLauncher;
|
||||
import com.mogo.module.apps.applaunch.CardAppLauncher;
|
||||
import com.mogo.module.apps.applaunch.GuideShowLauncher;
|
||||
import com.mogo.module.apps.applaunch.InternalFunctionLauncher;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
import com.mogo.module.apps.model.AppsModel;
|
||||
import com.mogo.module.apps.model.UnScannedApps;
|
||||
import com.mogo.service.analytics.IMogoAnalytics;
|
||||
import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.UiThreadHandler;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
@@ -38,16 +36,11 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
private IMogoAnalytics mAnalytics;
|
||||
private AppLaunchFilter mLauncher;
|
||||
|
||||
private IMogoCardManager mCardManager;
|
||||
|
||||
public AppsPresenter( AppsView view ) {
|
||||
super( view );
|
||||
mCardManager = AppServiceHandler.getApis().getCardManagerApi();
|
||||
InternalFunctionLauncher internalFunctionLauncher = new InternalFunctionLauncher( getContext() );
|
||||
CardAppLauncher cardAppLauncher = new CardAppLauncher( this, mCardManager );
|
||||
GuideShowLauncher guideShowLauncher = new GuideShowLauncher( AppServiceHandler.getApis().getMapServiceApi().getNavi( getContext() ) );
|
||||
internalFunctionLauncher.setNext( cardAppLauncher );
|
||||
cardAppLauncher.setNext( guideShowLauncher );
|
||||
internalFunctionLauncher.setNext( guideShowLauncher );
|
||||
guideShowLauncher.setNext( new AppLauncher() );
|
||||
mLauncher = internalFunctionLauncher;
|
||||
}
|
||||
@@ -174,12 +167,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 +209,11 @@ public class AppsPresenter extends Presenter< AppsView > {
|
||||
AppsListChangedLiveData.getInstance().release();
|
||||
mView = null;
|
||||
mLauncher.destroy();
|
||||
mAnalytics = 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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,52 +0,0 @@
|
||||
package com.mogo.module.apps.applaunch;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.module.apps.AppsPresenter;
|
||||
import com.mogo.module.apps.model.AppInfo;
|
||||
import com.mogo.service.cardmanager.IMogoCardManager;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-02-09
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class CardAppLauncher extends BaseAppLauncher {
|
||||
|
||||
private static Map< String, String > sCardApps = new HashMap<>();
|
||||
|
||||
static {
|
||||
sCardApps.put( "com.zhidao.roadcondition.split", "CARD_TYPE_ROAD_CONDITION" );
|
||||
sCardApps.put( "com.zhidao.roadcondition", "CARD_TYPE_ROAD_CONDITION" );
|
||||
sCardApps.put( "com.zhidao.imdemo", "CARD_TYPE_CARS_CHATTING" );
|
||||
}
|
||||
|
||||
private AppsPresenter mAppsPresenter;
|
||||
private IMogoCardManager mCardManager;
|
||||
|
||||
public CardAppLauncher( AppsPresenter mAppsPresenter, IMogoCardManager mCardManager ) {
|
||||
this.mAppsPresenter = mAppsPresenter;
|
||||
this.mCardManager = mCardManager;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void launch( Context context, AppInfo appInfo ) {
|
||||
if ( getNext() != null ) {
|
||||
getNext().launch( context, appInfo );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
mAppsPresenter = null;
|
||||
mCardManager = null;
|
||||
if ( getNext() != null ) {
|
||||
getNext().destroy();
|
||||
setNext( null );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -103,6 +103,7 @@ public class InternalFunctionLauncher extends BaseAppLauncher {
|
||||
public void destroy() {
|
||||
if ( getNext() != null ) {
|
||||
getNext().destroy();
|
||||
setNext( null );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -25,7 +25,7 @@ import java.util.concurrent.atomic.AtomicBoolean;
|
||||
* 加载并保存 app 列表
|
||||
*/
|
||||
public class AppsModel {
|
||||
|
||||
|
||||
private static final String TAG = "AppsModel";
|
||||
|
||||
private static volatile AppsModel sInstance;
|
||||
@@ -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 ) {
|
||||
@@ -57,7 +57,6 @@ public class AppsModel {
|
||||
if ( mPagedApps != null ) {
|
||||
mPagedApps.clear();
|
||||
}
|
||||
mPagedApps = null;
|
||||
mContext = null;
|
||||
mAppFilter = null;
|
||||
sInstance = null;
|
||||
@@ -88,7 +87,7 @@ public class AppsModel {
|
||||
continue;
|
||||
}
|
||||
int page = counter++ / AppsConst.TOTAL_SIZE_EACH_PAGE;
|
||||
if ( !mPagedApps.containsKey( page ) ) {
|
||||
if ( mPagedApps.get( page ) == null ) {
|
||||
mPagedApps.put( page, new ArrayList<>() );
|
||||
}
|
||||
String appName = getApplicationName( packageManager, packageInfo );
|
||||
@@ -116,9 +115,12 @@ public class AppsModel {
|
||||
if ( TextUtils.isEmpty( packageName ) ) {
|
||||
return;
|
||||
}
|
||||
if ( mPagedApps.isEmpty() ) {
|
||||
if ( mPagedApps == null || mPagedApps.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
if ( mAppFilter == null ) {
|
||||
mAppFilter = new AppFilterImpl( mContext );
|
||||
}
|
||||
try {
|
||||
final PackageManager packageManager = mContext.getPackageManager();
|
||||
PackageInfo packageInfo = packageManager.getPackageInfo( packageName, 0 );
|
||||
@@ -129,7 +131,7 @@ public class AppsModel {
|
||||
Drawable appIcon = packageInfo.applicationInfo.loadIcon( packageManager );
|
||||
AppInfo appInfo = new AppInfo( appName, packageName, versionName, versionCode, appIcon, AppEnumHelper.getCustomizedAppIconResId( packageName ) );
|
||||
int pageIndex = getPageIndex( packageName, true );
|
||||
if ( !mPagedApps.containsKey( pageIndex ) ) {
|
||||
if ( mPagedApps.get( pageIndex ) == null ) {
|
||||
mPagedApps.put( pageIndex, new ArrayList<>() );
|
||||
}
|
||||
mPagedApps.get( pageIndex ).add( appInfo );
|
||||
@@ -154,7 +156,8 @@ public class AppsModel {
|
||||
if ( totalPages == 0 ) {
|
||||
return 0;
|
||||
} else {
|
||||
if ( mPagedApps.get( totalPages - 1 ).size() == AppsConst.TOTAL_SIZE_EACH_PAGE ) {
|
||||
if ( mPagedApps.get( totalPages - 1 ) == null
|
||||
|| mPagedApps.get( totalPages - 1 ).size() == AppsConst.TOTAL_SIZE_EACH_PAGE ) {
|
||||
return totalPages;
|
||||
} else {
|
||||
return totalPages - 1;
|
||||
@@ -183,6 +186,9 @@ public class AppsModel {
|
||||
if ( TextUtils.isEmpty( packageName ) ) {
|
||||
return;
|
||||
}
|
||||
if ( mPagedApps == null || mPagedApps.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
int pageIndex = getPageIndex( packageName, false );
|
||||
if ( pageIndex == -1 ) {
|
||||
@@ -200,7 +206,7 @@ public class AppsModel {
|
||||
continue;
|
||||
}
|
||||
int page = counter++ / AppsConst.TOTAL_SIZE_EACH_PAGE + pageIndex;
|
||||
if ( !mPagedApps.containsKey( page ) ) {
|
||||
if ( mPagedApps.get( page ) == null ) {
|
||||
mPagedApps.put( page, new ArrayList<>() );
|
||||
}
|
||||
mPagedApps.get( page ).add( appInfo );
|
||||
|
||||
@@ -27,10 +27,10 @@ class OnAiAssistClickListener implements View.OnClickListener {
|
||||
@Override
|
||||
public void onClick( View v ) {
|
||||
if ( Devices.isBind() || !DebugConfig.isActiveAIAssistFlag() ) {
|
||||
AIAssist.startAssistant( v.getContext() );
|
||||
AIAssist.getInstance( v.getContext() ).startAssistant( v.getContext() );
|
||||
} else {
|
||||
if ( mDebugModeOpen ) {
|
||||
AIAssist.startAssistant( v.getContext(), 1 );
|
||||
AIAssist.getInstance( v.getContext() ).startAssistant( v.getContext(), 1 );
|
||||
return;
|
||||
}
|
||||
if ( mClickCounter == 0 ) {
|
||||
@@ -38,7 +38,7 @@ class OnAiAssistClickListener implements View.OnClickListener {
|
||||
mClickCounter++;
|
||||
} else {
|
||||
if ( mClickCounter == TOTAL_CLICK_AMOUNT ) {
|
||||
AIAssist.startAssistant( v.getContext(), 2 );
|
||||
AIAssist.getInstance( v.getContext() ).startAssistant( v.getContext(), 2 );
|
||||
TipToast.shortTip( "开启语音调试" );
|
||||
mClickCounter = 0;
|
||||
mLastClickTime = 0L;
|
||||
|
||||
|
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 |