taskAsync(delayTime: Long = 0, noinline job: suspend () -> T) = GlobalScope.async(ThreadPool) {
+ delay(delayTime)
+ job()
+}
\ No newline at end of file
diff --git a/libraries/tanlulib/src/test/java/com/zhidao/roadcondition/ExampleUnitTest.kt b/libraries/tanlulib/src/test/java/com/zhidao/roadcondition/ExampleUnitTest.kt
new file mode 100644
index 0000000000..a2c91715fe
--- /dev/null
+++ b/libraries/tanlulib/src/test/java/com/zhidao/roadcondition/ExampleUnitTest.kt
@@ -0,0 +1,17 @@
+package com.zhidao.roadcondition
+
+import org.junit.Test
+
+import org.junit.Assert.*
+
+/**
+ * Example local unit test, which will execute on the development machine (host).
+ *
+ * See [testing documentation](http://d.android.com/tools/testing).
+ */
+class ExampleUnitTest {
+ @Test
+ fun addition_isCorrect() {
+ assertEquals(4, 2 + 2)
+ }
+}
diff --git a/modules/mogo-module-main/build.gradle b/modules/mogo-module-main/build.gradle
index 2f686a9f62..0973d16ea3 100644
--- a/modules/mogo-module-main/build.gradle
+++ b/modules/mogo-module-main/build.gradle
@@ -39,7 +39,6 @@ dependencies {
implementation rootProject.ext.dependencies.androidxappcompat
implementation rootProject.ext.dependencies.androidxconstraintlayout
implementation rootProject.ext.dependencies.arouter
- implementation rootProject.ext.dependencies.tanluupload
annotationProcessor rootProject.ext.dependencies.aroutercompiler
if (Boolean.valueOf(RELEASE)) {
api rootProject.ext.dependencies.mogoutils
@@ -52,6 +51,7 @@ dependencies {
api rootProject.ext.dependencies.moduleapps
api rootProject.ext.dependencies.moduleextensions
api rootProject.ext.dependencies.mogomoduleback
+ implementation rootProject.ext.dependencies.tanluupload
} else {
api project(":foudations:mogo-utils")
api project(":foudations:mogo-commons")
@@ -63,6 +63,7 @@ dependencies {
api project(':modules:mogo-module-apps')
api project(':modules:mogo-module-extensions')
api project(':modules:mogo-module-back')
+ implementation project(':libraries:tanlulib')
}
}
diff --git a/modules/mogo-module-tanlu/.gitignore b/modules/mogo-module-tanlu/.gitignore
new file mode 100644
index 0000000000..796b96d1c4
--- /dev/null
+++ b/modules/mogo-module-tanlu/.gitignore
@@ -0,0 +1 @@
+/build
diff --git a/modules/mogo-module-tanlu/build.gradle b/modules/mogo-module-tanlu/build.gradle
new file mode 100644
index 0000000000..f28f498553
--- /dev/null
+++ b/modules/mogo-module-tanlu/build.gradle
@@ -0,0 +1,81 @@
+apply plugin: 'com.android.library'
+apply plugin: 'kotlin-android'
+apply plugin: 'kotlin-android-extensions'
+apply plugin: 'com.alibaba.arouter'
+
+android {
+ compileSdkVersion rootProject.ext.android.compileSdkVersion
+ // buildToolsVersion rootProject.ext.android.buildToolsVersion
+ defaultConfig {
+ minSdkVersion rootProject.ext.android.minSdkVersion
+ targetSdkVersion rootProject.ext.android.targetSdkVersion
+ versionCode Integer.valueOf(VERSION_CODE)
+ versionName getValueFromRootProperties("${project.name.replace("-", "_").toUpperCase()}_VERSION")
+
+ testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
+ consumerProguardFiles 'consumer-rules.pro'
+
+ javaCompileOptions {
+ annotationProcessorOptions {
+ arguments = [AROUTER_MODULE_NAME: project.getName()]
+ }
+ }
+ }
+
+ buildTypes {
+ release {
+ minifyEnabled false
+ zipAlignEnabled true
+ proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
+ }
+ }
+
+ compileOptions {
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
+ }
+
+ lintOptions {
+ abortOnError false
+ }
+}
+
+dependencies {
+ implementation fileTree(dir: 'libs', include: ['*.jar'])
+ implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
+ implementation 'androidx.appcompat:appcompat:1.0.2'
+ implementation 'androidx.core:core-ktx:1.3.0'
+ implementation 'androidx.recyclerview:recyclerview:1.1.0'
+ testImplementation 'junit:junit:4.12'
+ androidTestImplementation 'androidx.test:runner:1.2.0'
+ androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0'
+ implementation rootProject.ext.dependencies.androidxappcompat
+ implementation rootProject.ext.dependencies.arouter
+ annotationProcessor rootProject.ext.dependencies.aroutercompiler
+ implementation rootProject.ext.dependencies.androidxconstraintlayout
+ implementation rootProject.ext.dependencies.rxjava
+ implementation rootProject.ext.dependencies.rxandroid
+
+ compileOnly rootProject.ext.dependencies.mogomap
+ compileOnly rootProject.ext.dependencies.mogoutils
+ compileOnly rootProject.ext.dependencies.mogocommons
+ compileOnly rootProject.ext.dependencies.mogoserviceapi
+ compileOnly rootProject.ext.dependencies.modulecommon
+ compileOnly rootProject.ext.dependencies.moduleshare
+ compileOnly rootProject.ext.dependencies.carcallprovider
+
+ implementation rootProject.ext.dependencies.videoarmv7
+ implementation rootProject.ext.dependencies.videoarm64
+ implementation rootProject.ext.dependencies.videojava
+ implementation rootProject.ext.dependencies.eventbus
+
+// if( Boolean.valueOf(RELEASE)){
+// implementation rootProject.ext.dependencies.moduletanlulib
+// } else {
+// implementation project(":tanlulib")
+// }
+}
+apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
+repositories {
+ mavenCentral()
+}
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/com.java b/modules/mogo-module-tanlu/com.java
new file mode 100644
index 0000000000..4bd93c5158
--- /dev/null
+++ b/modules/mogo-module-tanlu/com.java
@@ -0,0 +1,13 @@
+-keep class com.mogo.module.tanlu.model.**{*;}
+-keep class com.mogo.module.tanlu.fragment.*{*;}
+-keep class com.mogo.module.tanlu.receiver.*{*;}
+-keep class com.mogo.module.tanlu.video.*{*;}
+-keep interface * implements com.mogo.module.tanlu.net.TanluApiService
+-keep interface * implements com.mogo.module.tanlu.callback.AlongTheWayCallback
+-keep interface * implements com.mogo.module.tanlu.callback.IThumbsUpCallback
+-keep interface * implements com.mogo.module.tanlu.callback.NaviCallback
+-keep interface * implements com.mogo.module.tanlu.callback.RoadInfoCallback
+-keep interface * implements com.mogo.module.tanlu.callback.RoadLineCallback
+-keep interface * implements com.mogo.module.tanlu.callback.UploadShareCallback
+-keep interface * implements com.mogo.module.tanlu.callback.VoiceSearchCallback
+-keep class com.mogo.module.tanlu.util.*{*;}
diff --git a/modules/mogo-module-tanlu/consumer-rules.pro b/modules/mogo-module-tanlu/consumer-rules.pro
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/modules/mogo-module-tanlu/gradle.properties b/modules/mogo-module-tanlu/gradle.properties
new file mode 100644
index 0000000000..3b59b15369
--- /dev/null
+++ b/modules/mogo-module-tanlu/gradle.properties
@@ -0,0 +1,3 @@
+GROUP=com.mogo.module
+POM_ARTIFACT_ID=module-tanlu
+VERSION_CODE=1
diff --git a/modules/mogo-module-tanlu/proguard-rules.pro b/modules/mogo-module-tanlu/proguard-rules.pro
new file mode 100644
index 0000000000..abda68c28d
--- /dev/null
+++ b/modules/mogo-module-tanlu/proguard-rules.pro
@@ -0,0 +1,40 @@
+# 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
+-keep class com.mogo.module.tanlu.model.**{*;}
+-keep class com.mogo.module.tanlu.fragment.*{*;}
+-keep class com.mogo.module.tanlu.receiver.*{*;}
+-keep class com.mogo.module.tanlu.video.*{*;}
+-keep interface * implements com.mogo.module.tanlu.net.TanluApiService
+-keep interface * implements com.mogo.module.tanlu.callback.AlongTheWayCallback
+-keep interface * implements com.mogo.module.tanlu.callback.IThumbsUpCallback
+-keep interface * implements com.mogo.module.tanlu.callback.NaviCallback
+-keep interface * implements com.mogo.module.tanlu.callback.RoadInfoCallback
+-keep interface * implements com.mogo.module.tanlu.callback.RoadLineCallback
+-keep interface * implements com.mogo.module.tanlu.callback.UploadShareCallback
+-keep interface * implements com.mogo.module.tanlu.callback.VoiceSearchCallback
+-keep class com.mogo.module.tanlu.util.*{*;}
+
+
+
+
+
+
diff --git a/modules/mogo-module-tanlu/src/main/AndroidManifest.xml b/modules/mogo-module-tanlu/src/main/AndroidManifest.xml
new file mode 100644
index 0000000000..1c2b75eee1
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/AndroidManifest.xml
@@ -0,0 +1,55 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/AlongTheWayCallback.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/AlongTheWayCallback.java
new file mode 100644
index 0000000000..de8c420fc6
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/AlongTheWayCallback.java
@@ -0,0 +1,13 @@
+package com.mogo.module.tanlu.callback;
+
+import com.mogo.module.tanlu.model.InformationAndLiveCarResult;
+
+/**
+ * @author lixiaopeng
+ * @description 导航沿途搜索
+ * @since 2020-01-09
+ */
+public interface AlongTheWayCallback {
+ void onSuccess(InformationAndLiveCarResult data);
+ void onFail(String message, int code);
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/DataSetChangedAdapter.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/DataSetChangedAdapter.java
new file mode 100644
index 0000000000..a13c7e2ff1
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/DataSetChangedAdapter.java
@@ -0,0 +1,44 @@
+package com.mogo.module.tanlu.callback;
+
+import com.mogo.service.datamanager.IMogoDataChangedListener;
+
+/**
+ * @author congtaowang
+ * @since 2020-02-12
+ *
+ * 描述
+ */
+public class DataSetChangedAdapter implements IMogoDataChangedListener {
+
+ private Object mData;
+
+ private DataSetChangedAdapter(){
+ // private constructor
+ }
+
+ private static final class InstanceHolder{
+ private static final DataSetChangedAdapter INSTANCE = new DataSetChangedAdapter();
+ }
+
+ private IMogoDataChangedListener mDelegate;
+
+ public void setDelegate( IMogoDataChangedListener delegate ) {
+ this.mDelegate = delegate;
+ }
+
+ public static DataSetChangedAdapter getInstance(){
+ return InstanceHolder.INSTANCE;
+ }
+
+ @Override
+ public void onDataSetChanged( Object data ) {
+ mData = data;
+ if ( mDelegate != null ) {
+ mDelegate.onDataSetChanged( data );
+ }
+ }
+
+ public Object getData() {
+ return mData;
+ }
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/IThumbsUpCallback.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/IThumbsUpCallback.kt
new file mode 100644
index 0000000000..0f7f6fb6f6
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/IThumbsUpCallback.kt
@@ -0,0 +1,6 @@
+package com.mogo.module.tanlu.callback
+
+interface IThumbsUpCallback {
+ fun onThumbsUpSuccess()
+ fun onThumbsUpFail()
+}
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/NaviCallback.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/NaviCallback.java
new file mode 100644
index 0000000000..3eb098bb58
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/NaviCallback.java
@@ -0,0 +1,13 @@
+package com.mogo.module.tanlu.callback;
+
+import com.mogo.module.tanlu.model.NaviResult;
+
+/**
+ * @author lixiaopeng
+ * @description 导航沿途数据
+ * @since 2020-01-09
+ */
+public interface NaviCallback {
+ void onSuccess(NaviResult data);
+ void onFail(String message, int code);
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/RoadInfoCallback.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/RoadInfoCallback.kt
new file mode 100644
index 0000000000..503f675283
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/RoadInfoCallback.kt
@@ -0,0 +1,11 @@
+package com.mogo.module.tanlu.callback
+
+import com.mogo.module.common.entity.MarkerExploreWay
+import com.mogo.module.tanlu.model.RoadInfos
+
+interface RoadInfoCallback {
+ fun onLocatSuccess(lat: Double, lon: Double)
+ fun onQueryRoadInfoSuccess(roadInfoList:List)
+ fun onQueryRoadInfoFail(msg: String, code: Int)
+
+}
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/RoadLineCallback.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/RoadLineCallback.java
new file mode 100644
index 0000000000..53e81c13dc
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/RoadLineCallback.java
@@ -0,0 +1,13 @@
+package com.mogo.module.tanlu.callback;
+
+import com.mogo.module.tanlu.model.PathLineResult;
+
+/**
+ * @author lixiaopeng
+ * @description 通勤族回调
+ * @since 2020-01-09
+ */
+public interface RoadLineCallback {
+ void onSuccess(PathLineResult data);
+ void onFail(String message, int code);
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/UploadShareCallback.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/UploadShareCallback.java
new file mode 100644
index 0000000000..c0ae07ea7a
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/UploadShareCallback.java
@@ -0,0 +1,14 @@
+package com.mogo.module.tanlu.callback;
+
+import com.mogo.commons.data.BaseData;
+
+
+/**
+ * @author lixiaopeng
+ * @description 上报分享
+ * @since 2020-01-09
+ */
+public interface UploadShareCallback {
+ void onSuccess(BaseData data);
+ void onFail(String message, int code);
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/VoiceSearchCallback.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/VoiceSearchCallback.java
new file mode 100644
index 0000000000..6b0913e7fb
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/callback/VoiceSearchCallback.java
@@ -0,0 +1,13 @@
+package com.mogo.module.tanlu.callback;
+
+import com.mogo.module.tanlu.model.VoiceSearchResult;
+
+/**
+ * @author lixiaopeng
+ * @description 声音控制搜索回调
+ * @since 2020-01-09
+ */
+public interface VoiceSearchCallback {
+ void onSuccess(VoiceSearchResult data);
+ void onFail(String message, int code);
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/constant/Const.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/constant/Const.kt
new file mode 100644
index 0000000000..75800d758b
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/constant/Const.kt
@@ -0,0 +1,34 @@
+package com.mogo.module.tanlu.constant
+
+const val REQUESTCODE_MAINACTIVITY = 0
+const val REQUESTCODE_MEDIAACTIVITY = 1
+
+//EXTRA_STATE
+const val AUTO_NAVI_START = 8 //开始导航
+const val AUTO_NAVI_END = 9 //结束导航
+
+// 道路事件名称,用于语音识别区分道路事件
+const val TYPE_NAME_BLOCK = "拥堵"
+const val TYPE_NAME_TRAFFIC_CHECK = "交通检查"
+const val TYPE_NAME_CLOSURE = "封路"
+const val TYPE_NAME_ACCIDENT = "交通事故"
+const val TYPE_NAME_REAL_TIME_TRAFFIC = "实时路况"
+const val TYPE_NAME_STAGNANT_WATER = "积水"
+const val TYPE_NAME_ROAD_ICY = "积冰"
+const val TYPE_NAME_DENSE_FOG = "雾"
+const val TYPE_NAME_ROAD_CONSTRUCTION = "施工"
+
+/**
+ * 搜索交通检查
+ */
+const val VOICE_COMMAND_QUERY_TRAFFIC_CHECK = "com.zhidao.share.traffic.police"
+
+/**
+ * 搜索封路信息
+ */
+const val VOICE_COMMAND_QUERY_ROAD_CLOSED = "com.zhidao.share.road.closure.query"
+
+/**
+ * 其他道路事件,包括事故,实时路况,道路积水,道路积冰,浓雾
+ */
+const val VOICE_COMMAND_NOVELTY_QUERY = "com.zhidao.novelty.query"
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/constant/HttpConst.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/constant/HttpConst.java
new file mode 100644
index 0000000000..db8261e5c3
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/constant/HttpConst.java
@@ -0,0 +1,13 @@
+package com.mogo.module.tanlu.constant;
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2020-01-09
+ */
+public class HttpConst {
+ public static final String HOST_DEV = "http://dzt-test.zhidaohulian.com";
+ public static final String HOST_SHOW = "http://dzt-show.zhidaohulian.com";
+ public static final String HOST_TEST = "http://dzt-test.zhidaohulian.com";
+ public static final String HOST_PRODUCT = "https://dzt.zhidaohulian.com";
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/constant/TanluConstants.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/constant/TanluConstants.java
new file mode 100644
index 0000000000..a033351035
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/constant/TanluConstants.java
@@ -0,0 +1,112 @@
+package com.mogo.module.tanlu.constant;
+
+/**
+ * @author congtaowang
+ * @since 2019-12-24
+ *
+ * 描述
+ */
+public class TanluConstants {
+
+ /**
+ * 加油 10001
+ * 交通检查 10002
+ * 封路 10003
+ * 商场打折 10004
+ * 4S店 10005
+ * 施工 10006
+ * 拥堵 10007
+ * 积水 10008
+ * 超市折扣 10009
+ * 浓雾 10010
+ * 结冰 10011
+ * 停车场 10012
+ * 交通事故 10013
+ * 社保 10014
+ * 实时路况 10015
+ */
+ public static final String TANLU_ROAD_PONDING = "10008"; //积水
+ public static final String TANLU_ROAD_ICING = "10011"; //积冰
+ public static final String TANLU_ROAD_HEAVY_FOG = "10010"; //大雾
+ public static final String TANLU_ROAD_ACCIDENT = "10013"; //事故
+ public static final String TANLU_ROAD_CONSTRUCTION = "10006"; //道路施工
+ public static final String TANLU_ROAD_CONGESTION_COMPAT = "10007"; //拥堵,适配语音不做数值转换
+ public static final String TANLU_TRAFFIC_CHECK_COMPAT = "10002"; //交通检查,适配语音不做数值转换
+ public static final String TANLU_ROAD_CLOSURE_COMPAT = "10003"; //封路,适配语音不做数值转换
+
+ public static final String TANLU_ROAD_CURRENT = "10015"; //实时路况
+
+
+ public static final String TAG = "/tanlu/ui";
+ public static final String NAVI_INFO = "navi_info";
+ public static final String MODEL_NAME = "CARD_TYPE_ROAD_CONDITION";
+
+ public static final String[] CMD_PLAY_ROAD_CONDITION = {"播放路况"};
+ public static final String[] CMD_THE_PREVIOUS = {"上一条"};
+ public static final String[] CMD_THE_NEXT = {"下一条"};
+ public static final String[] CMD_UPLOAD_BLOCK = {"上报拥堵"};
+ public static final String[] CMD_TRAFFIC_CHECK = {"上报交通检查"};
+ public static final String[] CMD_ROAD_CLOSURE = {"上报封路"};
+
+ //上报拥堵
+ public static final String UPLOAD_ROAD_BLOCK = "command_upload_block";
+ //上报交通检查
+ public static final String UPLOAD_TRAFFIC_CHECK = "command_upload_traffic_check";
+ //上报封路
+ public static final String UPLOAD_ROAD_CLOSURE = "command_upload_road_closure";
+
+ //上报路况
+ public static final String UPLOAD_ROAD_CONDITION = "command_upload_roadcondition";
+ //打开探路 免唤醒
+ public static final String OPEN_ROADCONDITION = "command_open_roadcondition";
+ //打开探路 唤醒
+ public static final String OPEN_ROADCONDITION_AWAKE = "com.zhidao.desk.switchCard";
+ //打开探路 唤醒
+ public static final String OPEN_ROADCONDITION_AWAKE_COMMAND = "system.application.operation";
+
+ //xx堵不堵 唤醒
+ public static final String SPECIFIEDROAD_SEARCH = "com.zhidao.pathfinder.specifiedroad.search";
+ //播放 免唤醒
+ public static final String PLAY_VIDEO = "com.zhidao.tanlu.play";
+ //播放 唤醒
+ public static final String PLAY_VIDEO_AWAKEN = "com.zhidao.pathfinder.play.roadCondition";
+ //分享路况/上报路况/上报拥堵/上报交通检查/上报封路 唤醒
+ public static final String UPLOAD_ROAD_CONDITION_AWAKEN = "com.zhidao.pathfinder.report.roadCondition";
+ //关闭分享框 唤醒
+ public static final String SHARE_DIALOG_CLOSE = "com.zhidao.share.close";
+
+ public static final String AWAKE_NOTIFY = "com.zhidao.speech.awake.notify";
+
+
+ //上一条
+// public static final String THE_PREVIOUS = "com.zhidao.tanlu.previous";
+ //下一条
+// public static final String THE_NEXT = "com.zhidao.tanlu.next";
+
+ //分享封路
+ public static final String SHARE_ROAD_CLOSURE = "com.zhidao.share.road.closure";
+ //分享交通检查
+ public static final String SHARE_TRAFFIC_CHECK = "com.zhidao.share.traffic.check";
+ //我要分享
+ public static final String GO_TO_SHARE = "com.zhidao.share";
+
+ //埋点数据
+ //marker点击
+ public static final String LAUNCHER_ICON_CLICK = "Launcher_Icon_Click";
+ //分享分类 1:路况,2:油价,3:交通检查,4:封路
+ public static final String LAUNCHER_SHARE_TYPE = "Launcher_Share_type";
+ //分享/上报按钮点击 from=1 手动点击 from=2 语音打开
+ public static final String LAUNCHER_SHARE_CLICK = "Launcher_Share_Click";
+ public static final String CARNET_USER_UPLOAD = "CarNet_user_upload";
+
+ public static final String CARNET_ROAD_ENVENT = "v2x_road_event";
+
+ //语音搜索
+ public static final String CARNET_VOICE_SEARCH = "CarNet_Voice_Search";
+
+ //视频播放
+ public static final String CARNET_USER_VIDEO_PLAY = "CarNet_user_video_play";
+
+ public static final String LAUNCHER_MARKER_ICON_CLICK = "Launcher_Icon_Click";
+
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewFragment.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewFragment.java
new file mode 100644
index 0000000000..7766ac1280
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewFragment.java
@@ -0,0 +1,1713 @@
+package com.mogo.module.tanlu.fragment;
+
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.Rect;
+import android.os.Bundle;
+import android.os.CountDownTimer;
+import android.os.Handler;
+import android.text.TextUtils;
+import android.view.MotionEvent;
+import android.view.View;
+import android.view.animation.Interpolator;
+import android.view.animation.LinearInterpolator;
+import android.widget.RelativeLayout;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.GridLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.alibaba.android.arouter.launcher.ARouter;
+import com.mogo.commons.data.BaseData;
+import com.mogo.commons.mvp.IView;
+import com.mogo.commons.mvp.MvpFragment;
+import com.mogo.commons.mvp.Presenter;
+import com.mogo.commons.voice.AIAssist;
+import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
+import com.mogo.map.MogoLatLng;
+import com.mogo.map.listener.IMogoMapListener;
+import com.mogo.map.location.IMogoLocationListener;
+import com.mogo.map.location.MogoLocation;
+import com.mogo.map.marker.IMogoMarker;
+import com.mogo.map.marker.IMogoMarkerClickListener;
+import com.mogo.map.marker.IMogoMarkerManager;
+import com.mogo.map.marker.MogoMarkerOptions;
+import com.mogo.map.marker.anim.OnMarkerAnimationListener;
+import com.mogo.map.model.MogoPoi;
+import com.mogo.map.navi.IMogoNaviListener;
+import com.mogo.map.navi.MogoNaviInfo;
+import com.mogo.map.navi.MogoTraffic;
+import com.mogo.map.search.geo.IMogoGeoSearch;
+import com.mogo.map.search.geo.IMogoGeoSearchListener;
+import com.mogo.map.search.geo.MogoGeocodeAddress;
+import com.mogo.map.search.geo.MogoGeocodeResult;
+import com.mogo.map.search.geo.MogoPoiItem;
+import com.mogo.map.search.geo.MogoRegeocodeResult;
+import com.mogo.map.search.geo.query.MogoGeocodeQuery;
+import com.mogo.map.search.poisearch.IMogoPoiSearch;
+import com.mogo.map.search.poisearch.IMogoPoiSearchListener;
+import com.mogo.map.search.poisearch.MogoPoiResult;
+import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
+import com.mogo.map.uicontroller.EnumMapUI;
+import com.mogo.map.uicontroller.IMogoMapUIController;
+import com.mogo.module.common.entity.MarkerExploreWay;
+import com.mogo.module.common.entity.MarkerExploreWayItem;
+import com.mogo.module.common.entity.MarkerLocation;
+import com.mogo.module.common.entity.MarkerShowEntity;
+import com.mogo.module.common.entity.MarkerUserInfo;
+import com.mogo.module.tanlu.R;
+import com.mogo.module.tanlu.callback.DataSetChangedAdapter;
+import com.mogo.module.tanlu.callback.NaviCallback;
+import com.mogo.module.tanlu.callback.RoadLineCallback;
+import com.mogo.module.tanlu.callback.UploadShareCallback;
+import com.mogo.module.tanlu.callback.VoiceSearchCallback;
+import com.mogo.module.tanlu.constant.TanluConstants;
+import com.mogo.module.tanlu.model.Center;
+import com.mogo.module.tanlu.model.Information;
+import com.mogo.module.tanlu.model.Items;
+import com.mogo.module.tanlu.model.NaviResult;
+import com.mogo.module.tanlu.model.PathLineResult;
+import com.mogo.module.tanlu.model.TanluModelData;
+import com.mogo.module.tanlu.model.VoiceSearchResult;
+import com.mogo.module.tanlu.model.event.ControlClickUpInfo;
+import com.mogo.module.tanlu.model.event.DataErrorInfo;
+import com.mogo.module.tanlu.model.event.GetInfoError;
+import com.mogo.module.tanlu.model.event.MarkerInfo;
+import com.mogo.module.tanlu.model.event.PushTypeInfo;
+import com.mogo.module.tanlu.model.event.SharedialogEvent;
+import com.mogo.module.tanlu.model.event.StartPlayInfo;
+import com.mogo.module.tanlu.model.event.VoiceControlUpInfo;
+import com.mogo.module.tanlu.util.LocationUtils;
+import com.mogo.module.tanlu.util.Utils;
+import com.mogo.module.tanlu.view.NetErrorDialog;
+import com.mogo.module.tanlu.view.UploadFailedDialog;
+import com.mogo.service.IMogoServiceApis;
+import com.mogo.service.MogoServicePaths;
+import com.mogo.service.adas.IMogoADASController;
+import com.mogo.service.analytics.IMogoAnalytics;
+import com.mogo.service.cardmanager.IMogoCardManager;
+import com.mogo.service.datamanager.IMogoDataChangedListener;
+import com.mogo.service.fragmentmanager.IMogoFragmentManager;
+import com.mogo.service.imageloader.IMogoImageloader;
+import com.mogo.service.intent.IMogoIntentListener;
+import com.mogo.service.intent.IMogoIntentManager;
+import com.mogo.service.map.IMogoMapService;
+import com.mogo.service.module.IMogoActionListener;
+import com.mogo.service.module.IMogoActionManager;
+import com.mogo.service.module.IMogoModuleLifecycle;
+import com.mogo.service.module.IMogoRegisterCenter;
+import com.mogo.service.module.MogoAction;
+import com.mogo.service.statusmanager.IMogoStatusManager;
+import com.mogo.utils.TipToast;
+import com.mogo.utils.logger.Logger;
+import com.shuyu.gsyvideoplayer.GSYVideoManager;
+
+import org.greenrobot.eventbus.EventBus;
+import org.greenrobot.eventbus.Subscribe;
+import org.greenrobot.eventbus.ThreadMode;
+import org.json.JSONObject;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+
+import static android.view.View.OVER_SCROLL_NEVER;
+import static com.mogo.module.tanlu.video.VideoInitKt.initVideo;
+
+/**
+ * @author lixiaopeng
+ * @description 探路卡片
+ * @since 2020-01-02
+ */
+public class TanluCardViewFragment extends MvpFragment>
+ implements IView,
+ IMogoMarkerClickListener,
+ IMogoModuleLifecycle,
+ IMogoMapListener,
+ IMogoPoiSearchListener,
+ IMogoLocationListener,
+ View.OnClickListener,
+ IMogoDataChangedListener,
+ IMogoGeoSearchListener {
+
+ private static final String TAG = "TanluCardViewFragment";
+ //map
+ private IMogoMarkerManager mMarkerManager;
+ private IMogoMapService mMogoMapService;
+ private IMogoCardManager iMogoCardManager;
+ private IMogoStatusManager mMogoStatusManager;
+ private IMogoIntentManager mogoIntentManager;
+ private IMogoMapUIController mMApUIController;
+ private IMogoAnalytics mAnalytics;
+ private IMogoGeoSearch mIMogoGeoSearch;
+ private IMogoFragmentManager mIMogoFragmentManager;
+ private IMogoImageloader mogoImageloader;
+ private IMogoADASController mADASController;
+
+ //语音上一条,下一条
+ private IMogoServiceApis mIMogoServiceApis;
+ private IMogoActionManager mActionManager;
+
+ //声音控制文字
+ private String voiceGetInfoMationTts;
+ // private String[] searchingVoiceStrings;
+ private String[] searchfaileVoiceStrings;
+ private String voiceShareSuccessTts;
+
+ private List markerExploreWayList = new ArrayList<>();
+ private int mCurrentPosition = 0; //卡片媒体当前位置
+ private Bitmap mMarkerIcon;
+ private Bitmap multiMarkerIcon;
+ private TanluModelData mTanluModelData;
+ private List passedByPoints;
+ private IMogoRegisterCenter mMogoRegisterCenter;
+ private String mKeywords;
+ private boolean isCurrentPage;
+ //新修改
+ private RecyclerView mLoopRecyclerView;
+// private TanluSlideAdapter mTanluSlideAdapter;
+ private RelativeLayout mEmptyLayout;
+ private TextView mEmptyTv;
+
+
+ @Override
+ protected int getLayoutId() {
+ return R.layout.tanlu_main_media_recycler;
+ }
+
+ @Override
+ protected void initViews() {
+ initVideo();
+ initInterface();
+
+ mLoopRecyclerView = findViewById(R.id.tanlu_rloop_recycleview);
+ mEmptyLayout = findViewById(R.id.layout_empty_data_show);
+ mEmptyTv = findViewById(R.id.tv_main_empty);
+ mEmptyTv.setOnClickListener(this);
+ mEmptyLayout.setVisibility(View.VISIBLE);
+ mLoopRecyclerView.setVisibility(View.GONE);
+
+ mLoopRecyclerView.setHasFixedSize(true);
+ mLoopRecyclerView.setOverScrollMode(OVER_SCROLL_NEVER);
+ GridLayoutManager layoutManage = new GridLayoutManager(getContext(), 1);
+ mLoopRecyclerView.setLayoutManager(layoutManage);
+
+// mTanluSlideAdapter = new TanluSlideAdapter(getContext(), mAnalytics);
+// mLoopRecyclerView.setAdapter(mTanluSlideAdapter);
+
+ //保证滑动单页显示
+// PagerSnapHelper snapHelper = new PagerSnapHelper();
+// snapHelper.attachToRecyclerView(mLoopRecyclerView);
+
+ //滑动监听
+ mLoopRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
+ @Override
+ public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
+// super.onScrollStateChanged(recyclerView, newState);
+ if (recyclerView != null && recyclerView.getChildCount() > 0) {
+ try {
+ int currentPositionPage = ((RecyclerView.LayoutParams) recyclerView.getChildAt(0).getLayoutParams()).getViewAdapterPosition();
+ Logger.e(TAG, "fragment currentPositionPage = " + currentPositionPage + " >>> size = " + markerExploreWayList.size() + " >>mCurrentPosition = " + mCurrentPosition);
+ if (currentPositionPage >= markerExploreWayList.size()) {
+ return;
+ }
+
+ if (mCurrentPosition != currentPositionPage) {
+ mCurrentPosition = currentPositionPage;
+ Logger.d(TAG, "fragment-------mCurrentPosition = " + mCurrentPosition);
+ moveMapLocation(mCurrentPosition);
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+ }
+
+ @Override
+ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
+// super.onScrolled(recyclerView, dx, dy);
+ }
+ });
+ }
+
+ /**
+ * 移动地图位置
+ */
+ private void moveMapLocation(int currentPositionPage) {
+ Logger.d(TAG, "fragment moveMapLocation size() =" + markerExploreWayList.size() + " >>>currentPositionPage = " + currentPositionPage);
+ if (markerExploreWayList.size() > currentPositionPage) {
+ MarkerExploreWay exploreWay = markerExploreWayList.get(currentPositionPage);
+ mActionManager.bizInvoke(TanluConstants.MODEL_NAME, currentPositionPage, markerExploreWayList.get(currentPositionPage));
+ moveMapToInfoFragement(exploreWay);
+ } else {
+ Logger.e(TAG, "Fragment error markerExploreWayList.size() <= currentPositionPage ");
+ }
+ }
+
+ /**
+ * 移动地图到某个位置
+ *
+ * @param exploreWay
+ */
+ private void moveMapToInfoFragement(MarkerExploreWay exploreWay) {
+ //经度
+ Double longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude();
+ //纬度
+ Double lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude();
+
+ if (exploreWay.getLocation() == null) {
+ return;
+ }
+ double distance = LocationUtils.getDistance(lat, longit, exploreWay.getLocation().getLat(), exploreWay.getLocation().getLon());
+ Logger.e(TAG, " fragment moveMapToInfoFragement distance =" + distance);
+ if (distance >= 20000) {
+ moveToMarcker(exploreWay.getLocation().getLat(), exploreWay.getLocation().getLon());
+ } else {
+ Rect rect = new Rect(
+ (int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_left),
+ (int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_top),
+ (int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_right),
+ (int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_bottom));
+ Logger.d(TAG, " Fragment moveMapToInfoFragement size() = " + getList(exploreWay).size());
+ moveNotFresh();
+ //第一个参数:调用者,第二个参数:当前自车的位置,第三个参数:需要显示在范围内的点(不包含自车的位置)
+ //第四个参数:显示范围的UI边界,第五个参数:是否锁定自车位置(看业务需要)
+ mMApUIController.showBounds(TanluConstants.MODEL_NAME, new MogoLatLng(lat, longit),
+ getList(exploreWay), rect, true);
+ }
+ }
+
+ private void moveNotFresh() {
+ mMogoStatusManager.setUserInteractionStatus(TAG, true, false);
+ }
+
+
+ /**
+ * 构造经纬度列表
+ *
+ * @param markerExploreWay
+ * @return
+ */
+ private List getList(MarkerExploreWay markerExploreWay) {
+ List list = new ArrayList<>();
+ if (markerExploreWay != null) {
+ MarkerLocation location = markerExploreWay.getLocation();
+ if (location != null) {
+ Logger.d(TAG, "getList location.getLon() =" + location.getLon() + " >>>location.getLat()=" + location.getLat());
+ MogoLatLng mogoLatLng = new MogoLatLng(location.getLat(), location.getLon());
+ //经度
+ Double longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude();
+ //维度
+ Double lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude();
+
+ list.add(mogoLatLng);
+ } else {
+ Logger.e(TAG, "getList() location == null");
+ }
+ } else {
+ Logger.e(TAG, "getList() markerExploreWay == null");
+ }
+ return list;
+ }
+
+
+ private void initInterface() {
+ mIMogoServiceApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation();
+ mActionManager = mIMogoServiceApis.getActionManagerApi();
+ mADASController = mIMogoServiceApis.getAdasControllerApi();
+
+ //地图marker,地图操作
+ mMogoMapService = (IMogoMapService) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_MAP).navigation(getActivity());
+ mMarkerManager = mMogoMapService.getMarkerManager(getContext());
+ mMApUIController = mMogoMapService.getMapUIController();
+ //地图逆序
+ mIMogoGeoSearch = mMogoMapService.getGeoSearch(getContext());
+ mogoImageloader = (IMogoImageloader) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_IMAGE_LOADER).navigation();
+ //切换卡片操作
+ iMogoCardManager = (IMogoCardManager) ARouter.getInstance().build(MogoServicePaths.PATH_CARD_MANAGER).navigation(getActivity());
+ mMogoRegisterCenter = (IMogoRegisterCenter) ARouter.getInstance().build(MogoServicePaths.PATH_REGISTER_CENTER).navigation(getContext());
+ mMogoRegisterCenter.registerMogoModuleLifecycle(TanluConstants.MODEL_NAME, this);
+ //唤醒
+ mogoIntentManager = (IMogoIntentManager) ARouter.getInstance().build(MogoServicePaths.PATH_INTENT_MANAGER).navigation(getContext());
+
+ mMogoStatusManager = (IMogoStatusManager) ARouter.getInstance().build(MogoServicePaths.PATH_STATUS_MANAGER).navigation(getContext());
+ mAnalytics = (IMogoAnalytics) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_ANALYTICS).navigation(getContext());
+
+ mIMogoFragmentManager = (IMogoFragmentManager) ARouter.getInstance().build(MogoServicePaths.PATH_FRAGMENT_MANAGER).navigation(getContext());
+
+ mIMogoGeoSearch.setGeoSearchListener(this);
+ DataSetChangedAdapter.getInstance().setDelegate(this);
+ }
+
+ @Override
+ public void onActivityCreated(@Nullable Bundle savedInstanceState) {
+ super.onActivityCreated(savedInstanceState);
+ getViewLifecycleOwner().getLifecycle().addObserver(mPresenter);
+ EventBus.getDefault().register(this);
+ initModelData();
+ initMap();
+ initStrings();
+ initListener();
+ Logger.d(TAG, "onActivityCreated ------>");
+ // 数据先到,卡片后创建
+ initData(DataSetChangedAdapter.getInstance().getData());
+ sendShareReceiver("0");
+ }
+
+ private void initModelData() {
+ if (mTanluModelData == null) {
+ mTanluModelData = new TanluModelData(getContext());
+ }
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ }
+
+ @Override
+ public void onRegeocodeSearched(MogoRegeocodeResult regeocodeResult) {
+ Logger.d(TAG, "onRegeocodeSearched -----> ");
+ }
+
+ @Override
+ public void onGeocodeSearched(MogoGeocodeResult geocodeResult) {
+ Logger.d(TAG, "onGeocodeSearched ------mKeywords =" + mKeywords);
+ if (geocodeResult != null) {
+ if (geocodeResult.getAddresses() != null && geocodeResult.getAddresses().size() > 0) {
+ Logger.d(TAG, "geocodeResult.getAddresses().size() = " + geocodeResult.getAddresses().size());
+ MogoGeocodeAddress geocodeAddress = geocodeResult.getAddresses().get(0);
+ MogoLatLng latLon = geocodeAddress.getLatlng();
+ Double longit; //经度
+ Double lat; //维度
+ if (mKeywords.equals("附近")) {
+ Logger.d(TAG, "附近 ----1---");
+ longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude();
+ lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude();
+ } else {
+ Logger.d(TAG, "其他 ---1----");
+ longit = latLon.lng;
+ lat = latLon.lat;
+ }
+ Logger.d(TAG, "geoSearch keywords =" + mKeywords + ">>longitude= " + longit + "--latitude= " + lat);
+ getVoiceControlRoadData(mKeywords, lat, longit);
+ } else {
+ Logger.d(TAG, "onGeocodeSearched ------mKeywords =" + mKeywords);
+ handlePoi(mKeywords);
+ }
+ } else {
+ Logger.e(TAG, "geocodeResult.getAddresses() == null");
+ speakFailVoice(searchfaileVoiceStrings[2]);
+ }
+ }
+
+
+ /**
+ * 初始化导航
+ */
+ private void initMap() {
+ mMogoRegisterCenter.registerMogoNaviListener(TanluConstants.MODEL_NAME, new IMogoNaviListener() {
+ @Override
+ public void onInitNaviFailure() {
+ }
+
+ @Override
+ public void onInitNaviSuccess() {
+ }
+
+ @Override
+ public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
+ }
+
+ @Override
+ public void onStartNavi() { //开始导航
+ Logger.d(TAG, "onStartNavi ------> ");
+ initModelData();
+ getNavigationData();
+ }
+
+ @Override
+ public void onStopNavi() {
+ }
+
+ @Override
+ public void onCalculateSuccess() {
+ }
+
+ @Override
+ public void onoCalculateFailed() {
+ }
+
+ @Override
+ public void onUpdateTraffic(MogoTraffic traffic) {
+ }
+ });
+
+ //监听marker点击
+ mMogoRegisterCenter.registerMogoMarkerClickListener(TanluConstants.MODEL_NAME, new IMogoMarkerClickListener() {
+ @Override
+ public boolean onMarkerClicked(IMogoMarker marker) {
+ //marker 点击
+ Map properties = new HashMap<>();
+ properties.put("type", "2");
+ mAnalytics.track(TanluConstants.LAUNCHER_ICON_CLICK, properties);
+
+ MarkerExploreWay exploreWay = extractFromMarker(marker);
+ if (exploreWay == null) { // 自己打点数据
+ double lat = marker.getPosition().lat;
+ //更新当前位置
+ for (int i = 0; i < markerExploreWayList.size(); i++) {
+ if (markerExploreWayList.get(i).getLocation().getLat() == lat) {
+ mCurrentPosition = i;
+ break;
+ }
+ }
+ Logger.d(TAG, "onMarkerClicked 自己打点数据 mCurrentPosition = " + mCurrentPosition + " >>size = " + markerExploreWayList.size());
+ mActionManager.bizInvoke(TanluConstants.MODEL_NAME, mCurrentPosition, markerExploreWayList.get(mCurrentPosition));
+ if (markerExploreWayList.size() == 1) {
+ //不处理
+ } else {
+ mLoopRecyclerView.scrollToPosition(mCurrentPosition);
+ }
+ } else { //大而全数据
+ double lat = exploreWay.getLocation().getLat();
+ for (int i = 0; i < markerExploreWayList.size(); i++) {
+ if (markerExploreWayList.get(i).getLocation().getLat() == lat) {
+ mCurrentPosition = i;
+ break;
+ }
+ }
+ Logger.d(TAG, "onMarkerClicked 大而全数据 mCurrentPosition = " + mCurrentPosition + " >>size = " + markerExploreWayList.size());
+ mActionManager.bizInvoke(TanluConstants.MODEL_NAME, mCurrentPosition, markerExploreWayList.get(mCurrentPosition));
+ if (markerExploreWayList.size() == 1) {
+ //不处理
+ } else {
+ mLoopRecyclerView.scrollToPosition(mCurrentPosition);
+ }
+ }
+ return false;
+ }
+ });
+ }
+
+ /**
+ * 处理关键词搜索
+ *
+ * @return
+ */
+ private void handleActionFoo(String keywords) {
+ speakSearchingVoice();
+ MogoGeocodeQuery geocodeQuery;
+ String cityCode = TanluServiceManager.getLocationClient().getLastKnowLocation().getCityCode();
+
+ geocodeQuery = new MogoGeocodeQuery();
+ geocodeQuery.setLocationName(keywords);
+ geocodeQuery.setCity(cityCode);
+ mIMogoGeoSearch.getFromLocationNameAsyn(geocodeQuery);
+ }
+
+ /**
+ * poi 搜索
+ *
+ * @param keywords
+ */
+ private void handlePoi(String keywords) {
+ String cityCode = TanluServiceManager.getLocationClient().getLastKnowLocation().getCityCode();
+ MogoPoiSearchQuery poiSearchQuery = new MogoPoiSearchQuery(keywords, "", cityCode);
+ IMogoPoiSearch poiSearch = mMogoMapService.getPoiSearch(getContext(), poiSearchQuery);
+ poiSearch.setPoiSearchListener(this);
+ poiSearch.searchPOIAsyn();
+ }
+
+ /**
+ * 注册listener监听
+ */
+ private void initListener() {
+ mogoIntentManager.registerIntentListener(TanluConstants.SPECIFIEDROAD_SEARCH, mogoIntentListener);
+ mogoIntentManager.registerIntentListener(TanluConstants.PLAY_VIDEO_AWAKEN, mogoIntentListener);
+ }
+
+ /**
+ * 唤醒语音
+ */
+ private IMogoIntentListener mogoIntentListener = new IMogoIntentListener() {
+ @Override
+ public void onIntentReceived(String intentStr, Intent intent) {
+ String data = intent.getStringExtra("data");
+ Logger.d(TAG, "唤醒 mogoIntentListener intentStr =" + intentStr + ">>data =" + data);
+ if (intentStr.equals(TanluConstants.SPECIFIEDROAD_SEARCH)) { //地点堵不堵 --ok
+ try {
+ JSONObject jsonObject = new JSONObject(data);
+ mKeywords = jsonObject.get("location").toString();
+ Logger.d(TAG, "mogoIntentListener specified mKeywords = " + mKeywords);
+ handleActionFoo(mKeywords);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ } else if (intentStr.equals(TanluConstants.PLAY_VIDEO_AWAKEN)) { //播放路况 唤醒
+ Logger.d(TAG, "mogoIntentListener 播放路况 唤醒 ----> ");
+ delayTime();
+ }
+ }
+ };
+
+
+ /**
+ * 免唤醒语音监听
+ */
+ private IMogoVoiceCmdCallBack mogoVoiceListener = new IMogoVoiceCmdCallBack() {
+ @Override
+ public void onCmdSelected(String cmd) {
+ Logger.d(TAG, "mogoVoiceListener cmd = " + cmd);
+ if (cmd.equals(TanluConstants.PLAY_VIDEO)) { //播放路况 --ok
+ //语音会中断播放
+ AIAssist.getInstance(getContext()).speakTTSVoice(getString(R.string.tanlu_prepare_play), null);
+ delayTime();
+ }
+ }
+
+ @Override
+ public void onCmdAction(String speakText) {
+ }
+
+ @Override
+ public void onCmdCancel(String speakText) {
+ }
+
+ @Override
+ public void onSpeakEnd(String speakText) {
+ }
+
+ @Override
+ public void onSpeakSelectTimeOut(String speakText) {
+ }
+ };
+
+
+ /**
+ * 上一条,下一条
+ */
+ private IMogoActionListener mogoActionListener = new IMogoActionListener() {
+ @Override
+ public void onActionDone(MogoAction mogoAction) {
+ Logger.d(TAG, "mogoActionListener mogoAction = " + mogoAction);
+ if (mogoAction == MogoAction.Prev) {
+ EventBus.getDefault().post(new VoiceControlUpInfo("1"));
+ } else if (mogoAction == MogoAction.Next) {
+ EventBus.getDefault().post(new VoiceControlUpInfo("2"));
+ }
+ }
+ };
+
+
+ private void delayTime() {
+ new Handler().postDelayed(new Runnable() {
+ public void run() {
+ EventBus.getDefault().post(new StartPlayInfo(mCurrentPosition));
+ }
+ }, 1500);
+ }
+
+ /**
+ * type=1 路况
+ * type=2 油价
+ * type=3 交通检查
+ * type=4 封路
+ *
+ * @param type
+ */
+ private void traceTypeData(String type) {
+ Map properties = new HashMap<>();
+ properties.put("type", type);
+ mAnalytics.track(TanluConstants.LAUNCHER_SHARE_TYPE, properties);
+ }
+
+ /**
+ * 分享/上报按钮点击 from=1 手动点击 from=2 语音打开
+ *
+ * @param from
+ */
+ private void traceData(String from) {
+ Map properties = new HashMap<>();
+ properties.put("from", from);
+ mAnalytics.track(TanluConstants.LAUNCHER_SHARE_CLICK, properties);
+ }
+
+ private void traceTanluData(String type) {
+ Map properties = new HashMap<>();
+ properties.put("type", type);
+ mAnalytics.track(TanluConstants.CARNET_USER_UPLOAD, properties);
+ }
+
+ /**
+ * 发送广播 audiofocus
+ */
+ private void sendAudioFocusReceiver() {
+ Logger.d(TAG, "TanluCardViewFragment sendAudioFocusReceiver ---->");
+ Intent intent = new Intent();
+ intent.setAction("com.zhidao.action.audio.package");
+ intent.putExtra("package", "com.mogo.module.tanlu");
+ getContext().sendBroadcast(intent);
+ }
+
+ /**
+ * 发送广播 type: 1拥堵,2交通检查,3封路,4实时路况,5积水,6积冰,7大雾,8事故
+ */
+ private void sendShareReceiver(String type) {
+ if (!type.equals("0")) {
+ mMogoStatusManager.setUploadingStatus("CARD_TYPE_ROAD_CONDITION", true);
+ }
+
+ Logger.d(TAG, "TanluCardViewFragment sendShareReceiver ---->");
+ Intent intent = new Intent();
+ intent.setAction("com.zhidao.share.roadcondition.action");
+ intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
+ intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
+ intent.putExtra("type", type);
+ getContext().sendBroadcast(intent);
+ }
+
+
+ private MarkerExploreWay extractFromMarker(IMogoMarker marker) {
+ if (marker == null) {
+ return null;
+ }
+ if (marker.getObject() instanceof MarkerShowEntity) {
+ MarkerShowEntity showEntity = ((MarkerShowEntity) marker.getObject());
+ if (showEntity.getBindObj() instanceof MarkerExploreWay) {
+ return ((MarkerExploreWay) showEntity.getBindObj());
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @param view
+ */
+ @Override
+ public void onClick(View view) {
+ int id = view.getId();
+ if (id == R.id.tv_main_empty) { //上报路况
+ sendShareReceiver("1");
+ }
+ }
+
+ private void moveToMarcker(double lat, double lon) {
+ MogoLatLng latLng = new MogoLatLng(lat, lon);
+ mMogoStatusManager.setUserInteractionStatus(TAG, true, false);
+ mMApUIController.moveToCenter(latLng);
+ }
+
+ /**
+ * marker点击事件
+ *
+ * @param marker
+ * @return
+ */
+ @Override
+ public boolean onMarkerClicked(IMogoMarker marker) {
+ return true;
+ }
+
+ @NonNull
+ @Override
+ protected Presenter createPresenter() {
+ return new Presenter(this) {
+ };
+ }
+
+ /**
+ * C位事件,如何获取数据,需要有默认数据
+ * 如果只有一个数据,不显示上下切换按钮,没有数据显示空页面
+ */
+ @Override
+ public void onPerform() {
+ //免唤醒
+ AIAssist.getInstance(getActivity()).registerUnWakeupCommand(TanluConstants.PLAY_VIDEO,
+ TanluConstants.CMD_PLAY_ROAD_CONDITION, mogoVoiceListener);
+ mActionManager.registerActionListener(TanluConstants.MODEL_NAME, mogoActionListener);
+
+ isCurrentPage = true;
+ Logger.d(TAG, "tanlu卡片 onPerform 有效 ---->");
+ new Handler().postDelayed(new Runnable() {
+ public void run() {
+ renderCardViews();
+ }
+ }, 500);
+ }
+
+ /**
+ * 根据数据展示页面
+ */
+ private void renderCardViews() {
+ if (markerExploreWayList != null && markerExploreWayList.size() > 0) {
+ mEmptyLayout.setVisibility(View.GONE);
+ mLoopRecyclerView.setVisibility(View.VISIBLE);
+ Logger.d(TAG, "renderCardViews size = " + markerExploreWayList.size());
+// mTanluSlideAdapter.setDatas(markerExploreWayList);
+// mTanluSlideAdapter.notifyDataSetChanged();
+ } else {
+ mLoopRecyclerView.setVisibility(View.GONE);
+ mEmptyLayout.setVisibility(View.VISIBLE);
+// mEmptyTv.setText(Html.fromHtml(getContext().getString(R.string.main_empty_content)));
+ Logger.e(TAG, "renderCardViews markerExploreWayList == null ");
+ }
+ }
+
+ @Override
+ public void onDataSetChanged(Object data) {
+ Logger.d(TAG, "receive data changed. isCurrentPage = " + isCurrentPage);
+ initData(data);
+ if (isCurrentPage) { //更新数据
+ Logger.d(TAG, "receive data changed 111 -------> ");
+ renderCardViews();
+ }
+ }
+
+ private void initData(Object data) {
+ if (markerExploreWayList != null) {
+ markerExploreWayList.clear();
+ } else {
+ markerExploreWayList = new ArrayList<>();
+ }
+ try {
+ markerExploreWayList.addAll((List) data);
+ Logger.d(TAG, "initData size = " + markerExploreWayList.size());
+ } catch (Exception e) {
+ Logger.e(TAG, e, "error.");
+ }
+ }
+
+ /**
+ * 离开C位事件
+ */
+ @Override
+ public void onDisable() {
+ Logger.d(TAG, "tanlu卡片 无效 ----->");
+ isCurrentPage = false;
+
+ AIAssist.getInstance(getActivity()).unregisterUnWakeupCommand(TanluConstants.PLAY_VIDEO);
+ if (mActionManager != null) {
+ mActionManager.unregisterActionListener(TanluConstants.MODEL_NAME, mogoActionListener);
+ }
+ }
+
+ @Override
+ public void accOn() {
+
+ }
+
+ @Override
+ public void onMapLoaded() {
+ }
+
+ @Override
+ public void onTouch(MotionEvent motionEvent) {
+ }
+
+ @Override
+ public void onPOIClick(MogoPoi poi) {
+ if (poi != null) {
+ TipToast.shortTip(poi.getName());
+ TanluServiceManager.getPoiSearch().searchPOIIdAsyn(poi.getPoiId());
+ }
+ }
+
+ /**
+ * poi
+ *
+ * @param p0
+ * @param p1
+ */
+ @Override
+ public void onPoiSearched(MogoPoiResult p0, int p1) {
+ if (p1 == 1000) {
+ if (p0.getPois() != null && p0.getPois().size() > 0) {
+ MogoPoiItem poi = p0.getPois().get(0);
+ MogoLatLng latLon = poi.getPoint();
+ Double longit; //经度
+ Double lat; //维度
+ if (mKeywords.equals("附近")) {
+ Logger.d(TAG, "附近 -onPoiSearched---1---");
+ longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude();
+ lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude();
+ } else {
+ Logger.d(TAG, "其他 -onPoiSearched---1----");
+ longit = latLon.lng;
+ lat = latLon.lat;
+ }
+ getVoiceControlRoadData(mKeywords, lat, longit);
+ Logger.d(TAG, "setOnPoiSearchListener keywords =" + mKeywords + ">>longitude= " + longit + "--latitude" + lat);
+ } else {
+ Logger.e(TAG, "poi == null");
+ Double longit; //经度
+ Double lat; //维度
+ if (mKeywords.equals("附近")) {
+ Logger.d(TAG, "附近 -onPoiSearched---2---");
+ longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude();
+ lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude();
+ getVoiceControlRoadData(mKeywords, lat, longit);
+ } else {
+ Logger.d(TAG, "其他 -onPoiSearched---2----");
+ speakFailVoice(searchfaileVoiceStrings[2]);
+ }
+ }
+ } else {
+ Logger.e(TAG, "poi search result p1 = " + p1);
+ speakFailVoice(searchfaileVoiceStrings[2]);
+ }
+ }
+
+ @Override
+ public void onPoiItemSearched(MogoPoiItem item, int errorCode) {
+ if (item == null) {
+ return;
+ }
+ }
+
+ @Override
+ public void onLocationChanged(MogoLocation location) {
+ }
+
+ @Override
+ public void onMapClick(MogoLatLng latLng) {
+
+ }
+
+ @Override
+ public void onLockMap(boolean isLock) {
+
+ }
+
+ @Override
+ public void onMapModeChanged(EnumMapUI ui) {
+ Logger.d(TAG, ui.name());
+ }
+
+ @Override
+ public void onMapChanged(MogoLatLng location, float zoom, float tilt, float bearing) {
+
+ }
+
+ @Override
+ public void onDestroyView() {
+ super.onDestroyView();
+ EventBus.getDefault().unregister(this);
+ getViewLifecycleOwner().getLifecycle().removeObserver(mPresenter);
+ TanluServiceManager.getLocationClient().removeLocationListener(this);
+ mMogoRegisterCenter.unregisterMogoNaviListener(TanluConstants.MODEL_NAME);
+ Logger.d(TAG, "onDestroyView --------> ");
+ GSYVideoManager.releaseAllVideos();
+// if (mTanluSlideAdapter != null) {
+// mTanluSlideAdapter.release();
+// }
+ }
+
+ /**
+ * 列表滑动位置
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onButtonUpAndDown(final ControlClickUpInfo event) {
+ if (event != null) {
+ Logger.d(TAG, " onButtonUpAndDown event.type = " + event.type + " >>>mCurrentPosition = " + mCurrentPosition);
+ if (event.type.equals("1")) { //上一条
+ if (mCurrentPosition > 0) {
+ mLoopRecyclerView.smoothScrollToPosition(mCurrentPosition - 1);
+ } else {
+ Logger.e(TAG, " onButtonUpAndDown 上一条 mCurrentPosition <= 0 ");
+ TipToast.shortTip("已经是第一条");
+ }
+ } else if (event.type.equals("2")) { //下一条
+ if (mCurrentPosition >= (markerExploreWayList.size() - 1)) {
+ TipToast.shortTip("已经是最后一条");
+ Logger.e(TAG, " onButtonUpAndDown 下一条 mCurrentPosition >= markerExploreWayList.size() - 1");
+ } else {
+ mLoopRecyclerView.smoothScrollToPosition(mCurrentPosition + 1);
+ }
+ }
+ } else {
+ Logger.e(TAG, "onButtonUpAndDown event == null ");
+ }
+ }
+
+ /**
+ * 接收到错误数据信息
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onDataErrorInfo(final DataErrorInfo event) {
+ if (event == null) {
+ return;
+ }
+ Logger.d(TAG, " onDataErrorInfo id = " + event.id + " >>>poiType = " + event.poiType + ">>>updateType = " + event.updateType);
+ mTanluModelData.uploadDeleteErrorDataInfo(event.id, event.poiType, event.updateType,
+ new UploadShareCallback() {
+ @Override
+ public void onSuccess(BaseData data) {
+ Logger.d(TAG, "uploadDeleteErrorDataInfo onSuccess -----> ");
+ }
+
+ @Override
+ public void onFail(String message, int code) {
+ Logger.e(TAG, "uploadDeleteErrorDataInfo onFail -----> message = " + message);
+ }
+ });
+ }
+
+ /**
+ * 分享弹框
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onShareDialog(final SharedialogEvent event) {
+ if (event == null) {
+ return;
+ }
+
+ if (mADASController != null) {
+ mADASController.closeADAS();
+ }
+// ShareControl.getInstance(getActivity()).showDialog();
+ }
+
+ /**
+ * 获取情报失败
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onGetInfoFailed(final GetInfoError error) {
+ mMogoStatusManager.setUploadingStatus(TanluConstants.MODEL_NAME, false);
+ float bearing = TanluServiceManager.getLocationClient().getLastKnowLocation().getBearing(); //角度
+ Logger.d(TAG, "onGetInfoFailed bearing = " + bearing + " >>>type = " + error.type);
+ //失败提示框
+ if (error == null) {
+ return;
+ }
+
+ if (error.type == null) {
+ return;
+ }
+
+ mErrorType = error.type;
+ if (error.type.equals("100")) {
+ //网络弹框
+ if (errorDialog != null && errorDialog.isShowing()) {
+ //TODO
+ } else {
+ showNetErrorDialog();
+ }
+ } else {
+ if (customDialog != null && customDialog.isShowing()) {
+ //TODO
+ } else {
+ showNormalDialog(error.type);
+ }
+ }
+ }
+
+ private UploadFailedDialog customDialog;
+ private NetErrorDialog errorDialog;
+ private String mErrorType;
+
+
+ private void showNormalDialog(final String type) {
+ customDialog = new UploadFailedDialog(getActivity());
+ customDialog.setContent("抱歉,无法获取到相关数据");
+ customDialog.setSubContent("分享失败");
+ customDialog.setOnCancelListener("取消", new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ timer.cancel(); //取消倒计时
+ }
+ });
+ customDialog.setOnOkClickListener("重新分享", new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ Logger.d(TAG, "重新分享 --------->");
+ //发送广播 type:1拥堵,2交通检查,3封路
+ sendShareReceiver(type);
+ }
+ });
+ customDialog.show();
+ timer.start();
+ }
+
+ private void showNetErrorDialog() {
+ errorDialog = new NetErrorDialog(getActivity());
+ errorDialog.setContent("由于网络原因上传失败");
+ errorDialog.setSubContent("系统将在网络恢复时自动上传");
+ errorDialog.setOnCancelListener("好的", new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ timer.cancel();
+ }
+ });
+ errorDialog.show();
+ timer.start();
+ }
+
+ /**
+ * 倒计时
+ */
+ CountDownTimer timer = new CountDownTimer(11000, 1000) {
+ @Override
+ public void onTick(long arg) {
+ int theTime = (int) (arg / 1000);
+ if (mErrorType.equals("100")) { //无网
+ if (errorDialog != null) {
+ errorDialog.getTxtCancel().setText(getString(R.string.tanlu_neterror_cancle_time, theTime + ""));
+ }
+ } else {
+ if (customDialog != null) {
+ customDialog.getTxtCancel().setText(getString(R.string.tanlu_cancle_time, theTime + ""));
+ }
+ }
+ }
+
+ @Override
+ public void onFinish() {
+ if (mErrorType.equals("100")) { //无网
+ if (errorDialog != null) {
+ errorDialog.dismiss();
+ }
+ } else {
+ if (customDialog != null) {
+ customDialog.dismiss();
+ }
+ }
+ }
+ };
+
+
+ /**
+ * 接收到分享对应数据打点
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onMarkerInfo(final MarkerInfo event) {
+ if (event == null) {
+ return;
+ }
+ Logger.d(TAG, "onMarkerInfo event.type =" + event.type + " >>event.lat = " + event.lat + " >>event.lon = " + event.lon + " >>event.imageUrl =" + event.imageUrl);
+
+ String poiType = "";
+// if (event.type.equals(TanluConstants.TANLU_ROAD_CONGESTION_COMPAT)) { //上报路况
+// poiType = "100";
+// mMarkerIcon = BitmapFactory.decodeResource(getResources(), R.drawable.tanlu_marker_block_up);
+// } else {
+// poiType = "-1";
+// }
+
+ double lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude();
+ double lon = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude();
+ Logger.d(TAG, "onMarkerInfo share onCompleted ---poiType =" + poiType);
+ if (!poiType.equals("-1")) {
+ Logger.d(TAG, "onMarkerInfo share onCompleted ---!poiType------->");
+ MogoMarkerOptions options = new MogoMarkerOptions()
+ .icon(mMarkerIcon)
+ .latitude(lat) //event.lat
+ .owner("share_tag")
+ .longitude(lon); //event.lon
+ final IMogoMarker mogoMarker = mMarkerManager.addMarker("share_tag", options); //随便传tag,不可点击 share_tag TanluConstants.MODEL_NAME
+ Logger.d(TAG, "getMathRandom() = " + getMathRandom());
+ AIAssist.getInstance(getContext()).speakTTSVoice((
+ String.format(voiceShareSuccessTts, getMathRandom())), null);
+// ShareControl.getInstance(getActivity()).dismissDialog();
+
+ //开启动画
+ mogoMarker.startScaleAnimation(0, 1, 0, 1, 300, new LinearInterpolator(), new OnMarkerAnimationListener() {
+ @Override
+ public void onAnimStart() {
+ Logger.d(TAG, " onAnimStart ---1----> ");
+ }
+
+ @Override
+ public void onAnimEnd() {
+ Logger.d(TAG, " onAnimEnd -----1---> ");
+ showJumpAnimation(mogoMarker);
+ }
+ });
+ } else {
+ Logger.d(TAG, "onMarkerInfo share onCompleted ---!poiType--- else ---->");
+ }
+
+ mMogoStatusManager.setUploadingStatus(TanluConstants.MODEL_NAME, false);
+
+ //请求分享接口,只有封路和交通检查走新接口,老接口只有上报拥堵使用,并且定时任务都是拥堵的type
+ if (poiType.equals("100") || poiType.equals("-1")) {
+ Logger.d(TAG, "poiType = 100 || -1 ");
+ } else {
+ if (markerExploreWayList != null && markerExploreWayList.size() > 0) {
+ MarkerExploreWay markerExploreWay = markerExploreWayList.get(0);
+ if (markerExploreWay.getUserInfo() != null && !TextUtils.isEmpty(poiType)) { //上报路况不使用这个接口
+ uploadShareInfo(poiType, event.imageUrl, markerExploreWay.getUserInfo().getUserName(),
+ markerExploreWay.getUserInfo().getUserHead());
+ } else {
+ Logger.e(TAG, "onMarkerInfo markerExploreWay.getUserInfo() == null");
+ uploadShareInfo(poiType, event.imageUrl, "", "");
+ }
+ } else {
+ Logger.e(TAG, "onMarkerInfo share markerExploreWayList = null");
+ uploadShareInfo(poiType, event.imageUrl, "", "");
+ }
+ }
+ }
+
+ private void showJumpAnimation(final IMogoMarker mogoMarker) {
+ if (mogoMarker == null) {
+ return;
+ }
+
+ mogoMarker.startJumpAnimation(80, 300, new Interpolator() {
+ @Override
+ public float getInterpolation(float input) {
+ if (input <= 0.5) {
+ return (float) (0.5f - 2.0 * (0.5 - input) * (0.5 - input));
+ } else {
+ return (float) (0.5f - Math.sqrt(input - 0.5f) * (1.5f - input));
+ }
+ }
+ }, new OnMarkerAnimationListener() {
+ @Override
+ public void onAnimStart() {
+// Logger.d(TAG, " onAnimStart ----2--> ");
+ }
+
+ @Override
+ public void onAnimEnd() {
+// Logger.d(TAG, " onAnimEnd ----2--> ");
+ }
+ });
+ }
+
+
+ /**
+ * 上报分享信息
+ */
+ private void uploadShareInfo(final String poiType, String poiImgUrl, String nickname, String headImgUrl) {
+ double lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude();
+ double lon = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude();
+ float bearing = TanluServiceManager.getLocationClient().getLastKnowLocation().getBearing(); //角度
+
+ String addressStr = TanluServiceManager.getLocationClient().getLastKnowLocation().getAddress();
+ Logger.d(TAG, "uploadShareInfo lat =" + lat + ">>>lon =" + lon + ">>>addressStr =" + addressStr + " >>bearing =" + bearing);
+ mTanluModelData.addTrafficCheckInfo(poiType, poiImgUrl, nickname, headImgUrl, lat, lon, addressStr, bearing,
+ new UploadShareCallback() {
+ @Override
+ public void onSuccess(BaseData data) {
+ Logger.d(TAG, "uploadShareInfo onSuccess -----> poiType = " + poiType);
+ }
+
+ @Override
+ public void onFail(String message, int code) {
+ Logger.e(TAG, "uploadShareInfo onFail -----> poiType = " + poiType);
+ }
+ });
+ }
+
+
+ /**
+ * push 类型,1为导航数据,2为通勤族
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onPushInfo(final PushTypeInfo event) {
+ if (event != null && TextUtils.isEmpty(event.type)) {
+ Logger.d(TAG, " onPushInfo event.type =" + event.type);
+ if (event.type.equals("1")) {
+ getNaviRoadLineInfo();
+ } else if (event.type.equals("2")) {
+ getRoadLineData();
+ }
+ } else {
+ Logger.e(TAG, "event == null ");
+ }
+ }
+
+
+ /**
+ * 导航路线数据事件
+ */
+ public void getNavigationData() {
+ if (mADASController != null) {
+ mADASController.closeADAS();
+ }
+
+ mTanluModelData.getNaviInformation(mMogoMapService.getNavi(getContext()).getCalculatedPathPos(),
+ new NaviCallback() {
+ @Override
+ public void onSuccess(NaviResult data) {
+ List informationList = data.getResult().getInformations();
+ Logger.d(TAG, "getNavigationData onSuccess informationList =" + informationList);
+ if (informationList == null || (informationList != null && informationList.size() == 0)) {
+ return;
+ }
+
+ if (markerExploreWayList != null && markerExploreWayList.size() > 0) {
+ markerExploreWayList.clear(); //刷新之前先删除之前的,然后再添加成请求的
+ mCurrentPosition = 0;
+ }
+
+ //转换数据结构
+ convertData(informationList);
+ //切换到探路卡片
+ if (!isCurrentPage) {
+ iMogoCardManager.switch2(TanluConstants.MODEL_NAME);
+ }
+
+ //清除探路之前的数据
+ mMarkerManager.removeMarkers(TanluConstants.MODEL_NAME);
+
+ //打点
+ ArrayList optionList = new ArrayList<>();
+ for (int i = 0; i < informationList.size(); i++) {
+ //根据type确定添加的图片
+ String trafficType = informationList.get(i).trafficInfoType;
+// if (trafficType.equals("traffic_jam")) { //拥堵
+// multiMarkerIcon = BitmapFactory.decodeResource(getResources(), R.drawable.tanlu_marker_block_up);
+// }
+
+ MarkerShowEntity markerShowEntity = new MarkerShowEntity();
+ markerShowEntity.setBindObj(markerExploreWayList.get(i));
+ markerShowEntity.setTextContent(informationList.get(i).addr);
+ markerShowEntity.setMarkerType(TanluConstants.MODEL_NAME);
+ MogoMarkerOptions options = new MogoMarkerOptions()
+ .object(markerShowEntity)
+ .icon(multiMarkerIcon)
+ .latitude(informationList.get(i).lat)
+ .owner(TanluConstants.MODEL_NAME)
+ .longitude(informationList.get(i).lon);
+
+ optionList.add(options);
+ mMarkerManager.addMarker(TanluConstants.MODEL_NAME, options);
+ }
+ Logger.d(TAG, "getNavigationData optionList.size() = " + optionList.size());
+// mMarkerManager.addMarkers(TanluConstants.MODEL_NAME, optionList, true);
+
+ mLoopRecyclerView.scrollToPosition(0);
+
+ //播报
+// speakFailVoice(getString(R.string.tanlu_navi_voice_play));
+
+ //自身位置和第一个情报自适应显示
+ Rect rect = new Rect(
+ (int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_left),
+ (int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_top),
+ (int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_right),
+ (int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_bottom));
+
+ mMogoStatusManager.setUserInteractionStatus(TAG, true, true);
+ //经度
+ Double longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude();
+ //纬度
+ Double lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude();
+ //第一个参数:调用者,第二个参数:当前自车的位置,第三个参数:需要显示在范围内的点(不包含自车的位置)
+ //第四个参数:显示范围的UI边界,第五个参数:是否锁定自车位置(看业务需要)
+ if (markerExploreWayList.size() > 0) {
+ mMApUIController.showBounds(TanluConstants.MODEL_NAME, new MogoLatLng(lat, longit),
+ getList(markerExploreWayList.get(0)), rect, true);
+ }
+ }
+
+ @Override
+ public void onFail(String message, int code) {
+ Logger.d(TAG, "getNavigationData message = " + message + ">>>code =" + code);
+ }
+ });
+ }
+
+ /**
+ * 通勤族 事件,监听消息自己请求路线数据
+ */
+ public void getRoadLineData() {
+ mTanluModelData.getRoadLineData(new RoadLineCallback() {
+ @Override
+ public void onSuccess(PathLineResult o) {
+ //绘制线路线
+ if (o != null && o.getResult() != null && o.getResult().getPointList() != null
+ && o.getResult().getPointList().size() > 0) {
+ drawMapLine(o.getResult().getPointList());
+ } else {
+ Logger.e(TAG, "getRoadLineData onSuccess o.getPointList() == null");
+ }
+ }
+
+ @Override
+ public void onFail(String message, int code) {
+ Logger.e(TAG, "getRoadLineData onFail message =" + message + ">>>code =" + code);
+ }
+ });
+ }
+
+ /**
+ * 导航路线,监听消息自己请求路线数据
+ */
+ public void getNaviRoadLineInfo() {
+ mTanluModelData.getNaviRoadLineInfo(new RoadLineCallback() {
+ @Override
+ public void onSuccess(PathLineResult o) {
+ //绘制线路线
+ if (o != null && o.getResult() != null && o.getResult().getPointList() != null
+ && o.getResult().getPointList().size() > 0) {
+ drawMapLine(o.getResult().getPointList());
+ } else {
+ Logger.e(TAG, "getNaviRoadLineInfo onSuccess o.getPointList() == null");
+ }
+ }
+
+ @Override
+ public void onFail(String message, int code) {
+ Logger.e(TAG, "getNaviRoadLineInfo onFail message =" + message + ">>>code =" + code);
+ }
+ });
+ }
+
+ /**
+ * 绘制线路
+ */
+ private void drawMapLine(List pointList) {
+ //避免人为操作,刷新
+ mMogoStatusManager.setUserInteractionStatus(TanluConstants.MODEL_NAME, true, true);
+
+ int intervalNum = Utils.getIntervalValue(pointList.size());
+ Logger.d(TAG, "drawMapLine intervalNum = " + intervalNum + ">>> pointList.size =" + pointList.size());
+ int listSize = pointList.size();
+ passedByPoints = new ArrayList<>();
+
+ //沿途最多15个点
+ for (int i = 0; i < listSize; i += intervalNum) {
+ passedByPoints.add(new MogoLatLng(pointList.get(i).getLat(), (pointList.get(i).getLon())));
+ }
+
+ Logger.d(TAG, "drawMapLine passedByPoints.size() ----> " + passedByPoints.size());
+ MogoLatLng startLatLng = new MogoLatLng(pointList.get(0).getLat(), pointList.get(0).getLon());
+ MogoLatLng endLatLng = new MogoLatLng(pointList.get(listSize - 1).getLat(), pointList.get(listSize - 1).getLon());
+ mMarkerManager.addRouteWay(getContext(), startLatLng, endLatLng, passedByPoints);
+ }
+
+
+ /**
+ * 声音控制道路数据
+ */
+ public void getVoiceControlRoadData(String keywords, final double lat, final double lon) {
+ if (mADASController != null) {
+ mADASController.closeADAS();
+ }
+
+ String adCode = TanluServiceManager.getLocationClient().getLastKnowLocation().getAdCode();
+ String cityCode = TanluServiceManager.getLocationClient().getLastKnowLocation().getCityCode();
+ //移动到具体位置
+ mMogoStatusManager.setUserInteractionStatus(TanluConstants.MODEL_NAME, true, true);
+ moveToMarcker(lat, lon);
+
+ inputlon = lon;
+ inputlat = lat;
+
+ if (mIMogoFragmentManager.getStackSize() > 0) {
+ mIMogoFragmentManager.clearAll();
+ }
+
+ Logger.d(TAG, "getVoiceControlRoadData lat =" + lat + ">>>lon =" + lon + ">>>cityCode= " + cityCode + " >>>adCode = " + adCode);
+ mTanluModelData.getVoiceControlRoadData(keywords, cityCode, lon, lat, adCode, new VoiceSearchCallback() {
+ @Override
+ public void onSuccess(VoiceSearchResult o) {
+ String discription = o.getResult().getDescription();
+ Logger.d(TAG, "getVoiceControlRoadData onSuccess ----1--->");
+ if (o.getResult().getInformations() != null && o.getResult().getInformations().size() > 0) {
+ Logger.d(TAG, "getVoiceControlRoadData onSuccess ----2--->");
+ if (markerExploreWayList != null && markerExploreWayList.size() > 0) {
+ markerExploreWayList.clear(); //刷新之前先删除之前的,然后再添加成请求的
+ mCurrentPosition = 0;
+ }
+
+ //转换数据结构
+ convertData(o.getResult().getInformations());
+ //切换到探路卡片
+ if (!isCurrentPage) {
+ iMogoCardManager.switch2(TanluConstants.MODEL_NAME);
+ }
+
+ speakSuccessVoice(o.getResult().getInformations(), discription == null ? "" : discription);
+
+ List informationList = o.getResult().getInformations();
+ Logger.d(TAG, "getVoiceControlRoadData onSuccess informationList =" + informationList);
+ if (informationList == null || (informationList != null && informationList.size() == 0)) {
+ return;
+ }
+ //清除探路之前的数据
+ mMarkerManager.removeMarkers(TanluConstants.MODEL_NAME);
+ //添加埋点数据
+ datalon = informationList.get(0).lon;
+ datalat = informationList.get(0).lat;
+
+ //打点
+ ArrayList optionList = new ArrayList<>();
+ for (int i = 0; i < informationList.size(); i++) {
+ //根据type确定添加的图片
+ String trafficType = informationList.get(i).trafficInfoType;
+
+ MarkerShowEntity markerShowEntity = new MarkerShowEntity();
+ markerShowEntity.setBindObj(markerExploreWayList.get(i));
+ markerShowEntity.setTextContent(informationList.get(i).addr);
+ markerShowEntity.setMarkerType(TanluConstants.MODEL_NAME);
+ MogoMarkerOptions options = new MogoMarkerOptions()
+ .object(markerShowEntity)
+ .icon(multiMarkerIcon)
+ .latitude(informationList.get(i).lat)
+ .owner(TanluConstants.MODEL_NAME)
+ .longitude(informationList.get(i).lon);
+
+// optionList.add(options);
+ mMarkerManager.addMarker(TanluConstants.MODEL_NAME, options);
+ }
+ Logger.d(TAG, "getVoiceControlRoadData optionList.size() = " + optionList.size());
+ mMogoStatusManager.setUserInteractionStatus(TanluConstants.MODEL_NAME, true, true);
+// mMarkerManager.addMarkers(TanluConstants.MODEL_NAME, optionList, true);
+
+ //展示6个在区域内显示
+ showBonndsRoadtion();
+
+ //直接使用当前数据list,作为切换的数据源,切换左侧列表到最新的数据
+ mLoopRecyclerView.scrollToPosition(0);
+ } else {
+ if (!TextUtils.isEmpty(discription)) {
+ Logger.d(TAG, "getVoiceControlRoadData discription != null else ----1--->");
+ AIAssist.getInstance(getContext()).speakTTSVoice(discription, null);
+ } else {
+ Logger.d(TAG, "getVoiceControlRoadData discription == null else ----2--->");
+// AIAssist.getInstance(getContext()).speakTTSVoice("未找到其他车主分享的路况信息", null);
+ }
+ }
+ }
+
+ @Override
+ public void onFail(String message, int code) {
+ Logger.e(TAG, "getVoiceControlRoadData onFail message = " + message + ">>>code= " + code);
+ speakFailVoice(searchfaileVoiceStrings[2]);
+ }
+ });
+ }
+
+
+ private void showBonndsRoadtion() {
+ Logger.e(TAG, "showBonndsRoadtion getMogoList markerExploreWayList.size() = " + markerExploreWayList.size());
+ //经度
+ Double longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude();
+ //纬度
+ Double lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude();
+
+ Rect rect = new Rect(
+ (int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_left),
+ (int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_top),
+ (int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_right),
+ (int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_bottom));
+
+ moveNotFresh();
+
+ //第一个参数:调用者,第二个参数:当前自车的位置,第三个参数:需要显示在范围内的点(不包含自车的位置)
+ //第四个参数:显示范围的UI边界,第五个参数:是否锁定自车位置(看业务需要)
+ mMApUIController.showBounds(TanluConstants.MODEL_NAME, new MogoLatLng(lat, longit),
+ getMogoList(), rect, true);
+ Logger.d(TAG, " getMogoList() = " + getMogoList().size());
+ }
+
+
+ /**
+ * 构造经纬度列表
+ *
+ * @return
+ */
+ private List getMogoList() {
+ List list = new ArrayList<>();
+ if (markerExploreWayList != null && markerExploreWayList.size() > 0) {
+ if (markerExploreWayList.size() < 6) {
+ for (int i = 0; i < markerExploreWayList.size(); i++) {
+ MarkerLocation location = markerExploreWayList.get(i).getLocation();
+ if (location != null) {
+ MogoLatLng mogoLatLng = new MogoLatLng(location.getLat(), location.getLon());
+ list.add(mogoLatLng);
+ } else {
+ Logger.e(TAG, "getMogoList() < 6 location == null");
+ }
+ }
+ } else {
+ for (int i = 0; i < 6; i++) {
+ MarkerLocation location = markerExploreWayList.get(i).getLocation();
+ if (location != null) {
+ MogoLatLng mogoLatLng = new MogoLatLng(location.getLat(), location.getLon());
+ list.add(mogoLatLng);
+ } else {
+ Logger.e(TAG, "getMogoList() location == null");
+ }
+ }
+ }
+ } else {
+ Logger.e(TAG, "getMogoList() markerExploreWay == null");
+ }
+ return list;
+ }
+
+
+ /**
+ * 将探路的数据结构转换成 MarkerExploreWay的列表
+ */
+ private void convertData(List informations) {
+ if (markerExploreWayList != null) {
+ markerExploreWayList.clear();
+ }
+
+ for (int i = 0; i < informations.size(); i++) {
+ MarkerExploreWay markerExploreWay = new MarkerExploreWay();
+ markerExploreWay.setAddr(informations.get(i).addr);
+ markerExploreWay.setCityName(informations.get(i).cityName);
+ markerExploreWay.setDistance(informations.get(i).distance);
+ markerExploreWay.setFileType(informations.get(i).type);
+ markerExploreWay.setItems(convertMediaData(informations.get(i).items));
+ markerExploreWay.setLocation(convertLocation(informations.get(i)));
+ markerExploreWay.setUserInfo(convertUserInfo(informations.get(i)));
+
+ markerExploreWayList.add(markerExploreWay);
+ }
+
+ //更新数据
+ renderCardViews();
+ }
+
+ /**
+ * 转换媒体数据
+ *
+ * @param items
+ * @return
+ */
+ private List convertMediaData(ArrayList items) {
+ List exploreWayItems = new ArrayList<>();
+ MarkerExploreWayItem item = new MarkerExploreWayItem();
+ if (items != null && items.size() > 0) {
+ item.setThumbnail(items.get(0).getThumbnail());
+ item.setUrl(items.get(0).getUrl());
+
+ exploreWayItems.add(item);
+ }
+
+ return exploreWayItems;
+ }
+
+
+ private MarkerLocation convertLocation(Information information) {
+ MarkerLocation location = new MarkerLocation();
+ location.setAddress(information.addr);
+ location.setAngle(0);
+ location.setLat(information.lat);
+ location.setLon(information.lon);
+
+ return location;
+ }
+
+
+ private MarkerUserInfo convertUserInfo(Information information) {
+ MarkerUserInfo userInfo = new MarkerUserInfo();
+ userInfo.setUserHead(information.headImgUrl);
+ userInfo.setUserName(information.nickName);
+
+ return userInfo;
+ }
+
+
+ Random random = new Random();
+
+ private void speakSuccessVoice(List informations, String
+ trafficStatus) {
+ Logger.d(TAG, "speakSuccessVoice informations.size() = " + informations.size());
+ switch (informations.size()) {
+ case 0:
+ speakFailVoice(searchfaileVoiceStrings[random.nextInt(3)]);
+ break;
+
+ case 1:
+ trackVoiceSearch(1);
+ AIAssist.getInstance(getContext()).speakTTSVoice((
+ String.format(voiceGetInfoMationTts, "1") + trafficStatus), null);
+ break;
+
+ case 2:
+ trackVoiceSearch(1);
+ AIAssist.getInstance(getContext()).speakTTSVoice((
+ String.format(
+ voiceGetInfoMationTts,
+ "2"
+ ) + trafficStatus), null);
+ break;
+ case 3:
+ trackVoiceSearch(1);
+ AIAssist.getInstance(getContext()).speakTTSVoice((
+ String.format(
+ voiceGetInfoMationTts,
+ "3"
+ ) + trafficStatus), null);
+ break;
+
+ default:
+ trackVoiceSearch(1);
+ AIAssist.getInstance(getContext()).speakTTSVoice((
+ String.format(
+ voiceGetInfoMationTts,
+ "多"
+ ) + trafficStatus), null);
+ }
+ }
+
+ private void initStrings() {
+ voiceGetInfoMationTts =
+ getContext().getResources().getString(R.string.voice_get_informations_tts);
+// searchingVoiceStrings =
+// getContext().getResources().getStringArray(R.array.searching_voice_string_array);
+ searchfaileVoiceStrings =
+ getContext().getResources().getStringArray(R.array.search_fail_voice_array);
+ voiceShareSuccessTts = getContext().getResources().getString(R.string.tanlu_share_success);
+ }
+
+ private void speakFailVoice(String string) {
+ AIAssist.getInstance(getContext()).speakTTSVoice(string, null);
+ }
+
+ private void speakSearchingVoice() {
+// AIAssist.getInstance(getContext()).speakTTSVoice(searchingVoiceStrings[random.nextInt(3)], null);
+ }
+
+
+ Double inputlon = 0.0;//经度
+ Double inputlat = 0.0; //维度
+ Double datalon = 0.0; //经度
+ Double datalat = 0.0; //维度
+
+ //上报语音搜索
+ private void trackVoiceSearch(int type) {
+ Map properties = new HashMap<>();
+ properties.put("type", type);
+ properties.put("searchtext", mKeywords);
+ properties.put("inputlon", inputlon);
+ properties.put("inputlat", inputlat);
+ properties.put("datalon", datalon);
+ properties.put("datalat", datalat);
+ mAnalytics.track(TanluConstants.CARNET_VOICE_SEARCH, properties);
+ }
+
+ private String getMathRandom() {
+ Random random = new Random();
+ int temp = random.nextInt(50) + 10;
+
+ return String.valueOf(temp);
+ }
+}
+
+
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewProvider.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewProvider.java
new file mode 100644
index 0000000000..bf34e2ba13
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluCardViewProvider.java
@@ -0,0 +1,101 @@
+package com.mogo.module.tanlu.fragment;
+
+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.tanlu.callback.DataSetChangedAdapter;
+import com.mogo.service.module.IMogoModuleLifecycle;
+import com.mogo.service.module.IMogoModuleProvider;
+import com.mogo.service.module.ModuleType;
+import com.mogo.module.tanlu.constant.TanluConstants;
+import com.mogo.utils.logger.Logger;
+
+/**
+ * @author congtaowang
+ * @since 2019-12-24
+ *
+ * 描述
+ */
+@Route( path = TanluConstants.TAG )
+public class TanluCardViewProvider implements IMogoModuleProvider {
+
+ private static final String TAG = "TanluCardViewProvider";
+ private TanluCardViewFragment fragment;
+
+ @Override
+ public Fragment createFragment( Context context, Bundle data ) {
+ fragment = new TanluCardViewFragment();
+ fragment.setArguments( data );
+ Logger.i( TAG, "createFragment" );
+ return fragment;
+ }
+
+ @Override
+ public void init( Context context ) {
+ Logger.d(TAG, "init --------------> 1");
+ TanluServiceManager.init( context );
+ TanluServiceManager.getDataManager().registerDataListener( TanluConstants.MODEL_NAME, DataSetChangedAdapter.getInstance() );
+
+ TanluListWindow tanluListWindow = new TanluListWindow(context);
+ tanluListWindow.initWindow();
+ }
+
+ @Override
+ public String getModuleName() {
+ return "CARD_TYPE_ROAD_CONDITION";
+ }
+
+ @Override
+ public IMogoModuleLifecycle getCardLifecycle() {
+ return fragment;
+ }
+
+ @Override
+ public View createView( Context context ) {
+ // don't
+ return null;
+ }
+
+ @Override
+ public IMogoMapListener getMapListener() {
+ return fragment;
+ }
+
+ @Override
+ public int getType() {
+ return ModuleType.TYPE_CARD_FRAGMENT;
+ }
+
+ @Override
+ public IMogoNaviListener getNaviListener() {
+ return null;
+ }
+
+ @Override
+ public IMogoLocationListener getLocationListener() {
+ return fragment;
+ }
+
+ @Override
+ public IMogoMarkerClickListener getMarkerClickListener() {
+ return null;
+ }
+
+ @Override
+ public String getAppPackage() {
+ return "";
+ }
+
+ @Override
+ public String getAppName() {
+ return "探路";
+ }
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluListWindow.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluListWindow.java
new file mode 100644
index 0000000000..69be074449
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluListWindow.java
@@ -0,0 +1,1506 @@
+package com.mogo.module.tanlu.fragment;
+
+import android.content.Context;
+import android.content.Intent;
+import android.graphics.Bitmap;
+import android.graphics.Rect;
+import android.os.CountDownTimer;
+import android.os.Handler;
+import android.text.TextUtils;
+import android.util.AttributeSet;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.view.WindowManager;
+import android.view.animation.AccelerateInterpolator;
+import android.view.animation.Interpolator;
+import android.view.animation.LinearInterpolator;
+import android.widget.RelativeLayout;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.PagerSnapHelper;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.alibaba.android.arouter.launcher.ARouter;
+import com.mogo.commons.data.BaseData;
+import com.mogo.commons.voice.AIAssist;
+import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
+import com.mogo.map.MogoLatLng;
+import com.mogo.map.marker.IMogoMarker;
+import com.mogo.map.marker.IMogoMarkerClickListener;
+import com.mogo.map.marker.IMogoMarkerManager;
+import com.mogo.map.marker.MogoMarkerOptions;
+import com.mogo.map.marker.anim.OnMarkerAnimationListener;
+import com.mogo.map.navi.IMogoNaviListener;
+import com.mogo.map.navi.MogoNaviInfo;
+import com.mogo.map.navi.MogoTraffic;
+import com.mogo.map.search.geo.IMogoGeoSearch;
+import com.mogo.map.search.geo.IMogoGeoSearchListener;
+import com.mogo.map.search.geo.MogoGeocodeAddress;
+import com.mogo.map.search.geo.MogoGeocodeResult;
+import com.mogo.map.search.geo.MogoPoiItem;
+import com.mogo.map.search.geo.MogoRegeocodeResult;
+import com.mogo.map.search.poisearch.IMogoPoiSearch;
+import com.mogo.map.search.poisearch.IMogoPoiSearchListener;
+import com.mogo.map.search.poisearch.MogoPoiResult;
+import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
+import com.mogo.map.uicontroller.IMogoMapUIController;
+import com.mogo.module.common.entity.MarkerExploreWay;
+import com.mogo.module.common.entity.MarkerExploreWayItem;
+import com.mogo.module.common.entity.MarkerLocation;
+import com.mogo.module.common.entity.MarkerShowEntity;
+import com.mogo.module.common.entity.MarkerUserInfo;
+import com.mogo.module.tanlu.R;
+import com.mogo.module.tanlu.callback.DataSetChangedAdapter;
+import com.mogo.module.tanlu.callback.NaviCallback;
+import com.mogo.module.tanlu.callback.RoadInfoCallback;
+import com.mogo.module.tanlu.callback.RoadLineCallback;
+import com.mogo.module.tanlu.callback.UploadShareCallback;
+import com.mogo.module.tanlu.constant.TanluConstants;
+import com.mogo.module.tanlu.fragment.recycler.TanluSlideAdapterNew;
+import com.mogo.module.tanlu.model.Center;
+import com.mogo.module.tanlu.model.Information;
+import com.mogo.module.tanlu.model.Items;
+import com.mogo.module.tanlu.model.NaviResult;
+import com.mogo.module.tanlu.model.PathLineResult;
+import com.mogo.module.tanlu.model.TanluModelData;
+import com.mogo.module.tanlu.model.VoiceCmdData;
+import com.mogo.module.tanlu.model.event.ControlClickUpInfo;
+import com.mogo.module.tanlu.model.event.DataErrorInfo;
+import com.mogo.module.tanlu.model.event.GetInfoError;
+import com.mogo.module.tanlu.model.event.MarkerInfo;
+import com.mogo.module.tanlu.model.event.PushTypeInfo;
+import com.mogo.module.tanlu.model.event.StartPlayInfo;
+import com.mogo.module.tanlu.model.event.VoiceControlUpInfo;
+import com.mogo.module.tanlu.util.Utils;
+import com.mogo.module.tanlu.view.NetErrorDialog;
+import com.mogo.module.tanlu.view.UploadFailedDialog;
+import com.mogo.service.MogoServicePaths;
+import com.mogo.service.adas.IMogoADASController;
+import com.mogo.service.analytics.IMogoAnalytics;
+import com.mogo.service.datamanager.IMogoDataChangedListener;
+import com.mogo.service.imageloader.IMogoImageloader;
+import com.mogo.service.intent.IMogoIntentListener;
+import com.mogo.service.intent.IMogoIntentManager;
+import com.mogo.service.module.IMogoActionListener;
+import com.mogo.service.module.IMogoActionManager;
+import com.mogo.service.module.IMogoModuleLifecycle;
+import com.mogo.service.module.IMogoRegisterCenter;
+import com.mogo.service.module.MogoAction;
+import com.mogo.service.statusmanager.IMogoStatusManager;
+import com.mogo.service.windowview.IMogoTopViewStatusListener;
+import com.mogo.utils.NetworkUtils;
+import com.mogo.utils.TipToast;
+import com.mogo.utils.WorkThreadHandler;
+import com.mogo.utils.logger.Logger;
+import com.shuyu.gsyvideoplayer.GSYVideoManager;
+
+import org.greenrobot.eventbus.EventBus;
+import org.greenrobot.eventbus.Subscribe;
+import org.greenrobot.eventbus.ThreadMode;
+import org.jetbrains.annotations.NotNull;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Random;
+
+import static com.mogo.module.tanlu.constant.ConstKt.TYPE_NAME_BLOCK;
+import static com.mogo.module.tanlu.constant.ConstKt.TYPE_NAME_CLOSURE;
+import static com.mogo.module.tanlu.constant.ConstKt.TYPE_NAME_TRAFFIC_CHECK;
+import static com.mogo.module.tanlu.constant.ConstKt.VOICE_COMMAND_NOVELTY_QUERY;
+import static com.mogo.module.tanlu.constant.ConstKt.VOICE_COMMAND_QUERY_ROAD_CLOSED;
+import static com.mogo.module.tanlu.constant.ConstKt.VOICE_COMMAND_QUERY_TRAFFIC_CHECK;
+import static com.mogo.module.tanlu.constant.TanluConstants.PLAY_VIDEO_AWAKEN;
+import static com.mogo.module.tanlu.constant.TanluConstants.SPECIFIEDROAD_SEARCH;
+import static com.mogo.module.tanlu.video.VideoInitKt.initVideo;
+
+/**
+ * @author lixiaopeng
+ * @description 探路和新鲜事的view
+ * @since 2020/5/19
+ */
+public class TanluListWindow extends RelativeLayout implements IMogoMarkerClickListener,
+ IMogoPoiSearchListener,
+ View.OnClickListener,
+ IMogoModuleLifecycle,
+ IMogoDataChangedListener,
+// IMogoStatusChangedListener,
+ IMogoGeoSearchListener {
+
+ private static final String TAG = "TanluListWindow";
+ private Context mContext;
+ //map
+ private IMogoMarkerManager mMarkerManager;
+ private IMogoStatusManager mMogoStatusManager;
+ private IMogoIntentManager mogoIntentManager;
+ private IMogoMapUIController mMApUIController;
+ private IMogoAnalytics mAnalytics;
+ private IMogoGeoSearch mIMogoGeoSearch;
+ private IMogoADASController mADASController;
+ private IMogoImageloader mogoImageloader;
+
+ //语音上一条,下一条
+ private IMogoActionManager mActionManager;
+
+ //声音控制文字
+ private String voiceGetInfoMationTts;
+ private String[] searchfaileVoiceStrings;
+ private String voiceShareSuccessTts;
+
+ private List markerExploreWayList = new ArrayList<>();
+ private int mCurrentPosition = 0; //卡片媒体当前位置
+ private Bitmap multiMarkerIcon;
+ private TanluModelData mTanluModelData;
+ private List passedByPoints;
+ private IMogoRegisterCenter mMogoRegisterCenter;
+ private String mKeywords;
+
+ //新修改
+ private RecyclerView mLoopRecyclerView;
+ private TanluSlideAdapterNew mTanluSlideAdapter;
+
+
+ public TanluListWindow(Context context) {
+ super(context);
+ mContext = context;
+ }
+
+ public TanluListWindow(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ mContext = context;
+ }
+
+ public TanluListWindow(Context context, AttributeSet attrs, int defStyleAttr) {
+ super(context, attrs, defStyleAttr);
+ mContext = context;
+ }
+
+ public void initWindow() {
+ Logger.d("liyz", "initWindow --------->");
+ EventBus.getDefault().register(this);
+ initInterface();
+ initModelData();
+ initViews();
+ initMap();
+ initStrings();
+ initListener();
+ initData(DataSetChangedAdapter.getInstance().getData(), markerExploreWayList);
+ }
+
+ protected void initViews() {
+ LayoutInflater.from(mContext).inflate(R.layout.tanlu_main_media_recycler_new, this);
+ initVideo();
+ mLoopRecyclerView = findViewById(R.id.tanlu_rloop_recycleview);
+ mLoopRecyclerView.setHasFixedSize(true);
+ mLoopRecyclerView.setOverScrollMode(OVER_SCROLL_NEVER);
+
+ LinearLayoutManager layoutManager = new LinearLayoutManager(mContext, LinearLayoutManager.VERTICAL, false);
+ mLoopRecyclerView.setLayoutManager(layoutManager);
+
+ mTanluSlideAdapter = new TanluSlideAdapterNew(mContext, mAnalytics, mTanluModelData, mogoImageloader);
+ mLoopRecyclerView.setAdapter(mTanluSlideAdapter);
+
+ //保证滑动单页显示
+ PagerSnapHelper snapHelper = new PagerSnapHelper();
+ snapHelper.attachToRecyclerView(mLoopRecyclerView);
+
+ //滑动监听
+ mLoopRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
+ @Override
+ public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
+ super.onScrollStateChanged(recyclerView, newState);
+ }
+
+ @Override
+ public void onScrolled(@NonNull RecyclerView recyclerView, int dx, int dy) {
+ super.onScrolled(recyclerView, dx, dy);
+ }
+ });
+ }
+
+ private void moveNotFresh() {
+ mMogoStatusManager.setUserInteractionStatus(TAG, true, false);
+ }
+
+ /**
+ * 构造经纬度列表
+ *
+ * @param markerExploreWay
+ * @return
+ */
+ private List getList(MarkerExploreWay markerExploreWay) {
+ List list = new ArrayList<>();
+ if (markerExploreWay != null) {
+ MarkerLocation location = markerExploreWay.getLocation();
+ if (location != null) {
+ Logger.d(TAG, "getList location.getLon() =" + location.getLon() + " >>>location.getLat()=" + location.getLat());
+ MogoLatLng mogoLatLng = new MogoLatLng(location.getLat(), location.getLon());
+ //经度
+ Double longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude();
+ //维度
+ Double lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude();
+
+ list.add(mogoLatLng);
+ } else {
+ Logger.e(TAG, "getList() location == null");
+ }
+ } else {
+ Logger.e(TAG, "getList() markerExploreWay == null");
+ }
+ return list;
+ }
+
+ private void initInterface() {
+ mActionManager = TanluServiceManager.getServiceApis().getActionManagerApi();
+ mADASController = TanluServiceManager.getServiceApis().getAdasControllerApi();
+ //地图marker,地图操作
+ mMarkerManager = TanluServiceManager.getMapService().getMarkerManager(mContext);
+ mMApUIController = TanluServiceManager.getMapService().getMapUIController();
+ //地图逆序
+ mIMogoGeoSearch = TanluServiceManager.getMapService().getGeoSearch(mContext);
+ //唤醒
+ mogoIntentManager = TanluServiceManager.getMogoIntentManager();
+ mMogoStatusManager = TanluServiceManager.getMogoStatusManager();
+ mAnalytics = TanluServiceManager.getAnalytics();
+ mMogoRegisterCenter = TanluServiceManager.getIMogoRegisterCenter();
+ mMogoRegisterCenter.registerMogoModuleLifecycle(TanluConstants.MODEL_NAME, this);
+ mogoImageloader = (IMogoImageloader) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_IMAGE_LOADER).navigation();
+
+ mIMogoGeoSearch.setGeoSearchListener(this);
+ DataSetChangedAdapter.getInstance().setDelegate(this);
+ }
+
+ private void initModelData() {
+ if (mTanluModelData == null) {
+ mTanluModelData = new TanluModelData(mContext);
+ }
+ }
+
+ @Override
+ public void onRegeocodeSearched(MogoRegeocodeResult regeocodeResult) {
+ Logger.d(TAG, "onRegeocodeSearched -----> ");
+ }
+
+ @Override
+ public void onGeocodeSearched(MogoGeocodeResult geocodeResult) {
+ Logger.d(TAG, "onGeocodeSearched ------mKeywords =" + mKeywords);
+ if (geocodeResult != null) {
+ if (geocodeResult.getAddresses() != null && geocodeResult.getAddresses().size() > 0) {
+ Logger.d(TAG, "geocodeResult.getAddresses().size() = " + geocodeResult.getAddresses().size());
+ MogoGeocodeAddress geocodeAddress = geocodeResult.getAddresses().get(0);
+ MogoLatLng latLon = geocodeAddress.getLatlng();
+ Double longit; //经度
+ Double lat; //维度
+ if (mKeywords.equals("附近")) {
+ Logger.d(TAG, "附近 ----1---");
+ longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude();
+ lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude();
+ } else {
+ Logger.d(TAG, "其他 ---1----");
+ longit = latLon.lng;
+ lat = latLon.lat;
+ }
+ Logger.d(TAG, "geoSearch keywords =" + mKeywords + ">>longitude= " + longit + "--latitude= " + lat);
+// getVoiceControlRoadData(mKeywords, lat, longit);
+ } else {
+ Logger.d(TAG, "onGeocodeSearched ------mKeywords =" + mKeywords);
+ handlePoi(mKeywords);
+ }
+ } else {
+ Logger.e(TAG, "geocodeResult.getAddresses() == null");
+ speakFailVoice(searchfaileVoiceStrings[2]);
+ }
+ }
+
+
+ /**
+ * 初始化导航
+ */
+ private void initMap() {
+ mMogoRegisterCenter.registerMogoNaviListener(TanluConstants.MODEL_NAME, new IMogoNaviListener() {
+ @Override
+ public void onInitNaviFailure() {
+ }
+
+ @Override
+ public void onInitNaviSuccess() {
+ }
+
+ @Override
+ public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
+ }
+
+ @Override
+ public void onStartNavi() { //开始导航
+ Logger.d(TAG, "onStartNavi ------> ");
+// initModelData();
+// getNavigationData();
+ }
+
+ @Override
+ public void onStopNavi() {
+ }
+
+ @Override
+ public void onCalculateSuccess() {
+ }
+
+ @Override
+ public void onoCalculateFailed() {
+ }
+
+ @Override
+ public void onUpdateTraffic(MogoTraffic traffic) {
+ }
+ });
+
+ //监听marker点击
+ mMogoRegisterCenter.registerMogoMarkerClickListener(TanluConstants.MODEL_NAME, new IMogoMarkerClickListener() {
+ @Override
+ public boolean onMarkerClicked(IMogoMarker marker) {
+ GSYVideoManager.releaseAllVideos();
+ initVideo();
+ releaseTimer();
+ //埋点
+ Map properties = new HashMap<>();
+ properties.put("type", "2");
+ mAnalytics.track(TanluConstants.LAUNCHER_ICON_CLICK, properties);
+ //点击的marker的具体数据
+ MarkerExploreWay exploreWay = extractFromMarker(marker);
+ //更新数据
+ if (markerExploreWayList != null) {
+ markerExploreWayList.clear();
+ } else {
+ markerExploreWayList = new ArrayList<>();
+ }
+ markerExploreWayList.add(exploreWay);
+
+ boolean isAdd = TanluServiceManager.getIMogoTopViewManager().isViewAdded(TanluListWindow.this);
+ hideWindowTimerStart();
+ Logger.d(TAG, "onMarkerClicked ------ isAdd = " + isAdd);
+
+ //添加window窗口,重复创建
+ if (!isAdd) {
+ ViewGroup.LayoutParams layoutParams =
+ new ViewGroup.LayoutParams(
+ ViewGroup.LayoutParams.MATCH_PARENT,
+ (int) getContext().getResources().getDimension((R.dimen.tanlu_module_card_height)));
+ TanluServiceManager.getIMogoTopViewManager().addView(TanluListWindow.this, layoutParams, new IMogoTopViewStatusListener() {
+ @Override
+ public void onViewAdded(View view) {
+ Logger.d(TAG, "onViewAdded -------->");
+ }
+
+ @Override
+ public void onViewRemoved(View view) {
+ Logger.e(TAG, "onViewRemoved -------->");
+ releaseTimer();
+ releaseAction();
+ }
+
+ @Override
+ public void beforeViewAddAnim(View view) {
+
+ }
+
+ @Override
+ public void beforeViewRemoveAnim(View view) {
+
+ }
+ });
+
+ }
+
+ renderCardViews();
+
+ return false;
+ }
+ });
+ }
+
+ private CountDownTimer mHideWindowTimer;
+
+ private void hideWindowTimerStart() {
+ if (mHideWindowTimer == null) {
+ mHideWindowTimer = new CountDownTimer(30000, 1000) {
+ @Override
+ public void onTick(long millisUntilFinished) {
+ }
+
+ @Override
+ public void onFinish() {
+ releaseTimer();
+ TanluServiceManager.getIMogoTopViewManager().removeView(TanluListWindow.this);
+ }
+ };
+ }
+ mHideWindowTimer.start();
+ }
+
+ private void releaseTimer() {
+ if (mHideWindowTimer != null) {
+ mHideWindowTimer.cancel();
+ mHideWindowTimer = null;
+ }
+ }
+
+ /**
+ * poi 搜索
+ *
+ * @param keywords
+ */
+ private void handlePoi(String keywords) {
+ String cityCode = TanluServiceManager.getLocationClient().getLastKnowLocation().getCityCode();
+ MogoPoiSearchQuery poiSearchQuery = new MogoPoiSearchQuery(keywords, "", cityCode);
+ IMogoPoiSearch poiSearch = TanluServiceManager.getMapService().getPoiSearch(mContext, poiSearchQuery);
+ poiSearch.setPoiSearchListener(this);
+ poiSearch.searchPOIAsyn();
+ }
+
+ /**
+ * 注册listener监听
+ */
+ private void initListener() {
+ if (mogoIntentManager != null) {
+ mogoIntentManager.registerIntentListener(SPECIFIEDROAD_SEARCH, mogoIntentListener);
+ mogoIntentManager.registerIntentListener(PLAY_VIDEO_AWAKEN, mogoIntentListener);
+ mogoIntentManager.registerIntentListener(VOICE_COMMAND_QUERY_TRAFFIC_CHECK, mogoIntentListener);
+ mogoIntentManager.registerIntentListener(VOICE_COMMAND_QUERY_ROAD_CLOSED, mogoIntentListener);
+ mogoIntentManager.registerIntentListener(VOICE_COMMAND_NOVELTY_QUERY, mogoIntentListener);
+ }
+
+ AIAssist.getInstance(mContext).registerUnWakeupCommand(TanluConstants.PLAY_VIDEO,
+ TanluConstants.CMD_PLAY_ROAD_CONDITION, mogoVoiceListener);
+ if (mActionManager != null) {
+ mActionManager.registerActionListener(TanluConstants.MODEL_NAME, mogoActionListener);
+ }
+ }
+
+ Double currentLat = 0.0; //维度
+ Double currentLon = 0.0;//经度
+
+ /**
+ * 唤醒语音
+ */
+ private IMogoIntentListener mogoIntentListener = new IMogoIntentListener() {
+ @Override
+ public void onIntentReceived(String intentStr, Intent intent) {
+ String data = intent.getStringExtra("data");
+ Logger.d(TAG, "唤醒 mogoIntentListener intentStr =" + intentStr + ">>data =" + data);
+ VoiceCmdData voiceData = null;
+ switch (intentStr) {
+ case VOICE_COMMAND_QUERY_TRAFFIC_CHECK:
+ // 搜索交通检查
+ Logger.d(TAG, "搜索交通检查");
+ voiceData = Utils.parseTOVoiceCmdData(data);
+ voiceData.setObj(TYPE_NAME_TRAFFIC_CHECK);
+ break;
+ case VOICE_COMMAND_QUERY_ROAD_CLOSED:
+ // 搜索封路
+ Logger.d(TAG, "搜索封路");
+ voiceData = Utils.parseTOVoiceCmdData(data);
+ voiceData.setLocation(voiceData.getObj());
+ voiceData.setObj(TYPE_NAME_CLOSURE);
+ break;
+ case SPECIFIEDROAD_SEARCH:
+ // 拥堵和路况
+ Logger.d(TAG, "拥堵和路况");
+ voiceData = Utils.parseTOVoiceCmdData(data);
+ voiceData.setObj(TYPE_NAME_BLOCK);
+ break;
+ case VOICE_COMMAND_NOVELTY_QUERY:
+ Logger.d(TAG, "其他");
+ voiceData = Utils.parseTOVoiceCmdData(data);
+ break;
+ case PLAY_VIDEO_AWAKEN:
+ Logger.d(TAG, "mogoIntentListener 播放路况 唤醒 ----> ");
+ delayTime();
+ break;
+ default:
+ break;
+ }
+
+ if (voiceData != null) {
+ mTanluModelData.queryRodeInfo(voiceData, new RoadInfoCallback() {
+ @Override
+ public void onQueryRoadInfoSuccess(@NotNull List extends MarkerExploreWay> roadInfoList) {
+ if (roadInfoList == null || (roadInfoList != null && roadInfoList.size() <= 0)) {
+ speakFailVoice("未找到其他车主分享的路况信息");
+ moveToMarcker(currentLat, currentLon);
+ return;
+ }
+ Logger.d(TAG, "onQueryRoadInfoSuccess roadInfoList.size() = " + roadInfoList.size()
+ + " >>currentLat = " + currentLat + " -->currentLon = " + currentLon);
+ initData(null, (List) roadInfoList);
+ addMarkersAction((List) roadInfoList, currentLat, currentLon);
+ }
+
+ @Override
+ public void onQueryRoadInfoFail(@NotNull String msg, int code) {
+ Logger.e(TAG, "onQueryRoadInfoFail ----- msg = " + msg);
+ speakFailVoice(searchfaileVoiceStrings[2]);
+ }
+
+ @Override
+ public void onLocatSuccess(double lat, double lon) {
+ currentLat = lat;
+ currentLon = lon;
+ }
+ });
+ }
+ }
+ };
+
+ /**
+ * 添加marker
+ */
+ private void addMarkersAction(List list, final double lat, final double lon) {
+ //播报搜索结果
+ speakSuccessVoice(list, "");
+
+ //移动到具体位置
+ if (mMogoStatusManager != null) {
+ mMogoStatusManager.setUserInteractionStatus(TanluConstants.MODEL_NAME, true, true);
+ }
+ moveToMarcker(lat, lon);
+ inputlon = lon;
+ inputlat = lat;
+
+ Logger.d(TAG, "addMarker lat =" + lat + ">>>lon =" + lon);
+ if (markerExploreWayList != null && markerExploreWayList.size() > 0) {
+ markerExploreWayList.clear(); //刷新之前先删除之前的,然后再添加成请求的
+ mCurrentPosition = 0;
+ }
+ markerExploreWayList.addAll(list);
+
+ //清除探路之前的数据
+ if (mMarkerManager != null) {
+ mMarkerManager.removeMarkers(TanluConstants.MODEL_NAME);
+ }
+ //添加埋点数据
+ datalon = list.get(0).getLocation().getLon();
+ datalat = list.get(0).getLocation().getLat();
+
+ for (int i = 0; i < list.size(); i++) {
+ MarkerShowEntity markerShowEntity = new MarkerShowEntity();
+ markerShowEntity.setBindObj(markerExploreWayList.get(i));
+ markerShowEntity.setTextContent(list.get(i).getAddr());
+ markerShowEntity.setMarkerLocation(markerExploreWayList.get(i).getLocation());
+ markerShowEntity.setMarkerType(TanluConstants.MODEL_NAME);
+
+ TanluServiceManager.getServiceApis().getMarkerService().drawMarker(markerShowEntity);
+
+ try {
+ post2AddAndStartAnimation(markerShowEntity, i * 100L);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ //防止刷新策略改变
+ mMogoStatusManager.setUserInteractionStatus(TanluConstants.MODEL_NAME, true, true);
+ //展示6个在区域内显示
+ showBonndsRoadtion();
+ //直接使用当前数据list,作为切换的数据源,切换左侧列表到最新的数据
+ }
+
+
+ /**
+ * marker动画
+ *
+ * @param entity
+ * @param delay
+ */
+ private void post2AddAndStartAnimation(MarkerShowEntity entity, long delay) {
+ if (entity == null) {
+ return;
+ }
+ WorkThreadHandler.getInstance().postDelayed(() -> {
+ if (entity == null) {
+ return;
+ }
+
+ IMogoMarker marker = TanluServiceManager.getServiceApis().getMarkerService().drawMarker(entity);
+ marker.startScaleAnimation(0, 1.2f, 0, 1.2f, 300, new AccelerateInterpolator(), new OnMarkerAnimationListener() {
+ @Override
+ public void onAnimStart() {
+ Logger.d(TAG, " onAnimStart ---1----> ");
+ }
+
+ @Override
+ public void onAnimEnd() {
+ if (marker.isDestroyed()) {
+ return;
+ }
+ marker.startScaleAnimation(1.2f, 1, 1.2f, 1, 100, new LinearInterpolator(), null);
+ }
+ });
+ }, delay);
+ }
+
+
+ @Override
+ public void onDataSetChanged(Object data) {
+ initData(data, markerExploreWayList);
+ }
+
+ /**
+ * 免唤醒语音监听
+ */
+ private IMogoVoiceCmdCallBack mogoVoiceListener = new IMogoVoiceCmdCallBack() {
+ @Override
+ public void onCmdSelected(String cmd) {
+ Logger.d(TAG, "mogoVoiceListener cmd = " + cmd);
+ if (cmd.equals(TanluConstants.PLAY_VIDEO)) { //播放路况 --ok
+ //语音会中断播放
+ AIAssist.getInstance(getContext()).speakTTSVoice(mContext.getString(R.string.tanlu_prepare_play), null);
+ delayTime();
+ }
+ }
+
+ @Override
+ public void onCmdAction(String speakText) {
+ }
+
+ @Override
+ public void onCmdCancel(String speakText) {
+ }
+
+ @Override
+ public void onSpeakEnd(String speakText) {
+ }
+
+ @Override
+ public void onSpeakSelectTimeOut(String speakText) {
+ }
+ };
+
+ /**
+ * 上一条,下一条
+ */
+ private IMogoActionListener mogoActionListener = new IMogoActionListener() {
+ @Override
+ public void onActionDone(MogoAction mogoAction) {
+ Logger.d(TAG, "mogoActionListener mogoAction = " + mogoAction);
+ if (mogoAction == MogoAction.Prev) {
+ EventBus.getDefault().post(new VoiceControlUpInfo("1"));
+ } else if (mogoAction == MogoAction.Next) {
+ EventBus.getDefault().post(new VoiceControlUpInfo("2"));
+ }
+ }
+ };
+
+ private void delayTime() {
+ new Handler().postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ EventBus.getDefault().post(new StartPlayInfo(mCurrentPosition));
+ }
+ }, 1500);
+ }
+
+ /**
+ * 发送广播
+ */
+ private void sendShareReceiver(String type) {
+ if (!type.equals("0") && mMogoStatusManager != null) {
+ mMogoStatusManager.setUploadingStatus("CARD_TYPE_ROAD_CONDITION", true);
+ }
+
+ Logger.d(TAG, "TanluListWindow sendShareReceiver type = " + type);
+ Intent intent = new Intent();
+ intent.setAction("com.zhidao.share.roadcondition.action"); //com.zhidao.roadcondition.share
+ intent.addFlags(Intent.FLAG_RECEIVER_FOREGROUND);
+ intent.addFlags(Intent.FLAG_INCLUDE_STOPPED_PACKAGES);
+ intent.putExtra("type", type);
+ getContext().sendBroadcast(intent);
+ }
+
+
+ private MarkerExploreWay extractFromMarker(IMogoMarker marker) {
+ if (marker == null) {
+ return null;
+ }
+ if (marker.getObject() instanceof MarkerShowEntity) {
+ MarkerShowEntity showEntity = ((MarkerShowEntity) marker.getObject());
+ if (showEntity.getBindObj() instanceof MarkerExploreWay) {
+ return ((MarkerExploreWay) showEntity.getBindObj());
+ }
+ }
+
+ return null;
+ }
+
+ /**
+ * @param view
+ */
+ @Override
+ public void onClick(View view) {
+ }
+
+ private void moveToMarcker(double lat, double lon) {
+ Logger.d(TAG, "moveToMarcker lat = " + lat + " >>>>lon = " + lon);
+ MogoLatLng latLng = new MogoLatLng(lat, lon);
+ mMogoStatusManager.setUserInteractionStatus(TAG, true, false);
+ mMApUIController.moveToCenter(latLng);
+ }
+
+ /**
+ * marker点击事件
+ *
+ * @param marker
+ * @return
+ */
+ @Override
+ public boolean onMarkerClicked(IMogoMarker marker) {
+ return true;
+ }
+
+ /**
+ * C位事件,如何获取数据,需要有默认数据
+ * 如果只有一个数据,不显示上下切换按钮,没有数据显示空页面
+ */
+ @Override
+ public void onPerform() {
+ }
+
+ /**
+ * 根据数据展示页面
+ */
+ private void renderCardViews() {
+ if (markerExploreWayList != null && markerExploreWayList.size() > 0) {
+ mLoopRecyclerView.setVisibility(View.VISIBLE);
+ Logger.d(TAG, "renderCardViews size = " + markerExploreWayList.size());
+ mTanluSlideAdapter.setDatas(markerExploreWayList);
+ mTanluSlideAdapter.notifyDataSetChanged();
+ }
+ }
+
+ private void initData(Object data, List list) {
+ if (markerExploreWayList != null) {
+ markerExploreWayList.clear();
+ } else {
+ markerExploreWayList = new ArrayList<>();
+ }
+ try {
+ if (data != null) {
+// markerExploreWayList.addAll((List) data);
+ } else {
+ markerExploreWayList.addAll(list);
+ }
+ } catch (Exception e) {
+ Logger.e(TAG, e, "error.");
+ }
+
+ renderCardViews();
+ }
+
+ /**
+ * 离开C位事件
+ */
+ @Override
+ public void onDisable() {
+ }
+
+ /**
+ * TODO 释放资源
+ */
+ public void releaseAction() {
+// EventBus.getDefault().unregister(this);
+ mMogoRegisterCenter.unregisterMogoNaviListener(TanluConstants.MODEL_NAME);
+ GSYVideoManager.releaseAllVideos();
+ if (mTanluSlideAdapter != null) {
+ mTanluSlideAdapter.release();
+ }
+
+ AIAssist.getInstance(mContext).unregisterUnWakeupCommand(TanluConstants.PLAY_VIDEO);
+ if (mActionManager != null) {
+ mActionManager.unregisterActionListener(TanluConstants.MODEL_NAME, mogoActionListener);
+ }
+ }
+
+
+ /**
+ * poi
+ *
+ * @param p0
+ * @param p1
+ */
+ @Override
+ public void onPoiSearched(MogoPoiResult p0, int p1) {
+ if (p1 == 1000) {
+ if (p0.getPois() != null && p0.getPois().size() > 0) {
+ MogoPoiItem poi = p0.getPois().get(0);
+ MogoLatLng latLon = poi.getPoint();
+ Double longit; //经度
+ Double lat; //维度
+ if (mKeywords.equals("附近")) {
+ Logger.d(TAG, "附近 -onPoiSearched---1---");
+ longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude();
+ lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude();
+ } else {
+ Logger.d(TAG, "其他 -onPoiSearched---1----");
+ longit = latLon.lng;
+ lat = latLon.lat;
+ }
+// getVoiceControlRoadData(mKeywords, lat, longit);
+ Logger.d(TAG, "setOnPoiSearchListener keywords =" + mKeywords + ">>longitude= " + longit + "--latitude" + lat);
+ } else {
+ Logger.e(TAG, "poi == null");
+ Double longit; //经度
+ Double lat; //维度
+ if (mKeywords.equals("附近")) {
+ Logger.d(TAG, "附近 -onPoiSearched---2---");
+ longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude();
+ lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude();
+// getVoiceControlRoadData(mKeywords, lat, longit);
+ } else {
+ Logger.d(TAG, "其他 -onPoiSearched---2----");
+ speakFailVoice(searchfaileVoiceStrings[2]);
+ }
+ }
+ } else {
+ Logger.e(TAG, "poi search result p1 = " + p1);
+ speakFailVoice(searchfaileVoiceStrings[2]);
+ }
+ }
+
+ @Override
+ public void onPoiItemSearched(MogoPoiItem item, int errorCode) {
+ if (item == null) {
+ return;
+ }
+ }
+
+ /**
+ * 列表滑动位置
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onButtonUpAndDown(final ControlClickUpInfo event) {
+ if (event != null) {
+ Logger.d(TAG, " onButtonUpAndDown event.type = " + event.type + " >>>mCurrentPosition = " + mCurrentPosition);
+ if (event.type.equals("1")) { //上一条
+ if (mCurrentPosition > 0) {
+ mLoopRecyclerView.smoothScrollToPosition(mCurrentPosition - 1);
+ } else {
+ Logger.e(TAG, " onButtonUpAndDown 上一条 mCurrentPosition <= 0 ");
+ TipToast.shortTip("已经是第一条");
+ }
+ } else if (event.type.equals("2")) { //下一条
+ if (mCurrentPosition >= (markerExploreWayList.size() - 1)) {
+ TipToast.shortTip("已经是最后一条");
+ Logger.e(TAG, " onButtonUpAndDown 下一条 mCurrentPosition >= markerExploreWayList.size() - 1");
+ } else {
+ mLoopRecyclerView.smoothScrollToPosition(mCurrentPosition + 1);
+ }
+ }
+ } else {
+ Logger.e(TAG, "onButtonUpAndDown event == null ");
+ }
+ }
+
+ /**
+ * 接收到错误数据信息
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onDataErrorInfo(final DataErrorInfo event) {
+ if (event == null) {
+ return;
+ }
+ Logger.d(TAG, " onDataErrorInfo id = " + event.id + " >>>poiType = " + event.poiType + ">>>updateType = " + event.updateType);
+ mTanluModelData.uploadDeleteErrorDataInfo(event.id, event.poiType, event.updateType,
+ new UploadShareCallback() {
+ @Override
+ public void onSuccess(BaseData data) {
+ Logger.d(TAG, "uploadDeleteErrorDataInfo onSuccess -----> ");
+ }
+
+ @Override
+ public void onFail(String message, int code) {
+ Logger.e(TAG, "uploadDeleteErrorDataInfo onFail -----> message = " + message);
+ }
+ });
+ }
+
+ /**
+ * 获取情报失败
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onGetInfoFailed(final GetInfoError error) {
+ mMogoStatusManager.setUploadingStatus(TanluConstants.MODEL_NAME, false);
+ float bearing = TanluServiceManager.getLocationClient().getLastKnowLocation().getBearing(); //角度
+ Logger.d(TAG, "onGetInfoFailed bearing = " + bearing + " >>>type = " + error.type);
+ //失败提示框
+ if (error.type == null) {
+ return;
+ }
+
+ mErrorType = error.type;
+ if (error.type.equals("100")) {
+ //网络弹框
+ if (errorDialog != null && errorDialog.isShowing()) {
+ //TODO
+ } else {
+ showNetErrorDialog();
+ }
+ } else {
+ if (customDialog != null && customDialog.isShowing()) {
+ //TODO
+ } else {
+ showNormalDialog(error.type);
+ }
+ }
+ }
+
+ private UploadFailedDialog customDialog;
+ private NetErrorDialog errorDialog;
+ private String mErrorType;
+
+
+ private void showNormalDialog(final String type) {
+ customDialog = new UploadFailedDialog(mContext);
+ customDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
+ customDialog.setContent("抱歉,无法获取到相关数据");
+ customDialog.setSubContent("分享失败");
+ customDialog.setOnCancelListener("取消", new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ timer.cancel(); //取消倒计时
+ }
+ });
+ customDialog.setOnOkClickListener("重新分享", new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ //发送广播 type:1拥堵,2交通检查,3封路
+ sendShareReceiver(type);
+ }
+ });
+ customDialog.show();
+ timer.start();
+ }
+
+ private void showNetErrorDialog() {
+ errorDialog = new NetErrorDialog(mContext);
+ errorDialog.getWindow().setType(WindowManager.LayoutParams.TYPE_SYSTEM_ALERT);
+ errorDialog.setContent("由于网络原因上传失败");
+ errorDialog.setSubContent("系统将在网络恢复时自动上传");
+ errorDialog.setOnCancelListener("好的", new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ timer.cancel();
+ }
+ });
+ errorDialog.show();
+ timer.start();
+ }
+
+ /**
+ * 倒计时
+ */
+ CountDownTimer timer = new CountDownTimer(11000, 1000) {
+ @Override
+ public void onTick(long arg) {
+ int theTime = (int) (arg / 1000);
+ if (mErrorType.equals("100")) { //无网
+ if (errorDialog != null) {
+ errorDialog.getTxtCancel().setText(mContext.getString(R.string.tanlu_neterror_cancle_time, theTime + ""));
+ }
+ } else {
+ if (customDialog != null) {
+ customDialog.getTxtCancel().setText(mContext.getString(R.string.tanlu_cancle_time, theTime + ""));
+ }
+ }
+ }
+
+ @Override
+ public void onFinish() {
+ if (mErrorType.equals("100")) { //无网
+ if (errorDialog != null) {
+ errorDialog.dismiss();
+ }
+ } else {
+ if (customDialog != null) {
+ customDialog.dismiss();
+ }
+ }
+ }
+ };
+
+ /**
+ * 接收到分享对应数据打点
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onMarkerInfo(final MarkerInfo event) {
+ if (event == null) {
+ return;
+ }
+
+ if (!NetworkUtils.isConnected(getContext())) { //没有网络
+ TipToast.shortTip("分享失败,请检查网络");
+ } else {
+ float bearing = TanluServiceManager.getLocationClient().getLastKnowLocation().getBearing(); //角度
+ Logger.d(TAG, "onMarkerInfo event.type = " + event.type + " >>event.lat = " + event.lat + " >>event.lon = " + event.lon + " >>event.imageUrl =" + event.imageUrl);
+ String poiType = event.type;
+ boolean isCumtom = event.isCumtom;
+ Logger.d(TAG, "onMarkerInfo share poiType = " + poiType + " --isCumtom = " + isCumtom + " >> getMathRandom = " + getMathRandom() + " >>> bearing = " + bearing);
+ if (isCumtom && !poiType.equals("0")) {
+ double lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude();
+ double lon = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude();
+ Log.d(TAG, "onMarkerInfo lat = " + lat + " >>>> lon = " + lon);
+ String cityName = TanluServiceManager.getLocationClient().getLastKnowLocation().getCityName();
+ String address = TanluServiceManager.getLocationClient().getLastKnowLocation().getAddress();
+ MarkerExploreWay markerExploreWay = new MarkerExploreWay();
+ markerExploreWay.setCityName(cityName);
+ markerExploreWay.setPoiType(poiType);
+
+ MarkerLocation markerLocation = new MarkerLocation();
+ markerLocation.setLat(lat);
+ markerLocation.setLon(lon);
+ markerLocation.setAddress(address);
+
+ MarkerShowEntity markerShowEntity = new MarkerShowEntity();
+ markerShowEntity.setBindObj(markerExploreWay);
+ markerShowEntity.setTextContent(address);
+ markerShowEntity.setMarkerType(TanluConstants.MODEL_NAME);
+ markerShowEntity.setMarkerLocation(markerLocation);
+
+ AIAssist.getInstance(getContext()).speakTTSVoice((
+ String.format(voiceShareSuccessTts, getMathRandom())), null);
+ TipToast.shortTip("分享成功");
+
+ IMogoMarker mogoMarker = TanluServiceManager.getServiceApis().getMarkerService().drawMarker(markerShowEntity);
+ mogoMarker.setClickable(false);
+
+ //开启动画
+ mogoMarker.startScaleAnimationWithAlpha(0, 1.2f, 0, 1.2f, 0f, 1f, 300, new LinearInterpolator(), new OnMarkerAnimationListener() {
+ @Override
+ public void onAnimStart() {
+ Logger.d(TAG, " onAnimStart ---1----> ");
+ }
+
+ @Override
+ public void onAnimEnd() {
+ if (mogoMarker.isDestroyed()) {
+ return;
+ }
+ mogoMarker.startScaleAnimation(1.2f, 1, 1.2f, 1, 100, new LinearInterpolator(), null);
+ }
+ });
+ } else {
+ Logger.e(TAG, "onMarkerInfo share onCompleted poiType = -1 --- else ---->");
+ }
+ }
+
+ mMogoStatusManager.setUploadingStatus(TanluConstants.MODEL_NAME, false);
+ }
+
+ private void showJumpAnimation(final IMogoMarker mogoMarker) {
+ if (mogoMarker == null) {
+ return;
+ }
+
+ mogoMarker.startJumpAnimation(80, 300, new Interpolator() {
+ @Override
+ public float getInterpolation(float input) {
+ if (input <= 0.5) {
+ return (float) (0.5f - 2.0 * (0.5 - input) * (0.5 - input));
+ } else {
+ return (float) (0.5f - Math.sqrt(input - 0.5f) * (1.5f - input));
+ }
+ }
+ }, new OnMarkerAnimationListener() {
+ @Override
+ public void onAnimStart() {
+ }
+
+ @Override
+ public void onAnimEnd() {
+ }
+ });
+ }
+
+ /**
+ * push 类型,1为导航数据,2为通勤族
+ *
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onPushInfo(final PushTypeInfo event) {
+ if (event != null && TextUtils.isEmpty(event.type)) {
+ Logger.d(TAG, " onPushInfo event.type =" + event.type);
+ if (event.type.equals("1")) {
+ getNaviRoadLineInfo();
+ } else if (event.type.equals("2")) {
+ getRoadLineData();
+ }
+ } else {
+ Logger.e(TAG, "event == null ");
+ }
+ }
+
+ /**
+ * 导航路线数据事件
+ */
+ public void getNavigationData() {
+ if (mADASController != null) {
+ mADASController.closeADAS();
+ }
+
+ mTanluModelData.getNaviInformation(TanluServiceManager.getMapService().getNavi(getContext()).getCalculatedPathPos(),
+ new NaviCallback() {
+ @Override
+ public void onSuccess(NaviResult data) {
+ List informationList = data.getResult().getInformations();
+ Logger.d(TAG, "getNavigationData onSuccess informationList =" + informationList);
+ if (informationList == null || (informationList != null && informationList.size() == 0)) {
+ return;
+ }
+
+ if (markerExploreWayList != null && markerExploreWayList.size() > 0) {
+ markerExploreWayList.clear(); //刷新之前先删除之前的,然后再添加成请求的
+ mCurrentPosition = 0;
+ }
+
+ //转换数据结构
+ convertData(informationList);
+ //清除探路之前的数据
+ mMarkerManager.removeMarkers(TanluConstants.MODEL_NAME);
+
+ //打点
+ ArrayList optionList = new ArrayList<>();
+ for (int i = 0; i < informationList.size(); i++) {
+ //根据type确定添加的图片
+ MarkerShowEntity markerShowEntity = new MarkerShowEntity();
+ markerShowEntity.setBindObj(markerExploreWayList.get(i));
+ markerShowEntity.setTextContent(informationList.get(i).addr);
+ markerShowEntity.setMarkerType(TanluConstants.MODEL_NAME);
+ MogoMarkerOptions options = new MogoMarkerOptions()
+ .object(markerShowEntity)
+ .icon(multiMarkerIcon)
+ .latitude(informationList.get(i).lat)
+ .owner(TanluConstants.MODEL_NAME)
+ .longitude(informationList.get(i).lon);
+
+ optionList.add(options);
+ mMarkerManager.addMarker(TanluConstants.MODEL_NAME, options);
+ }
+ Logger.d(TAG, "getNavigationData optionList.size() = " + optionList.size());
+// mMarkerManager.addMarkers(TanluConstants.MODEL_NAME, optionList, true);
+ mLoopRecyclerView.scrollToPosition(0);
+
+ //自身位置和第一个情报自适应显示
+ Rect rect = new Rect(
+ (int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_left),
+ (int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_top),
+ (int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_right),
+ (int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_bottom));
+
+ mMogoStatusManager.setUserInteractionStatus(TAG, true, true);
+ //经度
+ Double longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude();
+ //纬度
+ Double lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude();
+ //第一个参数:调用者,第二个参数:当前自车的位置,第三个参数:需要显示在范围内的点(不包含自车的位置)
+ //第四个参数:显示范围的UI边界,第五个参数:是否锁定自车位置(看业务需要)
+ if (markerExploreWayList.size() > 0) {
+ mMApUIController.showBounds(TanluConstants.MODEL_NAME, new MogoLatLng(lat, longit),
+ getList(markerExploreWayList.get(0)), rect, true);
+ }
+ }
+
+ @Override
+ public void onFail(String message, int code) {
+ Logger.d(TAG, "getNavigationData message = " + message + ">>>code =" + code);
+ }
+ });
+ }
+
+ /**
+ * 通勤族 事件,监听消息自己请求路线数据
+ */
+ public void getRoadLineData() {
+ mTanluModelData.getRoadLineData(new RoadLineCallback() {
+ @Override
+ public void onSuccess(PathLineResult o) {
+ //绘制线路线
+ if (o != null && o.getResult() != null && o.getResult().getPointList() != null
+ && o.getResult().getPointList().size() > 0) {
+ drawMapLine(o.getResult().getPointList());
+ } else {
+ Logger.e(TAG, "getRoadLineData onSuccess o.getPointList() == null");
+ }
+ }
+
+ @Override
+ public void onFail(String message, int code) {
+ Logger.e(TAG, "getRoadLineData onFail message =" + message + ">>>code =" + code);
+ }
+ });
+ }
+
+ /**
+ * 导航路线,监听消息自己请求路线数据
+ */
+ public void getNaviRoadLineInfo() {
+ mTanluModelData.getNaviRoadLineInfo(new RoadLineCallback() {
+ @Override
+ public void onSuccess(PathLineResult o) {
+ //绘制线路线
+ if (o != null && o.getResult() != null && o.getResult().getPointList() != null
+ && o.getResult().getPointList().size() > 0) {
+ drawMapLine(o.getResult().getPointList());
+ } else {
+ Logger.e(TAG, "getNaviRoadLineInfo onSuccess o.getPointList() == null");
+ }
+ }
+
+ @Override
+ public void onFail(String message, int code) {
+ Logger.e(TAG, "getNaviRoadLineInfo onFail message =" + message + ">>>code =" + code);
+ }
+ });
+ }
+
+ /**
+ * 绘制线路
+ */
+ private void drawMapLine(List pointList) {
+ //避免人为操作,刷新
+ mMogoStatusManager.setUserInteractionStatus(TanluConstants.MODEL_NAME, true, true);
+
+ int intervalNum = Utils.getIntervalValue(pointList.size());
+ Logger.d(TAG, "drawMapLine intervalNum = " + intervalNum + ">>> pointList.size =" + pointList.size());
+ int listSize = pointList.size();
+ passedByPoints = new ArrayList<>();
+
+ //沿途最多15个点
+ for (int i = 0; i < listSize; i += intervalNum) {
+ passedByPoints.add(new MogoLatLng(pointList.get(i).getLat(), (pointList.get(i).getLon())));
+ }
+
+ Logger.d(TAG, "drawMapLine passedByPoints.size() ----> " + passedByPoints.size());
+ MogoLatLng startLatLng = new MogoLatLng(pointList.get(0).getLat(), pointList.get(0).getLon());
+ MogoLatLng endLatLng = new MogoLatLng(pointList.get(listSize - 1).getLat(), pointList.get(listSize - 1).getLon());
+ mMarkerManager.addRouteWay(getContext(), startLatLng, endLatLng, passedByPoints);
+ }
+
+
+ private void showBonndsRoadtion() {
+ Logger.e(TAG, "showBonndsRoadtion markerExploreWayList.size() = " + markerExploreWayList.size());
+ Logger.d(TAG, "showBonndsRoadtion getMogoList().size() = " + getMogoList().size());
+ //经度
+ Double longit = TanluServiceManager.getLocationClient().getLastKnowLocation().getLongitude();
+ //纬度
+ Double lat = TanluServiceManager.getLocationClient().getLastKnowLocation().getLatitude();
+ Rect rect = new Rect(
+ (int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_left),
+ (int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_top),
+ (int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_right),
+ (int) getContext().getResources().getDimension(R.dimen.tanlu_module_map_bottom));
+
+ moveNotFresh();
+ //第一个参数:调用者,第二个参数:当前自车的位置,第三个参数:需要显示在范围内的点(不包含自车的位置)
+ //第四个参数:显示范围的UI边界,第五个参数:是否锁定自车位置(看业务需要)
+ mMApUIController.showBounds(TanluConstants.MODEL_NAME, null,
+ getMogoList(), rect, false);
+ }
+
+
+ /**
+ * 构造经纬度列表
+ *
+ * @return
+ */
+ private List getMogoList() {
+ List list = new ArrayList<>();
+ if (markerExploreWayList != null && markerExploreWayList.size() > 0) {
+ if (markerExploreWayList.size() < 6) {
+ for (int i = 0; i < markerExploreWayList.size(); i++) {
+ MarkerLocation location = markerExploreWayList.get(i).getLocation();
+ if (location != null) {
+ MogoLatLng mogoLatLng = new MogoLatLng(location.getLat(), location.getLon());
+ list.add(mogoLatLng);
+ } else {
+ Logger.e(TAG, "getMogoList() < 6 location == null");
+ }
+ }
+ } else {
+ for (int i = 0; i < 6; i++) {
+ MarkerLocation location = markerExploreWayList.get(i).getLocation();
+ if (location != null) {
+ MogoLatLng mogoLatLng = new MogoLatLng(location.getLat(), location.getLon());
+ list.add(mogoLatLng);
+ } else {
+ Logger.e(TAG, "getMogoList() location == null");
+ }
+ }
+ }
+ } else {
+ Logger.e(TAG, "getMogoList() markerExploreWay == null");
+ }
+ return list;
+ }
+
+
+ /**
+ * 将探路的数据结构转换成 MarkerExploreWay的列表
+ */
+ private void convertData(List informations) {
+ if (markerExploreWayList != null) {
+ markerExploreWayList.clear();
+ }
+
+ for (int i = 0; i < informations.size(); i++) {
+ MarkerExploreWay markerExploreWay = new MarkerExploreWay();
+ markerExploreWay.setAddr(informations.get(i).addr);
+ markerExploreWay.setCityName(informations.get(i).cityName);
+ markerExploreWay.setDistance(informations.get(i).distance);
+ markerExploreWay.setFileType(informations.get(i).type);
+ markerExploreWay.setItems(convertMediaData(informations.get(i).items));
+ markerExploreWay.setLocation(convertLocation(informations.get(i)));
+ markerExploreWay.setUserInfo(convertUserInfo(informations.get(i)));
+
+ markerExploreWayList.add(markerExploreWay);
+ }
+
+ //更新数据
+ renderCardViews();
+ }
+
+ /**
+ * 转换媒体数据
+ *
+ * @param items
+ * @return
+ */
+ private List convertMediaData(ArrayList items) {
+ List exploreWayItems = new ArrayList<>();
+ MarkerExploreWayItem item = new MarkerExploreWayItem();
+ if (items != null && items.size() > 0) {
+ item.setThumbnail(items.get(0).getThumbnail());
+ item.setUrl(items.get(0).getUrl());
+
+ exploreWayItems.add(item);
+ }
+
+ return exploreWayItems;
+ }
+
+
+ private MarkerLocation convertLocation(Information information) {
+ MarkerLocation location = new MarkerLocation();
+ location.setAddress(information.addr);
+ location.setAngle(0);
+ location.setLat(information.lat);
+ location.setLon(information.lon);
+
+ return location;
+ }
+
+
+ private MarkerUserInfo convertUserInfo(Information information) {
+ MarkerUserInfo userInfo = new MarkerUserInfo();
+ userInfo.setUserHead(information.headImgUrl);
+ userInfo.setUserName(information.nickName);
+
+ return userInfo;
+ }
+
+ Random random = new Random();
+
+ private void speakSuccessVoice(List informations, String
+ trafficStatus) {
+ Logger.d(TAG, "speakSuccessVoice informations.size() = " + informations.size());
+ switch (informations.size()) {
+ case 0:
+ speakFailVoice(searchfaileVoiceStrings[random.nextInt(3)]);
+ break;
+
+ case 1:
+ trackVoiceSearch(1);
+ AIAssist.getInstance(getContext()).speakTTSVoice((
+ String.format(voiceGetInfoMationTts, "1") + trafficStatus), null);
+ break;
+
+ case 2:
+ trackVoiceSearch(1);
+ AIAssist.getInstance(getContext()).speakTTSVoice((
+ String.format(
+ voiceGetInfoMationTts,
+ "2"
+ ) + trafficStatus), null);
+ break;
+ case 3:
+ trackVoiceSearch(1);
+ AIAssist.getInstance(getContext()).speakTTSVoice((
+ String.format(
+ voiceGetInfoMationTts,
+ "3"
+ ) + trafficStatus), null);
+ break;
+
+ default:
+ trackVoiceSearch(1);
+ AIAssist.getInstance(getContext()).speakTTSVoice((
+ String.format(
+ voiceGetInfoMationTts,
+ "多"
+ ) + trafficStatus), null);
+ }
+ }
+
+ private void initStrings() {
+ voiceGetInfoMationTts =
+ getContext().getResources().getString(R.string.voice_get_informations_tts);
+// searchingVoiceStrings =
+// getContext().getResources().getStringArray(R.array.searching_voice_string_array);
+ searchfaileVoiceStrings =
+ getContext().getResources().getStringArray(R.array.search_fail_voice_array);
+ voiceShareSuccessTts = getContext().getResources().getString(R.string.tanlu_share_success);
+ }
+
+ private void speakFailVoice(String string) {
+ AIAssist.getInstance(getContext()).speakTTSVoice(string, null);
+ }
+
+
+ Double inputlon = 0.0;//经度
+ Double inputlat = 0.0; //维度
+ Double datalon = 0.0; //经度
+ Double datalat = 0.0; //维度
+
+ //上报语音搜索
+ private void trackVoiceSearch(int type) {
+ Map properties = new HashMap<>();
+ properties.put("type", type);
+ properties.put("searchtext", mKeywords);
+ properties.put("inputlon", inputlon);
+ properties.put("inputlat", inputlat);
+ properties.put("datalon", datalon);
+ properties.put("datalat", datalat);
+ mAnalytics.track(TanluConstants.CARNET_VOICE_SEARCH, properties);
+ }
+
+ private String getMathRandom() {
+ Random random = new Random();
+ int temp = random.nextInt(50) + 10;
+
+ return String.valueOf(temp);
+ }
+
+ @Override
+ public void accOn() {
+
+ }
+
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluServiceManager.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluServiceManager.java
new file mode 100644
index 0000000000..3709aed460
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/TanluServiceManager.java
@@ -0,0 +1,100 @@
+package com.mogo.module.tanlu.fragment;
+
+import android.content.Context;
+
+import com.alibaba.android.arouter.launcher.ARouter;
+import com.mogo.map.location.IMogoLocationClient;
+import com.mogo.map.search.poisearch.IMogoPoiSearch;
+import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
+import com.mogo.module.carchattingprovider.ICarsChattingProvider;
+import com.mogo.service.IMogoServiceApis;
+import com.mogo.service.MogoServicePaths;
+import com.mogo.service.analytics.IMogoAnalytics;
+import com.mogo.service.datamanager.IMogoDataManager;
+import com.mogo.service.intent.IMogoIntentManager;
+import com.mogo.service.map.IMogoMapService;
+import com.mogo.service.module.IMogoRegisterCenter;
+import com.mogo.service.statusmanager.IMogoStatusManager;
+import com.mogo.service.windowview.IMogoTopViewManager;
+import com.zhidao.carchattingprovider.CallChattingProviderConstant;
+
+/**
+ * @author lixiaopeng
+ * @since 2020-5-19
+ *
+ * 持有服务接口实例
+ */
+public class TanluServiceManager {
+ private static String TAG = "TanluServiceManager";
+ private static IMogoMapService mMapService;
+ private static IMogoPoiSearch mPoiSearch;
+ private static IMogoLocationClient mLocationClient;
+ private static IMogoDataManager mDataManager;
+ private static IMogoServiceApis mServiceApis;
+ private static IMogoStatusManager mIMogoStatusManager;
+ private static IMogoAnalytics mAnalytics;
+ private static IMogoIntentManager mogoIntentManager;
+ private static IMogoRegisterCenter mogoRegisterCenter;
+ private static ICarsChattingProvider mCarsChattingProvider;
+ private static IMogoTopViewManager mIMogoTopViewManager;
+
+ public static void init(Context context) {
+ mServiceApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
+ mMapService = mServiceApis.getMapServiceApi();
+ mDataManager = mServiceApis.getDataManagerApi();
+ mIMogoStatusManager = mServiceApis.getStatusManagerApi();
+ mAnalytics = mServiceApis.getAnalyticsApi();
+ mogoIntentManager = mServiceApis.getIntentManagerApi();
+ mogoRegisterCenter = mServiceApis.getRegisterCenterApi();
+
+ mCarsChattingProvider = (ICarsChattingProvider) ARouter.getInstance().build(CallChattingProviderConstant.CAR_CALL_PROVIDER).navigation();
+ mIMogoTopViewManager = mServiceApis.getTopViewManager();
+ mPoiSearch = mMapService.getPoiSearch(context, new MogoPoiSearchQuery());
+ mLocationClient = mMapService.getSingletonLocationClient(context);
+ }
+
+ public static IMogoTopViewManager getIMogoTopViewManager() {
+ return mIMogoTopViewManager;
+ }
+
+ public static IMogoRegisterCenter getIMogoRegisterCenter() {
+ return mogoRegisterCenter;
+ }
+
+ public static IMogoMapService getMapService() {
+ return mMapService;
+ }
+
+ public static IMogoPoiSearch getPoiSearch() {
+ return mPoiSearch;
+ }
+
+ public static IMogoLocationClient getLocationClient() {
+ return mLocationClient;
+ }
+
+ public static IMogoAnalytics getAnalytics() {
+ return mAnalytics;
+ }
+
+ public static IMogoIntentManager getMogoIntentManager() {
+ return mogoIntentManager;
+ }
+
+ public static IMogoStatusManager getMogoStatusManager() {
+ return mIMogoStatusManager;
+ }
+
+ public static IMogoDataManager getDataManager() {
+ return mDataManager;
+ }
+
+ public static IMogoServiceApis getServiceApis() {
+ return mServiceApis;
+ }
+
+ public static ICarsChattingProvider getCarsChattingProvider() {
+ return mCarsChattingProvider;
+ }
+
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/recycler/TanluSlideAdapterNew.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/recycler/TanluSlideAdapterNew.java
new file mode 100644
index 0000000000..601a7707d3
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/recycler/TanluSlideAdapterNew.java
@@ -0,0 +1,483 @@
+package com.mogo.module.tanlu.fragment.recycler;
+
+import android.animation.Animator;
+import android.animation.AnimatorInflater;
+import android.animation.AnimatorSet;
+import android.content.Context;
+import android.text.TextUtils;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.ImageView;
+import android.widget.LinearLayout;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.bumptech.glide.Glide;
+import com.bumptech.glide.request.RequestOptions;
+import com.mogo.commons.debug.DebugConfig;
+import com.mogo.module.common.entity.MarkerExploreWay;
+import com.mogo.module.tanlu.R;
+import com.mogo.module.tanlu.callback.IThumbsUpCallback;
+import com.mogo.module.tanlu.constant.TanluConstants;
+import com.mogo.module.tanlu.model.TanluModelData;
+import com.mogo.module.tanlu.model.event.ControlClickUpInfo;
+import com.mogo.module.tanlu.model.event.StartPlayInfo;
+import com.mogo.module.tanlu.model.event.VoiceControlUpInfo;
+import com.mogo.module.tanlu.util.ChartUtil;
+import com.mogo.module.tanlu.video.SimpleCoverVideoPlayer;
+import com.mogo.service.analytics.IMogoAnalytics;
+import com.mogo.service.imageloader.IMogoImageloader;
+import com.mogo.service.imageloader.MogoImageView;
+import com.mogo.utils.TipToast;
+import com.mogo.utils.logger.Logger;
+import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder;
+
+import org.greenrobot.eventbus.EventBus;
+import org.greenrobot.eventbus.Subscribe;
+import org.greenrobot.eventbus.ThreadMode;
+
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import static android.view.View.GONE;
+import static android.view.View.VISIBLE;
+import static com.mogo.module.tanlu.util.StringUitlKt.formatDate;
+import static com.mogo.module.tanlu.util.Utils.handleDistance;
+
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2020/3/11
+ */
+public class TanluSlideAdapterNew extends RecyclerView.Adapter {
+ private List markerExploreWayList = new ArrayList<>();
+ private static final String TAG = "TanluSlideAdapterNew";
+ private Context mContext;
+
+ private TextView mAddressTv;
+ private TextView mDistanceTv;
+ private TextView mTimeTv;
+ private SimpleCoverVideoPlayer simpleCoverVideoPlayer;
+ private ImageView autoZoomInImageView;
+ private MogoImageView mHeadImage;
+ private ImageView mChatImage;
+ private ImageView mLikeImage;
+ private LinearLayout mLikeLayout;
+ private TextView mTypeTv;
+ private IMogoImageloader mogoImageloader;
+
+ //media
+ private GSYVideoOptionBuilder gsyVideoOptionBuilder = new GSYVideoOptionBuilder();
+ private String mVideoUrl = "";
+ private String mImageUrl = "";
+
+ //底层api
+ private IMogoAnalytics mAnalytics;
+ private TanluModelData mTanluModelData;
+
+ private HashMap list = new HashMap<>();
+
+
+ public TanluSlideAdapterNew(Context context, IMogoAnalytics analytics, TanluModelData tanluModelData, IMogoImageloader mogoImageloader) {
+ this.mContext = context;
+ this.mAnalytics = analytics;
+ this.mTanluModelData = tanluModelData;
+ this.mogoImageloader = mogoImageloader;
+ EventBus.getDefault().register(this);
+ }
+
+ @NonNull
+ @Override
+ public TanluSlideViewHolderNew onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View inflate = LayoutInflater.from(parent.getContext())
+ .inflate(R.layout.tanlu_item_main_media_recycler_new, parent, false);
+ return new TanluSlideViewHolderNew(inflate);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull TanluSlideViewHolderNew holder, int position) {
+ final MarkerExploreWay markerExploreWay = markerExploreWayList.get(position);
+ if (markerExploreWay == null) {
+ return;
+ }
+
+ mAddressTv = holder.itemView.findViewById(R.id.tv_information_media_content);
+ mDistanceTv = holder.itemView.findViewById(R.id.tv_information_media_distance);
+ mTimeTv = holder.itemView.findViewById(R.id.tv_information_media_time);
+ simpleCoverVideoPlayer = holder.itemView.findViewById(R.id.video_player_main);
+ autoZoomInImageView = holder.itemView.findViewById(R.id.tanlu_photo_imageView);
+ mHeadImage = holder.itemView.findViewById(R.id.tanlu_head_imageView);
+ mChatImage = holder.itemView.findViewById(R.id.tanlu_chat_imageView);
+ mLikeImage = holder.itemView.findViewById(R.id.tanlu_like_imageView);
+ mLikeLayout = holder.itemView.findViewById(R.id.tanlu_like_layout);
+ mTypeTv = holder.itemView.findViewById(R.id.tv_information_type);
+
+ //有可能不是一个对象
+ simpleCoverVideoPlayer.setVisibility(View.VISIBLE);
+ autoZoomInImageView.setVisibility(View.GONE);
+
+ list.put(position, simpleCoverVideoPlayer);
+
+ mTypeTv.setText(getTypeName(markerExploreWay.getPoiType()));
+ if (markerExploreWay.getPoiType().equals(TanluConstants.TANLU_ROAD_CURRENT)) {
+ mTypeTv.setBackgroundResource(R.drawable.tanlu_type_button_blue_bg);
+ } else {
+ mTypeTv.setBackgroundResource(R.drawable.tanlu_event_type_red_bg);
+ }
+
+ //自研车机
+ if (DebugConfig.getCarMachineType() == 0) {
+ if (markerExploreWay.getUserInfo() != null) {
+ //是否能拨打
+ ChartUtil.isCanCall(mContext.getApplicationContext(), b -> {
+ Logger.d(TAG, " isCanCall b = " + b + " >>>sn =" + markerExploreWay.getUserInfo().getSn());
+ if (b) {
+ //对方是否在线
+ ChartUtil.isOnLine(markerExploreWay.getUserInfo().getSn(), mContext.getApplicationContext(), b1 -> {
+ Logger.d(TAG, " isonline b1 = " + b1 + " >>>sn =" + markerExploreWay.getUserInfo().getSn());
+ if (b1) {
+ mChatImage.setVisibility(VISIBLE);
+ } else {
+ mChatImage.setVisibility(GONE);
+ }
+ });
+ } else {
+ mChatImage.setVisibility(GONE);
+ }
+ });
+ } else {
+ Logger.e(TAG, " markerExploreWay.getUserInfo() == null ");
+ mChatImage.setVisibility(GONE);
+ }
+ }
+
+ //加载头像图片
+// RequestOptions requestOptions = new RequestOptions()
+// .circleCrop()
+// .placeholder(R.drawable.tanlu_head_image)
+// .error(R.drawable.tanlu_head_image)
+// .fallback(R.drawable.tanlu_head_image);
+// Glide.with(mContext)
+// .load(markerExploreWay.getUserInfo() != null ? markerExploreWay.getUserInfo().getUserHead() : "")
+// .apply(requestOptions)
+// .into(mHeadImage);
+ if (mogoImageloader != null) {
+ mogoImageloader.displayImage(markerExploreWay.getUserInfo() != null ? markerExploreWay.getUserInfo().getUserHead() : "", mHeadImage);
+ }
+
+ //处理数据显示
+ handleMarkerExploreWay(markerExploreWay);
+
+ mChatImage.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ traceTypeData(markerExploreWay.getInfoId() == null ? "" : markerExploreWay.getInfoId(), "2", markerExploreWay.getSn() == null ? "" : markerExploreWay.getSn());
+ ChartUtil.callChatting(markerExploreWay.getUserInfo(), markerExploreWay.getLocation());
+ }
+ });
+
+ mLikeLayout.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ //动画
+ AnimatorSet animatorSet = (AnimatorSet) AnimatorInflater.loadAnimator(mContext, R.anim.v2x_like_heart_animation);
+ animatorSet.setTarget(mLikeImage);
+ animatorSet.addListener(new Animator.AnimatorListener() {
+ @Override
+ public void onAnimationStart(Animator animation) {
+
+ }
+
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ traceTypeData(markerExploreWay.getInfoId() == null ? "" : markerExploreWay.getInfoId(), "1", markerExploreWay.getSn() == null ? "" : markerExploreWay.getSn());
+ if (TextUtils.isEmpty(markerExploreWay.getInfoId())) {
+ TipToast.shortTip("点赞失败");
+ return;
+ }
+
+ mTanluModelData.thumbsUp(markerExploreWay, new IThumbsUpCallback() {
+ @Override
+ public void onThumbsUpSuccess() {
+ TipToast.shortTip("点赞成功");
+ Logger.d(TAG, "onThumbsUpSuccess -------->");
+ }
+
+ @Override
+ public void onThumbsUpFail() {
+ TipToast.shortTip("点赞失败");
+ Logger.e(TAG, "onThumbsUpFail -------->");
+ }
+ });
+ }
+
+ @Override
+ public void onAnimationCancel(Animator animation) {
+
+ }
+
+ @Override
+ public void onAnimationRepeat(Animator animation) {
+
+ }
+ });
+ animatorSet.start();
+
+ }
+ });
+
+ }
+
+ @Override
+ public int getItemCount() {
+ return markerExploreWayList == null ? 0 : markerExploreWayList.size();
+ }
+
+ @Override
+ public int getItemViewType(int position) {
+ return super.getItemViewType(position);
+ }
+
+ @Override
+ public long getItemId(int position) {
+ return position;
+ }
+
+ /**
+ * 设置数据
+ *
+ * @param datas
+ */
+ public void setDatas(List datas) {
+ if (markerExploreWayList != null) {
+ markerExploreWayList.clear();
+
+ markerExploreWayList.addAll(datas);
+ Logger.e(TAG, "setDatas size = " + markerExploreWayList.size());
+ }
+ }
+
+ /**
+ * 通用的处理数据逻辑
+ *
+ * @param markerExploreWay
+ */
+ private void handleMarkerExploreWay(MarkerExploreWay markerExploreWay) {
+ if (markerExploreWay != null) {
+ Logger.d(TAG, "markerExploreWay.getFileType() =" + markerExploreWay.getFileType());
+ if (markerExploreWay.getFileType() == 0) { //图片
+ refreshPhotoData(markerExploreWay);
+ } else if (markerExploreWay.getFileType() == 1) { //视频
+ refreshVideoData(markerExploreWay);
+ }
+ } else {
+ Logger.e(TAG, "handleMarkerExploreWay == null");
+ }
+ }
+
+ /**
+ * 刷新单个视频数据,更新位置positon
+ */
+ private void refreshVideoData(MarkerExploreWay markerExploreWay) {
+ if (markerExploreWay.getItems() == null) {
+ showDefaultImage();
+ return;
+ }
+
+ if (markerExploreWay.getItems().size() == 0) {
+ showDefaultImage();
+ return;
+ }
+
+ String videoUrl = markerExploreWay.getItems().get(0).getUrl();
+ mImageUrl = markerExploreWay.getItems().get(0).getThumbnail();
+ Logger.d(TAG, "refreshVideoData mImageUrl = " + mImageUrl);
+ mAddressTv.setText(markerExploreWay.getAddr());
+ Logger.e(TAG, "refreshVideoData markerExploreWay.getAddr() = " + markerExploreWay.getAddr() + " >>>>videoUrl = " + videoUrl);
+ mDistanceTv.setText("距离" + handleDistance(markerExploreWay.getDistance()));
+ mTimeTv.setText(formatDate(markerExploreWay.getGenerateTime()));
+ //判断是图片还是视频,第一个时,上一个不可点击
+ autoZoomInImageView.setVisibility(View.GONE);
+
+ //视频配置
+ mVideoUrl = videoUrl;
+ if (!TextUtils.isEmpty(videoUrl) && !TextUtils.isEmpty(mImageUrl)) {
+ autoZoomInImageView.setVisibility(View.GONE);
+ simpleCoverVideoPlayer.setVisibility(View.VISIBLE);
+ //加载封面图
+ simpleCoverVideoPlayer.loadCoverImage(mImageUrl, mContext);
+ gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(false).setPlayTag(TAG)
+ .build(simpleCoverVideoPlayer);
+ simpleCoverVideoPlayer.getStartButton().performClick();
+ } else {
+ simpleCoverVideoPlayer.setVisibility(GONE);
+ autoZoomInImageView.setVisibility(View.VISIBLE);
+ //加载图片
+ RequestOptions requestOptions = new RequestOptions()
+ .placeholder(R.drawable.tanlu_normal_image)
+ .error(R.drawable.tanlu_normal_image)
+ .fallback(R.drawable.tanlu_normal_image);
+ Glide.with(mContext)
+ .load(mImageUrl)
+ .apply(requestOptions)
+ .into(autoZoomInImageView);
+ }
+
+ traceVideoPlayStatusData();
+ }
+
+ /**
+ * 刷新单个图片数据
+ */
+ private void refreshPhotoData(MarkerExploreWay markerExploreWay) {
+ if (markerExploreWay.getItems() == null) {
+ Logger.e(TAG, "refreshPhotoData markerExploreWay.getItems() == null");
+ showDefaultImage();
+ return;
+ }
+
+ if (markerExploreWay.getItems().size() == 0) {
+ Logger.e(TAG, "refreshPhotoData markerExploreWay.getItems().size() == 0");
+ showDefaultImage();
+ return;
+ }
+
+ mAddressTv.setText(markerExploreWay.getAddr());
+ mDistanceTv.setText("距离 " + handleDistance(markerExploreWay.getDistance()));
+ mTimeTv.setText(formatDate(markerExploreWay.getGenerateTime()));
+ String imageUrl = markerExploreWay.getItems().get(0).getUrl();
+ simpleCoverVideoPlayer.setVisibility(View.GONE);
+ autoZoomInImageView.setVisibility(View.VISIBLE);
+ Logger.d(TAG, "refreshPhotoData imageUrl = " + imageUrl);
+ //加载图片
+ RequestOptions requestOptions = new RequestOptions()
+ .placeholder(R.drawable.tanlu_normal_image)
+ .error(R.drawable.tanlu_normal_image)
+ .fallback(R.drawable.tanlu_normal_image);
+ Glide.with(mContext)
+ .load(imageUrl)
+ .apply(requestOptions)
+ .into(autoZoomInImageView);
+ }
+
+
+ private void showDefaultImage() {
+ simpleCoverVideoPlayer.setVisibility(View.GONE);
+ autoZoomInImageView.setVisibility(View.VISIBLE);
+ }
+
+ /**
+ * 上传播放
+ */
+ private void traceVideoPlayStatusData() {
+ if (mAnalytics != null) {
+ mAnalytics.track(TanluConstants.CARNET_USER_VIDEO_PLAY, null);
+ }
+ }
+
+ private void traceTypeData(String id, String type, String sn) {
+ Map properties = new HashMap<>();
+ properties.put("dbid", id);
+ properties.put("type", type);
+ properties.put("sn", sn);
+ mAnalytics.track(TanluConstants.CARNET_ROAD_ENVENT, properties);
+ }
+
+ /**
+ * 上一条逻辑
+ */
+ private void handlePrevious() {
+ //判断是图片还是视频,第一个时,上一个不可点击
+ Logger.d(TAG, " handlePrevious >> size= " + markerExploreWayList.size());
+ EventBus.getDefault().post(new ControlClickUpInfo("1"));
+ }
+
+ /**
+ * 下一条逻辑
+ */
+ private void handleNext() {
+ //判断是图片还是视频,最后一个时,下一个不可点击
+ Logger.d(TAG, " handleNext >> size= " + markerExploreWayList.size());
+ EventBus.getDefault().post(new ControlClickUpInfo("2"));
+ }
+
+ /**
+ * @param event
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onPushInfo(final VoiceControlUpInfo event) {
+ Logger.d(TAG, "TanluSlideAdapter onPushInfo -----type = " + event.type);
+ if (event.type.equals("1")) { //上一条
+ handlePrevious();
+ } else if (event.type.equals("2")) { //下一条
+ handleNext();
+ }
+ }
+
+
+ /**
+ * 开始播放
+ */
+ @Subscribe(threadMode = ThreadMode.MAIN)
+ public void onHandlePlay(final StartPlayInfo info) {
+ int finalPosition = info.mPosition;
+ Logger.d(TAG, "onHandlePlay size = " + list.size() + " >> info.mPosition = " + info.mPosition + " >> finalPosition = " + finalPosition);
+// if (list.size() > finalPosition) {
+ SimpleCoverVideoPlayer coverVideoPlayer = list.get(finalPosition);
+ coverVideoPlayer.release();
+ coverVideoPlayer.getStartButton().performClick();
+ traceVideoPlayStatusData();
+// }
+ }
+
+ public void release() {
+ if (list != null) {
+ list.clear();
+ }
+ }
+
+ private String getTypeName(String type) {
+ String typeName = "";
+ switch (type) {
+ case TanluConstants.TANLU_TRAFFIC_CHECK_COMPAT:
+ typeName = "交通检查";
+ break;
+ case TanluConstants.TANLU_ROAD_CLOSURE_COMPAT:
+ typeName = "封路";
+ break;
+ case TanluConstants.TANLU_ROAD_CONSTRUCTION:
+ typeName = "道路施工";
+ break;
+ case TanluConstants.TANLU_ROAD_CONGESTION_COMPAT:
+ typeName = "道路拥堵";
+ break;
+ case TanluConstants.TANLU_ROAD_PONDING:
+ typeName = "道路积水";
+ break;
+ case TanluConstants.TANLU_ROAD_ICING:
+ typeName = "路面结冰";
+ break;
+ case TanluConstants.TANLU_ROAD_HEAVY_FOG:
+ typeName = "出现浓雾";
+ break;
+ case TanluConstants.TANLU_ROAD_ACCIDENT:
+ typeName = "交通事故";
+ break;
+ case TanluConstants.TANLU_ROAD_CURRENT:
+ typeName = "实时路况";
+ break;
+ default:
+ typeName = "道路拥堵";
+ break;
+ }
+ return typeName;
+ }
+
+}
+
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/recycler/TanluSlideViewHolderNew.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/recycler/TanluSlideViewHolderNew.java
new file mode 100644
index 0000000000..56f5b6bdd6
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/fragment/recycler/TanluSlideViewHolderNew.java
@@ -0,0 +1,19 @@
+package com.mogo.module.tanlu.fragment.recycler;
+
+import android.view.View;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2020/3/11
+ */
+public class TanluSlideViewHolderNew extends RecyclerView.ViewHolder{
+
+ public TanluSlideViewHolderNew(@NonNull View itemView) {
+ super(itemView);
+ }
+
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/BaseDataComapt.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/BaseDataComapt.kt
new file mode 100644
index 0000000000..df44cedcc7
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/BaseDataComapt.kt
@@ -0,0 +1,5 @@
+package com.mogo.module.tanlu.model
+
+import com.mogo.commons.data.BaseData
+
+data class BaseDataCompat(var result:T?):BaseData()
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/CarsLive.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/CarsLive.kt
new file mode 100644
index 0000000000..aeacd5025c
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/CarsLive.kt
@@ -0,0 +1,17 @@
+package com.mogo.module.tanlu.model
+
+class CarsLive {
+ var sn: String
+ var lat: Double
+ var lon: Double
+ var direction: Int
+ var canLive: Int
+
+ constructor(sn: String, lat: Double, lon: Double, direction: Int, canLive: Int) {
+ this.sn = sn
+ this.lat = lat
+ this.lon = lon
+ this.direction = direction
+ this.canLive = canLive
+ }
+}
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Center.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Center.kt
new file mode 100644
index 0000000000..b5c5a909c8
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Center.kt
@@ -0,0 +1,12 @@
+package com.mogo.module.tanlu.model
+
+/**
+ * @description
+ *
+ * @author lixiaopeng
+ * @since 2019-10-24
+ */
+data class Center (
+ val lat: Double,//weidu
+ val lon: Double
+)
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/End.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/End.java
new file mode 100644
index 0000000000..4e937f983a
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/End.java
@@ -0,0 +1,16 @@
+package com.mogo.module.tanlu.model;
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2020-01-09
+ */
+public class End {
+ public Double lat;
+ public Double lon;
+
+ public End(Double lat, Double lon) {
+ this.lat = lat;
+ this.lon = lon;
+ }
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Information.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Information.java
new file mode 100644
index 0000000000..637a7bcf06
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Information.java
@@ -0,0 +1,80 @@
+package com.mogo.module.tanlu.model;
+
+import android.os.Parcel;
+import android.os.Parcelable;
+
+import com.mogo.commons.data.BaseData;
+
+import java.util.ArrayList;
+
+/**
+ * @author lixiaopeng
+ * @description 列表数据
+ * @since 2020-01-05
+ */
+public class Information extends BaseData implements Parcelable {
+ public int type;
+ public Double lon;
+ public Double lat;
+ public String addr;
+ public Long generateTime;
+ public String cityName;
+ public ArrayList items;
+ public int distance;
+ public String nickName;
+ public String headImgUrl;
+ public String phone;
+ public String trafficInfoType;
+
+
+ @Override
+ public int describeContents() {
+ return 0;
+ }
+
+ @Override
+ public void writeToParcel(Parcel dest, int flags) {
+ dest.writeInt(this.type);
+ dest.writeValue(this.lon);
+ dest.writeValue(this.lat);
+ dest.writeString(this.addr);
+ dest.writeValue(this.generateTime);
+ dest.writeString(this.cityName);
+ dest.writeTypedList(this.items);
+ dest.writeInt(this.distance);
+ dest.writeString(this.nickName);
+ dest.writeString(this.headImgUrl);
+ dest.writeString(this.phone);
+ dest.writeString(this.trafficInfoType);
+ }
+
+ public Information() {
+ }
+
+ protected Information(Parcel in) {
+ this.type = in.readInt();
+ this.lon = (Double) in.readValue(Double.class.getClassLoader());
+ this.lat = (Double) in.readValue(Double.class.getClassLoader());
+ this.addr = in.readString();
+ this.generateTime = (Long) in.readValue(Long.class.getClassLoader());
+ this.cityName = in.readString();
+ this.items = in.createTypedArrayList(Items.CREATOR);
+ this.distance = in.readInt();
+ this.nickName = in.readString();
+ this.headImgUrl = in.readString();
+ this.phone = in.readString();
+ this.trafficInfoType = in.readString();
+ }
+
+ public static final Creator CREATOR = new Creator() {
+ @Override
+ public Information createFromParcel(Parcel source) {
+ return new Information(source);
+ }
+
+ @Override
+ public Information[] newArray(int size) {
+ return new Information[size];
+ }
+ };
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/InformationAndLiveCarResult.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/InformationAndLiveCarResult.java
new file mode 100644
index 0000000000..d40d7ec8e9
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/InformationAndLiveCarResult.java
@@ -0,0 +1,38 @@
+package com.mogo.module.tanlu.model;
+
+import com.mogo.commons.data.BaseData;
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2020-01-09
+ */
+public class InformationAndLiveCarResult extends BaseData {
+ private Result onTheWayData;
+ private Result infoMationResult;
+ private Sns snResult;
+
+ public Result getOnTheWayData() {
+ return onTheWayData;
+ }
+
+ public void setOnTheWayData(Result onTheWayData) {
+ this.onTheWayData = onTheWayData;
+ }
+
+ public Result getInfoMationResult() {
+ return infoMationResult;
+ }
+
+ public void setInfoMationResult(Result infoMationResult) {
+ this.infoMationResult = infoMationResult;
+ }
+
+ public Sns getSnResult() {
+ return snResult;
+ }
+
+ public void setSnResult(Sns snResult) {
+ this.snResult = snResult;
+ }
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Items.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Items.kt
new file mode 100644
index 0000000000..444c53b240
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Items.kt
@@ -0,0 +1,33 @@
+package com.mogo.module.tanlu.model
+
+import android.os.Parcel
+import android.os.Parcelable
+
+class Items(var url: String? = null, var thumbnail: String? = null) : Parcelable {
+ constructor(parcel: Parcel) : this(
+ parcel.readString(),
+ parcel.readString()
+ ) {
+ }
+
+ override fun writeToParcel(parcel: Parcel, flags: Int) {
+ parcel.writeString(url)
+ parcel.writeString(thumbnail)
+ }
+
+ override fun describeContents(): Int {
+ return 0
+ }
+
+ companion object CREATOR : Parcelable.Creator {
+ override fun createFromParcel(parcel: Parcel): Items {
+ return Items(parcel)
+ }
+
+ override fun newArray(size: Int): Array {
+ return arrayOfNulls(size)
+ }
+ }
+
+
+}
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/LocationCarsWithRadius.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/LocationCarsWithRadius.kt
new file mode 100644
index 0000000000..f853fe51bb
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/LocationCarsWithRadius.kt
@@ -0,0 +1,21 @@
+package com.mogo.module.tanlu.model
+
+class LocationCarsWithRadius {
+ var coordinates: List
+ var radius: Int
+ var type: String
+ var keyWord: String? = null
+
+ constructor(coordinates: List, radius: Int, type: String, keyWord: String) {
+ this.coordinates = coordinates
+ this.radius = radius
+ this.type = type
+ this.keyWord = keyWord
+ }
+
+ constructor(coordinates: List, radius: Int, type: String) {
+ this.coordinates = coordinates
+ this.radius = radius
+ this.type = type
+ }
+}
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/NaviLatLng.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/NaviLatLng.java
new file mode 100644
index 0000000000..a24ea22360
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/NaviLatLng.java
@@ -0,0 +1,17 @@
+package com.mogo.module.tanlu.model;
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2020-01-09
+ */
+public class NaviLatLng {
+ public Start start;
+ public End end;
+
+ NaviLatLng(Start start, End end) {
+ this.start = start;
+ this.end = end;
+ }
+
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/NaviLatLngInfo.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/NaviLatLngInfo.java
new file mode 100644
index 0000000000..086f98a538
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/NaviLatLngInfo.java
@@ -0,0 +1,55 @@
+package com.mogo.module.tanlu.model;
+
+import java.io.Serializable;
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2020-01-09
+ */
+public class NaviLatLngInfo implements Serializable {
+ public String FromPoiLatitude = "";
+ public String FromPoiLongitude = "";
+ public String ToPoiLatitude = "";
+ public String ToPoiLongitude= "";
+
+ public Start fromStart() {
+ return new Start(Double.parseDouble(FromPoiLatitude), Double.parseDouble(FromPoiLongitude));
+ }
+
+ public End toEnd() {
+ return new End(Double.parseDouble(ToPoiLatitude), Double.parseDouble(ToPoiLongitude));
+ }
+
+ public String getFromPoiLatitude() {
+ return FromPoiLatitude;
+ }
+
+ public void setFromPoiLatitude(String fromPoiLatitude) {
+ FromPoiLatitude = fromPoiLatitude;
+ }
+
+ public String getFromPoiLongitude() {
+ return FromPoiLongitude;
+ }
+
+ public void setFromPoiLongitude(String fromPoiLongitude) {
+ FromPoiLongitude = fromPoiLongitude;
+ }
+
+ public String getToPoiLatitude() {
+ return ToPoiLatitude;
+ }
+
+ public void setToPoiLatitude(String toPoiLatitude) {
+ ToPoiLatitude = toPoiLatitude;
+ }
+
+ public String getToPoiLongitude() {
+ return ToPoiLongitude;
+ }
+
+ public void setToPoiLongitude(String toPoiLongitude) {
+ ToPoiLongitude = toPoiLongitude;
+ }
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/NaviLatLngInfo.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/NaviLatLngInfo.kt
new file mode 100644
index 0000000000..b4d7c77b88
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/NaviLatLngInfo.kt
@@ -0,0 +1,19 @@
+package com.mogo.module.tanlu.model
+
+import java.io.Serializable
+
+fun NaviLatLngInfo.fromStart(): Start {
+ return Start(FromPoiLatitude.toDouble(), FromPoiLongitude.toDouble())
+}
+
+fun NaviLatLngInfo.toEnd(): End {
+ return End(ToPoiLatitude.toDouble(), ToPoiLongitude.toDouble())
+}
+
+class NaviLatLngInfo1 : Serializable {
+ var FromPoiLatitude: String = ""
+ var FromPoiLongitude: String = ""
+ var ToPoiLatitude: String = ""
+ var ToPoiLongitude: String = ""
+
+}
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/NaviResult.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/NaviResult.java
new file mode 100644
index 0000000000..3f25edee5c
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/NaviResult.java
@@ -0,0 +1,36 @@
+package com.mogo.module.tanlu.model;
+
+import com.mogo.commons.data.BaseData;
+
+import java.util.List;
+
+/**
+ * @author lixiaopeng
+ * @description 导航沿途数据
+ * @since 2020-02-03
+ */
+public class NaviResult extends BaseData {
+
+ private Result result;
+
+ public Result getResult() {
+ return result;
+ }
+
+ public void setResult(Result result) {
+ this.result = result;
+ }
+
+ public static class Result {
+ private List informations;
+
+ public List getInformations() {
+ return informations;
+ }
+
+ public void setInformations(List informations) {
+ this.informations = informations;
+ }
+ }
+
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/NaviRoadRequest.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/NaviRoadRequest.java
new file mode 100644
index 0000000000..f62763b6b2
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/NaviRoadRequest.java
@@ -0,0 +1,18 @@
+package com.mogo.module.tanlu.model;
+
+import java.util.List;
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2020-02-03
+ */
+public class NaviRoadRequest {
+ public List coordinates;
+ public int limit;
+
+ public NaviRoadRequest(List coordinates, int limit) {
+ this.coordinates = coordinates;
+ this.limit = limit;
+ }
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/PathLineResult.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/PathLineResult.java
new file mode 100644
index 0000000000..3cc9bceba6
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/PathLineResult.java
@@ -0,0 +1,43 @@
+package com.mogo.module.tanlu.model;
+
+import com.mogo.commons.data.BaseData;
+import java.util.List;
+
+/**
+ * @author lixiaopeng
+ * @description 通勤族划线
+ * @since 2020-01-08
+ */
+public class PathLineResult extends BaseData {
+
+ private PathResult result;
+
+ public PathResult getResult() {
+ return result;
+ }
+
+ public void setResult(PathResult result) {
+ this.result = result;
+ }
+
+ public static class PathResult {
+ private List informations;
+ private List pointList;
+
+ public List getInformations() {
+ return informations;
+ }
+
+ public void setInformations(List informations) {
+ this.informations = informations;
+ }
+
+ public List getPointList() {
+ return pointList;
+ }
+
+ public void setPointList(List pointList) {
+ this.pointList = pointList;
+ }
+ }
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Result.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Result.java
new file mode 100644
index 0000000000..4c3f4aeabd
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Result.java
@@ -0,0 +1,22 @@
+package com.mogo.module.tanlu.model;
+
+import com.mogo.commons.data.BaseData;
+
+import java.util.List;
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2020-01-08
+ */
+public class Result extends BaseData {
+ public List informations;
+
+ public List getInformations() {
+ return informations;
+ }
+
+ public void setInformations(List informations) {
+ this.informations = informations;
+ }
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/RoadInfoRequest.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/RoadInfoRequest.kt
new file mode 100644
index 0000000000..165d9ed0b7
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/RoadInfoRequest.kt
@@ -0,0 +1,5 @@
+package com.mogo.module.tanlu.model
+
+data class RoadInfoRequest(var location:Location,var poiTypes:Array,var onlyFocus:Boolean = false,var onlySameCity:Boolean = false)
+
+data class Location(var lat:Double,var lon:Double)
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/RoadInfos.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/RoadInfos.kt
new file mode 100644
index 0000000000..e282ceb490
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/RoadInfos.kt
@@ -0,0 +1,6 @@
+package com.mogo.module.tanlu.model
+
+import com.mogo.commons.data.BaseData
+import com.mogo.module.common.entity.MarkerExploreWay
+
+data class RoadInfos(var data:List) : BaseData()
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/SearchOnlineInfo.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/SearchOnlineInfo.kt
new file mode 100644
index 0000000000..bd80487735
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/SearchOnlineInfo.kt
@@ -0,0 +1,10 @@
+package com.mogo.module.tanlu.model
+
+data class SearchOnlineInfo(
+ val address: String,
+ val cityId: String,
+ val size: Int,
+// val radius: Int,
+ val center: Center,
+ val adcode: String
+)
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Sns.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Sns.kt
new file mode 100644
index 0000000000..2ea9c8ebe7
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Sns.kt
@@ -0,0 +1,17 @@
+package com.mogo.module.tanlu.model
+
+
+class Sns {
+
+ var sns: List
+ var localUserId: String
+ var localNickName: String
+ var localHeadImgUrl: String
+
+ constructor(sns: List, localUserId: String, localNickName: String, localHeadImgUrl: String) {
+ this.sns = sns
+ this.localUserId = localUserId
+ this.localNickName = localNickName
+ this.localHeadImgUrl = localHeadImgUrl
+ }
+}
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Start.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Start.java
new file mode 100644
index 0000000000..1e43cb6883
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Start.java
@@ -0,0 +1,16 @@
+package com.mogo.module.tanlu.model;
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2020-01-09
+ */
+public class Start {
+ public Double lat;
+ public Double lon;
+
+ public Start(Double lat, Double lon) {
+ this.lat = lat;
+ this.lon = lon;
+ }
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/TanluModelData.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/TanluModelData.java
new file mode 100644
index 0000000000..b48668183c
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/TanluModelData.java
@@ -0,0 +1,559 @@
+package com.mogo.module.tanlu.model;
+
+import android.content.Context;
+import android.util.Log;
+
+import com.alibaba.android.arouter.launcher.ARouter;
+import com.google.gson.Gson;
+import com.mogo.commons.data.BaseData;
+import com.mogo.commons.debug.DebugConfig;
+import com.mogo.commons.network.ParamsProvider;
+import com.mogo.commons.network.SubscribeImpl;
+import com.mogo.commons.network.Utils;
+import com.mogo.map.MogoLatLng;
+import com.mogo.map.location.MogoLocation;
+import com.mogo.map.search.geo.MogoPoiItem;
+import com.mogo.map.search.poisearch.IMogoPoiSearch;
+import com.mogo.map.search.poisearch.MogoPoiResult;
+import com.mogo.map.search.poisearch.query.MogoPoiSearchQuery;
+import com.mogo.module.common.entity.MarkerExploreWay;
+import com.mogo.module.tanlu.callback.AlongTheWayCallback;
+import com.mogo.module.tanlu.callback.IThumbsUpCallback;
+import com.mogo.module.tanlu.callback.NaviCallback;
+import com.mogo.module.tanlu.callback.RoadInfoCallback;
+import com.mogo.module.tanlu.callback.RoadLineCallback;
+import com.mogo.module.tanlu.callback.UploadShareCallback;
+import com.mogo.module.tanlu.callback.VoiceSearchCallback;
+import com.mogo.module.tanlu.constant.HttpConst;
+import com.mogo.module.tanlu.constant.TanluConstants;
+import com.mogo.module.tanlu.fragment.TanluServiceManager;
+import com.mogo.module.tanlu.net.TanluApiService;
+import com.mogo.service.MogoServicePaths;
+import com.mogo.service.map.IMogoMapService;
+import com.mogo.service.network.IMogoNetwork;
+import com.mogo.utils.logger.Logger;
+import com.mogo.utils.network.RequestOptions;
+import com.mogo.utils.network.utils.GsonUtil;
+import com.mogo.utils.storage.SharedPrefsMgr;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import io.reactivex.Observable;
+import io.reactivex.ObservableEmitter;
+import io.reactivex.ObservableOnSubscribe;
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.functions.Function;
+import io.reactivex.schedulers.Schedulers;
+
+import static com.mogo.commons.network.Utils.getSn;
+import static com.mogo.module.tanlu.constant.ConstKt.TYPE_NAME_BLOCK;
+import static com.mogo.module.tanlu.constant.TanluConstants.TANLU_ROAD_CONGESTION_COMPAT;
+import static com.mogo.module.tanlu.constant.TanluConstants.TANLU_ROAD_CURRENT;
+
+/**
+ * @author lixiaopeng
+ * @description 探路接口数据处理
+ * @since 2020-01-09
+ */
+public class TanluModelData {
+
+ private final Context mContext;
+ private TanluApiService mTanluApiService;
+ private static final String TAG = "TanluModelData";
+
+ public TanluModelData(Context context) {
+ Logger.d(TAG, "TanluModelData ------->");
+ this.mContext = context;
+ IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(context);
+ mTanluApiService = network.create(TanluApiService.class, getBaseUrl());
+ }
+
+ private String getBaseUrl() {
+ if (DebugConfig.getNetMode() == DebugConfig.NET_MODE_RELEASE) {
+ return HttpConst.HOST_PRODUCT;
+ } else if (DebugConfig.getNetMode() == DebugConfig.NET_MODE_DEMO) {
+ return HttpConst.HOST_SHOW;
+ } else {
+ return HttpConst.HOST_TEST;
+ }
+ }
+
+ /**
+ * 声音控制道理数据
+ */
+ public void getVoiceControlRoadData(String keywords, String cityId, Double lon, Double lat,
+ String adCode, final VoiceSearchCallback callback) {
+ Gson gson = new Gson();
+ SearchOnlineInfo searchOnlineInfo = new SearchOnlineInfo(keywords, cityId, 50, new Center(lat, lon), adCode);
+ String searchInformationStr = gson.toJson(searchOnlineInfo);
+
+ List list = new ArrayList<>();
+ list.add(lon);
+ list.add(lat);
+ LocationCarsWithRadius locCarsWithRadius = new LocationCarsWithRadius(list, 20000, "circle");
+ String locCarsWithRadiusStr = gson.toJson(locCarsWithRadius);
+ Logger.d(TAG, "getVoiceControlRoadData -------> " + getSn());
+
+ final Map params = new ParamsProvider.Builder(mContext)
+ .append("sn", Utils.getSn())
+ .append("data", searchInformationStr)
+ .append("getSnData", locCarsWithRadiusStr)
+ .build();
+ mTanluApiService.searchOnLineInformation(params)
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) {
+ @Override
+ public void onSuccess(VoiceSearchResult o) {
+ super.onSuccess(o);
+ callback.onSuccess(o);
+ Logger.d(TAG, "getVoiceControlRoadData onSuccess ------>");
+ }
+
+ @Override
+ public void onError(String message, int code) {
+ super.onError(message, code);
+ callback.onFail(message, code);
+ Logger.e(TAG, "getVoiceControlRoadData onError message= " + message + ">>code =" + code);
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ super.onError(e);
+ Logger.d(TAG, "getVoiceControlRoadData onError ------> e= " + e.getMessage());
+ }
+ });
+ }
+
+
+ /**
+ * 通勤族 事件,监听消息自己请求路线数据 ZD821C1933L00974 query.get("sn")
+ */
+ public void getRoadLineData(final RoadLineCallback callback) {
+ Logger.d(TAG, "getRoadLineData -------> =" + Utils.getSn());
+ final Map params = new ParamsProvider.Builder(mContext)
+ .append("sn", Utils.getSn())
+ .build();
+
+ mTanluApiService.getRoadLineInfo(params)
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) {
+ @Override
+ public void onSuccess(PathLineResult o) {
+ super.onSuccess(o);
+ callback.onSuccess(o);
+ Logger.d(TAG, "getRoadLineData onSuccess ------>");
+ }
+
+ @Override
+ public void onError(String message, int code) {
+ super.onError(message, code);
+ callback.onFail(message, code);
+ Logger.e(TAG, "getRoadLineData onError message= " + message + ">>code =" + code);
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ super.onError(e);
+ e.printStackTrace();
+ Logger.d(TAG, "getRoadLineData onError ------> e= " + e.getMessage());
+ }
+ });
+
+ }
+
+ /**
+ * 导航路径,监听消息自己请求路线数据 ZD821C1933L00974
+ */
+ public void getNaviRoadLineInfo(final RoadLineCallback callback) {
+ Logger.d(TAG, "getNaviRoadLineInfo -------> =" + Utils.getSn());
+ final Map params = new ParamsProvider.Builder(mContext)
+ .append("sn", Utils.getSn())
+ .build();
+
+ mTanluApiService.getNaviRoadLineInfo(params)
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) {
+ @Override
+ public void onSuccess(PathLineResult o) {
+ super.onSuccess(o);
+ callback.onSuccess(o);
+ Logger.d(TAG, "getNaviRoadLineInfo onSuccess ------>");
+ }
+
+ @Override
+ public void onError(String message, int code) {
+ super.onError(message, code);
+ callback.onFail(message, code);
+ Logger.e(TAG, "getNaviRoadLineInfo onError message= " + message + ">>code =" + code);
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ super.onError(e);
+ e.printStackTrace();
+ Logger.d(TAG, "getNaviRoadLineInfo onError ------> e= " + e.getMessage());
+ }
+ });
+
+ }
+
+
+ /**
+ * 导航路线数据事件 TODO
+ */
+ public void getNavigationLineData(Double lon, Double lat, final AlongTheWayCallback callback) {
+ Gson gson = new Gson();
+ NaviLatLng coordinates = new NaviLatLng(getNaviInfo(lon, lat).fromStart(), getNaviInfo(lon, lat).toEnd());
+ Logger.d(TAG, "getNavigationLineData -------> " + getSn());
+
+ List list = new ArrayList<>();
+ list.add(lon);
+ list.add(lat);
+ LocationCarsWithRadius locCarsWithRadius = new LocationCarsWithRadius(list, 20000, "circle");
+ String locCarsWithRadiusStr = gson.toJson(locCarsWithRadius);
+
+ final Map params = new ParamsProvider.Builder(mContext)
+ .append("onTheWayData", gson.toJson(coordinates))
+ .append("getSnData", locCarsWithRadiusStr)
+ .build();
+
+ mTanluApiService.requestInformationAlongTheWay(Utils.getSn(), params)
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) {
+ @Override
+ public void onSuccess(InformationAndLiveCarResult data) {
+ super.onSuccess(data);
+ callback.onSuccess(data);
+ Logger.d(TAG, "getNavigationLineData onSuccess ------>");
+ }
+
+ @Override
+ public void onError(String message, int code) {
+ super.onError(message, code);
+ callback.onFail(message, code);
+ Logger.e(TAG, "getNavigationLineData onError message= " + message + ">>code =" + code);
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ super.onError(e);
+ Logger.d(TAG, "getNavigationLineData onError ------> e= " + e.getMessage());
+ }
+
+ });
+ }
+
+
+ /**
+ * 获取Location,如果没有location数据为空,则使用首次或者上次定位点,并且更新SP,需要抽取公共方法
+ */
+ public NaviLatLngInfo getNaviInfo(Double lon, Double lat) {
+ String naviInfo = SharedPrefsMgr.getInstance(mContext).getString(TanluConstants.NAVI_INFO);
+ Logger.d(TAG, " getNaviInfo naviInfo =" + naviInfo);
+ NaviLatLngInfo naviLatLngInfo = new Gson().fromJson(naviInfo, NaviLatLngInfo.class);
+ Logger.d(TAG, "getLocNaviInfo lat = $lat -----> lon = $lon");
+ if (naviLatLngInfo != null) {
+ if (lon == 0.0 || lat == 0.0) {
+ return naviLatLngInfo;
+ } else {
+ naviLatLngInfo.setFromPoiLatitude(lat + "");
+ naviLatLngInfo.setFromPoiLongitude(lon + "");
+ SharedPrefsMgr.getInstance(mContext).putString(TanluConstants.NAVI_INFO, new Gson().toJson(naviLatLngInfo));
+ return naviLatLngInfo;
+ }
+ } else {
+ return null;
+ }
+ }
+
+
+ /**
+ * 上报交通检查和封路
+ */
+ public void addTrafficCheckInfo(String poiType, String poiImgUrl, String nickname, String headImgUrl,
+ double lat, double lon, String address, float direction, final UploadShareCallback callback) {
+ Gson gson = new Gson();
+ UploadShareRoadInfo uploadShareRoadInfo = new UploadShareRoadInfo(poiType, poiImgUrl, nickname, headImgUrl, new Center(lat, lon), address, direction);
+ String uploadShareStr = gson.toJson(uploadShareRoadInfo);
+ Logger.d(TAG, "addTrafficCheckInfo sn= " + getSn() + ">> uploadShareStr =" + uploadShareStr);
+ final Map params = new ParamsProvider.Builder(mContext)
+ .append("sn", Utils.getSn())
+ .append("data", uploadShareStr)
+ .build();
+ mTanluApiService.uploadCheckTrafficInfor(params)
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) {
+ @Override
+ public void onSuccess(BaseData o) {
+ super.onSuccess(o);
+ callback.onSuccess(o);
+ Logger.d(TAG, "addTrafficCheckInfo onSuccess ------>");
+ }
+
+ @Override
+ public void onError(String message, int code) {
+ super.onError(message, code);
+ callback.onFail(message, code);
+ Logger.e(TAG, "addTrafficCheckInfo onError message= " + message + ">>code =" + code);
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ super.onError(e);
+ e.printStackTrace();
+ Logger.d(TAG, "addTrafficCheckInfo onError ------> e= " + e.getMessage());
+ }
+ });
+
+ }
+
+
+ /**
+ * 上报可能错误的数据,server删除
+ */
+ public void uploadDeleteErrorDataInfo(String id, String poiType, String updateType, final UploadShareCallback callback) {
+ Gson gson = new Gson();
+ UploadErrorDataInfo uploadErrorDataInfo = new UploadErrorDataInfo(id, poiType, updateType);
+ String uploadShareStr = gson.toJson(uploadErrorDataInfo);
+
+ Logger.d(TAG, "uploadDeleteErrorDataInfo sn= " + getSn() + ">> uploadShareStr =" + uploadShareStr);
+ final Map params = new ParamsProvider.Builder(mContext)
+ .append("sn", Utils.getSn())
+ .append("data", uploadShareStr)
+ .build();
+
+ mTanluApiService.uploadDeleteErrorData(params)
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) {
+ @Override
+ public void onSuccess(BaseData o) {
+ super.onSuccess(o);
+ callback.onSuccess(o);
+ Logger.d(TAG, "uploadDeleteErrorDataInfo onSuccess ------>");
+ }
+
+ @Override
+ public void onError(String message, int code) {
+ super.onError(message, code);
+ callback.onFail(message, code);
+ Logger.e(TAG, "uploadDeleteErrorDataInfo onError message= " + message + ">>code =" + code);
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ super.onError(e);
+ e.printStackTrace();
+ Logger.d(TAG, "uploadDeleteErrorDataInfo onError ------> e= " + e.getMessage());
+ }
+ });
+
+ }
+
+ /**
+ * 组装需要的请求list
+ *
+ * @return
+ */
+ private List getLatLngRequest(List latLnglist) {
+ List resultList = new ArrayList<>();
+ for (int i = 0; i < latLnglist.size(); i++) {
+ resultList.add(latLnglist.get(i).lng + "," + latLnglist.get(i).lat);
+ }
+
+ return resultList;
+ }
+
+ /**
+ * 获取导航沿途情报
+ */
+ public void getNaviInformation(List mogoLatLnglist, final NaviCallback callback) {
+ Gson gson = new Gson();
+ if (mogoLatLnglist == null) {
+ return;
+ }
+
+ NaviRoadRequest naviRoadRequest = new NaviRoadRequest(getLatLngRequest(mogoLatLnglist), 10);
+ String naviStr = gson.toJson(naviRoadRequest);
+ Logger.d(TAG, "getNaviInformation naviStr = " + naviStr);
+ final Map params = new ParamsProvider.Builder(mContext)
+ .append("sn", Utils.getSn())
+ .append("data", naviStr)
+ .build();
+
+ mTanluApiService.getNaviInformation(params)
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) {
+ @Override
+ public void onSuccess(NaviResult o) {
+ super.onSuccess(o);
+ callback.onSuccess(o);
+ Logger.d(TAG, "getNaviInformation onSuccess ------>");
+ }
+
+ @Override
+ public void onError(String message, int code) {
+ super.onError(message, code);
+ callback.onFail(message, code);
+ Logger.e(TAG, "getNaviInformation onError message= " + message + ">>code =" + code);
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ super.onError(e);
+ e.printStackTrace();
+ Logger.d(TAG, "getNaviInformation onError ------> e= " + e.getMessage());
+ }
+ });
+ }
+
+ /**
+ * 查询周边道路事件,是通过语音搜索,然后根据语音提供的语义,从服务端查询道路事件
+ *
+ * @param voiceCmdData 语音提供的语义封装
+ */
+ public void queryRodeInfo(final VoiceCmdData voiceCmdData, final RoadInfoCallback callback) {
+ Logger.d(TAG, "queryRodeInfo: " + voiceCmdData);
+ if (voiceCmdData.isHere()) {
+ // 搜索附近路况,只需要拿到当前位置信息,就可以请求服务端
+ MogoLocation l = TanluServiceManager.getServiceApis().getMapServiceApi().getSingletonLocationClient(mContext).getLastKnowLocation();
+ Location location = new Location(l.getLatitude(), l.getLongitude());
+ callback.onLocatSuccess(l.getLatitude(), l.getLongitude());
+ RoadInfoRequest request;
+ if (voiceCmdData.getObj().equals(TYPE_NAME_BLOCK)) {
+ // 拥堵和路况同时查
+ request = new RoadInfoRequest(location, new String[]{TANLU_ROAD_CONGESTION_COMPAT, TANLU_ROAD_CURRENT}, false, false);
+ }else{
+ request = new RoadInfoRequest(location, new String[]{voiceCmdData.getType()}, false, false);
+ }
+
+ Map params = new ParamsProvider.Builder(mContext)
+ .append("sn", Utils.getSn())
+ .append("data", GsonUtil.jsonFromObject(request))
+ .build();
+
+ mTanluApiService.queryRoadInfos(params)
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(new SubscribeImpl>(RequestOptions.create(mContext)) {
+ @Override
+ public void onError(Throwable e) {
+ super.onError(e);
+ }
+
+ @Override
+ public void onSuccess(BaseDataCompat o) {
+ super.onSuccess(o);
+ Logger.d(TAG, "搜索附近路况信息成功: " + o);
+ callback.onQueryRoadInfoSuccess(o.getResult().getData());
+ Logger.d(TAG, "搜索附近路况信息成功2: " + o);
+ }
+
+ @Override
+ public void onError(String message, int code) {
+ super.onError(message, code);
+ callback.onQueryRoadInfoFail(message, code);
+ }
+ });
+ } else {
+ // 查询的不是附近的信息,所以需要查询一下目标地址的经纬度,然后再请求服务端
+ Observable.create(new ObservableOnSubscribe() {
+ @Override
+ public void subscribe(ObservableEmitter emitter) throws Exception {
+ // 根据传入的地址,转成经纬度
+ IMogoMapService mapService = TanluServiceManager.getServiceApis().getMapServiceApi();
+ String cityCode = mapService.getSingletonLocationClient(mContext).getLastKnowLocation().getCityCode();
+ MogoPoiSearchQuery poiSearchQuery = new MogoPoiSearchQuery(voiceCmdData.getLocation(), "", cityCode);
+ IMogoPoiSearch poiSearch = mapService.getPoiSearch(mContext, poiSearchQuery);
+ MogoPoiResult result = poiSearch.searchPOI();
+ if (result != null && result.getPois() != null && result.getPois().size() > 0) {
+ emitter.onNext(result);
+ } else {
+ emitter.onError(new IllegalArgumentException("没有根据地址查询到对应的经纬度"));
+ }
+ }
+ }).subscribeOn(Schedulers.io()).observeOn(Schedulers.io())
+ .flatMap(new Function>>() {
+ @Override
+ public Observable> apply(MogoPoiResult mogoPoiResult) throws Exception {
+ // 转成经纬度后,整理参数,进行接口请求
+ Logger.d(TAG, "查询目标地址经纬度成功===" + Thread.currentThread().getName());
+ MogoPoiItem poiItem = mogoPoiResult.getPois().get(0);
+ Location location = new Location(poiItem.getPoint().lat, poiItem.getPoint().lon);
+ callback.onLocatSuccess(location.getLat(), location.getLon());
+ RoadInfoRequest request;
+ if (voiceCmdData.getObj().equals(TYPE_NAME_BLOCK)) {
+ // 拥堵和路况同时查
+ request = new RoadInfoRequest(location, new String[]{TANLU_ROAD_CONGESTION_COMPAT, TANLU_ROAD_CURRENT}, false, false);
+ }else{
+ request = new RoadInfoRequest(location, new String[]{voiceCmdData.getType()}, false, false);
+ }
+
+ Map params = new ParamsProvider.Builder(mContext)
+ .append("sn", Utils.getSn())
+ .append("data", GsonUtil.jsonFromObject(request))
+ .build();
+ return mTanluApiService.queryRoadInfos(params);
+ }
+ }).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread())
+ .subscribe(new SubscribeImpl>(RequestOptions.create(mContext)) {
+ @Override
+ public void onError(Throwable e) {
+ super.onError(e);
+ callback.onQueryRoadInfoFail(e.getMessage(), -1);
+ }
+
+ @Override
+ public void onSuccess(BaseDataCompat o) {
+ super.onSuccess(o);
+ Logger.d(TAG, "当前线程为"+Thread.currentThread().getName()+" 搜索目标地址路况信息成功: " + o);
+ callback.onQueryRoadInfoSuccess(o.getResult().getData());
+ }
+
+ @Override
+ public void onError(String message, int code) {
+ super.onError(message, code);
+ callback.onQueryRoadInfoFail(message, code);
+ }
+ });
+ }
+ }
+
+ /**
+ * 点赞接口
+ */
+ public void thumbsUp(MarkerExploreWay marker, final IThumbsUpCallback callback) {
+ ThumbsUpRequest request = new ThumbsUpRequest(Utils.getSn(), null, marker.getPoiType(), marker.getInfoId());
+ Map params = new HashMap<>();
+
+ params.put("data", GsonUtil.jsonFromObject(request));
+ mTanluApiService.addLikes(params).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new SubscribeImpl>(RequestOptions.create(mContext)) {
+ @Override
+ public void onSuccess(BaseDataCompat o) {
+ super.onSuccess(o);
+ callback.onThumbsUpSuccess();
+ }
+
+ @Override
+ public void onError(Throwable e) {
+ super.onError(e);
+ callback.onThumbsUpFail();
+ }
+
+ @Override
+ public void onError(String message, int code) {
+ super.onError(message, code);
+ callback.onThumbsUpFail();
+ }
+ });
+ }
+
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Test.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Test.java
new file mode 100644
index 0000000000..6756c3290a
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/Test.java
@@ -0,0 +1,9 @@
+package com.mogo.module.tanlu.model;
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2020/7/29
+ */
+public class Test {
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/ThumbsUpRequest.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/ThumbsUpRequest.kt
new file mode 100644
index 0000000000..dbbb52b487
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/ThumbsUpRequest.kt
@@ -0,0 +1,8 @@
+package com.mogo.module.tanlu.model
+
+data class ThumbsUpRequest(
+ var sn: String,
+ var userId: String?,
+ var poiType: String,
+ var infoId: String
+)
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/UploadErrorDataInfo.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/UploadErrorDataInfo.java
new file mode 100644
index 0000000000..2b6458b04e
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/UploadErrorDataInfo.java
@@ -0,0 +1,18 @@
+package com.mogo.module.tanlu.model;
+
+/**
+ * @author lixiaopeng
+ * @description 分享上报错误信息参数
+ * @since 2020-01-16
+ */
+public class UploadErrorDataInfo {
+ public String id;
+ public String poiType;
+ public String updateType;
+
+ public UploadErrorDataInfo(String id, String poiType, String updateType) {
+ this.id = id;
+ this.poiType = poiType;
+ this.updateType = updateType;
+ }
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/UploadShareRoadInfo.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/UploadShareRoadInfo.java
new file mode 100644
index 0000000000..dcebdccdcf
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/UploadShareRoadInfo.java
@@ -0,0 +1,28 @@
+package com.mogo.module.tanlu.model;
+
+/**
+ * @author lixiaopeng
+ * @description 分享上报信息参数
+ * @since 2020-01-16
+ */
+public class UploadShareRoadInfo {
+
+ public String poiType;
+ public String poiImgUrl;
+ public String nickname;
+ public String headImgUrl;
+ public float direction;
+ private Center location;
+ private String address;
+
+ public UploadShareRoadInfo(String poiType, String poiImgUrl, String nickname,
+ String headImgUrl, Center location, String address, float direction) {
+ this.poiType = poiType;
+ this.poiImgUrl = poiImgUrl;
+ this.nickname = nickname;
+ this.headImgUrl = headImgUrl;
+ this.location = location;
+ this.address = address;
+ this.direction = direction;
+ }
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/VoiceCmdData.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/VoiceCmdData.kt
new file mode 100644
index 0000000000..b66c24454e
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/VoiceCmdData.kt
@@ -0,0 +1,38 @@
+package com.mogo.module.tanlu.model
+
+import com.mogo.module.tanlu.constant.*
+import com.mogo.module.tanlu.constant.TanluConstants.*
+
+/**
+ * 语音指令附带数据,目前只针对道路事件查询 */
+class VoiceCmdData(var op: String, var location: String, var obj: String) {
+
+ /**
+ * 将obj转成服务端可识别的道路事件类型
+ */
+ val type: String
+ get() {
+ return when (obj) {
+ TYPE_NAME_BLOCK -> TANLU_ROAD_CONGESTION_COMPAT
+ TYPE_NAME_TRAFFIC_CHECK -> TANLU_TRAFFIC_CHECK_COMPAT
+ TYPE_NAME_CLOSURE -> TANLU_ROAD_CLOSURE_COMPAT
+ TYPE_NAME_ACCIDENT -> TANLU_ROAD_ACCIDENT
+ TYPE_NAME_REAL_TIME_TRAFFIC -> TANLU_ROAD_CURRENT
+ TYPE_NAME_STAGNANT_WATER -> TANLU_ROAD_PONDING
+ TYPE_NAME_ROAD_ICY -> TANLU_ROAD_ICING
+ TYPE_NAME_DENSE_FOG -> TANLU_ROAD_HEAVY_FOG
+ TYPE_NAME_ROAD_CONSTRUCTION -> TANLU_ROAD_CONSTRUCTION
+ else -> ""
+ }
+ }
+
+ fun isHere(): Boolean {
+ return "附近" == location
+ }
+
+ override fun toString(): String {
+ return "VoiceCmdData(op='$op', location='$location', obj='$obj', type='$type')"
+ }
+
+
+}
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/VoiceSearchResult.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/VoiceSearchResult.java
new file mode 100644
index 0000000000..086957fc6b
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/VoiceSearchResult.java
@@ -0,0 +1,53 @@
+package com.mogo.module.tanlu.model;
+
+import com.mogo.commons.data.BaseData;
+import java.util.List;
+
+/**
+ * @author lixiaopeng
+ * @description 声音控制接口
+ * @since 2020-01-08
+ */
+public class VoiceSearchResult extends BaseData {
+
+ private Result result;
+
+ public Result getResult() {
+ return result;
+ }
+
+ public void setResult(Result result) {
+ this.result = result;
+ }
+
+ public static class Result {
+ private List informations;
+ private String description;
+ private Sns snResult;
+
+ public List getInformations() {
+ return informations;
+ }
+
+ public void setInformations(List informations) {
+ this.informations = informations;
+ }
+
+ public String getDescription() {
+ return description;
+ }
+
+ public void setDescription(String description) {
+ this.description = description;
+ }
+
+ public Sns getSnResult() {
+ return snResult;
+ }
+
+ public void setSnResult(Sns snResult) {
+ this.snResult = snResult;
+ }
+ }
+
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/ControlClickUpInfo.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/ControlClickUpInfo.java
new file mode 100644
index 0000000000..a404751bc4
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/ControlClickUpInfo.java
@@ -0,0 +1,16 @@
+package com.mogo.module.tanlu.model.event;
+
+
+/**
+ * @author lixiaopeng
+ * @description 上下按钮事件
+ * @since 2020-01-08
+ */
+public class ControlClickUpInfo {
+ public String type;
+
+ public ControlClickUpInfo(String type) {
+ this.type = type;
+ }
+
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/DataErrorInfo.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/DataErrorInfo.java
new file mode 100644
index 0000000000..84ade6c8a2
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/DataErrorInfo.java
@@ -0,0 +1,21 @@
+package com.mogo.module.tanlu.model.event;
+
+import java.io.Serializable;
+
+/**
+ * @author lixiaopeng
+ * @description 错误数据id和type
+ * @since 2020-01-08
+ */
+public class DataErrorInfo implements Serializable {
+ public String id; //封路,还是上报
+ public String poiType;
+ public String updateType;
+
+ public DataErrorInfo(String id, String poiType, String updateType) {
+ this.id = id;
+ this.poiType = poiType;
+ this.updateType = updateType;
+ }
+
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/EmptyData.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/EmptyData.java
new file mode 100644
index 0000000000..ab8cd2788e
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/EmptyData.java
@@ -0,0 +1,11 @@
+package com.mogo.module.tanlu.model.event;
+
+
+/**
+ * @author lixiaopeng
+ * @description 空数据
+ * @since 2020-03-12
+ */
+public class EmptyData {
+
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/GetInfoError.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/GetInfoError.java
new file mode 100644
index 0000000000..fd6eaa07aa
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/GetInfoError.java
@@ -0,0 +1,15 @@
+package com.mogo.module.tanlu.model.event;
+
+
+/**
+ * @author lixiaopeng
+ * @description 获取数据失败
+ * @since 2020-01-08
+ */
+public class GetInfoError {
+ public String type;
+
+ public GetInfoError(String type) {
+ this.type = type;
+ }
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/MarkerInfo.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/MarkerInfo.java
new file mode 100644
index 0000000000..bef289c739
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/MarkerInfo.java
@@ -0,0 +1,25 @@
+package com.mogo.module.tanlu.model.event;
+
+import java.io.Serializable;
+
+/**
+ * @author lixiaopeng
+ * @description marker数据
+ * @since 2020-01-08
+ */
+public class MarkerInfo implements Serializable {
+ public String type; //封路,还是上报
+ public String imageUrl; //上传完cos图片
+ public double lon; //经度
+ public double lat; //纬度
+ public boolean isCumtom; //是否主动上报
+
+ public MarkerInfo(String type, String imageUrl, double lon, double lat, boolean isCumtom) {
+ this.type = type;
+ this.imageUrl = imageUrl;
+ this.lon = lon;
+ this.lat = lat;
+ this.isCumtom = isCumtom;
+ }
+
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/PushTypeInfo.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/PushTypeInfo.java
new file mode 100644
index 0000000000..52c23ebdda
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/PushTypeInfo.java
@@ -0,0 +1,17 @@
+package com.mogo.module.tanlu.model.event;
+
+import java.io.Serializable;
+
+/**
+ * @author lixiaopeng
+ * @description push区分类别
+ * @since 2020-01-08
+ */
+public class PushTypeInfo implements Serializable {
+ public String type;
+
+ public PushTypeInfo(String type) {
+ this.type = type;
+ }
+
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/SharedialogEvent.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/SharedialogEvent.java
new file mode 100644
index 0000000000..3911fd8ea1
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/SharedialogEvent.java
@@ -0,0 +1,10 @@
+package com.mogo.module.tanlu.model.event;
+
+/**
+ * @author lixiaopeng
+ * @description 分享弹框事件
+ * @since 2020-01-08
+ */
+public class SharedialogEvent {
+
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/StartPlayInfo.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/StartPlayInfo.java
new file mode 100644
index 0000000000..03ee5e3754
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/StartPlayInfo.java
@@ -0,0 +1,16 @@
+package com.mogo.module.tanlu.model.event;
+
+
+/**
+ * @author lixiaopeng
+ * @description 开始播放
+ * @since 2020-03-11
+ */
+public class StartPlayInfo {
+ public int mPosition;
+
+ public StartPlayInfo(int position) {
+ this.mPosition = position;
+ }
+
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/TanluMarkerEvent.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/TanluMarkerEvent.java
new file mode 100644
index 0000000000..8c9ea9cdf2
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/TanluMarkerEvent.java
@@ -0,0 +1,16 @@
+package com.mogo.module.tanlu.model.event;
+
+import com.mogo.module.common.entity.MarkerExploreWay;
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2020/3/11
+ */
+public class TanluMarkerEvent {
+ public MarkerExploreWay markerExploreWay;
+
+ public TanluMarkerEvent(MarkerExploreWay exploreWay) {
+ this.markerExploreWay = exploreWay;
+ }
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/VoiceControlUpInfo.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/VoiceControlUpInfo.java
new file mode 100644
index 0000000000..06f9d742fc
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/event/VoiceControlUpInfo.java
@@ -0,0 +1,16 @@
+package com.mogo.module.tanlu.model.event;
+
+
+/**
+ * @author lixiaopeng
+ * @description marker数据
+ * @since 2020-01-08
+ */
+public class VoiceControlUpInfo {
+ public String type;
+
+ public VoiceControlUpInfo(String type) {
+ this.type = type;
+ }
+
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/global/GlobalSharedInformation.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/global/GlobalSharedInformation.kt
new file mode 100644
index 0000000000..280a81b536
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/model/global/GlobalSharedInformation.kt
@@ -0,0 +1,15 @@
+package com.mogo.module.tanlu.model.global
+
+import com.mogo.module.tanlu.model.Information
+import java.util.ArrayList
+
+/**
+ * @author congtaowang
+ * @since 2019-12-02
+ *
+ * 共享的情报列表,避免在点击大屏查看视频时intent序列化造成的开销
+ */
+object GlobalSharedInformation {
+
+ var informationList: ArrayList? = null
+}
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/net/TanluApiService.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/net/TanluApiService.java
new file mode 100644
index 0000000000..190fe47ca0
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/net/TanluApiService.java
@@ -0,0 +1,96 @@
+package com.mogo.module.tanlu.net;
+
+import com.mogo.commons.data.BaseData;
+import com.mogo.module.tanlu.model.BaseDataCompat;
+import com.mogo.module.tanlu.model.InformationAndLiveCarResult;
+import com.mogo.module.tanlu.model.NaviResult;
+import com.mogo.module.tanlu.model.PathLineResult;
+import com.mogo.module.tanlu.model.RoadInfos;
+import com.mogo.module.tanlu.model.VoiceSearchResult;
+
+import java.util.Map;
+
+import io.reactivex.Observable;
+import io.reactivex.Single;
+import retrofit2.http.Field;
+import retrofit2.http.FieldMap;
+import retrofit2.http.FormUrlEncoded;
+import retrofit2.http.POST;
+import retrofit2.http.Query;
+
+/**
+ * @author lixiaopeng
+ * @description 探路相关接口定义
+ * @since 2020-01-07
+ */
+public interface TanluApiService {
+
+ /**
+ * 探路沿途数据,只是为了通知server下发push
+ */
+ @FormUrlEncoded
+ @POST("deva/car/path/no/getOnTheWayDataAndSn/v1")
+ Observable requestInformationAlongTheWay(@Query("sn") String sn, @FieldMap Map parameters);
+
+ /**
+ * 获取上班族路线的坐标集
+ */
+ @FormUrlEncoded
+ @POST("yycp-travel-condition/travelDetail/info/no/commuter/v1")
+ Observable getRoadLineInfo(@FieldMap Map infoBody);
+
+ /**
+ * 获取导航路线的坐标集
+ */
+ @FormUrlEncoded
+ @POST("deva/car/path/no/getOnWayPushData/v1")
+ Observable getNaviRoadLineInfo(@FieldMap Map infoBody);
+
+ /**
+ * 基于地理信息词缀的空间情报检索
+ */
+ @FormUrlEncoded
+ @POST("deva/car/search/no/searchInforationByAddress/v1")
+ Observable searchOnLineInformation(@FieldMap Map infoBody);
+
+ /**
+ * 上报交通检查,封路
+ */
+ @FormUrlEncoded
+ @POST("deva/car/poi/no/addNovelty/v1")
+ Observable uploadCheckTrafficInfor(@FieldMap Map infoBody);
+
+ /**
+ * 导航沿途情报
+ */
+ @FormUrlEncoded
+ @POST("deva/car/search/no/searchInforationByCoordinates/v1")
+ Observable getNaviInformation(@FieldMap Map infoBody);
+
+ /**
+ * 纠错
+ * 交通检查 10002
+ * 封路 10003
+ * 拥堵 10007
+ */
+ @FormUrlEncoded
+ @POST("deva/car/poi/no/carPoiErrorRecovery/v1")
+ Observable uploadDeleteErrorData(@FieldMap Map infoBody);
+
+ /**
+ * 查询(搜索)道路事件信息
+ * 接口文档:http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42305842
+ * 文档中有些参数暂时没有用到,包括radius,limit
+ * @return
+ */
+ @FormUrlEncoded
+ @POST("/yycp-launcherSnapshot/launcherSnapshot/searchRoadEventsSync")
+ Observable> queryRoadInfos(@FieldMap Map params);
+
+ /**
+ * 点赞接口
+ */
+ @FormUrlEncoded
+ @POST("/deva/poiInfoFabulous/car/poi/no/addPoiInfoFabulous/v1")
+ Observable> addLikes(@FieldMap Map params);
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/DataErrorReceiver.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/DataErrorReceiver.java
new file mode 100644
index 0000000000..e4a4ae8d1a
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/DataErrorReceiver.java
@@ -0,0 +1,30 @@
+package com.mogo.module.tanlu.receiver;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
+import com.mogo.module.tanlu.model.event.DataErrorInfo;
+import com.mogo.module.tanlu.model.event.SharedialogEvent;
+
+import org.greenrobot.eventbus.EventBus;
+
+/**
+ * @author lixiaopeng
+ * @description 数据失效后收到的广播
+ * @since 2020-02-09
+ */
+public class DataErrorReceiver extends BroadcastReceiver {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ Log.d("DataErrorReceiver", "intent.getAction() = " + intent.getAction());
+ if (intent.getAction() == "com.zhidao.tanlu.dataerror") {
+ String id = intent.getStringExtra("id");
+ String poiType = intent.getStringExtra("type");
+ String updateType = intent.getStringExtra("updateType");
+ Log.d("DataErrorReceiver", "id = " + id + " >>> poiType = " + poiType + " >>updateType = " + updateType);
+ EventBus.getDefault().post(new DataErrorInfo(id, poiType, updateType));
+ }
+ }
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/GetInfoFailedReceiver.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/GetInfoFailedReceiver.kt
new file mode 100644
index 0000000000..4c086f3caa
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/GetInfoFailedReceiver.kt
@@ -0,0 +1,24 @@
+package com.mogo.module.tanlu.receiver
+
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import android.util.Log
+import com.mogo.module.tanlu.model.event.GetInfoError
+import com.mogo.module.tanlu.model.event.MarkerInfo
+import com.mogo.module.tanlu.model.event.PushTypeInfo
+import org.greenrobot.eventbus.EventBus
+
+/**
+ * 摄像头获取数据失败
+ */
+class GetInfoFailedReceiver : BroadcastReceiver() {
+ override fun onReceive(context: Context, intent: Intent) {
+ Log.d("GetInfoFailedReceiver", "-----1-------");
+ if (intent.action == "com.zhidao.roadcondition.getinfo.failed"){
+ var type = intent.getStringExtra("type")
+ Log.d("GetInfoFailedReceiver", " ---2---- type = $type")
+ EventBus.getDefault().post(GetInfoError(type))
+ }
+ }
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/MarkerInfoReceiver.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/MarkerInfoReceiver.kt
new file mode 100644
index 0000000000..0eacbee379
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/MarkerInfoReceiver.kt
@@ -0,0 +1,25 @@
+package com.mogo.module.tanlu.receiver
+
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import android.util.Log
+import com.mogo.module.tanlu.model.event.MarkerInfo
+import org.greenrobot.eventbus.EventBus
+
+/**
+ * marker数据接收
+ */
+class MarkerInfoReceiver : BroadcastReceiver() {
+ override fun onReceive(context: Context, intent: Intent) {
+ if (intent.action == "com.zhidao.roadcondition.marker.info"){
+ var type = intent.getStringExtra("type")
+ var imageUrl = intent.getStringExtra("imageUrl")
+ var lat = intent.getDoubleExtra("lat",0.0)
+ var lon = intent.getDoubleExtra("lon",0.0) //经度
+ var custom = intent.getBooleanExtra("custom", false)
+ Log.d("MarkerInfoReceiver", "type =" + type + "---->lat =" + lat + "----lon =" + lon + " --custom = " + custom + "---imageUrl =" + imageUrl)
+ EventBus.getDefault().post(MarkerInfo(type, imageUrl,lon, lat, custom))
+ }
+ }
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/NetWorkReceiver.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/NetWorkReceiver.kt
new file mode 100644
index 0000000000..d29f26bb9e
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/NetWorkReceiver.kt
@@ -0,0 +1,43 @@
+package com.mogo.module.tanlu.receiver
+
+import android.Manifest
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import android.content.pm.PackageManager
+import android.util.Log
+import android.widget.Toast
+import androidx.core.content.ContextCompat
+import com.mogo.module.tanlu.util.NetworkUtil
+
+/**
+ * @description 网络改变监听
+ *
+ * @author lixiaopeng
+ * @since 2019-10-17
+ */
+class NetWorkReceiver : BroadcastReceiver() {
+ private var isConnect = true
+
+ override fun onReceive(context: Context, intent: Intent?) {
+ if (ContextCompat.checkSelfPermission(
+ context,
+ Manifest.permission.ACCESS_NETWORK_STATE
+ ) === PackageManager.PERMISSION_GRANTED
+ ) {
+ if (android.os.Build.VERSION.SDK_INT < android.os.Build.VERSION_CODES.LOLLIPOP) {
+ isConnect = NetworkUtil.isConnected(context)
+ } else {
+ isConnect = NetworkUtil.isConnectedV21(context)
+ }
+ }
+
+// if (!isConnect) {
+// Toast.makeText(context, "网络已断开,请检查网络", Toast.LENGTH_SHORT).show()
+// //TODO
+//
+// }
+
+ }
+
+}
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/PushReceiver.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/PushReceiver.kt
new file mode 100644
index 0000000000..88842f1190
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/PushReceiver.kt
@@ -0,0 +1,22 @@
+package com.mogo.module.tanlu.receiver
+
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import android.net.Uri
+import android.util.Log
+import com.mogo.module.tanlu.model.event.PushTypeInfo
+import org.greenrobot.eventbus.EventBus
+
+/**
+ * 导航和通勤族 push的action
+ */
+class PushReceiver : BroadcastReceiver() {
+ override fun onReceive(context: Context, intent: Intent) {
+ if (intent.action == "com.zhidao.roadcondition.split"){
+ var uri = Uri.parse(intent.getStringExtra("uri"))
+ Log.d("PushReceiver", "uri = $uri")
+ EventBus.getDefault().post(PushTypeInfo(uri.getQueryParameter("type")))
+ }
+ }
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/SearchTrafficInfoReceiver.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/SearchTrafficInfoReceiver.kt
new file mode 100644
index 0000000000..df29f3ce8b
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/SearchTrafficInfoReceiver.kt
@@ -0,0 +1,50 @@
+package com.mogo.module.tanlu.receiver
+
+import android.content.BroadcastReceiver
+import android.content.Context
+import android.content.Intent
+import com.mogo.module.tanlu.constant.*
+import com.mogo.module.tanlu.constant.TanluConstants.SPECIFIEDROAD_SEARCH
+import com.mogo.module.tanlu.model.TanluModelData
+import com.mogo.module.tanlu.model.VoiceCmdData
+import com.mogo.module.tanlu.util.Utils
+import com.mogo.utils.logger.Logger
+
+class SearchTrafficInfoReceiver : BroadcastReceiver() {
+ private val TAG = "SearchTrafficInfoReceiver"
+ override fun onReceive(context: Context?, intent: Intent?) {
+ // 目前只接com.zhidao.speech.awake.notify这一个广播,所以暂不区分action
+ Logger.d(TAG,"收到搜索事件广播====")
+ val data = intent?.getStringExtra("data") ?: ""
+ var voiceData: VoiceCmdData? = null
+ when (intent?.getStringExtra("command") ?: "") {
+ VOICE_COMMAND_QUERY_TRAFFIC_CHECK -> {
+ // 搜索交通检查
+ voiceData = Utils.parseTOVoiceCmdData(data)
+ voiceData.obj = TYPE_NAME_TRAFFIC_CHECK
+ }
+ VOICE_COMMAND_QUERY_ROAD_CLOSED -> {
+ // 搜索封路
+ Logger.d(TAG, "封路: $data")
+ voiceData = Utils.parseTOVoiceCmdData(data)
+ voiceData.location = voiceData.obj
+ voiceData.obj = TYPE_NAME_CLOSURE
+ }
+ SPECIFIEDROAD_SEARCH->{
+ // 拥堵和路况
+ Logger.d(TAG,"拥堵和路况:$data")
+ voiceData = Utils.parseTOVoiceCmdData(data)
+ voiceData.obj = TYPE_NAME_BLOCK
+ }
+ // 其他道路事件
+ VOICE_COMMAND_NOVELTY_QUERY -> voiceData = Utils.parseTOVoiceCmdData(data)
+ else->{
+ Logger.d(TAG, "未收录广播===${intent?.getStringExtra("command")}")
+ }
+ }
+
+ voiceData?.let {
+ Logger.d(TAG, "准备开始网络请求,搜索附近道路事件: $it")
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/ShareDialogReceiver.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/ShareDialogReceiver.java
new file mode 100644
index 0000000000..89680cb0c2
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/receiver/ShareDialogReceiver.java
@@ -0,0 +1,24 @@
+package com.mogo.module.tanlu.receiver;
+
+import android.content.BroadcastReceiver;
+import android.content.Context;
+import android.content.Intent;
+import android.util.Log;
+
+import com.mogo.module.tanlu.model.event.SharedialogEvent;
+
+import org.greenrobot.eventbus.EventBus;
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2020-02-09
+ */
+public class ShareDialogReceiver extends BroadcastReceiver {
+ @Override
+ public void onReceive(Context context, Intent intent) {
+ if (intent.getAction() == "com.zhidao.sharedialog") {
+ EventBus.getDefault().post(new SharedialogEvent());
+ }
+ }
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/ActivityStatusUtil.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/ActivityStatusUtil.java
new file mode 100644
index 0000000000..fa9bb7614b
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/ActivityStatusUtil.java
@@ -0,0 +1,46 @@
+package com.mogo.module.tanlu.util;
+
+import android.app.ActivityManager;
+import android.content.ComponentName;
+import android.content.Context;
+import android.text.TextUtils;
+
+import java.util.List;
+
+import static android.content.Context.ACTIVITY_SERVICE;
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2019-09-26
+ */
+public class ActivityStatusUtil {
+ /**
+ * 判断某个activity是否在前台显示
+ */
+ public static boolean isForeground(Context activity) {
+ return isForeground(activity, "com.zhidao.roadcondition.main_module.MainActivity");
+ }
+
+ /**
+ * 判断某个界面是否在前台,返回true,为显示,否则不是
+ */
+ public static boolean isForeground(Context context, String className) {
+ if (context == null || TextUtils.isEmpty(className)) {
+ return false;
+ }
+ ActivityManager am = (ActivityManager) context.getSystemService(ACTIVITY_SERVICE);
+ List list = am.getRunningTasks(1);
+ if (list != null && list.size() > 0) {
+ ComponentName cpn = list.get(0).topActivity;
+ if (className.equals(cpn.getClassName())) {
+ return true;
+ } else {
+
+ }
+ }
+
+ return false;
+ }
+
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/ChartUtil.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/ChartUtil.java
new file mode 100644
index 0000000000..0d1aad44ba
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/ChartUtil.java
@@ -0,0 +1,97 @@
+package com.mogo.module.tanlu.util;
+
+import android.content.Context;
+
+import com.mogo.module.common.entity.MarkerLocation;
+import com.mogo.module.common.entity.MarkerUserInfo;
+import com.mogo.module.tanlu.constant.TanluConstants;
+import com.mogo.module.tanlu.fragment.TanluServiceManager;
+import com.mogo.utils.logger.Logger;
+import com.zhidao.carchattingprovider.CallChattingProviderConstant;
+import com.zhidao.carchattingprovider.ICallChatResponse;
+import org.jetbrains.annotations.Nullable;
+
+import java.util.HashMap;
+import java.util.Map;
+
+/**
+ * 调用车聊聊的工具类
+ */
+public class ChartUtil {
+ private static final String TAG = "ChartUtil";
+
+ public interface ChartStatusListener {
+ void canCall(boolean b);
+ }
+
+ /**
+ * 调用车聊聊拨打电话
+ *
+ * @param userInfo 用户数据
+ * @param location 位置信息
+ */
+ public static void callChatting(MarkerUserInfo userInfo, MarkerLocation location) {
+ try {
+ Map params = new HashMap<>();
+ params.put(CallChattingProviderConstant.CCPROVIDER_SN, userInfo.getSn());
+ params.put(CallChattingProviderConstant.CCPROVIDER_USER_IMG, userInfo.getUserHead());
+ params.put(CallChattingProviderConstant.CCPROVIDER_USER_AGE, userInfo.getAgeNumber() + "");
+ params.put(CallChattingProviderConstant.CCPROVIDER_NICK_NAME, userInfo.getUserName());
+ params.put(CallChattingProviderConstant.CCPROVIDER_USER_SEX, userInfo.getGender() + "");
+
+ if (location != null) {
+ params.put(CallChattingProviderConstant.CCPROVIDER_ADDRESS, location.getAddress());
+ params.put(CallChattingProviderConstant.CCPROVIDER_LAT, location.getLat() + "");
+ params.put(CallChattingProviderConstant.CCPROVIDER_LON, location.getLon() + "");
+ }
+
+ Logger.d(TAG, "调用车聊聊传入参数:\n" + params);
+ TanluServiceManager.getCarsChattingProvider().call(params);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ /**
+ * 判断是否可以拨打电话
+ *
+ * @param chartStatusListener 车聊聊状态监听
+ */
+ public static void isOnLine(String sn, Context context, ChartStatusListener chartStatusListener) {
+ TanluServiceManager.getCarsChattingProvider().isOnLine(
+ "CAR_CALL_TO_" + TanluConstants.MODEL_NAME,
+ context,
+ sn,
+ new ICallChatResponse() {
+ @Override
+ public void isOnLine(boolean onLine, @Nullable String errorMsg) {
+ Logger.e(TAG, "isOnLine:" + onLine + " errorMsg:" + errorMsg);
+ if (chartStatusListener != null) {
+ chartStatusListener.canCall(onLine);
+ }
+ }
+ });
+
+ }
+
+ /**
+ * 判断是否可以拨打电话
+ *
+ * @param chartStatusListener 车聊聊状态监听
+ */
+ public static void isCanCall(Context context, ChartStatusListener chartStatusListener) {
+ TanluServiceManager.getCarsChattingProvider().canCall(
+ "CAR_CALL_TO_" + TanluConstants.MODEL_NAME,
+ context,
+ new ICallChatResponse() {
+ @Override
+ public void canCall(boolean onLine) {
+ Logger.e(TAG, "isOnLine:" + onLine);
+ if (chartStatusListener != null) {
+ chartStatusListener.canCall(onLine);
+ }
+ }
+ });
+
+ }
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/DoubleCheckUtil.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/DoubleCheckUtil.kt
new file mode 100644
index 0000000000..a3a1bf645e
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/DoubleCheckUtil.kt
@@ -0,0 +1,29 @@
+package com.mogo.module.tanlu.util
+
+
+const val SPACE_TIME = 1000
+var lastClickTime = 0L
+var viewId: Int = 0
+
+fun isDoubleClick(view: Int): Boolean {
+ val time = System.currentTimeMillis()
+ val timeD = time - lastClickTime
+ if (timeD < SPACE_TIME && viewId == view) {
+ return true
+ }
+ lastClickTime = time
+ viewId = view
+ return false
+}
+
+
+fun isDoubleClickTime(view: Int,spaceTime:Int): Boolean {
+ val time = System.currentTimeMillis()
+ val timeD = time - lastClickTime
+ if (timeD < spaceTime && viewId == view) {
+ return true
+ }
+ lastClickTime = time
+ viewId = view
+ return false
+}
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/GlideRoundTransform.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/GlideRoundTransform.java
new file mode 100644
index 0000000000..61a79e2d54
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/GlideRoundTransform.java
@@ -0,0 +1,72 @@
+package com.mogo.module.tanlu.util;
+
+import android.content.Context;
+import android.content.res.Resources;
+import android.graphics.Bitmap;
+import android.graphics.BitmapShader;
+import android.graphics.Canvas;
+import android.graphics.Paint;
+import android.graphics.RectF;
+
+import androidx.annotation.NonNull;
+
+import com.bumptech.glide.load.engine.bitmap_recycle.BitmapPool;
+import com.bumptech.glide.load.resource.bitmap.BitmapTransformation;
+
+import java.security.MessageDigest;
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2020/6/3
+ */
+public class GlideRoundTransform extends BitmapTransformation {
+ private static float radius = 0f;
+
+ /**
+ * 构造函数 默认圆角半径 4dp
+ *
+ * @param context Context
+ */
+ public GlideRoundTransform(Context context) {
+ this(context, 4);
+ }
+
+ /**
+ * 构造函数
+ *
+ * @param context Context
+ * @param dp 圆角半径
+ */
+ public GlideRoundTransform(Context context, int dp) {
+// super(context);
+ radius = Resources.getSystem().getDisplayMetrics().density * dp;
+ }
+
+ @Override
+ protected Bitmap transform(BitmapPool pool, Bitmap toTransform, int outWidth, int outHeight) {
+ return roundCrop(pool, toTransform);
+ }
+
+ private static Bitmap roundCrop(BitmapPool pool, Bitmap source) {
+ if (source == null) return null;
+
+ Bitmap result = pool.get(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
+ if (result == null) {
+ result = Bitmap.createBitmap(source.getWidth(), source.getHeight(), Bitmap.Config.ARGB_8888);
+ }
+
+ Canvas canvas = new Canvas(result);
+ Paint paint = new Paint();
+ paint.setShader(new BitmapShader(source, BitmapShader.TileMode.CLAMP, BitmapShader.TileMode.CLAMP));
+ paint.setAntiAlias(true);
+ RectF rectF = new RectF(0f, 0f, source.getWidth(), source.getHeight());
+ canvas.drawRoundRect(rectF, radius, radius, paint);
+ return result;
+ }
+
+ @Override
+ public void updateDiskCacheKey(@NonNull MessageDigest messageDigest) {
+
+ }
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/HideControl.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/HideControl.kt
new file mode 100644
index 0000000000..d11c954451
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/HideControl.kt
@@ -0,0 +1,71 @@
+package com.mogo.module.tanlu.util
+
+import android.os.Message
+import android.view.View
+import androidx.constraintlayout.widget.Group
+
+class HideControl {
+
+ companion object {
+ const val MSG_HIDE = 0x01
+ }
+
+ private var mHideHandler: HideHandler = HideHandler()
+ var view1: Group? = null
+ var view2: Group? = null
+
+ val hideRunable = Runnable {
+ mHideHandler.obtainMessage(MSG_HIDE).sendToTarget()
+ }
+
+ private inner class HideHandler : android.os.Handler() {
+ override fun handleMessage(msg: Message) {
+ super.handleMessage(msg)
+ when (msg.what) {
+ MSG_HIDE -> {
+ view1?.let {
+ it.visibility = View.GONE
+ }
+ view2?.let {
+ it.visibility = View.GONE
+ }
+ }
+ }
+ }
+
+ }
+
+ fun startHideTimer(view1: Group,view2: Group? = null) {
+ this.view1 = view1
+ this.view2 = view2
+ mHideHandler.removeCallbacks(hideRunable)
+ if (view1.visibility == View.GONE) {
+ view1.visibility = View.VISIBLE
+ }
+ if (view2?.visibility == View.GONE) {
+ view2.visibility = View.VISIBLE
+ }
+ mHideHandler.postDelayed(hideRunable, 3000)
+ }
+
+ fun resetHideTimer() {
+ if(view1 != null){
+ view1!!.visibility = View.VISIBLE
+ }
+ if(view2 != null){
+ view2!!.visibility = View.VISIBLE
+ }
+ mHideHandler.removeCallbacks(hideRunable)
+ mHideHandler.postDelayed(hideRunable, 3000)
+ }
+
+ fun endHideTime() {
+ mHideHandler.removeCallbacks(hideRunable)
+ if (view1 != null) {
+ view1 = null
+ }
+ if (view2 != null) {
+ view2 = null
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/LocationUtils.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/LocationUtils.java
new file mode 100644
index 0000000000..f97102c998
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/LocationUtils.java
@@ -0,0 +1,41 @@
+package com.mogo.module.tanlu.util;
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2020/3/18
+ */
+public class LocationUtils {
+ /**
+ * 地球半径
+ */
+ private static double EARTH_RADIUS = 6378.137;
+
+ private static double rad(double d) {
+ return d * Math.PI / 180.0;
+ }
+
+ /**
+ * 通过经纬度获取距离(单位:米)
+ * @param lat1
+ * @param lng1
+ * @param lat2
+ * @param lng2
+ * @return
+ */
+ public static double getDistance(double lat1, double lng1, double lat2,
+ double lng2) {
+ double radLat1 = rad(lat1);
+ double radLat2 = rad(lat2);
+ double a = radLat1 - radLat2;
+ double b = rad(lng1) - rad(lng2);
+ double s = 2 * Math.asin(Math.sqrt(Math.pow(Math.sin(a / 2), 2)
+ + Math.cos(radLat1) * Math.cos(radLat2)
+ * Math.pow(Math.sin(b / 2), 2)));
+ s = s * EARTH_RADIUS;
+ s = Math.round(s * 10000d) / 10000d;
+ s = s * 1000;
+ return s;
+ }
+
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/NetworkUtil.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/NetworkUtil.java
new file mode 100644
index 0000000000..86a80f7584
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/NetworkUtil.java
@@ -0,0 +1,128 @@
+package com.mogo.module.tanlu.util;
+
+import android.Manifest;
+import android.annotation.TargetApi;
+import android.content.Context;
+import android.net.ConnectivityManager;
+import android.net.Network;
+import android.net.NetworkInfo;
+import android.os.Build;
+
+import androidx.annotation.Nullable;
+import androidx.annotation.RequiresPermission;
+
+
+public class NetworkUtil {
+ /**
+ * Returns true if device is connected to wifi or mobile network, false
+ * otherwise.
+ *
+ * @param context
+ * @return
+ */
+ public static boolean isConnected(Context context) {
+ ConnectivityManager conMan = (ConnectivityManager) context
+ .getSystemService(Context.CONNECTIVITY_SERVICE);
+ if (conMan != null){
+ NetworkInfo infoWifi = conMan.getNetworkInfo(ConnectivityManager.TYPE_WIFI);
+
+ if (infoWifi != null) {
+ NetworkInfo.State wifi = infoWifi.getState();
+ if (wifi == NetworkInfo.State.CONNECTED) {
+ return true;
+ }
+ }
+
+ NetworkInfo infoMobile = conMan.getNetworkInfo(ConnectivityManager.TYPE_MOBILE);
+ if (infoMobile != null) {
+ NetworkInfo.State mobile = infoMobile.getState();
+ if (mobile == NetworkInfo.State.CONNECTED) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Check if there is any connectivity to a Wifi network
+ *
+ * @param context
+ * @return
+ */
+ public static boolean isConnectedWifi(Context context) {
+ NetworkInfo info = getNetworkInfo(context);
+ return (info != null && info.isConnected() && info.getType() == ConnectivityManager.TYPE_WIFI);
+ }
+
+ /**
+ * Check if there is any connectivity to a mobile network
+ *
+ * @param context
+ * @return
+ */
+ public static boolean isConnectedMobile(Context context) {
+ NetworkInfo info = getNetworkInfo(context);
+ return (info != null && info.isConnected() && info.getType() == ConnectivityManager.TYPE_MOBILE);
+ }
+
+ /**
+ * Get the network info
+ *
+ * @param context
+ * @return
+ */
+ @Nullable
+ public static NetworkInfo getNetworkInfo(Context context) {
+ ConnectivityManager cm = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
+ if (cm != null){
+ return cm.getActiveNetworkInfo();
+ }else{
+ return null;
+ }
+ }
+
+
+ @TargetApi( Build.VERSION_CODES.LOLLIPOP )
+ @RequiresPermission(allOf = {Manifest.permission.ACCESS_NETWORK_STATE})
+ public static boolean isConnectedV21(Context context){
+
+ boolean isConnect = false;
+ ConnectivityManager connMgr = (ConnectivityManager) context.getSystemService(Context.CONNECTIVITY_SERVICE);
+
+ Network[] networks = connMgr.getAllNetworks();
+ if (networks.length == 0) {
+ isConnect = false;
+ } else if (networks.length == 1) {
+ NetworkInfo networkInfo = connMgr.getNetworkInfo(networks[0]);
+ if (networkInfo != null) {
+ if (networkInfo.isConnected()) {
+ isConnect = true;
+ } else {
+ isConnect = false;
+ }
+ } else {
+ return false;
+ }
+ } else if (networks.length == 2) {
+ //两个同时存在
+ NetworkInfo networkInfoOne = connMgr.getNetworkInfo(networks[0]);
+ NetworkInfo networkInfoTwo = connMgr.getNetworkInfo(networks[1]);
+ if (networkInfoOne == null || networkInfoTwo == null) {
+ return false;
+ }
+ if (networkInfoOne.isConnected() && networkInfoTwo.isConnected()) {
+ isConnect = true;
+ } else if (networkInfoOne.isConnected() && !networkInfoTwo.isConnected()) {
+ isConnect = true;
+ } else if (!networkInfoOne.isConnected() && networkInfoTwo.isConnected()) {
+ isConnect = true;
+ } else {
+ isConnect = false;
+ }
+ }
+ return isConnect;
+ }
+}
+
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/StringUitl.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/StringUitl.kt
new file mode 100644
index 0000000000..d216039034
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/StringUitl.kt
@@ -0,0 +1,36 @@
+package com.mogo.module.tanlu.util
+
+import android.text.format.DateFormat
+import com.google.gson.Gson
+import java.text.DecimalFormat
+
+const val format = "yyyy/MM/dd HH:mm"
+
+fun formatDate(time: Long): String {
+ return DateFormat.format(format, time).toString()
+}
+
+fun convertVar(param: Any?): Any? {
+ return if (param is String) {
+ "\"$param\""
+ } else {
+ param
+ }
+}
+
+//处理距离,大于1000时,四舍五入保留一位小数
+fun handleDistances(distance: Int): String {
+ if (distance < 1000) {
+ return distance.toString() + "M"
+ } else {
+ var floatDistance = distance.toFloat()
+ val df = DecimalFormat("0.0")
+ val transformDistance = floatDistance / 1000
+ return (df.format(transformDistance)).toString() + "KM"
+ }
+
+}
+
+
+
+
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/Utils.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/Utils.java
new file mode 100644
index 0000000000..63e806d2d4
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/util/Utils.java
@@ -0,0 +1,45 @@
+package com.mogo.module.tanlu.util;
+
+import com.google.gson.Gson;
+import com.mogo.module.tanlu.model.VoiceCmdData;
+
+import java.text.DecimalFormat;
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2020-01-08
+ */
+public class Utils {
+
+ //处理距离,大于1000时,四舍五入保留一位小数
+ public static String handleDistance(double distance) {
+ if (distance < 1000) {
+ return distance + "M";
+ } else {
+ DecimalFormat df = new DecimalFormat("0.0");
+ double transformDistance = distance / 1000;
+ return (df.format(transformDistance)) + "KM";
+ }
+ }
+
+ //保留整数,四舍五入
+ public static int getIntervalValue(int listSize){
+// var floatSize = listSize.toFloat();
+ int transformSize = listSize / 15;
+ DecimalFormat df = new DecimalFormat("0");
+ return Integer.parseInt((df.format(transformSize)));
+ }
+
+ /**
+ * 解析json串为 VoiceCmdData 对象
+ *
+ * @param dataJsonStr
+ * @return
+ */
+ public static VoiceCmdData parseTOVoiceCmdData(String dataJsonStr) {
+ Gson gson = new Gson();
+ return gson.fromJson(dataJsonStr, VoiceCmdData.class);
+ }
+
+}
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/video/FullMediaActivity.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/video/FullMediaActivity.kt
new file mode 100644
index 0000000000..8a65f095f6
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/video/FullMediaActivity.kt
@@ -0,0 +1,146 @@
+package com.mogo.module.tanlu.video
+
+import android.app.Activity
+import android.content.Intent
+import android.os.Bundle
+import android.util.Log
+import android.view.View
+import androidx.appcompat.app.AppCompatActivity
+import com.mogo.module.tanlu.R
+import com.mogo.module.tanlu.util.HideControl
+import com.mogo.module.tanlu.util.formatDate
+import com.mogo.utils.logger.Logger
+import com.shuyu.gsyvideoplayer.GSYVideoManager
+import com.shuyu.gsyvideoplayer.builder.GSYVideoOptionBuilder
+import kotlinx.android.synthetic.main.tanlu_activity_media_full.*
+import java.util.*
+
+/**
+ * 全屏显示适配
+ */
+
+class FullMediaActivity : AppCompatActivity(), View.OnClickListener {
+ companion object {
+ const val TAG = "FullMediaActivity"
+
+ const val PARAM_VIDEO_URL = "param_video_url"
+ const val PARAM_THUMB_URL = "param_thumb_url"
+ const val PARAM_ADDRESS = "param_address"
+ const val PARAM_TIME = "generate_time"
+
+
+// fun launch(context: Activity, strategyInfo: List, position: Int) {
+// val intent = Intent(context, FullMediaActivity::class.java)
+// intent.putExtra(PARAM_MEDIA_POSITION, position)
+// // 使用全局静态对象代替,避免序列化开销
+// GlobalSharedInformation.informationList = strategyInfo as ArrayList
+// context.startActivityForResult(intent, REQUESTCODE_MAINACTIVITY)
+// context.overridePendingTransition(0, 0)
+// }
+
+ fun launch(context: Activity, videoUrl: String, thumbnail: String, address: String, generateTime: Long) {
+ val intent = Intent(context, FullMediaActivity::class.java)
+ intent.putExtra(PARAM_VIDEO_URL, videoUrl)
+ intent.putExtra(PARAM_THUMB_URL, thumbnail)
+ intent.putExtra(PARAM_ADDRESS, address)
+ intent.putExtra(PARAM_TIME, generateTime)
+ context.startActivity(intent)
+ context.overridePendingTransition(0, 0)
+ }
+ }
+
+ private var control = HideControl()
+ private var gsyVideoOptionBuilder = GSYVideoOptionBuilder()
+ private var videoUrl: String? = null
+ private var thumbUrl: String? = null
+ private var address: String? = null
+ private var generateTime: Long = 0
+
+
+
+ override fun onCreate(savedInstanceState: Bundle?) {
+ super.onCreate(savedInstanceState)
+ setContentView(R.layout.tanlu_activity_media_full)
+ handleIntent()
+ setListener()
+ }
+
+ private fun handleIntent() {
+ var intent = intent
+
+ videoUrl = intent.getStringExtra(PARAM_VIDEO_URL)
+ thumbUrl = intent.getStringExtra(PARAM_THUMB_URL)
+ address = intent.getStringExtra(PARAM_ADDRESS)
+ generateTime = intent.getLongExtra(PARAM_TIME, 0)
+ }
+
+ override fun onResume() {
+ super.onResume()
+ updateInformation()
+ GSYVideoManager.onResume()
+ }
+
+ override fun onPause() {
+ super.onPause()
+ GSYVideoManager.onPause()
+ }
+
+ //需要监听完成事件
+ private fun setListener() {
+ iv_media_back.setOnClickListener(this)
+ //重置timer
+ video_view.addSingleClickListener(object :
+ MediaCoverVideoPlayer.SingleClickListener {
+ override fun onClick() {
+ control.resetHideTimer()
+ }
+ })
+
+ //视频播放完成
+ video_view.onCompletionListener(object :
+ MediaCoverVideoPlayer.CompletionListener {
+ override fun onCompletion() {
+ finish()
+ }
+ })
+
+ video_view
+ video_view.loadCoverImage(thumbUrl!!)
+ //设置url,点击播放
+ gsyVideoOptionBuilder.setUrl(videoUrl).setCacheWithPlay(true)
+ .setPlayTag(TAG).build(video_view)
+ video_view.startButton.performClick()
+ }
+
+
+ private fun updateInformation() {
+ tv_media_title_content.text = address
+ tv_media_title_time.text = formatDate(generateTime)
+ }
+
+
+ override fun onClick(view: View) {
+ view?.let {
+ when (view) {
+ iv_media_back -> {
+ handleBack()
+ }
+ }
+ }
+ }
+
+ override fun onDestroy() {
+ super.onDestroy()
+ GSYVideoManager.releaseAllVideos()
+ overridePendingTransition(0, 0)
+ }
+
+ private fun handleBack() {
+ finish()
+ }
+
+ override fun onBackPressed() {
+ super.onBackPressed()
+ handleBack()
+ }
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/video/MediaCoverVideoPlayer.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/video/MediaCoverVideoPlayer.kt
new file mode 100644
index 0000000000..b3f941c3a8
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/video/MediaCoverVideoPlayer.kt
@@ -0,0 +1,162 @@
+package com.mogo.module.tanlu.video
+
+import android.content.Context
+import android.util.AttributeSet
+import android.util.Log
+import android.view.View
+import android.widget.ImageView
+import android.widget.SeekBar
+import com.bumptech.glide.Glide
+import com.mogo.module.tanlu.R
+import com.shuyu.gsyvideoplayer.GSYVideoManager
+import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
+import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
+import com.shuyu.gsyvideoplayer.video.base.GSYVideoViewBridge
+
+
+/**
+ * 全屏播放
+ */
+class MediaCoverVideoPlayer : StandardGSYVideoPlayer {
+
+ private lateinit var coverImage: ImageView
+ private lateinit var start: ImageView
+ private lateinit var fullscreen: ImageView
+ private lateinit var singleClickListener: SingleClickListener
+ private lateinit var completionListener: CompletionListener
+
+ constructor(context: Context?) : super(context)
+ constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
+ constructor(context: Context?, fullFlag: Boolean?) : super(context, fullFlag)
+
+ interface SingleClickListener {
+ fun onClick()
+ }
+
+ interface CompletionListener {
+ fun onCompletion()
+ }
+
+ override fun init(context: Context) {
+ super.init(context)
+ coverImage = findViewById(R.id.thumbImage)
+ start = findViewById(R.id.start)
+ fullscreen = findViewById(R.id.fullscreen)
+ if (mThumbImageViewLayout != null
+ && (mCurrentState == -1 || mCurrentState == GSYVideoView.CURRENT_STATE_NORMAL || mCurrentState == GSYVideoView.CURRENT_STATE_ERROR)
+ ) {
+ mThumbImageViewLayout.visibility = View.VISIBLE
+ }
+ }
+
+ fun addSingleClickListener(singleClickListener: SingleClickListener) {
+ this.singleClickListener = singleClickListener
+ }
+
+ fun onCompletionListener(completionListener: CompletionListener) {
+ this.completionListener = completionListener
+ }
+
+ override fun getLayoutId(): Int {
+ return R.layout.tanlu_item_video_cover_media
+ }
+
+ override fun getGSYVideoManager(): GSYVideoViewBridge {
+ GSYVideoManager.instance().initContext(context.applicationContext)
+ return GSYVideoManager.instance()
+ }
+
+ override fun setProgressAndTime(progress: Int, secProgress: Int, currentTime: Int, totalTime: Int, forceChange: Boolean) {
+ super.setProgressAndTime(progress, secProgress, currentTime, totalTime, forceChange)
+ if (progress != 0) {
+ mProgressBar.progress = progress
+ }
+ }
+
+ fun loadCoverImage(url: String) {
+ Glide.with(context)
+ .load(url)
+ .into(coverImage)
+ }
+
+ override fun updateStartImage() {
+ when (mCurrentState) {
+ GSYVideoView.CURRENT_STATE_PLAYING -> start.setImageResource(R.drawable.selector_bg_btn_pause)
+ GSYVideoView.CURRENT_STATE_ERROR -> start.setImageResource(R.drawable.main_video_refresh_btn)
+ else -> start.setImageResource(R.drawable.selector_bg_btn_play)
+ }
+ }
+
+ fun setFullClickListener(listener: OnClickListener) {
+ fullscreen.setOnClickListener(listener)
+ }
+
+ override fun onClickUiToggle() {
+ super.onClickUiToggle()
+ singleClickListener.let {
+ it.onClick()
+ }
+ }
+
+ override fun changeUiToCompleteShow() {
+ super.changeUiToCompleteShow()
+// setViewShowState(mBottomContainer, View.INVISIBLE)
+ }
+
+ override fun onAutoCompletion() {
+ super.onAutoCompletion()
+ mProgressBar.progress = 0
+
+ completionListener.let {
+ it.onCompletion()
+ }
+
+ Log.d("liyz", "MediaCoverVideoPlayer onAutoCompletion ------->")
+ }
+
+ override fun showWifiDialog() {
+ //直接播放,不显示WIFI对话框
+ startPlayLogic()
+ }
+
+ override fun onClick(v: View?) {
+ super.onClick(v)
+ v?.let {
+ when (v) {
+ start -> {
+
+ }
+ else -> {
+
+ }
+ }
+ }
+ }
+
+ override fun onPrepared() {
+ super.onPrepared()
+ }
+
+ /**
+ * 多次回调
+ */
+ override fun onCompletion() {
+ super.onCompletion()
+ }
+
+
+ override fun onProgressChanged(seekBar: SeekBar?, progress: Int, fromUser: Boolean) {
+ super.onProgressChanged(seekBar, progress, fromUser)
+ }
+
+ override fun onDetachedFromWindow() {
+ super.onDetachedFromWindow()
+ mFullPauseBitmap?.let {
+ if (!it.isRecycled) {
+ it.recycle()
+ }
+ }
+ mFullPauseBitmap = null
+ }
+
+}
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/video/SimpleCoverVideoPlayer.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/video/SimpleCoverVideoPlayer.kt
new file mode 100644
index 0000000000..1b99c2b0b5
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/video/SimpleCoverVideoPlayer.kt
@@ -0,0 +1,182 @@
+package com.mogo.module.tanlu.video
+
+import android.content.Context
+import android.util.AttributeSet
+import android.util.Log
+import android.view.Surface
+import android.view.View
+import android.widget.ImageView
+import com.bumptech.glide.Glide
+import com.bumptech.glide.request.RequestOptions
+import com.mogo.module.tanlu.R
+import com.shuyu.gsyvideoplayer.GSYVideoManager
+import com.shuyu.gsyvideoplayer.utils.GSYVideoType
+import com.shuyu.gsyvideoplayer.video.StandardGSYVideoPlayer
+import com.shuyu.gsyvideoplayer.video.base.GSYVideoView
+import com.shuyu.gsyvideoplayer.video.base.GSYVideoViewBridge
+
+
+class SimpleCoverVideoPlayer : StandardGSYVideoPlayer {
+ private lateinit var coverImage: ImageView
+ private lateinit var start: ImageView
+ private lateinit var fullscreen: ImageView
+
+ constructor(context: Context?) : super(context)
+ constructor(context: Context?, attrs: AttributeSet?) : super(context, attrs)
+ constructor(context: Context?, fullFlag: Boolean?) : super(context, fullFlag)
+
+ override fun init(context: Context) {
+ super.init(context)
+ coverImage = findViewById(R.id.thumbImage)
+ start = findViewById(R.id.start)
+ fullscreen = findViewById(R.id.fullscreen)
+ if (mThumbImageViewLayout != null
+ && (mCurrentState == -1 || mCurrentState == GSYVideoView.CURRENT_STATE_NORMAL || mCurrentState == GSYVideoView.CURRENT_STATE_ERROR)
+ ) {
+ mThumbImageViewLayout.visibility = View.VISIBLE
+ }
+ }
+
+ override fun getLayoutId(): Int {
+ return R.layout.tanlu_item_video_cover
+ }
+
+ override fun getGSYVideoManager(): GSYVideoViewBridge {
+ GSYVideoManager.instance().initContext(context.applicationContext)
+ return GSYVideoManager.instance()
+ }
+
+ override fun setProgressAndTime(progress: Int, secProgress: Int, currentTime: Int, totalTime: Int, forceChange: Boolean) {
+ super.setProgressAndTime(progress, secProgress, currentTime, totalTime, forceChange)
+ if (progress != 0) {
+// Log.d("liyz", "SimpleCoverVideoPlayer setProgressAndTime -----2---- $progress");
+ mProgressBar.progress = progress
+ }
+ }
+
+ fun loadCoverImage(url: String, mContext: Context) {
+ //加载图片
+ val requestOptions = RequestOptions()
+ .placeholder(R.drawable.tanlu_normal_image)
+ .error(R.drawable.tanlu_normal_image)
+ .fallback(R.drawable.tanlu_normal_image)
+ Glide.with(mContext)
+ .load(url)
+ .apply(requestOptions)
+ .into(coverImage)
+
+
+ }
+
+ override fun updateStartImage() {
+ when (mCurrentState) {
+// GSYVideoView.CURRENT_STATE_PLAYING -> start.setImageResource(R.drawable.selector_bg_btn_pause)
+// GSYVideoView.CURRENT_STATE_ERROR -> start.setImageResource(R.drawable.main_video_refresh_btn)
+// else -> start.setImageResource(R.drawable.selector_bg_btn_play)
+ }
+ }
+
+ fun setFullClickListener(listener: OnClickListener) {
+ fullscreen.setOnClickListener(listener)
+ }
+
+ override fun changeUiToCompleteShow() {
+ super.changeUiToCompleteShow()
+// setViewShowState(mBottomContainer, View.INVISIBLE)
+ mBottomContainer.visibility = View.INVISIBLE
+ mProgressBar.visibility = View.GONE
+ }
+
+ override fun hideAllWidget() {
+ super.hideAllWidget()
+ mBottomContainer.visibility = View.INVISIBLE
+ mProgressBar.visibility = View.GONE
+ }
+
+ override fun changeUiToPrepareingClear() {
+ super.changeUiToPrepareingClear()
+ mBottomContainer.visibility = View.INVISIBLE
+ mProgressBar.visibility = View.GONE
+ }
+
+ override fun changeUiToPlayingBufferingClear() {
+ super.changeUiToPlayingBufferingClear()
+ mBottomContainer.visibility = View.INVISIBLE
+ mProgressBar.visibility = View.GONE
+
+ }
+
+ override fun changeUiToClear() {
+ super.changeUiToClear()
+ mBottomContainer.visibility = View.INVISIBLE
+ mProgressBar.visibility = View.GONE
+ }
+
+ override fun changeUiToCompleteClear() {
+ super.changeUiToCompleteClear()
+ mBottomContainer.visibility = View.INVISIBLE
+ mProgressBar.visibility = View.GONE
+ }
+
+ override fun onAutoCompletion() {
+ super.onAutoCompletion()
+ mProgressBar.progress = 0
+ }
+
+ override fun showWifiDialog() {
+ //直接播放,不显示WIFI对话框
+ startPlayLogic()
+ }
+
+ override fun onDetachedFromWindow() {
+ super.onDetachedFromWindow()
+ mProgressBar.progress = 0
+ mFullPauseBitmap = null
+ }
+
+ override fun onClick(v: View?) {
+ super.onClick(v)
+ v?.let {
+ when (v) {
+ start -> {
+
+ }
+ else -> {
+
+ }
+ }
+ }
+ }
+
+ override fun onPrepared() {
+ super.onPrepared()
+ }
+
+ override fun onCompletion() {
+
+ }
+
+ override fun onSurfaceUpdated(surface: Surface) {
+ super.onSurfaceUpdated(surface)
+ if (mThumbImageViewLayout != null && mThumbImageViewLayout.visibility == View.VISIBLE) {
+ mThumbImageViewLayout.visibility = View.INVISIBLE
+ }
+ }
+
+ override fun setViewShowState(view: View?, visibility: Int) {
+ if (view === mThumbImageViewLayout && visibility != View.VISIBLE) {
+ return
+ }
+ super.setViewShowState(view, visibility)
+ }
+
+ override fun onSurfaceAvailable(surface: Surface) {
+ super.onSurfaceAvailable(surface)
+ mProgressBar.visibility = View.GONE
+ if (GSYVideoType.getRenderType() != GSYVideoType.TEXTURE) {
+ if (mThumbImageViewLayout != null && mThumbImageViewLayout.visibility == View.VISIBLE) {
+ mThumbImageViewLayout.visibility = View.INVISIBLE
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/video/VideoInit.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/video/VideoInit.kt
new file mode 100644
index 0000000000..b7962f3acc
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/video/VideoInit.kt
@@ -0,0 +1,23 @@
+package com.mogo.module.tanlu.video
+
+import com.shuyu.gsyvideoplayer.GSYVideoManager
+import com.shuyu.gsyvideoplayer.cache.CacheFactory
+import com.shuyu.gsyvideoplayer.cache.ProxyCacheManager
+import com.shuyu.gsyvideoplayer.model.VideoOptionModel
+import com.shuyu.gsyvideoplayer.player.IjkPlayerManager
+import com.shuyu.gsyvideoplayer.player.PlayerFactory
+import com.shuyu.gsyvideoplayer.utils.GSYVideoType
+import tv.danmaku.ijk.media.player.IjkMediaPlayer
+
+
+fun initVideo() {
+ PlayerFactory.setPlayManager(IjkPlayerManager::class.java)
+ CacheFactory.setCacheManager(ProxyCacheManager::class.java)
+ var list = mutableListOf()
+ list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "enable-accurate-seek", 1))
+ list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_PLAYER, "videotoolbox", 0))
+// list.add(VideoOptionModel(IjkMediaPlayer.OPT_CATEGORY_FORMAT, "dns_cache_clear", 1))
+ GSYVideoManager.instance().optionModelList = list
+ GSYVideoType.enableMediaCodec()
+ GSYVideoType.enableMediaCodecTexture()
+}
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/view/AutoZoomInImageView.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/view/AutoZoomInImageView.java
new file mode 100644
index 0000000000..cd34a35832
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/view/AutoZoomInImageView.java
@@ -0,0 +1,274 @@
+package com.mogo.module.tanlu.view;
+
+import com.mogo.service.imageloader.MogoImageView;
+
+import android.animation.Animator;
+import android.animation.ValueAnimator;
+import android.content.Context;
+import android.graphics.Matrix;
+import android.graphics.drawable.Drawable;
+import android.util.AttributeSet;
+import android.view.View;
+
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2020-01-06
+ */
+public class AutoZoomInImageView extends MogoImageView {
+ private int mDrawableW;
+ private int mDrawableH;
+ private int mImageViewW;
+ private int mImageViewH;
+ private long mDurationMillis = 700;
+
+ private float[] mValues = new float[9];
+ private float mScaleDelta = 0.2f;
+
+ private Drawable mDrawable;
+ private Matrix mMatrix;
+
+ public AutoZoomInImageView(Context context) {
+ super(context);
+ this.setScaleType(ScaleType.MATRIX);
+ }
+
+ public AutoZoomInImageView(Context context, AttributeSet attrs) {
+ super(context, attrs);
+ this.setScaleType(ScaleType.MATRIX);
+ }
+
+ public AutoZoomInImageView(Context context, AttributeSet attrs, int defStyle) {
+ super(context, attrs, defStyle);
+ this.setScaleType(ScaleType.MATRIX);
+ }
+
+ public AutoZoomInImageView init() {
+ initInternalValues();
+ initPicturePosition();
+ return this;
+ }
+
+ public void init(Drawable drawable) {
+ initInternalValues(drawable);
+ initPicturePosition();
+ }
+
+ private void initInternalValues() {
+ mDrawable = getDrawable();
+
+ if (mDrawable == null) {
+ throw new IllegalArgumentException("please set the source of AutoZoomInImageView");
+ }
+
+ mDrawableW = mDrawable.getIntrinsicWidth();
+ mDrawableH = mDrawable.getIntrinsicHeight();
+
+ mImageViewW = getMeasuredWidth();
+ mImageViewH = getMeasuredHeight();
+
+ mMatrix = getImageMatrix();
+ mMatrix.getValues(mValues);
+ }
+
+ private void initInternalValues(Drawable drawable) {
+ mDrawable = drawable;
+
+ if (mDrawable == null) {
+ throw new IllegalArgumentException("please set the source of AutoZoomInImageView");
+ }
+
+ mDrawableW = mDrawable.getIntrinsicWidth();
+ mDrawableH = mDrawable.getIntrinsicHeight();
+
+ mImageViewW = getMeasuredWidth();
+ mImageViewH = getMeasuredHeight();
+
+ mMatrix = getImageMatrix();
+ mMatrix.getValues(mValues);
+ }
+
+ private void initPicturePosition() {
+ updateMatrixValuesOrigin(mMatrix, mValues, mDrawableW, mDrawableH, mImageViewW, mImageViewH);
+ setImageMatrix(mMatrix);
+ }
+
+ private ValueAnimator mCurrentAnimator;
+
+ private void startZoomInByScaleDelta(final float scaleDelta, long duration) {
+
+ final float oriScaleX = mValues[0];
+ final float oriScaleY = mValues[4];
+
+ mCurrentAnimator = ValueAnimator.ofFloat(0, scaleDelta);
+ mCurrentAnimator.addUpdateListener(new ValueAnimator.AnimatorUpdateListener() {
+
+ @Override
+ public void onAnimationUpdate(ValueAnimator animation) {
+ float value = (Float) animation.getAnimatedValue();
+ if (mOnZoomListener != null)
+ mOnZoomListener.onUpdate(AutoZoomInImageView.this, value / scaleDelta);
+ updateMatrixValuesSpan(mValues, mDrawableW, mDrawableH, mImageViewW, mImageViewH,
+ oriScaleX, oriScaleY, value);
+ mMatrix.setValues(mValues);
+ setImageMatrix(mMatrix);
+ }
+ });
+ mCurrentAnimator.addListener(new Animator.AnimatorListener() {
+ @Override
+ public void onAnimationStart(Animator animation) {
+ if (mOnZoomListener != null) mOnZoomListener.onStart(AutoZoomInImageView.this);
+ }
+
+ @Override
+ public void onAnimationEnd(Animator animation) {
+ if (mOnZoomListener != null) mOnZoomListener.onEnd(AutoZoomInImageView.this);
+ mCurrentAnimator = null;
+ }
+
+ @Override
+ public void onAnimationCancel(Animator animation) {
+ mCurrentAnimator = null;
+ }
+
+ @Override
+ public void onAnimationRepeat(Animator animation) {
+ }
+ });
+ mCurrentAnimator.setDuration(duration);
+ mCurrentAnimator.start();
+ }
+
+ /**
+ * 停止动画
+ */
+ public void stopCurrentAnimator(){
+ if ( mCurrentAnimator != null ) {
+ if ( mCurrentAnimator.isRunning() ) {
+ mCurrentAnimator.cancel();
+ }
+ }
+ }
+
+ /**
+ * start zooming in
+ *
+ * @param scaleDelta the scale that the image will add to original scale
+ * @param durationMillis the duration of zoomin animation, in millisecond.
+ * @param delayMillis the delayed time of starting zoomin animation, in millisecond.
+ */
+ public void startZoomInByScaleDeltaAndDuration(final float scaleDelta, final long durationMillis, long delayMillis) {
+ if (scaleDelta < 0) {
+ throw new IllegalArgumentException("scaleDelta should be larger than 0, now scaleDelta is " + scaleDelta);
+ }
+ if (durationMillis < 0) {
+ throw new IllegalArgumentException("durationMillis should not be less than 0, now durationMillis is " + durationMillis);
+ }
+ if (delayMillis < 0) {
+ throw new IllegalArgumentException("delayMillis should not be less than 0, now delayMillis is " + delayMillis);
+ }
+ postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ startZoomInByScaleDelta(scaleDelta, durationMillis);
+ }
+ }, delayMillis);
+ }
+
+ /**
+ * the scale that the image will add to original scale
+ *
+ * @param scaleDelta
+ * @return
+ */
+ public AutoZoomInImageView setScaleDelta(float scaleDelta) {
+ mScaleDelta = scaleDelta;
+ return this;
+ }
+
+ /**
+ * the duration of zoomin animation, in millisecond.
+ *
+ * @param durationMillis
+ * @return
+ */
+ public AutoZoomInImageView setDurationMillis(long durationMillis) {
+ mDurationMillis = durationMillis;
+ return this;
+ }
+
+ /**
+ * callback when zoomin animation finished
+ *
+ * @param onZoomListener
+ * @return
+ */
+ public AutoZoomInImageView setOnZoomListener(OnZoomListener onZoomListener) {
+ mOnZoomListener = onZoomListener;
+ return this;
+ }
+
+ /**
+ * start animation of zoomin
+ *
+ * @param delayMillis the delayed time of starting zoomin animation, in millisecond.
+ */
+ public void start(long delayMillis) {
+ postDelayed(new Runnable() {
+ @Override
+ public void run() {
+ startZoomInByScaleDelta(mScaleDelta, mDurationMillis);
+ }
+ }, delayMillis);
+ }
+
+ private void updateMatrixValuesOrigin(Matrix outMatrix, float[] outValues, float drawW, float drawH, float imageW, float imageH) {
+ if (outMatrix == null || outValues == null) {
+ throw new IllegalArgumentException("please set the source of AutoZoomInImageView's matrix and values");
+ }
+ outMatrix.reset();
+ if ((imageH * drawW > drawH * imageW)) {
+ float scale1 = (imageH) / (drawH);
+ float offset1 = (drawW * scale1 - imageW) / 2;
+ outMatrix.postScale(scale1, scale1);
+ outMatrix.postTranslate(-offset1, 0);
+ } else {
+ float scale2 = (imageW) / (drawW);
+ float offset2 = (drawH * scale2 - imageH) / 2;
+ outMatrix.postScale(scale2, scale2);
+ outMatrix.postTranslate(0, -offset2);
+ }
+ outMatrix.getValues(outValues);
+ }
+
+ private void updateMatrixValuesSpan(float[] outValues,
+ float drawW, float drawH,
+ float imageW, float imageH,
+ float oriScaleX, float oriScaleY,
+ float scaleDelta) {
+ outValues[0] = oriScaleX * (1 + scaleDelta);
+ outValues[4] = oriScaleY * (1 + scaleDelta);
+ float offsetwidth = (drawW * outValues[0] - imageW) / 2;
+ outValues[2] = -offsetwidth;
+ float offsetHeight = (drawH * outValues[4] - imageH) / 2;
+ outValues[5] = -offsetHeight;
+ }
+
+ private OnZoomListener mOnZoomListener;
+
+ public interface OnZoomListener {
+ /**
+ * callback when zoom in animation is updating
+ *
+ * @param view AutoZoomInImageView
+ * @param progress return the progress of animation, scope is [0,1]
+ */
+ void onUpdate(View view, float progress);
+
+ void onEnd(View view);
+
+ void onStart(View view);
+ }
+
+}
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/view/NetErrorDialog.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/view/NetErrorDialog.java
new file mode 100644
index 0000000000..c303056633
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/view/NetErrorDialog.java
@@ -0,0 +1,169 @@
+package com.mogo.module.tanlu.view;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.text.method.LinkMovementMethod;
+import android.util.TypedValue;
+import android.view.Gravity;
+import android.view.View;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+
+import com.mogo.module.tanlu.R;
+
+
+public class NetErrorDialog extends Dialog {
+ TextView txtOk;
+ TextView txtCancel;
+ TextView txtContent;
+ TextView txtSubContent;
+
+ private int mContentSize = 0;
+ private int mContentColor = 0;
+ private int mBtnSize = 0;
+
+ private View.OnClickListener onOkListener, onCancelListener;
+
+ private String title, subContent, okText, cancelText;
+ private CharSequence content;
+ private boolean isAutoDismissDialog = true;
+
+ private int contentGravity = Gravity.CENTER;
+
+ private boolean isContentClickSpanEnable = false;
+
+ public NetErrorDialog(@NonNull Context context) {
+ super(context, R.style.Theme_AppCompat_Dialog);
+ getWindow().setBackgroundDrawableResource(android.R.color.transparent);
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.tanlu_dialog_neterror_layout);
+
+ initView();
+
+ if (mContentSize > 0){
+ txtContent.setTextSize(TypedValue.COMPLEX_UNIT_PX,mContentSize);
+ }
+
+ if (mContentColor > 0){
+ txtContent.setTextColor(mContentColor);
+ }
+
+ if ( content instanceof String ) {
+ content = ( ( String ) content ).replace( "\\n", "\n" );
+ }
+
+ txtContent.setText(content);
+ if (TextUtils.isEmpty(subContent)) {
+ txtSubContent.setVisibility(View.GONE);
+ } else {
+ txtSubContent.setVisibility(View.VISIBLE);
+ txtSubContent.setText(subContent);
+ }
+
+ if (mBtnSize > 0){
+ txtOk.setTextSize(TypedValue.COMPLEX_UNIT_PX,mBtnSize);
+ txtCancel.setTextSize(TypedValue.COMPLEX_UNIT_PX,mBtnSize);
+ }
+
+ if (!TextUtils.isEmpty(okText)) {
+ txtOk.setVisibility(View.VISIBLE);
+ txtOk.setText(okText);
+ } else {
+ txtOk.setVisibility(View.GONE);
+ }
+ if (!TextUtils.isEmpty(cancelText)) {
+ txtCancel.setVisibility(View.VISIBLE);
+ txtCancel.setText(cancelText);
+ } else {
+ txtCancel.setVisibility(View.GONE);
+ }
+
+ txtOk.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (isAutoDismissDialog) {
+ dismiss();
+ }
+ if (onOkListener != null) {
+ onOkListener.onClick(v);
+ }
+ }
+ });
+
+ txtCancel.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (isAutoDismissDialog) {
+ dismiss();
+ }
+ if (onCancelListener != null) {
+ onCancelListener.onClick(v);
+ }
+ }
+ });
+
+ txtContent.setGravity( contentGravity );
+
+ if ( isContentClickSpanEnable ) {
+ txtContent.setMovementMethod( LinkMovementMethod.getInstance() );
+ }
+
+ }
+
+ private void initView() {
+ txtOk = findViewById(R.id.txt_ok);
+ txtCancel = findViewById(R.id.txt_cancel);
+ txtContent = findViewById(R.id.txt_content);
+ txtSubContent = findViewById(R.id.txt_sub_content);
+ }
+
+ public void setContent(CharSequence content) {
+ this.content = content;
+ }
+
+ public void setSubContent(String subContent) {
+ this.subContent = subContent;
+ }
+
+ public TextView getTxtCancel() {
+ return txtCancel;
+ }
+
+ public void setOnOkClickListener(String okText, View.OnClickListener onOkClickListener) {
+ this.okText = okText;
+ this.onOkListener = onOkClickListener;
+ }
+
+ public void setOnOkClickListener(View.OnClickListener onOkClickListener) {
+ setOnOkClickListener("确定", onOkClickListener);
+ }
+
+ public void setOnCancelListener(String cancelText, View.OnClickListener onCancelListener) {
+ this.cancelText = cancelText;
+ this.onCancelListener = onCancelListener;
+ }
+
+ public void setOnCancelListener(View.OnClickListener onCancelListener) {
+ setOnCancelListener("取消", onCancelListener);
+ }
+
+ public void setAutoDismissDialog(boolean autoDismissDialog) {
+ isAutoDismissDialog = autoDismissDialog;
+ }
+
+ public int getContentGravity() {
+ return contentGravity;
+ }
+
+ public void setContentClickSpanEnable( boolean contentClickSpanEnable ) {
+ isContentClickSpanEnable = contentClickSpanEnable;
+ }
+}
+
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/view/RoundLayout.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/view/RoundLayout.java
new file mode 100644
index 0000000000..9ca0a4784f
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/view/RoundLayout.java
@@ -0,0 +1,76 @@
+package com.mogo.module.tanlu.view;
+
+import android.content.Context;
+import android.content.res.TypedArray;
+import android.graphics.Canvas;
+import android.graphics.Path;
+import android.graphics.RectF;
+import android.util.AttributeSet;
+import android.widget.RelativeLayout;
+
+import com.mogo.module.tanlu.R;
+
+/**
+ * author : donghongyu
+ * e-mail : 1358506549@qq.com
+ * date : 2020/3/25 11:39 AM
+ * desc :
+ * version: 1.0
+ */
+public class RoundLayout extends RelativeLayout {
+ private float roundLayoutRadius = 14f;
+ private Path roundPath;
+ private RectF rectF;
+
+ public RoundLayout(Context context) {
+ this(context, null);
+ }
+
+ public RoundLayout(Context context, AttributeSet attrs, int defStyleAttr) {
+ this(context, attrs);
+ }
+
+ public RoundLayout(Context context, AttributeSet attrs) {
+ super(context, attrs);
+
+ TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RoundLayout);
+ roundLayoutRadius = typedArray.getDimensionPixelSize(R.styleable.RoundLayout_roundLayoutRadius, (int) roundLayoutRadius);
+ typedArray.recycle();
+
+ init();
+ }
+
+ private void init() {
+ setWillNotDraw(false);//如果你继承的是ViewGroup,注意此行,否则draw方法是不会回调的;
+ roundPath = new Path();
+ rectF = new RectF();
+ }
+
+ private void setRoundPath() {
+ //添加一个圆角矩形到path中, 如果要实现任意形状的View, 只需要手动添加path就行
+ roundPath.addRoundRect(rectF, roundLayoutRadius, roundLayoutRadius, Path.Direction.CW);
+ }
+
+
+ public void setRoundLayoutRadius(float roundLayoutRadius) {
+ this.roundLayoutRadius = roundLayoutRadius;
+ setRoundPath();
+ postInvalidate();
+ }
+
+ @Override
+ protected void onLayout(boolean changed, int l, int t, int r, int b) {
+ super.onLayout(changed, l, t, r, b);
+ rectF.set(0f, 0f, getMeasuredWidth(), getMeasuredHeight());
+ setRoundPath();
+ }
+
+ @Override
+ public void draw(Canvas canvas) {
+ if (roundLayoutRadius > 0f) {
+ canvas.clipPath(roundPath);
+ }
+ super.draw(canvas);
+ }
+}
+
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/view/UploadFailedDialog.java b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/view/UploadFailedDialog.java
new file mode 100644
index 0000000000..31cd067e08
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/view/UploadFailedDialog.java
@@ -0,0 +1,202 @@
+package com.mogo.module.tanlu.view;
+
+import android.app.Dialog;
+import android.content.Context;
+import android.os.Bundle;
+import android.text.TextUtils;
+import android.text.method.LinkMovementMethod;
+import android.util.TypedValue;
+import android.view.Gravity;
+import android.view.View;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+
+import com.mogo.module.tanlu.R;
+
+
+public class UploadFailedDialog extends Dialog {
+ TextView txtOk;
+ TextView txtCancel;
+// TextView txtTitle;
+ TextView txtContent;
+ TextView txtSubContent;
+
+ private int mContentSize = 0;
+ private int mContentColor = 0;
+ private int mBtnSize = 0;
+
+ private View.OnClickListener onOkListener, onCancelListener;
+
+ private String title, subContent, okText, cancelText;
+ private CharSequence content;
+ private boolean isAutoDismissDialog = true;
+
+ private int contentGravity = Gravity.CENTER;
+
+ private boolean isContentClickSpanEnable = false;
+
+ public UploadFailedDialog(@NonNull Context context) {
+ super(context, R.style.Theme_AppCompat_Dialog);
+ getWindow().setBackgroundDrawableResource(android.R.color.transparent);
+ }
+
+ @Override
+ protected void onCreate(Bundle savedInstanceState) {
+ super.onCreate(savedInstanceState);
+ setContentView(R.layout.tanlu_dialog_cutom_layout);
+ getWindow().setBackgroundDrawableResource(android.R.color.transparent);
+
+ initView();
+
+// if (TextUtils.isEmpty(title)) {
+// txtTitle.setVisibility(View.GONE);
+// } else {
+// txtTitle.setText(title);
+// txtTitle.setVisibility(View.VISIBLE);
+// }
+
+ if (mContentSize > 0){
+ txtContent.setTextSize(TypedValue.COMPLEX_UNIT_PX,mContentSize);
+ }
+
+ if (mContentColor > 0){
+ txtContent.setTextColor(mContentColor);
+ }
+
+ if ( content instanceof String ) {
+ content = ( ( String ) content ).replace( "\\n", "\n" );
+ }
+
+ txtContent.setText(content);
+ if (TextUtils.isEmpty(subContent)) {
+ txtSubContent.setVisibility(View.GONE);
+ } else {
+ txtSubContent.setVisibility(View.VISIBLE);
+ txtSubContent.setText(subContent);
+ }
+
+ if (mBtnSize > 0){
+ txtOk.setTextSize(TypedValue.COMPLEX_UNIT_PX,mBtnSize);
+ txtCancel.setTextSize(TypedValue.COMPLEX_UNIT_PX,mBtnSize);
+ }
+
+ if (!TextUtils.isEmpty(okText)) {
+ txtOk.setVisibility(View.VISIBLE);
+ txtOk.setText(okText);
+ } else {
+ txtOk.setVisibility(View.GONE);
+ }
+ if (!TextUtils.isEmpty(cancelText)) {
+ txtCancel.setVisibility(View.VISIBLE);
+ txtCancel.setText(cancelText);
+ } else {
+ txtCancel.setVisibility(View.GONE);
+ }
+
+ txtOk.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (isAutoDismissDialog) {
+ dismiss();
+ }
+ if (onOkListener != null) {
+ onOkListener.onClick(v);
+ }
+ }
+ });
+ txtCancel.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ if (isAutoDismissDialog) {
+ dismiss();
+ }
+ if (onCancelListener != null) {
+ onCancelListener.onClick(v);
+ }
+ }
+ });
+
+ txtContent.setGravity( contentGravity );
+
+ if ( isContentClickSpanEnable ) {
+ txtContent.setMovementMethod( LinkMovementMethod.getInstance() );
+ }
+
+ }
+
+ private void initView() {
+ txtOk = findViewById(R.id.txt_ok);
+ txtCancel = findViewById(R.id.txt_cancel);
+// txtTitle = findViewById(R.id.txt_title);
+ txtContent = findViewById(R.id.txt_content);
+ txtSubContent = findViewById(R.id.txt_sub_content);
+ }
+
+ public TextView getTxtCancel() {
+ return txtCancel;
+ }
+
+// public void setTitle(String title) {
+// this.title = title;
+// }
+
+ public void setContent(CharSequence content) {
+ this.content = content;
+ }
+
+ public void setSubContent(String subContent) {
+ this.subContent = subContent;
+ }
+
+ public void setContentGravity(int gravity) {
+ contentGravity = gravity;
+ }
+
+ public void hiddenBtnCancel() {
+ txtCancel.setVisibility(View.GONE);
+ }
+
+ public void setOnOkClickListener(String okText, View.OnClickListener onOkClickListener) {
+ this.okText = okText;
+ this.onOkListener = onOkClickListener;
+ }
+
+ public void setOnOkClickListener(View.OnClickListener onOkClickListener) {
+ setOnOkClickListener("确定", onOkClickListener);
+ }
+
+ public void setOnCancelListener(String cancelText, View.OnClickListener onCancelListener) {
+ this.cancelText = cancelText;
+ this.onCancelListener = onCancelListener;
+ }
+
+ public void setOnCancelListener(View.OnClickListener onCancelListener) {
+ setOnCancelListener("取消", onCancelListener);
+ }
+
+ public void setAutoDismissDialog(boolean autoDismissDialog) {
+ isAutoDismissDialog = autoDismissDialog;
+ }
+
+ public void setBtnTextSize(int size){
+ mBtnSize = size;
+ }
+
+ public void setContentTextSize(int size){
+ mContentSize = size;
+ }
+
+ public void setContentColor(int color){
+ mContentColor = color;
+ }
+
+ public int getContentGravity() {
+ return contentGravity;
+ }
+
+ public void setContentClickSpanEnable( boolean contentClickSpanEnable ) {
+ isContentClickSpanEnable = contentClickSpanEnable;
+ }
+}
+
diff --git a/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/voice/VoiceController.kt b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/voice/VoiceController.kt
new file mode 100644
index 0000000000..5b623fb41f
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/java/com/mogo/module/tanlu/voice/VoiceController.kt
@@ -0,0 +1,57 @@
+package com.mogo.module.tanlu.voice
+
+import com.zhidao.auto.platform.voice.VoiceClient
+
+/**
+ * @description 声音控制类
+ *
+ * @author lixiaopeng
+ * @since 2019-11-01
+ */
+object VoiceController {
+ private lateinit var voiceClient: VoiceClient
+
+// fun initVoice() {
+// voiceClient = VoiceClient.getInstance(BaseApplication.getAppContext())
+// }
+
+ /**
+ * 设置语音命令回调接口
+ * @param callBack
+ */
+ fun setCallBack(callBack: VoiceClient.VoiceCmdCallBack) {
+ voiceClient.setCallBack(callBack)
+ }
+
+ /**
+ * @param speakText 语音播报内容
+ */
+ fun speakVoice(speakText: String) {
+ voiceClient.speakDefault(speakText)
+ }
+
+ /**
+ * 注册免唤醒命令
+ * @param customType 命令
+ * @param customWakeupCmd 命令对应的唤醒词集合
+ */
+ fun registerCustomWakeupCmd(customType: String, customWakeupCmd: Array) {
+ voiceClient.registerCustomWakeupCmd(customType, customWakeupCmd)
+ }
+
+ /**
+ * 取消免唤醒命令
+ * @param customType 命令
+ */
+ fun unRegisterCustomWakeupCmd(customType: String) {
+ voiceClient.unRegisterCustomWakeupCmd(customType)
+ }
+
+ /**
+ * 释放资源(界面销毁的时候调用)
+ */
+ fun release() {
+ voiceClient.release()
+ }
+
+}
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/anim/v2x_like_heart_animation.xml b/modules/mogo-module-tanlu/src/main/res/anim/v2x_like_heart_animation.xml
new file mode 100644
index 0000000000..eb0b1e566a
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/anim/v2x_like_heart_animation.xml
@@ -0,0 +1,61 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/anim/v2x_unlike_heart_animation.xml b/modules/mogo-module-tanlu/src/main/res/anim/v2x_unlike_heart_animation.xml
new file mode 100644
index 0000000000..2982515e45
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/anim/v2x_unlike_heart_animation.xml
@@ -0,0 +1,31 @@
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/app_icon.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/app_icon.png
new file mode 100644
index 0000000000..c97be4be12
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/app_icon.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/icon_heart_like.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/icon_heart_like.png
new file mode 100644
index 0000000000..3ce8b5d793
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/icon_heart_like.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/icon_heart_like_bg.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/icon_heart_like_bg.png
new file mode 100644
index 0000000000..95f8552545
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/icon_heart_like_bg.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/icon_heart_unlike.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/icon_heart_unlike.png
new file mode 100644
index 0000000000..2df4d5ba5d
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/icon_heart_unlike.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/icon_heart_unlike_bg.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/icon_heart_unlike_bg.png
new file mode 100644
index 0000000000..66a3d308ca
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/icon_heart_unlike_bg.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_solid_left_page_up_normal.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_solid_left_page_up_normal.png
new file mode 100644
index 0000000000..9c1a2a4aea
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_solid_left_page_up_normal.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_solid_left_page_up_press.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_solid_left_page_up_press.png
new file mode 100644
index 0000000000..d927b18877
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_solid_left_page_up_press.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_solid_right_page_up_normal.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_solid_right_page_up_normal.png
new file mode 100644
index 0000000000..dda526f475
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_solid_right_page_up_normal.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_solid_right_page_up_press.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_solid_right_page_up_press.png
new file mode 100644
index 0000000000..2289209d9a
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_solid_right_page_up_press.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_video_pause_btn_normal.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_video_pause_btn_normal.png
new file mode 100644
index 0000000000..90b401f17f
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_video_pause_btn_normal.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_video_play_btn_normal.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_video_play_btn_normal.png
new file mode 100644
index 0000000000..a30cf8591a
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_video_play_btn_normal.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_video_refresh_btn.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_video_refresh_btn.png
new file mode 100644
index 0000000000..7f021fc1a9
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_video_refresh_btn.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_view_empty_bg.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_view_empty_bg.png
new file mode 100644
index 0000000000..627aab9957
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/main_view_empty_bg.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/media_next.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/media_next.png
new file mode 100644
index 0000000000..339d7731ec
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/media_next.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/media_previous.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/media_previous.png
new file mode 100644
index 0000000000..7c0e9618fb
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/media_previous.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/public_arrow_back_iv.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/public_arrow_back_iv.png
new file mode 100644
index 0000000000..cd7159e219
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/public_arrow_back_iv.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/share_failed_icon.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/share_failed_icon.png
new file mode 100644
index 0000000000..38609be713
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/share_failed_icon.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_chat.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_chat.png
new file mode 100644
index 0000000000..89ae31e528
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_chat.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_chat_nomal.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_chat_nomal.png
new file mode 100644
index 0000000000..151904c2d9
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_chat_nomal.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_chat_press.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_chat_press.png
new file mode 100644
index 0000000000..8da24b97ee
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_chat_press.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_head_image.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_head_image.png
new file mode 100644
index 0000000000..a6fba691bb
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_head_image.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_like.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_like.png
new file mode 100644
index 0000000000..0f1c0132e1
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_like.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_logo.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_logo.png
new file mode 100644
index 0000000000..1fc2152cd5
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_logo.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_navi.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_navi.png
new file mode 100644
index 0000000000..db15c8c987
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_navi.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_normal_image.png b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_normal_image.png
new file mode 100644
index 0000000000..4be775c67e
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-ldpi/tanlu_normal_image.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/app_icon.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/app_icon.png
new file mode 100644
index 0000000000..c97be4be12
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/app_icon.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/icon_heart_like.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/icon_heart_like.png
new file mode 100644
index 0000000000..3ce8b5d793
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/icon_heart_like.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/icon_heart_like_bg.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/icon_heart_like_bg.png
new file mode 100644
index 0000000000..95f8552545
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/icon_heart_like_bg.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/icon_heart_unlike.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/icon_heart_unlike.png
new file mode 100644
index 0000000000..2df4d5ba5d
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/icon_heart_unlike.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/icon_heart_unlike_bg.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/icon_heart_unlike_bg.png
new file mode 100644
index 0000000000..66a3d308ca
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/icon_heart_unlike_bg.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_solid_left_page_up_normal.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_solid_left_page_up_normal.png
new file mode 100644
index 0000000000..9c1a2a4aea
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_solid_left_page_up_normal.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_solid_left_page_up_press.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_solid_left_page_up_press.png
new file mode 100644
index 0000000000..d927b18877
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_solid_left_page_up_press.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_solid_right_page_up_normal.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_solid_right_page_up_normal.png
new file mode 100644
index 0000000000..dda526f475
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_solid_right_page_up_normal.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_solid_right_page_up_press.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_solid_right_page_up_press.png
new file mode 100644
index 0000000000..2289209d9a
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_solid_right_page_up_press.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_video_pause_btn_normal.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_video_pause_btn_normal.png
new file mode 100644
index 0000000000..90b401f17f
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_video_pause_btn_normal.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_video_play_btn_normal.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_video_play_btn_normal.png
new file mode 100644
index 0000000000..a30cf8591a
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_video_play_btn_normal.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_video_refresh_btn.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_video_refresh_btn.png
new file mode 100644
index 0000000000..7f021fc1a9
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_video_refresh_btn.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_view_empty_bg.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_view_empty_bg.png
new file mode 100644
index 0000000000..627aab9957
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/main_view_empty_bg.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/media_next.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/media_next.png
new file mode 100644
index 0000000000..339d7731ec
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/media_next.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/media_previous.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/media_previous.png
new file mode 100644
index 0000000000..7c0e9618fb
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/media_previous.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/public_arrow_back_iv.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/public_arrow_back_iv.png
new file mode 100644
index 0000000000..cd7159e219
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/public_arrow_back_iv.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/share_failed_icon.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/share_failed_icon.png
new file mode 100644
index 0000000000..38609be713
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/share_failed_icon.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_chat.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_chat.png
new file mode 100644
index 0000000000..89ae31e528
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_chat.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_chat_nomal.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_chat_nomal.png
new file mode 100644
index 0000000000..151904c2d9
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_chat_nomal.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_chat_press.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_chat_press.png
new file mode 100644
index 0000000000..8da24b97ee
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_chat_press.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_head_image.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_head_image.png
new file mode 100644
index 0000000000..a6fba691bb
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_head_image.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_like.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_like.png
new file mode 100644
index 0000000000..0f1c0132e1
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_like.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_logo.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_logo.png
new file mode 100644
index 0000000000..1fc2152cd5
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_logo.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_navi.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_navi.png
new file mode 100644
index 0000000000..db15c8c987
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_navi.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_normal_image.png b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_normal_image.png
new file mode 100644
index 0000000000..4be775c67e
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-mdpi/tanlu_normal_image.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/main_video_pause_btn_normal.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/main_video_pause_btn_normal.png
new file mode 100644
index 0000000000..cbd22bb486
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/main_video_pause_btn_normal.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/main_video_play_btn_normal.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/main_video_play_btn_normal.png
new file mode 100644
index 0000000000..bddef2f872
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/main_video_play_btn_normal.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/main_view_empty_bg.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/main_view_empty_bg.png
new file mode 100644
index 0000000000..bde2223192
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/main_view_empty_bg.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/media_next.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/media_next.png
new file mode 100644
index 0000000000..cfb640f6a3
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/media_next.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/media_previous.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/media_previous.png
new file mode 100644
index 0000000000..fe7bd3486c
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/media_previous.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/share_failed_icon.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/share_failed_icon.png
new file mode 100644
index 0000000000..5ba01a14db
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/share_failed_icon.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/tanlu_head_image.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/tanlu_head_image.png
new file mode 100644
index 0000000000..a6fba691bb
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/tanlu_head_image.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/tanlu_logo.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/tanlu_logo.png
new file mode 100644
index 0000000000..d93e27ece5
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/tanlu_logo.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/tanlu_navi.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/tanlu_navi.png
new file mode 100644
index 0000000000..db15c8c987
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/tanlu_navi.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/tanlu_normal_image.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/tanlu_normal_image.png
new file mode 100644
index 0000000000..8cad619232
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi-1920x1000/tanlu_normal_image.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/icon_heart_like.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/icon_heart_like.png
new file mode 100644
index 0000000000..ce886a2383
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/icon_heart_like.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/icon_heart_like_bg.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/icon_heart_like_bg.png
new file mode 100644
index 0000000000..f196b6ff8e
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/icon_heart_like_bg.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/icon_heart_unlike.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/icon_heart_unlike.png
new file mode 100644
index 0000000000..0401ccc256
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/icon_heart_unlike.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/icon_heart_unlike_bg.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/icon_heart_unlike_bg.png
new file mode 100644
index 0000000000..33becf307e
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/icon_heart_unlike_bg.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/main_video_pause_btn_normal.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/main_video_pause_btn_normal.png
new file mode 100644
index 0000000000..cbd22bb486
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/main_video_pause_btn_normal.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/main_video_play_btn_normal.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/main_video_play_btn_normal.png
new file mode 100644
index 0000000000..bddef2f872
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/main_video_play_btn_normal.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/main_view_empty_bg.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/main_view_empty_bg.png
new file mode 100644
index 0000000000..bde2223192
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/main_view_empty_bg.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/media_next.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/media_next.png
new file mode 100644
index 0000000000..cfb640f6a3
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/media_next.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/media_previous.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/media_previous.png
new file mode 100644
index 0000000000..fe7bd3486c
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/media_previous.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/share_failed_icon.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/share_failed_icon.png
new file mode 100644
index 0000000000..5ba01a14db
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/share_failed_icon.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/tanlu_chat_nomal.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/tanlu_chat_nomal.png
new file mode 100644
index 0000000000..ffb73a8dbc
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/tanlu_chat_nomal.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/tanlu_chat_press.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/tanlu_chat_press.png
new file mode 100644
index 0000000000..db9134bd4d
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/tanlu_chat_press.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/tanlu_head_image.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/tanlu_head_image.png
new file mode 100644
index 0000000000..a6fba691bb
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/tanlu_head_image.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/tanlu_logo.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/tanlu_logo.png
new file mode 100644
index 0000000000..d93e27ece5
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/tanlu_logo.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/tanlu_navi.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/tanlu_navi.png
new file mode 100644
index 0000000000..db15c8c987
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/tanlu_navi.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/tanlu_normal_image.png b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/tanlu_normal_image.png
new file mode 100644
index 0000000000..01d1f3ebea
Binary files /dev/null and b/modules/mogo-module-tanlu/src/main/res/drawable-xhdpi/tanlu_normal_image.png differ
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/loading_bg.xml b/modules/mogo-module-tanlu/src/main/res/drawable/loading_bg.xml
new file mode 100644
index 0000000000..b6c8ef5b9d
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/loading_bg.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/selector_bg_btn_pause.xml b/modules/mogo-module-tanlu/src/main/res/drawable/selector_bg_btn_pause.xml
new file mode 100644
index 0000000000..5e45e9d00b
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/selector_bg_btn_pause.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/selector_bg_btn_play.xml b/modules/mogo-module-tanlu/src/main/res/drawable/selector_bg_btn_play.xml
new file mode 100644
index 0000000000..84339617e4
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/selector_bg_btn_play.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/selector_bg_btn_upload.xml b/modules/mogo-module-tanlu/src/main/res/drawable/selector_bg_btn_upload.xml
new file mode 100644
index 0000000000..9d5ae2e7bc
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/selector_bg_btn_upload.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/selector_bg_solid_left_page_up.xml b/modules/mogo-module-tanlu/src/main/res/drawable/selector_bg_solid_left_page_up.xml
new file mode 100644
index 0000000000..5448ebf742
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/selector_bg_solid_left_page_up.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/selector_bg_solid_right_page_up.xml b/modules/mogo-module-tanlu/src/main/res/drawable/selector_bg_solid_right_page_up.xml
new file mode 100644
index 0000000000..a3879591d8
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/selector_bg_solid_right_page_up.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/selector_chat_btn.xml b/modules/mogo-module-tanlu/src/main/res/drawable/selector_chat_btn.xml
new file mode 100644
index 0000000000..12db1a0776
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/selector_chat_btn.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/shape_bg_222533.xml b/modules/mogo-module-tanlu/src/main/res/drawable/shape_bg_222533.xml
new file mode 100644
index 0000000000..db9b3f3247
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/shape_bg_222533.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/shape_bg_222533_6px_bottom.xml b/modules/mogo-module-tanlu/src/main/res/drawable/shape_bg_222533_6px_bottom.xml
new file mode 100644
index 0000000000..1b882ade41
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/shape_bg_222533_6px_bottom.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/shape_bg_222533_9px.xml b/modules/mogo-module-tanlu/src/main/res/drawable/shape_bg_222533_9px.xml
new file mode 100644
index 0000000000..3ac5215724
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/shape_bg_222533_9px.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/shape_bg_99191c25_4px.xml b/modules/mogo-module-tanlu/src/main/res/drawable/shape_bg_99191c25_4px.xml
new file mode 100644
index 0000000000..f459707924
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/shape_bg_99191c25_4px.xml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/shape_bg_upload_222533.xml b/modules/mogo-module-tanlu/src/main/res/drawable/shape_bg_upload_222533.xml
new file mode 100644
index 0000000000..e6fcbff414
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/shape_bg_upload_222533.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/shape_bg_upload_press.xml b/modules/mogo-module-tanlu/src/main/res/drawable/shape_bg_upload_press.xml
new file mode 100644
index 0000000000..8a40f60d68
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/shape_bg_upload_press.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/small_video_seekbar_style.xml b/modules/mogo-module-tanlu/src/main/res/drawable/small_video_seekbar_style.xml
new file mode 100644
index 0000000000..c48724bdd8
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/small_video_seekbar_style.xml
@@ -0,0 +1,28 @@
+
+
+ -
+
+
+
+
+
+ -
+
+
+
+
+
+
+ -
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_dialog_bg.xml b/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_dialog_bg.xml
new file mode 100644
index 0000000000..61251bd7a5
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_dialog_bg.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_dialog_bottom_button_right_bg.xml b/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_dialog_bottom_button_right_bg.xml
new file mode 100644
index 0000000000..21152d5aac
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_dialog_bottom_button_right_bg.xml
@@ -0,0 +1,5 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_dialog_button_bg.xml b/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_dialog_button_bg.xml
new file mode 100644
index 0000000000..b4f3a4a62e
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_dialog_button_bg.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_dialog_button_right_bg.xml b/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_dialog_button_right_bg.xml
new file mode 100644
index 0000000000..4ecda55ea4
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_dialog_button_right_bg.xml
@@ -0,0 +1,7 @@
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_dialog_neterror_button_bg.xml b/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_dialog_neterror_button_bg.xml
new file mode 100644
index 0000000000..b7d8bed176
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_dialog_neterror_button_bg.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_event_type_red_bg.xml b/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_event_type_red_bg.xml
new file mode 100644
index 0000000000..29e0357cc9
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_event_type_red_bg.xml
@@ -0,0 +1,10 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_gradual_change_bg.xml b/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_gradual_change_bg.xml
new file mode 100644
index 0000000000..1dd431586f
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_gradual_change_bg.xml
@@ -0,0 +1,15 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_type_button_blue_bg.xml b/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_type_button_blue_bg.xml
new file mode 100644
index 0000000000..d2aa0a07c1
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/drawable/tanlu_type_button_blue_bg.xml
@@ -0,0 +1,8 @@
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/layout/tanlu_activity_media_full.xml b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_activity_media_full.xml
new file mode 100644
index 0000000000..83821faa8a
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_activity_media_full.xml
@@ -0,0 +1,72 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/layout/tanlu_dialog_cutom_layout.xml b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_dialog_cutom_layout.xml
new file mode 100644
index 0000000000..7e4ab5e49f
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_dialog_cutom_layout.xml
@@ -0,0 +1,81 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/mogo-module-tanlu/src/main/res/layout/tanlu_dialog_neterror_layout.xml b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_dialog_neterror_layout.xml
new file mode 100644
index 0000000000..8b19f35380
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_dialog_neterror_layout.xml
@@ -0,0 +1,63 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/mogo-module-tanlu/src/main/res/layout/tanlu_fullscreen_video_view_pager.xml b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_fullscreen_video_view_pager.xml
new file mode 100644
index 0000000000..231a9ba631
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_fullscreen_video_view_pager.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/layout/tanlu_item_main_media_recycler.xml b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_item_main_media_recycler.xml
new file mode 100644
index 0000000000..77031d9a53
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_item_main_media_recycler.xml
@@ -0,0 +1,174 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/layout/tanlu_item_main_media_recycler_new.xml b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_item_main_media_recycler_new.xml
new file mode 100644
index 0000000000..40236319c3
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_item_main_media_recycler_new.xml
@@ -0,0 +1,165 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/layout/tanlu_item_video_cover.xml b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_item_video_cover.xml
new file mode 100644
index 0000000000..eaaf91f104
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_item_video_cover.xml
@@ -0,0 +1,82 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/mogo-module-tanlu/src/main/res/layout/tanlu_item_video_cover_media.xml b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_item_video_cover_media.xml
new file mode 100644
index 0000000000..f01258705d
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_item_video_cover_media.xml
@@ -0,0 +1,86 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/modules/mogo-module-tanlu/src/main/res/layout/tanlu_main_media_recycler.xml b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_main_media_recycler.xml
new file mode 100644
index 0000000000..9e88dff310
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_main_media_recycler.xml
@@ -0,0 +1,70 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/layout/tanlu_main_media_recycler_new.xml b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_main_media_recycler_new.xml
new file mode 100644
index 0000000000..e4c7898356
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/layout/tanlu_main_media_recycler_new.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/values-xhdpi-1920x1000/dimens.xml b/modules/mogo-module-tanlu/src/main/res/values-xhdpi-1920x1000/dimens.xml
new file mode 100644
index 0000000000..3dc0047c7a
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/values-xhdpi-1920x1000/dimens.xml
@@ -0,0 +1,99 @@
+
+
+
+
+ 98px
+ 98px
+ 48px
+ 48px
+ 72px
+ 5px
+
+ 106px
+ 106px
+ 96px
+ 96px
+ 100px
+ 700px
+ 12px
+
+ 135px
+ 50px
+ 50px
+ 30px
+ 92px
+ 40px
+ 800px
+
+ 14px
+ 28px
+ 4px
+ 32px
+ 255px
+ 82px
+ 2px
+ 205px
+ 20px
+ 40px
+ 60px
+ 50px
+ 32px
+ 40px
+ 50px
+
+
+ 10px
+
+ 750px
+ 270px
+ 120px
+ 60px
+
+ 488px
+ 82px
+
+
+ 34px
+ 24px
+ 28px
+ 26px
+ 30px
+
+
+ 790px
+ 524px
+ 130px
+ 40px
+ 66px
+ 36px
+ 59px
+
+ 44px
+ 105px
+ 44px
+
+ 20px
+ 16px
+
+
+ 1233px
+ 300px
+ 480px
+ 270px
+
+ 20px
+ 15px
+ 25px
+ 15px
+ 5px
+ 27px
+ 46px
+
+ 50px
+ 90px
+ 6px
+ 30px
+
+
+
+
diff --git a/modules/mogo-module-tanlu/src/main/res/values-xhdpi/dimens.xml b/modules/mogo-module-tanlu/src/main/res/values-xhdpi/dimens.xml
new file mode 100644
index 0000000000..b103b2b1ac
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/values-xhdpi/dimens.xml
@@ -0,0 +1,99 @@
+
+
+
+
+ 98px
+ 98px
+ 48px
+ 48px
+ 72px
+ 5px
+
+ 106px
+ 106px
+ 96px
+ 96px
+ 100px
+ 700px
+ 12px
+
+ 135px
+ 50px
+ 50px
+ 30px
+ 92px
+ 40px
+ 800px
+
+ 30px
+ 28px
+ 4px
+ 32px
+ 255px
+ 82px
+ 2px
+ 205px
+ 20px
+ 40px
+ 60px
+ 50px
+ 32px
+ 40px
+ 50px
+
+
+ 10px
+
+ 750px
+ 270px
+ 120px
+ 60px
+
+ 488px
+ 82px
+
+
+ 34px
+ 24px
+ 28px
+ 26px
+ 30px
+
+
+ 790px
+ 524px
+ 130px
+ 40px
+ 66px
+ 36px
+ 59px
+
+ 44px
+ 105px
+ 44px
+
+ 20px
+ 16px
+
+
+ 1060px
+ 350px
+ 480px
+ 320px
+
+ 23px
+ 15px
+ 25px
+ 15px
+ 10px
+ 27px
+ 46px
+
+ 50px
+ 98px
+ 6px
+ 30px
+
+
+
+
diff --git a/modules/mogo-module-tanlu/src/main/res/values/colors.xml b/modules/mogo-module-tanlu/src/main/res/values/colors.xml
new file mode 100644
index 0000000000..48a00d3b8d
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/values/colors.xml
@@ -0,0 +1,43 @@
+
+
+ #000000
+ #000000
+ #1F7FFF
+ #FFFFFF
+ #80FFFFFF
+ #1E212C
+ #1F7FFF
+ #171F7FFF
+ #4d191C25
+ #99191C25
+ #222533
+ #303447
+ #323131
+ #4B5369
+ #9A9A9A
+ #A2A2A2
+ #5a979797
+ #80FFFFFF
+ #00FFFFFF
+ #b3000000
+ #0DFFFFFF
+ #000000
+ #69718B
+ #213142
+ #33FFFFFF
+ #B3000000
+ #0091FF
+ #d9000000
+ #FF1B1B
+
+ #F8F8F8
+ #333333
+ #DADAE2
+ #545362
+ #99191C25
+ #99666666
+ #999999
+ #99FFFFFF
+ #59FFFFFF
+
+
diff --git a/modules/mogo-module-tanlu/src/main/res/values/dimens.xml b/modules/mogo-module-tanlu/src/main/res/values/dimens.xml
new file mode 100644
index 0000000000..20e89547a3
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/values/dimens.xml
@@ -0,0 +1,97 @@
+
+
+
+ 52px
+ 52px
+ 48px
+ 48px
+ 72px
+ 5px
+
+ 56px
+ 56px
+ 96px
+ 96px
+ 90px
+ 700px
+ 10px
+
+ 72px
+ 25px
+ 25px
+ 16px
+ 48px
+ 22px
+ 700px
+
+
+ 10px
+ 15px
+ 2px
+ 19px
+ 136px
+ 44px
+ 2px
+ 109px
+ 10px
+ 23px
+ 30px
+ 28px
+ 16px
+ 22px
+ 26px
+
+
+ 6px
+
+ 400px
+ 150px
+ 80px
+ 32px
+
+ 260px
+ 44px
+
+
+ 18px
+ 14px
+ 15px
+ 13px
+ 16px
+
+
+ 418px
+ 278px
+ 69px
+ 22px
+ 36px
+ 18px
+ 32px
+
+ 20px
+ 56px
+ 23px
+
+ 10px
+ 8px
+
+
+ 642px
+ 194px
+ 266px
+ 194px
+
+ 16px
+ 8px
+ 13px
+ 15px
+ 10px
+ 18px
+ 26px
+
+ 28px
+ 56px
+ 3px
+ 16px
+
+
\ No newline at end of file
diff --git a/modules/mogo-module-tanlu/src/main/res/values/strings.xml b/modules/mogo-module-tanlu/src/main/res/values/strings.xml
new file mode 100644
index 0000000000..ac9866e506
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/values/strings.xml
@@ -0,0 +1,41 @@
+
+ tanlu
+ 返回
+ 取消授权
+ 《探路共享计划》
+ 已同意
+ 探路共享计划 >>
+ 探路APP用户服务协议
+ 未找到其他用户分享的拥堵信息,
您可以试试分享拥堵]]>
+ 未找到其他用户分享的路况
+ 未知区域
+ 上报路况
+ 正在更新情报数据
+ 欢迎使用探路,您可以在探路内查看到周边的实时路况,也可以通过关键词“上报路况”来分享一段视频给其他车主
+ 您还可以试试语音上报
+ 为您找到%s条路况信息
+ 开启小智车联
+ 共享计划
+ 上一条
+ 下一条
+ 已分享成功,你分享的内容将帮助%s位车友
+ 上传失败
+ 将为您播放
+ 上报路况
+ 为你查询到导航路线沿途的路况信息,可以对我说上一条、下一条来查看
+
+ 取消(%s)
+ 好的(%s)
+
+
+ - 正在为您搜索路况
+ - 探路系统正在为您搜索
+ - 小智这就去查,您稍等一下
+
+
+ - 找不到相关地址
+ - 找不到地址,是小智不好
+ - 未找到其他车主分享的路况信息
+
+
+
diff --git a/modules/mogo-module-tanlu/src/main/res/values/styles.xml b/modules/mogo-module-tanlu/src/main/res/values/styles.xml
new file mode 100644
index 0000000000..1a0cf70536
--- /dev/null
+++ b/modules/mogo-module-tanlu/src/main/res/values/styles.xml
@@ -0,0 +1,22 @@
+
+
+
+
+
+
+
+
+
+
diff --git a/settings.gradle b/settings.gradle
index 6f334160e1..83d8fa5d49 100644
--- a/settings.gradle
+++ b/settings.gradle
@@ -36,3 +36,6 @@ include ':main-extensions:mogo-module-main-launcher'
include ':modules:mogo-module-push'
include ':modules:mogo-module-push-base'
include ':modules:mogo-module-push-noop'
+
+include ':modules:mogo-module-tanlu'
+include ':libraries:tanlulib'