@@ -64,6 +64,15 @@ project.android.productFlavors {
|
||||
}
|
||||
}
|
||||
}
|
||||
// f系列-分体机
|
||||
phone {
|
||||
externalNativeBuild {
|
||||
ndk {
|
||||
// 设置支持的SO库架构
|
||||
abiFilters "arm64-v8a"
|
||||
}
|
||||
}
|
||||
}
|
||||
// f系列-分体机-高德
|
||||
f8Amap {
|
||||
externalNativeBuild {
|
||||
@@ -73,4 +82,13 @@ project.android.productFlavors {
|
||||
}
|
||||
}
|
||||
}
|
||||
// 比亚迪
|
||||
bydauto {
|
||||
externalNativeBuild {
|
||||
ndk {
|
||||
// 设置支持的SO库架构
|
||||
abiFilters "armeabi-v7a"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,8 @@
|
||||
// 基础服务:仅比亚迪渠道用sdk方式实现,其他都基于apk基础服务
|
||||
project.dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
bydautoImplementation rootProject.ext.dependencies.mogoaicloudservicesdk
|
||||
phoneImplementation rootProject.ext.dependencies.mogoaicloudservicesdk
|
||||
|
||||
f8xxImplementation rootProject.ext.dependencies.mogoaicloudserviceapk
|
||||
f80xImplementation rootProject.ext.dependencies.mogoaicloudserviceapk
|
||||
@@ -12,6 +14,8 @@ project.dependencies {
|
||||
fPadLenovoOchTaxiImplementation rootProject.ext.dependencies.mogoaicloudservicesdk
|
||||
fPadLenovoOchBusImplementation rootProject.ext.dependencies.mogoaicloudservicesdk
|
||||
} else {
|
||||
bydautoImplementation project(':foudations:mogo-aicloud-services-sdk')
|
||||
phoneImplementation project(':foudations:mogo-aicloud-services-sdk')
|
||||
|
||||
f8xxImplementation project(':foudations:mogo-aicloud-services-apk')
|
||||
f80xImplementation project(':foudations:mogo-aicloud-services-apk')
|
||||
|
||||
@@ -6,12 +6,15 @@ project.dependencies {
|
||||
f80xImplementation rootProject.ext.dependencies.mapcustom
|
||||
fochtaxiImplementation rootProject.ext.dependencies.mapcustom
|
||||
fochbusImplementation rootProject.ext.dependencies.mapcustom
|
||||
phoneImplementation rootProject.ext.dependencies.mapcustom
|
||||
|
||||
fPadLenovoImplementation rootProject.ext.dependencies.mapcustom
|
||||
fPadLenovoOchTaxiImplementation rootProject.ext.dependencies.mapcustom
|
||||
fPadLenovoOchBusImplementation rootProject.ext.dependencies.mapcustom
|
||||
|
||||
f8AmapImplementation rootProject.ext.dependencies.mapamap
|
||||
bydautoImplementation rootProject.ext.dependencies.mapamap
|
||||
|
||||
} else {
|
||||
f8xxImplementation project(':libraries:map-custom')
|
||||
f80xImplementation project(':libraries:map-custom')
|
||||
@@ -22,6 +25,10 @@ project.dependencies {
|
||||
fPadLenovoOchTaxiImplementation project(':libraries:map-custom')
|
||||
fPadLenovoOchBusImplementation project(':libraries:map-custom')
|
||||
|
||||
phoneImplementation project(':libraries:map-custom')
|
||||
|
||||
f8AmapImplementation project(':libraries:map-amap')
|
||||
bydautoImplementation project(':libraries:map-amap')
|
||||
|
||||
}
|
||||
}
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
project.dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
bydautoImplementation rootProject.ext.dependencies.mogobaseservicesdk
|
||||
phoneImplementation rootProject.ext.dependencies.mogobaseservicesdk
|
||||
|
||||
f8xxImplementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||
f80xImplementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||
f8AmapImplementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||
@@ -12,6 +15,9 @@ project.dependencies {
|
||||
fPadLenovoOchTaxiImplementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||
fPadLenovoOchBusImplementation rootProject.ext.dependencies.mogobaseserviceapk
|
||||
} else {
|
||||
bydautoImplementation project(':foudations:mogo-base-services-sdk')
|
||||
phoneImplementation project(':foudations:mogo-base-services-sdk')
|
||||
|
||||
f8xxImplementation project(':foudations:mogo-base-services-apk')
|
||||
f80xImplementation project(':foudations:mogo-base-services-apk')
|
||||
f8AmapImplementation project(':foudations:mogo-base-services-apk')
|
||||
|
||||
@@ -2,6 +2,8 @@
|
||||
|
||||
project.dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
bydautoImplementation rootProject.ext.dependencies.mogomoduleguide
|
||||
phoneImplementation rootProject.ext.dependencies.mogomoduleguide
|
||||
f8xxImplementation rootProject.ext.dependencies.mogomoduleguide
|
||||
f80xImplementation rootProject.ext.dependencies.mogomoduleguide
|
||||
f8AmapImplementation rootProject.ext.dependencies.mogomoduleguide
|
||||
@@ -13,6 +15,8 @@ project.dependencies {
|
||||
fPadLenovoOchTaxiImplementation rootProject.ext.dependencies.mogomoduleguide
|
||||
fPadLenovoOchBusImplementation rootProject.ext.dependencies.mogomoduleguide
|
||||
} else {
|
||||
bydautoImplementation project(':modules:mogo-module-guide')
|
||||
phoneImplementation project(':modules:mogo-module-guide')
|
||||
|
||||
f8xxImplementation project(':modules:mogo-module-guide')
|
||||
f80xImplementation project(':modules:mogo-module-guide')
|
||||
|
||||
@@ -2,6 +2,9 @@
|
||||
|
||||
project.dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
bydautoImplementation rootProject.ext.dependencies.moduleleftpanel
|
||||
phoneImplementation rootProject.ext.dependencies.moduleleftpanelnoop
|
||||
|
||||
f8xxImplementation rootProject.ext.dependencies.moduleleftpanelnoop
|
||||
f80xImplementation rootProject.ext.dependencies.moduleleftpanelnoop
|
||||
f8AmapImplementation rootProject.ext.dependencies.moduleleftpanelnoop
|
||||
@@ -14,6 +17,9 @@ project.dependencies {
|
||||
fPadLenovoOchBusImplementation rootProject.ext.dependencies.moduleleftpanelnoop
|
||||
|
||||
} else {
|
||||
bydautoImplementation project(':modules:mogo-module-left-panel')
|
||||
phoneImplementation project(':modules:mogo-module-left-panel-noop')
|
||||
|
||||
f8xxImplementation project(':modules:mogo-module-left-panel-noop')
|
||||
f80xImplementation project(':modules:mogo-module-left-panel-noop')
|
||||
f8AmapImplementation project(':modules:mogo-module-left-panel-noop')
|
||||
|
||||
9
app/functions/mediaui.gradle
Normal file
@@ -0,0 +1,9 @@
|
||||
// 音乐播放模块
|
||||
|
||||
project.dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
launcherImplementation rootProject.ext.dependencies.modulemedia
|
||||
} else {
|
||||
launcherImplementation project(':modules:mogo-module-media')
|
||||
}
|
||||
}
|
||||
@@ -1,6 +1,9 @@
|
||||
// 网约车服务:仅小巴车、出租车渠道用
|
||||
project.dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
bydautoImplementation rootProject.ext.dependencies.mogoochnoop
|
||||
phoneImplementation rootProject.ext.dependencies.mogoochnoop
|
||||
|
||||
f8xxImplementation rootProject.ext.dependencies.mogoochnoop
|
||||
f80xImplementation rootProject.ext.dependencies.mogoochnoop
|
||||
f8AmapImplementation rootProject.ext.dependencies.mogoochnoop
|
||||
@@ -12,6 +15,9 @@ project.dependencies {
|
||||
fPadLenovoOchTaxiImplementation rootProject.ext.dependencies.mogoochtaxi
|
||||
fPadLenovoOchBusImplementation rootProject.ext.dependencies.mogoochbus
|
||||
} else {
|
||||
bydautoImplementation project(':OCH:mogo-och-noop')
|
||||
phoneImplementation project(':OCH:mogo-och-noop')
|
||||
|
||||
f8xxImplementation project(':OCH:mogo-och-noop')
|
||||
f80xImplementation project(':OCH:mogo-och-noop')
|
||||
f8AmapImplementation project(':OCH:mogo-och-noop')
|
||||
|
||||
@@ -3,10 +3,14 @@
|
||||
project.dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
launcherImplementation rootProject.ext.dependencies.modulemainlauncher
|
||||
independentImplementation rootProject.ext.dependencies.modulemainindependent
|
||||
|
||||
// 仅launcher需要引入该模块
|
||||
launcherImplementation rootProject.ext.dependencies.moduleapps
|
||||
} else {
|
||||
launcherImplementation project(':main-extensions:mogo-module-main-launcher')
|
||||
independentImplementation project(':main-extensions:mogo-module-main-independent')
|
||||
|
||||
// 仅launcher需要引入该模块
|
||||
launcherImplementation project(':modules:mogo-module-apps')
|
||||
}
|
||||
|
||||
@@ -1,5 +1,8 @@
|
||||
project.dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
bydautoImplementation rootProject.ext.dependencies.skinsupportnoop
|
||||
phoneImplementation rootProject.ext.dependencies.skinsupportimpl
|
||||
|
||||
f8xxImplementation rootProject.ext.dependencies.skinsupportimpl
|
||||
f80xImplementation rootProject.ext.dependencies.skinsupportimpl
|
||||
f8AmapImplementation rootProject.ext.dependencies.skinsupportimpl
|
||||
@@ -11,6 +14,9 @@ project.dependencies {
|
||||
fPadLenovoOchTaxiImplementation rootProject.ext.dependencies.skinsupportimpl
|
||||
fPadLenovoOchBusImplementation rootProject.ext.dependencies.skinsupportimpl
|
||||
|
||||
|
||||
phoneImplementation rootProject.ext.dependencies.skinsupportlight
|
||||
|
||||
f8xxImplementation rootProject.ext.dependencies.skinsupportlight
|
||||
f80xImplementation rootProject.ext.dependencies.skinsupportlight
|
||||
f8AmapImplementation rootProject.ext.dependencies.skinsupportlight
|
||||
@@ -22,6 +28,10 @@ project.dependencies {
|
||||
fPadLenovoOchTaxiImplementation rootProject.ext.dependencies.skinsupportlight
|
||||
fPadLenovoOchBusImplementation rootProject.ext.dependencies.skinsupportlight
|
||||
} else {
|
||||
|
||||
bydautoImplementation project(':skin:mogo-skin-support-noop')
|
||||
phoneImplementation project(':skin:mogo-skin-support-impl')
|
||||
|
||||
f8xxImplementation project(':skin:mogo-skin-support-impl')
|
||||
f80xImplementation project(':skin:mogo-skin-support-impl')
|
||||
f8AmapImplementation project(':skin:mogo-skin-support-impl')
|
||||
@@ -33,6 +43,9 @@ project.dependencies {
|
||||
fPadLenovoOchTaxiImplementation project(':skin:mogo-skin-support-impl')
|
||||
fPadLenovoOchBusImplementation project(':skin:mogo-skin-support-impl')
|
||||
|
||||
|
||||
phoneImplementation project(':skin:mogo-skin-light')
|
||||
|
||||
f8xxImplementation project(':skin:mogo-skin-light')
|
||||
f80xImplementation project(':skin:mogo-skin-light')
|
||||
f8AmapImplementation project(':skin:mogo-skin-light')
|
||||
@@ -43,5 +56,6 @@ project.dependencies {
|
||||
fPadLenovoImplementation project(':skin:mogo-skin-light')
|
||||
fPadLenovoOchTaxiImplementation project(':skin:mogo-skin-light')
|
||||
fPadLenovoOchBusImplementation project(':skin:mogo-skin-light')
|
||||
|
||||
}
|
||||
}
|
||||
@@ -4,8 +4,10 @@ project.dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.modulepushbase
|
||||
launcherImplementation rootProject.ext.dependencies.modulepush
|
||||
independentImplementation rootProject.ext.dependencies.modulepushnoop
|
||||
} else {
|
||||
implementation project(":modules:mogo-module-push-base")
|
||||
launcherImplementation project(":modules:mogo-module-push")
|
||||
independentImplementation project(":modules:mogo-module-push-noop")
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,8 @@
|
||||
project.dependencies {
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
bydautoImplementation rootProject.ext.dependencies.ttsdi
|
||||
phoneImplementation rootProject.ext.dependencies.ttszhi
|
||||
|
||||
f8xxImplementation rootProject.ext.dependencies.ttszhi
|
||||
f80xImplementation rootProject.ext.dependencies.ttszhi
|
||||
f8AmapImplementation rootProject.ext.dependencies.ttszhi
|
||||
@@ -11,6 +14,9 @@ project.dependencies {
|
||||
fPadLenovoOchTaxiImplementation rootProject.ext.dependencies.ttspad
|
||||
fPadLenovoOchBusImplementation rootProject.ext.dependencies.ttspad
|
||||
} else {
|
||||
bydautoImplementation project(':tts:tts-di')
|
||||
phoneImplementation project(':tts:tts-zhi')
|
||||
|
||||
f8xxImplementation project(':tts:tts-zhi')
|
||||
f80xImplementation project(':tts:tts-zhi')
|
||||
f8AmapImplementation project(':tts:tts-zhi')
|
||||
|
||||
37
app/productFlavors/bydauto.gradle
Normal file
@@ -0,0 +1,37 @@
|
||||
project.android.productFlavors {
|
||||
// 比亚迪
|
||||
bydauto {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
// 应用包名
|
||||
applicationId rootProject.ext.android.bydautoIndependentApplicationId
|
||||
dimension "product"
|
||||
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'false'
|
||||
// 车机类型,主要用于区分自研车机还是别人家的车机,其他车机,比亚迪定为1
|
||||
buildConfigField 'int', 'CAR_MACHINE_TYPE', '1'
|
||||
buildConfigField 'boolean', 'ROAD_EVENT_ANIMATED', 'true'
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.bydautoIndependentApiValue, CHANNEL_VALUE: "bydauto"]
|
||||
// 是否使用高德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'
|
||||
// 是否基于地图
|
||||
buildConfigField 'boolean', 'IS_MAP_BASED', 'true'
|
||||
// 是否加载引导模块
|
||||
buildConfigField 'boolean', 'IS_NEED_LOAD_GUIDE_MODULE', 'true'
|
||||
// 分享时是否隐藏 adas
|
||||
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
|
||||
// 是否需要实时上报坐标
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'false'
|
||||
// 是否需要使用工控机的rtk定位
|
||||
buildConfigField 'boolean', 'IS_USE_ADAS_RTK_LOCATION_INFO', 'false'
|
||||
// 是否需要悬浮窗权限申请
|
||||
buildConfigField 'boolean', 'IS_NEED_REQUEST_FLOAT_PERMISSION', 'true'
|
||||
// GPS数据提供源: 0-Android系统,1-工控机,2-OBU
|
||||
buildConfigField 'int', 'GPS_PROVIDER', "1"
|
||||
}
|
||||
}
|
||||
35
app/productFlavors/phone.gradle
Normal file
@@ -0,0 +1,35 @@
|
||||
project.android.productFlavors {
|
||||
// f系列-分体机
|
||||
phone {
|
||||
// 应用包名
|
||||
applicationId rootProject.ext.android.fLauncherApplicationId
|
||||
dimension "product"
|
||||
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'false'
|
||||
// 车机类型,主要用于区分自研车机还是别人家的车机,自研车机类型为0
|
||||
buildConfigField 'int', 'CAR_MACHINE_TYPE', '1'
|
||||
buildConfigField 'boolean', 'ROAD_EVENT_ANIMATED', 'true'
|
||||
manifestPlaceholders = [AMAP_API_VALUE: rootProject.ext.android.fLauncherAmapApiValue, CHANNEL_VALUE: "phone"]
|
||||
// 是否使用高德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'
|
||||
// 是否基于地图
|
||||
buildConfigField 'boolean', 'IS_MAP_BASED', 'true'
|
||||
// 是否加载引导模块
|
||||
buildConfigField 'boolean', 'IS_NEED_LOAD_GUIDE_MODULE', 'true'
|
||||
// 分享时是否隐藏 adas
|
||||
buildConfigField 'boolean', 'IS_NEED_HIDE_ADAS_WHEN_SHARE', 'false'
|
||||
// 是否需要实时上报坐标
|
||||
buildConfigField 'boolean', 'IS_NEED_UPLOAD_COORDINATES_IN_TIME', 'true'
|
||||
// 是否需要使用工控机的rtk定位
|
||||
buildConfigField 'boolean', 'IS_USE_ADAS_RTK_LOCATION_INFO', 'true'
|
||||
// 是否需要悬浮窗权限申请
|
||||
buildConfigField 'boolean', 'IS_NEED_REQUEST_FLOAT_PERMISSION', 'true'
|
||||
// GPS数据提供源: 0-Android系统,1-工控机,2-OBU
|
||||
buildConfigField 'int', 'GPS_PROVIDER', "1"
|
||||
}
|
||||
}
|
||||
@@ -2,12 +2,21 @@
|
||||
|
||||
afterEvaluate {
|
||||
|
||||
def independent = ["bydauto", "phone"]
|
||||
def launcher = ["f80x", "f8xx", "f8amap", "fochtaxi", "fochbus", "fPadLenovo", "fPadLenovoOchTaxi", "fPadLenovoOchBus"]
|
||||
|
||||
it.getTasks().iterator().forEachRemaining {
|
||||
def task = it
|
||||
def taskName = task.name
|
||||
if (taskName.startsWith("assemble")
|
||||
&& taskName.contains("Independent")
|
||||
&& (taskName.endsWith("Debug") || taskName.endsWith("Release"))) {
|
||||
independent.forEach {
|
||||
if (taskName.toLowerCase().contains(it)) {
|
||||
task.group = "assembleIndependent"
|
||||
}
|
||||
}
|
||||
} else if (taskName.startsWith("assemble")
|
||||
&& taskName.contains("Launcher")
|
||||
&& (taskName.endsWith("Debug") || taskName.endsWith("Release"))) {
|
||||
launcher.forEach {
|
||||
@@ -15,6 +24,14 @@ afterEvaluate {
|
||||
task.group = "assembleLauncher"
|
||||
}
|
||||
}
|
||||
} else if (taskName.startsWith("install")
|
||||
&& taskName.contains("Independent")
|
||||
&& (taskName.endsWith("Debug") || taskName.endsWith("Release"))) {
|
||||
independent.forEach {
|
||||
if (taskName.toLowerCase().contains(it)) {
|
||||
task.group = "installIndependent"
|
||||
}
|
||||
}
|
||||
} else if (taskName.startsWith("install")
|
||||
&& taskName.contains("Launcher")
|
||||
&& (taskName.endsWith("Debug") || taskName.endsWith("Release"))) {
|
||||
|
||||
5
app/src/e8xx/AndroidManifest.xml
Normal file
@@ -0,0 +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"
|
||||
package="com.mogo.launcher">
|
||||
</manifest>
|
||||
6
app/src/em4/AndroidManifest.xml
Normal file
@@ -0,0 +1,6 @@
|
||||
<?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>
|
||||
28
app/src/launcher/AndroidManifest.xml
Normal file
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
package="com.mogo.launcher">
|
||||
|
||||
<uses-permission android:name="android.permission.WAKE_LOCK" />
|
||||
|
||||
<application
|
||||
android:name=".MogoApplication"
|
||||
android:allowBackup="true"
|
||||
android:icon="@drawable/ic_launcher"
|
||||
android:label="@string/app_shell_name"
|
||||
android:supportsRtl="true"
|
||||
android:theme="@style/AppTheme.App"
|
||||
tools:replace="android:label">
|
||||
<!-- <provider-->
|
||||
<!-- android:name="com.mogo.module.navi.cp.AddressContentProvider"-->
|
||||
<!-- android:authorities="com.zhidao.auto.personal.provider"-->
|
||||
<!-- android:enabled="true"-->
|
||||
<!-- android:exported="true" />-->
|
||||
<!-- <meta-data-->
|
||||
<!-- android:name="com.amap.api.v2.apikey"-->
|
||||
<!-- android:value="a36b9f7b086fa3951bb35338a5a06dd3"-->
|
||||
<!-- tools:replace="android:value" />-->
|
||||
<!-- 高德地图 -->
|
||||
</application>
|
||||
|
||||
</manifest>
|
||||
@@ -102,6 +102,7 @@ ext {
|
||||
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}",
|
||||
@@ -117,6 +118,7 @@ ext {
|
||||
moduleV2x : "com.mogo.module:module-v2x:${MOGO_MODULE_V2X_VERSION}",
|
||||
moduleSmallMap : "com.mogo.module:module-small-map:${MOGO_MODULES_SMALL_MAP}",
|
||||
moduleADAS : "com.mogo.module:mogo-module-adas:${MOGO_MODULES_ADAS}",
|
||||
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}",
|
||||
|
||||
1
foudations/httpdns-tencent/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
46
foudations/httpdns-tencent/build.gradle
Normal file
@@ -0,0 +1,46 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation "com.mogo.tencent.httpdns:android-httpdns:+@aar"
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
annotationProcessor rootProject.ext.dependencies.aroutercompiler
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.httpdnsbase
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
} else {
|
||||
implementation project(':foudations:httpdns-base')
|
||||
implementation project(':foudations:mogo-commons')
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
0
foudations/httpdns-tencent/consumer-rules.pro
Normal file
3
foudations/httpdns-tencent/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.httpdns
|
||||
POM_ARTIFACT_ID=httpdns-tencent
|
||||
VERSION_CODE=1
|
||||
21
foudations/httpdns-tencent/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
19
foudations/httpdns-tencent/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1,19 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.httpdns">
|
||||
|
||||
<uses-permission android:name="android.permission.ACCESS_NETWORK_STATE" />
|
||||
<uses-permission android:name="android.permission.ACCESS_WIFI_STATE" />
|
||||
<uses-permission android:name="android.permission.INTERNET" />
|
||||
|
||||
<!-- 用于获取手机imei码进行数据上报,非必须 -->
|
||||
<uses-permission android:name="android.permission.READ_PHONE_STATE" />
|
||||
|
||||
<!-- 灯塔 -->
|
||||
<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
|
||||
|
||||
<application>
|
||||
<meta-data android:name="HTTP_DNS_APP_KEY" android:value="0I00093F244N42WU"/>
|
||||
<meta-data android:name="HTTP_DNS_ID" android:value="2742"/>
|
||||
<meta-data android:name="HTTP_DNS_KEY" android:value="7Pplkaua"/>
|
||||
</application>
|
||||
</manifest>
|
||||
@@ -0,0 +1,170 @@
|
||||
package com.mogo.httpdns.tencent;
|
||||
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.tencent.msdk.dns.MSDKDnsResolver;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/11/18
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
class HttpDnsIpsCache {
|
||||
|
||||
private static final String TAG = "HttpDnsIpsCache";
|
||||
|
||||
// 缓存过期时间
|
||||
public static final long INTERVAL_CACHE = 60 * 60 * 1000;
|
||||
|
||||
// 刷新缓存时间
|
||||
public static final long TTL = ( long ) ( INTERVAL_CACHE * 0.75 );
|
||||
|
||||
// 使用dns新域名
|
||||
public static final int MSG_DNS_FLUSH = 6000000;
|
||||
// ttl
|
||||
public static final int MSG_DNS_TTL = 6000001;
|
||||
|
||||
private final static Map< String, String > sCaches = new ConcurrentHashMap<>();
|
||||
private final static Map< String, String > sTTLCaches = new ConcurrentHashMap<>();
|
||||
|
||||
private final static Map< String, IHttpDnsTtlCallback > sTtlCallbacks = new ConcurrentHashMap<>();
|
||||
|
||||
private final static Handler sHandler = new Handler( Looper.getMainLooper() ) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
if ( msg.what == MSG_DNS_FLUSH ) {
|
||||
flushNewDnsCache();
|
||||
postTtlCallback();
|
||||
loopDnsParse();
|
||||
} else if ( msg.what == MSG_DNS_TTL ) {
|
||||
parseHosts();
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* 将 ttl 消息回调
|
||||
*/
|
||||
static void postTtlCallback() {
|
||||
if ( sTtlCallbacks.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
Collection<IHttpDnsTtlCallback> callbacks = sTtlCallbacks.values();
|
||||
if (callbacks.isEmpty()) {
|
||||
return;
|
||||
}
|
||||
for ( IHttpDnsTtlCallback callback : callbacks ) {
|
||||
if ( callback == null ) {
|
||||
continue;
|
||||
}
|
||||
try {
|
||||
callback.onTtl();
|
||||
} catch ( Exception e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 缓存域名
|
||||
*
|
||||
* @param host
|
||||
* @param ip
|
||||
*/
|
||||
static void cache( String host, String ip ) {
|
||||
sCaches.put( host, ip );
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取缓存中的域名
|
||||
*
|
||||
* @param host
|
||||
* @return
|
||||
*/
|
||||
static String getHttpDnsIps( String host ) {
|
||||
return sCaches.get( host );
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用新的 dns 缓存
|
||||
*/
|
||||
static void flushNewDnsCache() {
|
||||
sCaches.clear();
|
||||
sCaches.putAll( sTTLCaches );
|
||||
}
|
||||
|
||||
/**
|
||||
* ttl 到达后,刷新一遍 dns 域名
|
||||
*/
|
||||
static void loopDnsParse() {
|
||||
Logger.d( TAG, "使用新的dns列表" );
|
||||
sHandler.sendEmptyMessageDelayed( MSG_DNS_FLUSH, INTERVAL_CACHE );
|
||||
sHandler.sendEmptyMessageDelayed( MSG_DNS_TTL, TTL );
|
||||
}
|
||||
|
||||
/**
|
||||
* ttl 到期,刷新域名
|
||||
*/
|
||||
static void parseHosts() {
|
||||
Logger.d( TAG, "ttl 过期,刷新dns列表" );
|
||||
ThreadPoolService.execute( new Runnable() {
|
||||
@Override
|
||||
public void run() {
|
||||
Set< String > hostSet = sCaches.keySet();
|
||||
if ( hostSet.isEmpty() ) {
|
||||
return;
|
||||
}
|
||||
for ( String host : hostSet ) {
|
||||
String newIp = parseHostFromHttpDns( host );
|
||||
if ( TextUtils.isEmpty( newIp ) ) {
|
||||
continue;
|
||||
}
|
||||
sTTLCaches.put( host, newIp );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
/**
|
||||
* 使用腾讯服务解析域名
|
||||
*
|
||||
* @param host
|
||||
* @return
|
||||
*/
|
||||
static String parseHostFromHttpDns( String host ) {
|
||||
String ips = MSDKDnsResolver.getInstance().getAddrByName( host );
|
||||
String[] ipArr = ips.split( ";" );
|
||||
if ( 0 == ipArr.length ) {
|
||||
return null;
|
||||
}
|
||||
for ( String ip : ipArr ) {
|
||||
if ( TextUtils.isEmpty( ip ) || TextUtils.equals( "0", ip ) ) {
|
||||
continue;
|
||||
}
|
||||
Logger.d( TAG, "parse: %s - %s", host, ip );
|
||||
return ip;
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
|
||||
static void addHttpDnsTtlCallback( String host, IHttpDnsTtlCallback callback ) {
|
||||
sTtlCallbacks.put( host, callback );
|
||||
}
|
||||
|
||||
static void removeHttpDnsTtlCallback( String host ) {
|
||||
sTtlCallbacks.remove( host );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
package com.mogo.httpdns.tencent;
|
||||
|
||||
public class IHttpDnsTtlCallback {
|
||||
public void onTtl() {
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.mogo.httpdns.tencent;
|
||||
|
||||
import android.content.Context;
|
||||
import android.text.TextUtils;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.cloud.httpdns.listener.OnAddressChangedListener;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.httpdns.HttpDnsConst;
|
||||
import com.mogo.httpdns.IHttpDnsCallback;
|
||||
import com.mogo.httpdns.IMogoHttpDns;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.HttpDns;
|
||||
import com.tencent.msdk.dns.MSDKDnsResolver;
|
||||
|
||||
import java.net.InetAddress;
|
||||
import java.net.UnknownHostException;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.List;
|
||||
|
||||
import static com.mogo.httpdns.HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_IM;
|
||||
import static com.mogo.httpdns.HttpDnsConst.HTTP_DNS_ADDRESS_TYPE_WS;
|
||||
|
||||
|
||||
@Route( path = HttpDnsConst.PATH )
|
||||
public class TencentHttpDns implements IMogoHttpDns, HttpDns {
|
||||
|
||||
private static volatile boolean sInited = false;
|
||||
|
||||
private static final String TAG = "TencentHttpDns";
|
||||
|
||||
@Override
|
||||
public List< InetAddress > lookup( String hostname ) throws UnknownHostException {
|
||||
Logger.d( TAG, "需要dns解析" );
|
||||
String cacheIp = getCacheOrParseIpIfNecessary( hostname );
|
||||
if ( TextUtils.isEmpty( cacheIp ) ) {
|
||||
return Collections.emptyList();
|
||||
}
|
||||
|
||||
return Arrays.asList( InetAddress.getAllByName( cacheIp ) );
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCachedHttpDnsIps( String host,int type ) {
|
||||
String ip = HttpDnsIpsCache.getHttpDnsIps(host);
|
||||
if (ip == null) {
|
||||
return null;
|
||||
} else {
|
||||
return tailPort(ip, type);
|
||||
}
|
||||
}
|
||||
|
||||
private String getCacheOrParseIpIfNecessary( String host ) {
|
||||
String cacheIp = HttpDnsIpsCache.getHttpDnsIps( host );
|
||||
if ( TextUtils.isEmpty( cacheIp ) ) {
|
||||
cacheIp = HttpDnsIpsCache.parseHostFromHttpDns( host );
|
||||
if ( !TextUtils.isEmpty( cacheIp ) ) {
|
||||
HttpDnsIpsCache.cache( host, cacheIp );
|
||||
}
|
||||
}
|
||||
return cacheIp;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void getHttpDnsIp( String host,int type, boolean useCache, IHttpDnsCallback callback ) {
|
||||
String cacheIp;
|
||||
if ( useCache ) {
|
||||
cacheIp = getCacheOrParseIpIfNecessary( host );
|
||||
} else {
|
||||
cacheIp = HttpDnsIpsCache.parseHostFromHttpDns( host );
|
||||
if ( !TextUtils.isEmpty( cacheIp ) ) {
|
||||
HttpDnsIpsCache.cache( host, cacheIp );
|
||||
}
|
||||
}
|
||||
if ( !TextUtils.isEmpty( cacheIp ) ) {
|
||||
if ( callback != null ) {
|
||||
callback.onParsed( tailPort(cacheIp,type) );
|
||||
return;
|
||||
}
|
||||
}
|
||||
if ( callback != null ) {
|
||||
callback.onParsed( null );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public String syncGetHttpDns(String host, int type, boolean useCache) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addressChangedListener(OnAddressChangedListener listener) {
|
||||
|
||||
}
|
||||
|
||||
@Keep
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
if ( sInited ) {
|
||||
return;
|
||||
}
|
||||
MSDKDnsResolver.getInstance().init( context.getApplicationContext(),
|
||||
"0I00093F244N42WU",
|
||||
"2742",
|
||||
"7Pplkaua",
|
||||
DebugConfig.isDebug(),
|
||||
1_000
|
||||
);
|
||||
MSDKDnsResolver.getInstance().WGSetDnsOpenId( "1AE58PG9444E3G9L" );
|
||||
HttpDnsIpsCache.loopDnsParse();
|
||||
sInited = true;
|
||||
}
|
||||
|
||||
private String tailPort(String ip, int type) {
|
||||
switch (type) {
|
||||
case HTTP_DNS_ADDRESS_TYPE_WS:
|
||||
return ip + ":4004";
|
||||
case HTTP_DNS_ADDRESS_TYPE_IM:
|
||||
return ip + ":4002";
|
||||
default:
|
||||
return ip;
|
||||
}
|
||||
}
|
||||
}
|
||||
1
foudations/mogo-base-services-apk/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
7
foudations/mogo-base-services-apk/README.md
Normal file
@@ -0,0 +1,7 @@
|
||||
## 基实现功能
|
||||
|
||||
基础服务apk实现对应功能:位置上报、长连接、passport
|
||||
|
||||
位置上报:com.zhidao.locationinfo
|
||||
长链:com.zhidao.socketservice
|
||||
passport:
|
||||
51
foudations/mogo-base-services-apk/build.gradle
Normal file
@@ -0,0 +1,51 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
|
||||
api rootProject.ext.dependencies.socketsdk
|
||||
api rootProject.ext.dependencies.socketsdkconnsvrprotoco
|
||||
api rootProject.ext.dependencies.socketsdkprotobufjava
|
||||
implementation rootProject.ext.dependencies.accountsdk
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.mogoserviceapi
|
||||
} else {
|
||||
implementation project(":foudations:mogo-utils")
|
||||
implementation project(":foudations:mogo-commons")
|
||||
implementation project(":services:mogo-service-api")
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
3
foudations/mogo-base-services-apk/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.base
|
||||
POM_ARTIFACT_ID=services-apk
|
||||
VERSION_CODE=1
|
||||
21
foudations/mogo-base-services-apk/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.base.services.apk">
|
||||
|
||||
/
|
||||
</manifest>
|
||||
@@ -0,0 +1,63 @@
|
||||
package com.mogo.base.services.locationinfo;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.service.locationinfo.IMogoLocationInfoService;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
*
|
||||
* 位置服务
|
||||
*/
|
||||
@Keep
|
||||
class MogoLocationInfoServices implements IMogoLocationInfoService {
|
||||
|
||||
private static final String TAG = "MogoLocationInfoServices-apk";
|
||||
|
||||
private static volatile MogoLocationInfoServices sInstance;
|
||||
|
||||
private MogoLocationInfoServices() {
|
||||
}
|
||||
|
||||
@Keep
|
||||
public static MogoLocationInfoServices getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoLocationInfoServices.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MogoLocationInfoServices();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideLocation( MogoLocation location ) {
|
||||
Logger.d( TAG, "apk - provideLocation" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
Logger.d( TAG, "apk - start" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
Logger.d( TAG, "apk - stop" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
Logger.d( TAG, "apk - init" );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,100 @@
|
||||
package com.mogo.base.services.passport;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
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;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
@Keep
|
||||
class PassportManager implements IMogoPassportManager {
|
||||
|
||||
private static final String TAG = "PassportManager-apk";
|
||||
|
||||
private static volatile PassportManager sInstance;
|
||||
|
||||
private PassportManager() {
|
||||
}
|
||||
|
||||
@Keep
|
||||
public static PassportManager getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( PassportManager.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new PassportManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestTicket( final IMogoTicketCallback callback ) {
|
||||
getTicket( new TicketInfoCallback() {
|
||||
@Override
|
||||
public void onSuccess( String ticket ) {
|
||||
Logger.d( TAG, "success" );
|
||||
SpStorage.setTicket( ticket );
|
||||
if ( callback != null ) {
|
||||
callback.onTicketGot( ticket );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure( int code, String msg ) {
|
||||
Logger.d( TAG, "fail code= %s, msg=%s", code, msg );
|
||||
if ( callback != null ) {
|
||||
callback.onError( code, msg );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
private static void getTicket( TicketInfoCallback callback ) {
|
||||
AccountClientManager.getTicket( callback );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
AccountClientManager.init( context.getApplicationContext(), getNetEnvironment(), BusinessType.toc_login, "os2.0-launcher" );
|
||||
}
|
||||
|
||||
private Environment getNetEnvironment() {
|
||||
int mode = DebugConfig.getNetMode();
|
||||
if ( mode == DebugConfig.NET_MODE_DEMO ) {
|
||||
// 演示环境用 qa 的
|
||||
mode = DebugConfig.NET_MODE_QA;
|
||||
}
|
||||
switch ( mode ) {
|
||||
case DebugConfig.NET_MODE_DEV:
|
||||
return Environment.dev;
|
||||
case DebugConfig.NET_MODE_DEMO:
|
||||
case DebugConfig.NET_MODE_QA:
|
||||
return Environment.qa;
|
||||
case DebugConfig.NET_MODE_RELEASE:
|
||||
default:
|
||||
return Environment.release;
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,227 @@
|
||||
package com.mogo.base.services.socket;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import com.google.protobuf.ByteString;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.mogo.service.connection.IMogoMsgAckListener;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.service.connection.MsgBody;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.zhidao.ptech.connsvr.commom.protocol.MogoCommon;
|
||||
import com.zhidao.ptech.connsvr.protocol.MogoConnsvr;
|
||||
import com.zhidao.socketsdk.manager.OnSocketAckCallback;
|
||||
import com.zhidao.socketsdk.manager.OnSocketReceiveCallback;
|
||||
import com.zhidao.socketsdk.manager.SocketConnManager;
|
||||
import com.zhidao.socketsdk.manager.SocketConnManagerImpl;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-31
|
||||
* <p>
|
||||
* 长链实现:基于 netty
|
||||
*/
|
||||
@Keep
|
||||
public class SocketManager implements IMogoSocketManager, OnSocketReceiveCallback, OnSocketAckCallback {
|
||||
|
||||
private static final String TAG = "SocketManager-apk";
|
||||
|
||||
public static final int MSG_PRODUCT_LINE = MogoCommon.Product.mogoBussiness_VALUE;
|
||||
private static final int MSG_HEADER_TYPE = MogoConnsvr.MsgType.mogoMsgTypeDispatchSvrNoRspReq_VALUE;
|
||||
|
||||
private static volatile SocketManager sInstance;
|
||||
|
||||
private SocketManager( Context context ) {
|
||||
mSocketConnManager = SocketConnManagerImpl.getInstance( context );
|
||||
mSocketConnManager.addSocketMessageCallback( this );
|
||||
mSocketConnManager.addSocketAckCallback( this );
|
||||
}
|
||||
|
||||
@Keep
|
||||
public static SocketManager getInstance( Context context ) {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( SocketManager.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new SocketManager( context );
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理消息分发
|
||||
* <p>
|
||||
* key - msgType
|
||||
*/
|
||||
private Map< Integer, List< IMogoOnMessageListener > > mListeners = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 管理消息回执
|
||||
* <p>
|
||||
* key - msgId
|
||||
*/
|
||||
private Map< Long, IMogoMsgAckListener > mAckListeners = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
private SocketConnManager mSocketConnManager;
|
||||
public static final int MAX_CAP = 64; //保证充足的容量应对非常延时的推送
|
||||
private ArrayList< Long > mReceivedMsgId = new ArrayList<>( MAX_CAP );
|
||||
private int mCurrentIndex = 0;
|
||||
|
||||
@Override
|
||||
public void init( Context context, String appId ) {
|
||||
if ( mSocketConnManager != null ) {
|
||||
mSocketConnManager.init( appId );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMessageReceived( byte[] content ) {
|
||||
onMessageReceived( content, 0);
|
||||
}
|
||||
|
||||
public void onMessageReceived( byte[] content, long msgId ) {
|
||||
try {
|
||||
MogoConnsvr.Payload payload = MogoConnsvr.Payload.parseFrom( content );
|
||||
int msgType = payload.getMsgType();
|
||||
Logger.d( TAG, "received msg type = " + msgType );
|
||||
List< IMogoOnMessageListener > listeners = mListeners.get( msgType );
|
||||
if ( listeners != null && !listeners.isEmpty() ) {
|
||||
Iterator< IMogoOnMessageListener > iterator = listeners.iterator();
|
||||
if ( msgId != 0 ) { //兼容老版本
|
||||
if ( mReceivedMsgId.contains( msgId ) ) { // 避免消息重发
|
||||
return;
|
||||
}
|
||||
cacheLastReceivedMsgId( msgId );
|
||||
}
|
||||
Object object = null;
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoOnMessageListener listener = iterator.next();
|
||||
if ( object == null ) {
|
||||
object = GsonUtil.objectFromJson( payload.getPayload().toStringUtf8(), listener.target() );
|
||||
}
|
||||
if ( listener != null ) {
|
||||
Logger.d( TAG, "received msgId = %s, content = %s", msgId, payload.getPayload().toStringUtf8() );
|
||||
listener.onMsgReceived( object );
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch ( InvalidProtocolBufferException e ) {
|
||||
Logger.e( TAG, e, "parse msg error." );
|
||||
}
|
||||
}
|
||||
|
||||
private void cacheLastReceivedMsgId( long msgId ) {
|
||||
if ( msgId == 0 ) {
|
||||
return;
|
||||
}
|
||||
synchronized ( this ){
|
||||
mReceivedMsgId.add( mCurrentIndex % MAX_CAP, msgId );
|
||||
mCurrentIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAck( byte[] headerBytes, byte[] payloadBytes ) {
|
||||
try {
|
||||
MogoConnsvr.Header header = MogoConnsvr.Header.parseFrom( headerBytes );
|
||||
int msgType = header.getMsgType();
|
||||
String appId = header.getAppId();
|
||||
int productLine = header.getProductLine();
|
||||
long msgId = header.getMsgId();
|
||||
IMogoMsgAckListener listener = mAckListeners.remove( msgId );
|
||||
if ( listener != null ) {
|
||||
listener.onAck( msgId );
|
||||
}
|
||||
} catch ( InvalidProtocolBufferException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerOnMessageListener( int msgType, IMogoOnMessageListener listener ) {
|
||||
if ( mListeners.containsKey( msgType ) ) {
|
||||
Logger.w( TAG, "msgType %d is exist.", msgType );
|
||||
}
|
||||
if ( !mListeners.containsKey( msgType ) ) {
|
||||
mListeners.put( msgType, new ArrayList< IMogoOnMessageListener >() );
|
||||
}
|
||||
mListeners.get( msgType ).add( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterOnMessageListener( int msgType ) {
|
||||
mListeners.remove( msgType );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterOnMessageListener( int msgType, IMogoOnMessageListener listener ) {
|
||||
if ( listener == null ) {
|
||||
return;
|
||||
}
|
||||
if ( !mListeners.containsKey( msgType ) ) {
|
||||
return;
|
||||
}
|
||||
List< IMogoOnMessageListener > listeners = mListeners.get( msgType );
|
||||
if ( listeners != null && listeners.contains( listener ) ) {
|
||||
listeners.remove( listener );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMsg( MsgBody body, IMogoMsgAckListener listener ) {
|
||||
Logger.d( TAG, "sendMsg." );
|
||||
if ( mSocketConnManager != null ) {
|
||||
if ( mSocketConnManager.isConnected() ) {
|
||||
Logger.d( TAG, "isConnected." );
|
||||
final byte[] pb = convertToPBBytes( body.getMsgType(), objectToBytes( body.getContent() ) );
|
||||
mSocketConnManager.sendPayload(
|
||||
MSG_PRODUCT_LINE,
|
||||
pb,
|
||||
MSG_HEADER_TYPE,
|
||||
body.isAck(),
|
||||
body.getMsgId()
|
||||
);
|
||||
mAckListeners.put( body.getMsgId(), listener );
|
||||
} else {
|
||||
Logger.e( TAG, "sendMsg error, connect is lost." );
|
||||
}
|
||||
} else {
|
||||
Logger.e( TAG, "sendMsg error, client is null." );
|
||||
}
|
||||
}
|
||||
|
||||
public byte[] objectToBytes( Object obj ) {
|
||||
String jsonStr = GsonUtil.jsonFromObject( obj );
|
||||
return jsonStr.getBytes();
|
||||
}
|
||||
|
||||
private byte[] convertToPBBytes( int msgType, byte[] payloadBytes ) {
|
||||
MogoConnsvr.Payload payloadData = MogoConnsvr.Payload.newBuilder()
|
||||
.setMsgType( msgType )
|
||||
.setPayload( ByteString.copyFrom( payloadBytes ) ).build();
|
||||
return payloadData.toByteArray();
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
mListeners.clear();
|
||||
mListeners = null;
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
}
|
||||
}
|
||||
1
foudations/mogo-base-services-sdk/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
3
foudations/mogo-base-services-sdk/README.md
Normal file
@@ -0,0 +1,3 @@
|
||||
## sdk实现功能
|
||||
|
||||
脱离基础服务apk实现对应功能:位置上报、长连接、passport
|
||||
53
foudations/mogo-base-services-sdk/build.gradle
Normal file
@@ -0,0 +1,53 @@
|
||||
apply plugin: 'com.android.library'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
// buildToolsVersion rootProject.ext.android.buildToolsVersion
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles "consumer-rules.pro"
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: "libs", include: ["*.jar"])
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
// 上报位置
|
||||
implementation 'com.zhidao.locupload:loc-upload-sdk:1.1.7'
|
||||
// 长链
|
||||
implementation 'com.zhidao.socket:built-in-socket:1.0.17'
|
||||
// passport
|
||||
implementation 'com.zhidao.tcloginsdk:tclogin:1.1.3'
|
||||
|
||||
annotationProcessor 'com.elegant.spi:compiler:1.0.3'
|
||||
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.mogoserviceapi
|
||||
} else {
|
||||
implementation project(":foudations:mogo-utils")
|
||||
implementation project(":foudations:mogo-commons")
|
||||
implementation project(":services:mogo-service-api")
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
2
foudations/mogo-base-services-sdk/consumer-rules.pro
Normal file
@@ -0,0 +1,2 @@
|
||||
#-----MogoBaseServiceSdk-----
|
||||
-keep class com.mogo.base.services.locationinfo.MogoLocationSource.*{*;}
|
||||
3
foudations/mogo-base-services-sdk/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.base
|
||||
POM_ARTIFACT_ID=services-sdk
|
||||
VERSION_CODE=1
|
||||
24
foudations/mogo-base-services-sdk/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,24 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
|
||||
#-----MogoBaseServiceSdk-----
|
||||
-keep class com.mogo.base.services.locationinfo.MogoLocationSource.*{*;}
|
||||
@@ -0,0 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.mogo.base.services">
|
||||
|
||||
/
|
||||
</manifest>
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.mogo.base.services;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
public abstract
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/7/23
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
class BaseServicesConstants {
|
||||
|
||||
/**
|
||||
* 建立长链的通道ID
|
||||
*/
|
||||
@Keep
|
||||
public static final String SOCKET_CHANNEL_ID = "dataCrawler";
|
||||
}
|
||||
@@ -0,0 +1,79 @@
|
||||
package com.mogo.base.services.locationinfo;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.service.locationinfo.IMogoLocationInfoService;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.locupload.LocUploadConfig;
|
||||
import com.zhidao.locupload.LocUploadManager;
|
||||
|
||||
public
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
*
|
||||
* 位置服务
|
||||
*/
|
||||
@Keep
|
||||
class MogoLocationInfoServices implements IMogoLocationInfoService {
|
||||
|
||||
private static final String TAG = "MogoLocationInfoServices-sdk";
|
||||
|
||||
private static volatile MogoLocationInfoServices sInstance;
|
||||
private MogoLocation mLocation;
|
||||
|
||||
private MogoLocationInfoServices() {
|
||||
}
|
||||
|
||||
@Keep
|
||||
public static MogoLocationInfoServices getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoLocationInfoServices.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MogoLocationInfoServices();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void provideLocation( MogoLocation location ) {
|
||||
mLocation = location;
|
||||
Logger.d( TAG, "sdk - provideLocation" );
|
||||
}
|
||||
|
||||
public MogoLocation getLocation() {
|
||||
return mLocation;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void start() {
|
||||
LocUploadManager.getInstance().startUpload();
|
||||
Logger.d( TAG, "sdk - start" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void stop() {
|
||||
LocUploadManager.getInstance().stopUpload();
|
||||
Logger.d( TAG, "sdk - stop" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
LocUploadConfig.instance().
|
||||
setAppId( DebugConfig.getSocketAppId() ).
|
||||
setContext( context.getApplicationContext() ).
|
||||
setLoggable( DebugConfig.isDebug() ).
|
||||
setLocInterval( 2000L );
|
||||
Logger.d( TAG, "sdk - init" );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,133 @@
|
||||
package com.mogo.base.services.locationinfo;
|
||||
|
||||
import com.elegant.spi.annotations.Service;
|
||||
import com.zhidao.locupload.location.LocationServiceProvider;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
@Service( value = LocationServiceProvider.class )
|
||||
class MogoLocationSource extends LocationServiceProvider {
|
||||
|
||||
@Override
|
||||
public float getBearing() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getBearing();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getAccuracy() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getAccuracy();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getProvider() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getProvider();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getSpeed() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getSpeed();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getAltitude() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getAltitude();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getAdCode() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getAdCode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getLocType() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getLocType();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLatitude() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getLatitude();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public double getLongitude() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getLongitude();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public long getTime() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getTime();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCityCode() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getCityCode();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getCityName() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getCityName();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getGpsAccuracyStatus() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getGpsAccuracyStatus();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getSatellites() {
|
||||
if ( MogoLocationInfoServices.getInstance().getLocation() != null ) {
|
||||
return MogoLocationInfoServices.getInstance().getLocation().getSatellite();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getCarStatus() {
|
||||
// 常开状态
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,119 @@
|
||||
package com.mogo.base.services.passport;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.storage.SpStorage;
|
||||
import com.mogo.service.passport.IMogoPassportManager;
|
||||
import com.mogo.service.passport.IMogoTicketCallback;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.zhidao.accountsdk.manager.CarPadClientManagerImpl;
|
||||
import com.zhidao.accountsdk.manager.TicketInfoCallback;
|
||||
import com.zhidao.tcloginsdk.LoginManager;
|
||||
import com.zhidao.tcloginsdk.model.TokenData;
|
||||
import com.zhidao.tcloginsdk.network.LoginCallback;
|
||||
|
||||
public
|
||||
/*
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
*
|
||||
* 描述
|
||||
*/
|
||||
@Keep
|
||||
class PassportManager implements IMogoPassportManager {
|
||||
|
||||
private static final String TAG = "PassportManager-sdk";
|
||||
private Context mContext;
|
||||
|
||||
private static volatile PassportManager sInstance;
|
||||
|
||||
private PassportManager() {
|
||||
}
|
||||
|
||||
@Keep
|
||||
public static PassportManager getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( PassportManager.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new PassportManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void requestTicket( final IMogoTicketCallback callback ) {
|
||||
LoginManager.getInstance( mContext ).login( DebugConfig.getCarMachineType() != DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE, DebugConfig.getProductFlavor(), new LoginCallback() {
|
||||
@Override
|
||||
public void onSuccess( TokenData.TokenResult result ) {
|
||||
if ( callback != null ) {
|
||||
callback.onLoginSuccess( result.token, result.sn );
|
||||
}
|
||||
getTicket( new TicketInfoCallback() {
|
||||
@Override
|
||||
public void onSuccess( String ticket ) {
|
||||
Logger.d( TAG, "success" );
|
||||
SpStorage.setTicket( ticket );
|
||||
if ( callback != null ) {
|
||||
callback.onTicketGot( ticket );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure( int code ) {
|
||||
Logger.d( TAG, "fail: code = %s", code );
|
||||
if ( callback != null ) {
|
||||
callback.onError( code, "getTicket error." );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
@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 );
|
||||
}
|
||||
}
|
||||
} );
|
||||
|
||||
}
|
||||
|
||||
private void getTicket( TicketInfoCallback callback ) {
|
||||
CarPadClientManagerImpl.getInstance( mContext ).getTicket( "os2.0-launcher", new TicketInfoCallback() {
|
||||
@Override
|
||||
public void onSuccess( String ticket ) {
|
||||
if ( callback != null ) {
|
||||
callback.onSuccess( ticket );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onFailure( int code ) {
|
||||
if ( callback != null ) {
|
||||
callback.onFailure( code );
|
||||
}
|
||||
}
|
||||
} );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
mContext = context;
|
||||
int mode = DebugConfig.getNetMode();
|
||||
if ( mode == DebugConfig.NET_MODE_DEMO ) {
|
||||
// 演示环境用 qa 的
|
||||
mode = DebugConfig.NET_MODE_QA;
|
||||
}
|
||||
LoginManager.getInstance( context ).setNetEnviron( mode );
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,231 @@
|
||||
package com.mogo.base.services.socket;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import androidx.annotation.Keep;
|
||||
import androidx.annotation.NonNull;
|
||||
|
||||
import com.google.protobuf.ByteString;
|
||||
import com.google.protobuf.InvalidProtocolBufferException;
|
||||
import com.mogo.base.services.BaseServicesConstants;
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.commons.network.Utils;
|
||||
import com.mogo.service.connection.IMogoMsgAckListener;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
import com.mogo.service.connection.IMogoSocketManager;
|
||||
import com.mogo.service.connection.MsgBody;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
import com.mogo.utils.network.utils.GsonUtil;
|
||||
import com.zhidao.locupload.Platform;
|
||||
import com.zhidao.ptech.connsvr.protocol.MogoConnsvr;
|
||||
import com.zhidao.socket.Callback;
|
||||
import com.zhidao.socket.CallbackManager;
|
||||
import com.zhidao.socket.Environment;
|
||||
import com.zhidao.socket.SocketClient;
|
||||
import com.zhidao.socket.SocketConfig;
|
||||
import com.zhidao.socket.utils.RequestUtil;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.concurrent.ConcurrentHashMap;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020/7/16
|
||||
*
|
||||
* 长链
|
||||
*/
|
||||
@Keep
|
||||
class SocketManager implements IMogoSocketManager, Callback {
|
||||
|
||||
private static final String TAG = "SocketManager-sdk";
|
||||
|
||||
private static volatile SocketManager sInstance;
|
||||
private String mAppId;
|
||||
|
||||
public SocketManager( Context context ) {
|
||||
CallbackManager.getInstance().register( this );
|
||||
}
|
||||
|
||||
@Keep
|
||||
public static SocketManager getInstance( Context context ) {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( SocketManager.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new SocketManager( context );
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
/**
|
||||
* 管理消息分发
|
||||
* <p>
|
||||
* key - msgType
|
||||
*/
|
||||
private Map< Integer, List< IMogoOnMessageListener > > mListeners = new ConcurrentHashMap<>();
|
||||
|
||||
/**
|
||||
* 管理消息回执
|
||||
* <p>
|
||||
* key - msgId
|
||||
*/
|
||||
private Map< Long, IMogoMsgAckListener > mAckListeners = new ConcurrentHashMap<>();
|
||||
|
||||
|
||||
public static final int MAX_CAP = 64; //保证充足的容量应对非常延时的推送
|
||||
private ArrayList< Long > mReceivedMsgId = new ArrayList<>( MAX_CAP );
|
||||
private int mCurrentIndex = 0;
|
||||
|
||||
@Override
|
||||
public void init( Context context, String appId ) {
|
||||
mAppId = appId;
|
||||
SocketConfig.instance()
|
||||
.setAppContext( context.getApplicationContext() )
|
||||
.setEnvironment( getEnvironment() )
|
||||
.setClient( Platform.getClient( Platform.car ) )
|
||||
.setChannelId( BaseServicesConstants.SOCKET_CHANNEL_ID )
|
||||
.setOpenAnalytics( true )
|
||||
.setSn( MoGoAiCloudClientConfig.getInstance().getSn() )
|
||||
.setDebug( DebugConfig.isDebug() );
|
||||
SocketClient.getInstance().start( context );
|
||||
}
|
||||
|
||||
private Environment getEnvironment() {
|
||||
switch ( DebugConfig.getNetMode() ) {
|
||||
case 1:
|
||||
return Environment.dev;
|
||||
case 2:
|
||||
case 4:
|
||||
return Environment.qa;
|
||||
case 3:
|
||||
default:
|
||||
return Environment.release;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update( @NonNull CallbackManager manager, @NonNull byte[] content, String appId, long msgId ) {
|
||||
try {
|
||||
MogoConnsvr.Payload payload = MogoConnsvr.Payload.parseFrom( content );
|
||||
int msgType = payload.getMsgType();
|
||||
Logger.d( TAG, "received msg type = %d", msgType );
|
||||
List< IMogoOnMessageListener > listeners = mListeners.get( msgType );
|
||||
if ( listeners != null && !listeners.isEmpty() ) {
|
||||
Iterator< IMogoOnMessageListener > iterator = listeners.iterator();
|
||||
if ( msgId != 0 ) { //兼容老版本
|
||||
if ( mReceivedMsgId.contains( msgId ) ) { // 避免消息重发
|
||||
return;
|
||||
}
|
||||
cacheLastReceivedMsgId( msgId );
|
||||
}
|
||||
Object object = null;
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoOnMessageListener listener = iterator.next();
|
||||
if ( object == null ) {
|
||||
object = GsonUtil.objectFromJson( payload.getPayload().toStringUtf8(), listener.target() );
|
||||
}
|
||||
if ( listener != null ) {
|
||||
Logger.d( TAG, "received msgId = %s, content = %s", msgId, payload.getPayload().toStringUtf8() );
|
||||
listener.onMsgReceived( object );
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch ( InvalidProtocolBufferException e ) {
|
||||
Logger.e( TAG, e, "parse msg error." );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onAck( @NonNull CallbackManager manager, @NonNull byte[] headerBytes, byte[] content ) {
|
||||
try {
|
||||
MogoConnsvr.Header header = MogoConnsvr.Header.parseFrom( headerBytes );
|
||||
int msgType = header.getMsgType();
|
||||
String appId = header.getAppId();
|
||||
int productLine = header.getProductLine();
|
||||
long msgId = header.getMsgId();
|
||||
IMogoMsgAckListener listener = mAckListeners.remove( msgId );
|
||||
if ( listener != null ) {
|
||||
listener.onAck( msgId );
|
||||
}
|
||||
Logger.d( TAG, "send message success: msgType = %d, appId = %s, productLine = %d", msgType, appId, productLine );
|
||||
} catch ( InvalidProtocolBufferException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
private void cacheLastReceivedMsgId( long msgId ) {
|
||||
if ( msgId == 0 ) {
|
||||
return;
|
||||
}
|
||||
synchronized ( this ) {
|
||||
mReceivedMsgId.add( mCurrentIndex % MAX_CAP, msgId );
|
||||
mCurrentIndex++;
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerOnMessageListener( int msgType, IMogoOnMessageListener listener ) {
|
||||
if ( mListeners.containsKey( msgType ) ) {
|
||||
Logger.w( TAG, "msgType %d is exist.", msgType );
|
||||
}
|
||||
if ( !mListeners.containsKey( msgType ) ) {
|
||||
mListeners.put( msgType, new ArrayList<>() );
|
||||
}
|
||||
mListeners.get( msgType ).add( listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterOnMessageListener( int msgType ) {
|
||||
mListeners.remove( msgType );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterOnMessageListener( int msgType, IMogoOnMessageListener listener ) {
|
||||
if ( listener == null ) {
|
||||
return;
|
||||
}
|
||||
if ( !mListeners.containsKey( msgType ) ) {
|
||||
return;
|
||||
}
|
||||
List< IMogoOnMessageListener > listeners = mListeners.get( msgType );
|
||||
if ( listeners != null && listeners.contains( listener ) ) {
|
||||
listeners.remove( listener );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void sendMsg( MsgBody body, IMogoMsgAckListener listener ) {
|
||||
Logger.d( TAG, "sendMsg." );
|
||||
final byte[] pb = convertToPBBytes( body.getMsgType(), objectToBytes( body.getContent() ) );
|
||||
RequestUtil.sendPayloadData( mAppId, 2, pb, 1, true, System.currentTimeMillis() );
|
||||
}
|
||||
|
||||
public byte[] objectToBytes( Object obj ) {
|
||||
String jsonStr = GsonUtil.jsonFromObject( obj );
|
||||
return jsonStr.getBytes();
|
||||
}
|
||||
|
||||
private byte[] convertToPBBytes( int msgType, byte[] payloadBytes ) {
|
||||
MogoConnsvr.Payload payloadData = MogoConnsvr.Payload.newBuilder()
|
||||
.setMsgType( msgType )
|
||||
.setPayload( ByteString.copyFrom( payloadBytes ) ).build();
|
||||
return payloadData.toByteArray();
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
mListeners.clear();
|
||||
mListeners = null;
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
}
|
||||
|
||||
}
|
||||
1
modules/mogo-module-guide/.gitignore
vendored
Normal file
@@ -0,0 +1 @@
|
||||
/build
|
||||
70
modules/mogo-module-guide/build.gradle
Normal file
@@ -0,0 +1,70 @@
|
||||
apply plugin: 'com.android.library'
|
||||
apply plugin: 'kotlin-android'
|
||||
apply plugin: 'kotlin-android-extensions'
|
||||
apply plugin: 'com.alibaba.arouter'
|
||||
apply plugin: 'kotlin-kapt'
|
||||
|
||||
android {
|
||||
compileSdkVersion rootProject.ext.android.compileSdkVersion
|
||||
|
||||
defaultConfig {
|
||||
minSdkVersion rootProject.ext.android.minSdkVersion
|
||||
targetSdkVersion rootProject.ext.android.targetSdkVersion
|
||||
versionCode Integer.valueOf(VERSION_CODE)
|
||||
versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
|
||||
//ARouter apt 参数
|
||||
kapt {
|
||||
useBuildCache = false
|
||||
arguments {
|
||||
arg("AROUTER_MODULE_NAME",project.getName() )
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
release {
|
||||
minifyEnabled false
|
||||
proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
|
||||
}
|
||||
}
|
||||
|
||||
compileOptions {
|
||||
sourceCompatibility JavaVersion.VERSION_1_8
|
||||
targetCompatibility JavaVersion.VERSION_1_8
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(dir: 'libs', include: ['*.jar'])
|
||||
implementation rootProject.ext.dependencies.kotlinstdlibjdk7
|
||||
implementation rootProject.ext.dependencies.androidxccorektx
|
||||
implementation rootProject.ext.dependencies.coroutinescore
|
||||
implementation rootProject.ext.dependencies.coroutinesandroid
|
||||
implementation rootProject.ext.dependencies.androidxappcompat
|
||||
implementation rootProject.ext.dependencies.androidxconstraintlayout
|
||||
implementation rootProject.ext.dependencies.androidxviewpager2
|
||||
implementation rootProject.ext.dependencies.arouter
|
||||
kapt rootProject.ext.dependencies.aroutercompiler
|
||||
implementation rootProject.ext.dependencies.indicator
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.mogoserviceapi
|
||||
implementation rootProject.ext.dependencies.mogomoduleauth
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
} else {
|
||||
implementation project(":foudations:mogo-utils")
|
||||
implementation project(":foudations:mogo-commons")
|
||||
implementation project(':services:mogo-service-api')
|
||||
implementation project(':modules:mogo-module-authorize')
|
||||
implementation project(":modules:mogo-module-common")
|
||||
}
|
||||
}
|
||||
|
||||
apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
|
||||
0
modules/mogo-module-guide/consumer-rules.pro
Normal file
3
modules/mogo-module-guide/gradle.properties
Normal file
@@ -0,0 +1,3 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=module-guide
|
||||
VERSION_CODE=1
|
||||
21
modules/mogo-module-guide/proguard-rules.pro
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
# Add project specific ProGuard rules here.
|
||||
# You can control the set of applied configuration files using the
|
||||
# proguardFiles setting in build.gradle.
|
||||
#
|
||||
# For more details, see
|
||||
# http://developer.android.com/guide/developing/tools/proguard.html
|
||||
|
||||
# If your project uses WebView with JS, uncomment the following
|
||||
# and specify the fully qualified class name to the JavaScript interface
|
||||
# class:
|
||||
#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
|
||||
# public *;
|
||||
#}
|
||||
|
||||
# Uncomment this to preserve the line number information for
|
||||
# debugging stack traces.
|
||||
#-keepattributes SourceFile,LineNumberTable
|
||||
|
||||
# If you keep the line number information, uncomment this to
|
||||
# hide the original source file name.
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -0,0 +1,2 @@
|
||||
package com.mogo.module.guide.agreement
|
||||
|
||||
1
modules/mogo-module-guide/src/main/AndroidManifest.xml
Normal file
@@ -0,0 +1 @@
|
||||
<manifest package="com.mogo.module.guide" />
|
||||
@@ -0,0 +1,65 @@
|
||||
package com.mogo.module.guide
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeConstant
|
||||
import com.mogo.module.authorize.authprovider.invoke.AuthorizeInvokerConstant.Companion.AUTHORIZE_TYPE_LAUNCHER_MAIN
|
||||
import com.mogo.module.authorize.authprovider.module.IMogoAuthorizeModuleManager
|
||||
import com.mogo.module.guide.GuideConstant.Companion.PATH_GUIDE_MODULE_NAME
|
||||
import com.mogo.module.guide.fragment.GuideFragment
|
||||
import com.mogo.module.guide.util.SharedPreferenceUtil.hasGuide
|
||||
import com.mogo.module.guide.util.SharedPreferenceUtil.setGuideFinish
|
||||
import com.mogo.module.guide.util.SharedPreferenceUtil.setGuideRecord
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.fragmentmanager.FragmentDescriptor
|
||||
import com.mogo.utils.UiThreadHandler
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
object GuideBizManager {
|
||||
|
||||
private var serviceApi: IMogoServiceApis? = null
|
||||
|
||||
fun init() {
|
||||
Logger.d("GuideBizManager", "init===================================")
|
||||
initService()
|
||||
addGuideFragmentToStack()
|
||||
}
|
||||
|
||||
private fun initService() {
|
||||
val mogoService = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation()
|
||||
if (mogoService is IMogoServiceApis && serviceApi == null) {
|
||||
serviceApi = mogoService
|
||||
serviceApi?.adasControllerApi?.closeADAS()
|
||||
}
|
||||
}
|
||||
|
||||
private fun addGuideFragmentToStack() {
|
||||
if (!hasGuide()) {
|
||||
serviceApi?.let {
|
||||
val builderWrapper = FragmentDescriptor.Builder().fragment(GuideFragment())
|
||||
.tag(PATH_GUIDE_MODULE_NAME).build()
|
||||
it.fragmentManagerApi.push(builderWrapper)
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun removeGuideFragmentToStack() {
|
||||
Logger.d("GuideBizManager", "removeGuideFragmentToStack")
|
||||
setGuideFinish()
|
||||
setGuideRecord()
|
||||
serviceApi?.fragmentManagerApi?.pop()
|
||||
serviceApi?.adasControllerApi?.showADAS()
|
||||
}
|
||||
|
||||
fun invokeAuthorize() {
|
||||
UiThreadHandler.postDelayed({
|
||||
val authorizeInvoke = ARouter.getInstance().build(AuthorizeConstant.PROVIDER_MODULE).navigation()
|
||||
if (authorizeInvoke is IMogoAuthorizeModuleManager) {
|
||||
if (authorizeInvoke.needAuthorize(AUTHORIZE_TYPE_LAUNCHER_MAIN)) {
|
||||
authorizeInvoke.invokeAuthorizeForShow()
|
||||
}
|
||||
}
|
||||
}, 3000L)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,16 @@
|
||||
package com.mogo.module.guide
|
||||
|
||||
class GuideConstant {
|
||||
|
||||
companion object {
|
||||
/**
|
||||
* 展示用户引导模块地址
|
||||
*/
|
||||
const val PATH_GUIDE_FRAGMENT = "/guide/showFragment"
|
||||
|
||||
/**
|
||||
* provider模块实例名称(暂时仅有卡片用到)
|
||||
*/
|
||||
const val PATH_GUIDE_MODULE_NAME = "GUIDE_MODULE_NAME"
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,68 @@
|
||||
package com.mogo.module.guide
|
||||
|
||||
import android.content.Context
|
||||
import android.os.Bundle
|
||||
import android.view.View
|
||||
import androidx.fragment.app.Fragment
|
||||
import com.alibaba.android.arouter.facade.annotation.Route
|
||||
import com.mogo.map.listener.IMogoMapListener
|
||||
import com.mogo.map.location.IMogoLocationListener
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener
|
||||
import com.mogo.map.navi.IMogoNaviListener
|
||||
import com.mogo.module.guide.GuideConstant.Companion.PATH_GUIDE_FRAGMENT
|
||||
import com.mogo.module.guide.GuideConstant.Companion.PATH_GUIDE_MODULE_NAME
|
||||
import com.mogo.service.module.IMogoModuleProvider
|
||||
import com.mogo.service.module.ModuleType
|
||||
import com.mogo.utils.logger.Logger
|
||||
|
||||
@Route(path = PATH_GUIDE_FRAGMENT)
|
||||
class MogoGuideProvider : IMogoModuleProvider {
|
||||
|
||||
/**
|
||||
* 卡片用到
|
||||
*/
|
||||
override fun createFragment(context: Context?, data: Bundle?): Fragment? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun createView(context: Context?): View? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getModuleName(): String {
|
||||
return PATH_GUIDE_MODULE_NAME
|
||||
}
|
||||
|
||||
override fun getMapListener(): IMogoMapListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getType(): Int {
|
||||
return ModuleType.TYPE_SERVICE
|
||||
}
|
||||
|
||||
override fun getNaviListener(): IMogoNaviListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getLocationListener(): IMogoLocationListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getMarkerClickListener(): IMogoMarkerClickListener? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun init(context: Context?) {
|
||||
Logger.d("MogoGuideProvider", "init====")
|
||||
GuideBizManager.init()
|
||||
}
|
||||
|
||||
override fun getAppPackage(): String? {
|
||||
return null
|
||||
}
|
||||
|
||||
override fun getAppName(): String? {
|
||||
return null
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,35 @@
|
||||
package com.mogo.module.guide.fragment
|
||||
|
||||
import androidx.fragment.app.Fragment
|
||||
import androidx.viewpager2.adapter.FragmentStateAdapter
|
||||
import com.mogo.module.guide.guide.*
|
||||
|
||||
class GuideAdapter(fragmentActivity: GuideFragment) : FragmentStateAdapter(fragmentActivity) {
|
||||
|
||||
override fun getItemCount(): Int {
|
||||
return guideList.size
|
||||
}
|
||||
|
||||
override fun createFragment(position: Int): Fragment {
|
||||
return guideList[position]
|
||||
}
|
||||
|
||||
private val guideList: MutableList<Fragment> = mutableListOf()
|
||||
|
||||
companion object {
|
||||
const val GUIDE_PAGE_ONE = 0
|
||||
const val GUIDE_PAGE_TWO = 1
|
||||
const val GUIDE_PAGE_THREE = 2
|
||||
const val GUIDE_PAGE_FOUR = 3
|
||||
const val GUIDE_PAGE_FIVE = 4
|
||||
}
|
||||
|
||||
init {
|
||||
guideList.add(GUIDE_PAGE_ONE, GuideStageOneFragment(fragmentActivity))
|
||||
guideList.add(GUIDE_PAGE_TWO, GuideStageTwoFragment(fragmentActivity))
|
||||
guideList.add(GUIDE_PAGE_THREE, GuideStageThreeFragment(fragmentActivity))
|
||||
guideList.add(GUIDE_PAGE_FOUR, GuideStageFourFragment(fragmentActivity))
|
||||
guideList.add(GUIDE_PAGE_FIVE, GuideStageFiveFragment(fragmentActivity))
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.mogo.module.guide.fragment
|
||||
|
||||
import com.mogo.commons.mvp.IView
|
||||
|
||||
class GuideConstract {
|
||||
|
||||
interface View:IView{
|
||||
|
||||
}
|
||||
|
||||
interface Biz{
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,138 @@
|
||||
package com.mogo.module.guide.fragment
|
||||
|
||||
import android.view.View
|
||||
import androidx.recyclerview.widget.RecyclerView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
||||
import com.mogo.module.guide.GuideBizManager
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.module.guide.util.AnalyticsUtil
|
||||
import com.mogo.module.guide.util.AnalyticsUtil.INVOKE_TRACK_PASS_TIME
|
||||
import com.mogo.module.guide.util.AnalyticsUtil.INVOKE_TRACK_PLAY_PASS_ID
|
||||
import com.mogo.module.guide.util.AnalyticsUtil.INVOKE_TRACK_PLAY_TIME
|
||||
import com.mogo.module.guide.util.breakOffSpeak
|
||||
import com.mogo.module.guide.util.speak
|
||||
import com.mogo.utils.logger.Logger
|
||||
import com.zhpan.indicator.enums.IndicatorSlideMode
|
||||
import com.zhpan.indicator.enums.IndicatorStyle
|
||||
import kotlinx.android.synthetic.main.module_guide_fragment.*
|
||||
import kotlinx.android.synthetic.main.module_guide_item_include.*
|
||||
|
||||
class GuideFragment : MvpFragment<GuideConstract.View, GuidePresenter>(), GuideConstract.View {
|
||||
|
||||
companion object {
|
||||
const val TAG = "GuideFragment"
|
||||
}
|
||||
|
||||
private var duringTime: Long = 0L
|
||||
private var recordCount = 0
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_guide_fragment
|
||||
}
|
||||
|
||||
override fun createPresenter(): GuidePresenter {
|
||||
return GuidePresenter(this)
|
||||
}
|
||||
|
||||
private var adapter: GuideAdapter? = null
|
||||
|
||||
override fun initViews() {
|
||||
Logger.d(TAG, "init Views")
|
||||
duringTime = System.currentTimeMillis()
|
||||
adapter = GuideAdapter(this)
|
||||
moduleGuideViewPager.adapter = adapter
|
||||
(moduleGuideViewPager.getChildAt(0) as RecyclerView).layoutManager!!.isItemPrefetchEnabled = false
|
||||
@Suppress("DEPRECATION")
|
||||
moduleGuideIndicator.setSliderColor(context!!.resources.getColor(R.color.module_guide_indicator_dark), context!!.resources.getColor(R.color.module_guide_indicator_white))
|
||||
.setSliderWidth(context!!.resources.getDimension(R.dimen.dp_22))
|
||||
.setSlideMode(IndicatorSlideMode.NORMAL)
|
||||
.setIndicatorStyle(IndicatorStyle.CIRCLE)
|
||||
.setupWithViewPager(moduleGuideViewPager)
|
||||
visibleRight()
|
||||
module_guide_page_left.setOnClickListener {
|
||||
moveToBack()
|
||||
}
|
||||
module_guide_page_right.setOnClickListener {
|
||||
moveToNext()
|
||||
}
|
||||
module_guide_tv_next_step.setOnClickListener {
|
||||
if( (moduleGuideViewPager.currentItem + 1) == adapter!!.itemCount){
|
||||
closeGuideFragment()
|
||||
}else{
|
||||
moveToNext()
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
fun visibleLeft() {
|
||||
module_guide_page_left.visibility = View.VISIBLE
|
||||
}
|
||||
|
||||
fun invisibleLeft() {
|
||||
module_guide_page_left.visibility = View.GONE
|
||||
}
|
||||
|
||||
fun visibleRight() {
|
||||
module_guide_page_right.visibility = View.VISIBLE
|
||||
module_guide_tv_next_step.text = context!!.resources.getString(R.string.module_guide_item_next_step)
|
||||
}
|
||||
|
||||
fun invisibleRight() {
|
||||
module_guide_page_right.visibility = View.GONE
|
||||
module_guide_tv_next_step.text = context!!.resources.getString(R.string.module_guide_finish)
|
||||
}
|
||||
|
||||
fun moveToNext() {
|
||||
val count = adapter?.itemCount
|
||||
if (moduleGuideViewPager.currentItem != count) {
|
||||
moduleGuideViewPager.currentItem = moduleGuideViewPager.currentItem + 1
|
||||
}
|
||||
}
|
||||
|
||||
private fun moveToBack() {
|
||||
val count = adapter?.itemCount
|
||||
val backCount = moduleGuideViewPager.currentItem - 1
|
||||
if (moduleGuideViewPager.currentItem != count) {
|
||||
moduleGuideViewPager.currentItem = backCount
|
||||
}
|
||||
}
|
||||
|
||||
fun closeGuideFragment() {
|
||||
recordCount = moduleGuideViewPager.currentItem + 1
|
||||
destroy()
|
||||
}
|
||||
|
||||
private fun track() {
|
||||
val recordTime = System.currentTimeMillis() - duringTime
|
||||
AnalyticsUtil.track(INVOKE_TRACK_PLAY_PASS_ID,
|
||||
hashMapOf(INVOKE_TRACK_PASS_TIME to recordCount
|
||||
, INVOKE_TRACK_PLAY_TIME to recordTime))
|
||||
Logger.d(TAG, "closeGuideFragment -> recordTime : $recordTime , recordCount : $recordCount")
|
||||
}
|
||||
|
||||
private fun destroy() {
|
||||
GuideBizManager.removeGuideFragmentToStack()
|
||||
}
|
||||
|
||||
private fun invokeAuthorize() {
|
||||
GuideBizManager.invokeAuthorize()
|
||||
}
|
||||
|
||||
override fun onDestroyView() {
|
||||
closeGuideFragment()
|
||||
super.onDestroyView()
|
||||
}
|
||||
|
||||
override fun onDestroy() {
|
||||
super.onDestroy()
|
||||
track()
|
||||
breakOffSpeak(context!!)
|
||||
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_end), object : IMogoVoiceCmdCallBack {
|
||||
override fun onTTSEnd(ttsId: String?, tts: String?) {
|
||||
|
||||
}
|
||||
})
|
||||
invokeAuthorize()
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.mogo.module.guide.fragment
|
||||
|
||||
import androidx.lifecycle.LifecycleOwner
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
|
||||
class GuidePresenter : Presenter<GuideConstract.View>, GuideConstract.Biz {
|
||||
|
||||
constructor(view: GuideConstract.View) : super(view)
|
||||
|
||||
companion object{
|
||||
const val TAG = "GuidePresenter"
|
||||
}
|
||||
|
||||
override fun onCreate(owner: LifecycleOwner) {
|
||||
super.onCreate(owner)
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.mogo.module.guide.guide
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.module.guide.fragment.GuideFragment
|
||||
import com.mogo.module.guide.util.breakOffSpeak
|
||||
import com.mogo.module.guide.util.speak
|
||||
import kotlinx.android.synthetic.main.module_guide_item_stage_five.*
|
||||
import kotlinx.android.synthetic.main.module_guide_item_stage_four.*
|
||||
|
||||
class GuideStageFiveFragment : MvpFragment<IView, Presenter<IView>> {
|
||||
|
||||
private var containerFragment: GuideFragment? = null
|
||||
|
||||
constructor(containerFragment: GuideFragment) {
|
||||
this.containerFragment = containerFragment
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_guide_item_stage_five
|
||||
}
|
||||
|
||||
override fun createPresenter(): Presenter<IView> {
|
||||
return GuideLocationPresenter(this)
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
if(!DebugConfig.isLauncher()){
|
||||
@Suppress("DEPRECATION")
|
||||
moduleGuidePageFive.background = context!!.resources!!.getDrawable(R.mipmap.module_guide_item_stage_five)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
containerFragment?.invisibleRight()
|
||||
breakOffSpeak(context!!)
|
||||
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_five), object : IMogoVoiceCmdCallBack {
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
if(!isVisible){
|
||||
return
|
||||
}
|
||||
containerFragment?.closeGuideFragment()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
class GuideLocationPresenter : Presenter<IView> {
|
||||
|
||||
constructor(view: IView?) : super(view)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.mogo.module.guide.guide
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.module.guide.fragment.GuideFragment
|
||||
import com.mogo.module.guide.util.breakOffSpeak
|
||||
import com.mogo.module.guide.util.speak
|
||||
import kotlinx.android.synthetic.main.module_guide_item_stage_four.*
|
||||
import kotlinx.android.synthetic.main.module_guide_item_stage_three.*
|
||||
|
||||
class GuideStageFourFragment : MvpFragment<IView, Presenter<IView>> {
|
||||
|
||||
private var containerFragment: GuideFragment? = null
|
||||
|
||||
constructor(containerFragment: GuideFragment) {
|
||||
this.containerFragment = containerFragment
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_guide_item_stage_four
|
||||
}
|
||||
|
||||
override fun createPresenter(): Presenter<IView> {
|
||||
return GuideNavigationPresenter(this)
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
if(!DebugConfig.isLauncher()){
|
||||
@Suppress("DEPRECATION")
|
||||
moduleGuidePageFour.background = context!!.resources!!.getDrawable(R.mipmap.module_guide_item_stage_four)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
containerFragment?.visibleLeft()
|
||||
containerFragment?.visibleRight()
|
||||
breakOffSpeak(context!!)
|
||||
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_four), object : IMogoVoiceCmdCallBack {
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
if(!isVisible){
|
||||
return
|
||||
}
|
||||
containerFragment?.moveToNext()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
class GuideNavigationPresenter : Presenter<IView> {
|
||||
|
||||
constructor(view: IView?) : super(view)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
package com.mogo.module.guide.guide
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.module.guide.fragment.GuideFragment
|
||||
import com.mogo.module.guide.util.breakOffSpeak
|
||||
import com.mogo.module.guide.util.speak
|
||||
import kotlinx.android.synthetic.main.module_guide_item_stage_one.*
|
||||
|
||||
|
||||
class GuideStageOneFragment : MvpFragment<IView, Presenter<IView>> {
|
||||
|
||||
private var containerFragment: GuideFragment? = null
|
||||
|
||||
constructor(containerFragment: GuideFragment) {
|
||||
this.containerFragment = containerFragment
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_guide_item_stage_one
|
||||
}
|
||||
|
||||
override fun createPresenter(): Presenter<IView> {
|
||||
return GuideStartPresenter(this)
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
containerFragment?.visibleRight()
|
||||
if(!DebugConfig.isLauncher()){
|
||||
@Suppress("DEPRECATION")
|
||||
moduleGuidePageOne.background = context!!.resources!!.getDrawable(R.mipmap.module_guide_item_stage_one)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
containerFragment?.invisibleLeft()
|
||||
breakOffSpeak(context!!)
|
||||
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_one), object : IMogoVoiceCmdCallBack {
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
if (!isVisible) {
|
||||
return
|
||||
}
|
||||
containerFragment?.moveToNext()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
class GuideStartPresenter : Presenter<IView> {
|
||||
|
||||
constructor(view: IView?) : super(view)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.mogo.module.guide.guide
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.module.guide.fragment.GuideFragment
|
||||
import com.mogo.module.guide.util.breakOffSpeak
|
||||
import com.mogo.module.guide.util.speak
|
||||
import kotlinx.android.synthetic.main.module_guide_item_stage_three.*
|
||||
import kotlinx.android.synthetic.main.module_guide_item_stage_two.*
|
||||
|
||||
class GuideStageThreeFragment : MvpFragment<IView, Presenter<IView>> {
|
||||
|
||||
private var containerFragment: GuideFragment? = null
|
||||
|
||||
constructor(containerFragment: GuideFragment) {
|
||||
this.containerFragment = containerFragment
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_guide_item_stage_three
|
||||
}
|
||||
|
||||
override fun createPresenter(): Presenter<IView> {
|
||||
return GuideOnLineCarPresenter(this)
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
if(!DebugConfig.isLauncher()){
|
||||
@Suppress("DEPRECATION")
|
||||
moduleGuidePageThree.background = context!!.resources!!.getDrawable(R.mipmap.module_guide_item_stage_three)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
containerFragment?.visibleLeft()
|
||||
containerFragment?.visibleRight()
|
||||
breakOffSpeak(context!!)
|
||||
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_three), object : IMogoVoiceCmdCallBack {
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
if(!isVisible){
|
||||
return
|
||||
}
|
||||
containerFragment?.moveToNext()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
class GuideOnLineCarPresenter : Presenter<IView> {
|
||||
|
||||
constructor(view: IView?) : super(view)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,58 @@
|
||||
package com.mogo.module.guide.guide
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig
|
||||
import com.mogo.commons.mvp.IView
|
||||
import com.mogo.commons.mvp.MvpFragment
|
||||
import com.mogo.commons.mvp.Presenter
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
||||
import com.mogo.module.guide.R
|
||||
import com.mogo.module.guide.fragment.GuideFragment
|
||||
import com.mogo.module.guide.util.breakOffSpeak
|
||||
import com.mogo.module.guide.util.speak
|
||||
import kotlinx.android.synthetic.main.module_guide_item_stage_one.*
|
||||
import kotlinx.android.synthetic.main.module_guide_item_stage_two.*
|
||||
|
||||
class GuideStageTwoFragment : MvpFragment<IView, Presenter<IView>> {
|
||||
|
||||
private var containerFragment: GuideFragment? = null
|
||||
|
||||
constructor(containerFragment: GuideFragment) {
|
||||
this.containerFragment = containerFragment
|
||||
}
|
||||
|
||||
override fun getLayoutId(): Int {
|
||||
return R.layout.module_guide_item_stage_two
|
||||
}
|
||||
|
||||
override fun createPresenter(): Presenter<IView> {
|
||||
return GuideCardPresenter(this)
|
||||
}
|
||||
|
||||
override fun initViews() {
|
||||
if(!DebugConfig.isLauncher()){
|
||||
@Suppress("DEPRECATION")
|
||||
moduleGuidePageTwo.background = context!!.resources!!.getDrawable(R.mipmap.module_guide_item_stage_two)
|
||||
}
|
||||
}
|
||||
|
||||
override fun onResume() {
|
||||
super.onResume()
|
||||
containerFragment?.visibleLeft()
|
||||
containerFragment?.visibleRight()
|
||||
breakOffSpeak(context!!)
|
||||
speak(context!!, context!!.resources.getString(R.string.module_guide_voice_page_two), object : IMogoVoiceCmdCallBack {
|
||||
override fun onSpeakEnd(speakText: String?) {
|
||||
if(!isVisible){
|
||||
return
|
||||
}
|
||||
containerFragment?.moveToNext()
|
||||
}
|
||||
})
|
||||
}
|
||||
|
||||
class GuideCardPresenter : Presenter<IView> {
|
||||
|
||||
constructor(view: IView?) : super(view)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
package com.mogo.module.guide.util
|
||||
|
||||
import com.alibaba.android.arouter.launcher.ARouter
|
||||
import com.mogo.service.IMogoServiceApis
|
||||
import com.mogo.service.MogoServicePaths
|
||||
import com.mogo.service.analytics.IMogoAnalytics
|
||||
|
||||
object AnalyticsUtil {
|
||||
|
||||
const val INVOKE_TRACK_PLAY_PASS_ID = "v2x_play_pass"
|
||||
const val INVOKE_TRACK_PASS_TIME = "pass_time"
|
||||
const val INVOKE_TRACK_PLAY_TIME = "play_time"
|
||||
|
||||
private var trackRouter: IMogoAnalytics? = null
|
||||
|
||||
fun track(eventType: String, data: MutableMap<String, Any>? = hashMapOf()) {
|
||||
if (trackRouter == null) {
|
||||
val arouter = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation()
|
||||
if (arouter is IMogoServiceApis) {
|
||||
trackRouter = arouter.analyticsApi
|
||||
}
|
||||
}
|
||||
trackRouter!!.track(eventType, data)
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
package com.mogo.module.guide.util
|
||||
|
||||
import com.mogo.commons.AbsMogoApplication
|
||||
import com.mogo.module.common.utils.SPConst.getSPGuideRecord
|
||||
import com.mogo.module.common.utils.SPConst.getSpGuide
|
||||
import com.mogo.utils.storage.SharedPrefsMgr
|
||||
|
||||
object SharedPreferenceUtil {
|
||||
|
||||
fun hasGuide(): Boolean {
|
||||
return SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).getBoolean(getSpGuide(), false)
|
||||
}
|
||||
|
||||
fun setGuideFinish() {
|
||||
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).putBoolean(getSpGuide(), true)
|
||||
}
|
||||
|
||||
fun setGuideRecord() {
|
||||
SharedPrefsMgr.getInstance(AbsMogoApplication.getApp()).putLong(getSPGuideRecord(), System.currentTimeMillis())
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,14 @@
|
||||
package com.mogo.module.guide.util
|
||||
|
||||
import android.content.Context
|
||||
import com.mogo.commons.voice.AIAssist
|
||||
import com.mogo.commons.voice.IMogoVoiceCmdCallBack
|
||||
import com.mogo.commons.voice.VoicePreemptType
|
||||
|
||||
fun speak(context: Context, text: String, callBack: IMogoVoiceCmdCallBack?) {
|
||||
AIAssist.getInstance(context).speakTTSVoice(text, VoicePreemptType.PREEMPT_TYPE_IMMEADIATELY, callBack)
|
||||
}
|
||||
|
||||
fun breakOffSpeak(context: Context){
|
||||
AIAssist.getInstance(context).breakOffSpeak()
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<shape xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
<corners android:radius="@dimen/dp_15"/>
|
||||
<gradient android:angle="180" android:startColor="#42B2FD" android:endColor="#1F7BF9"/>
|
||||
</shape>
|
||||
@@ -0,0 +1,28 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/moduleGuideViewPager"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<com.zhpan.indicator.IndicatorView
|
||||
android:id="@+id/moduleGuideIndicator"
|
||||
android:layout_width="@dimen/dp_30"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginBottom="@dimen/dp_84"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
|
||||
<include
|
||||
android:id="@+id/module_guide_include"
|
||||
layout="@layout/module_guide_item_include" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,42 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_guide_page_right"
|
||||
android:layout_width="@dimen/dp_54"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
android:layout_marginRight="@dimen/dp_92"
|
||||
android:visibility="gone"
|
||||
android:src="@mipmap/module_guide_right_page"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_guide_page_left"
|
||||
android:layout_width="@dimen/dp_54"
|
||||
android:layout_height="@dimen/dp_90"
|
||||
android:layout_marginLeft="@dimen/dp_92"
|
||||
android:visibility="gone"
|
||||
android:src="@mipmap/module_guide_left_page"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_guide_tv_next_step"
|
||||
android:layout_width="@dimen/dp_159"
|
||||
android:layout_height="@dimen/dp_64"
|
||||
android:layout_marginTop="@dimen/dp_18"
|
||||
android:layout_marginRight="@dimen/dp_55"
|
||||
android:background="@drawable/module_guide_blue_corner"
|
||||
android:gravity="center"
|
||||
android:text="@string/module_guide_item_next_step"
|
||||
android:textColor="#FFFFFF"
|
||||
android:textSize="@dimen/dp_37"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,8 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/moduleGuidePageFive"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/module_guide_item_stage_five_launcher">
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/moduleGuidePageFour"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/module_guide_item_stage_four_launcher">
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,9 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/moduleGuidePageOne"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/module_guide_item_stage_one_launcher">
|
||||
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/moduleGuidePageThree"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/module_guide_item_stage_three_launcher">
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -0,0 +1,7 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/moduleGuidePageTwo"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:background="@mipmap/module_guide_item_stage_two_launcher">
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
|
After Width: | Height: | Size: 371 KiB |
|
After Width: | Height: | Size: 342 KiB |
|
After Width: | Height: | Size: 337 KiB |
|
After Width: | Height: | Size: 500 KiB |
|
After Width: | Height: | Size: 474 KiB |
|
After Width: | Height: | Size: 635 B |
|
After Width: | Height: | Size: 713 B |
|
After Width: | Height: | Size: 536 KiB |
|
After Width: | Height: | Size: 445 KiB |
|
After Width: | Height: | Size: 550 KiB |
|
After Width: | Height: | Size: 597 KiB |
|
After Width: | Height: | Size: 568 KiB |
|
After Width: | Height: | Size: 749 B |
|
After Width: | Height: | Size: 820 B |
|
After Width: | Height: | Size: 918 KiB |
|
After Width: | Height: | Size: 835 KiB |
|
After Width: | Height: | Size: 978 KiB |
|
After Width: | Height: | Size: 1.3 MiB |
|
After Width: | Height: | Size: 1004 KiB |
|
After Width: | Height: | Size: 1.2 KiB |