diff --git a/.idea/gradle.xml b/.idea/gradle.xml
index 5ecdf77031..89ad10bff2 100644
--- a/.idea/gradle.xml
+++ b/.idea/gradle.xml
@@ -29,8 +29,6 @@
-
-
@@ -40,6 +38,7 @@
+
diff --git a/.idea/misc.xml b/.idea/misc.xml
index 21e99e2dc0..cd77a1f062 100644
--- a/.idea/misc.xml
+++ b/.idea/misc.xml
@@ -4,7 +4,7 @@
-
+
\ No newline at end of file
diff --git a/app/build.gradle b/app/build.gradle
index aac18fc73d..36f516089d 100644
--- a/app/build.gradle
+++ b/app/build.gradle
@@ -273,6 +273,7 @@ dependencies {
implementation rootProject.ext.dependencies.moduleservice
implementation rootProject.ext.dependencies.modulesplash
implementation rootProject.ext.dependencies.moduleV2x
+ implementation rootProject.ext.dependencies.mogomonitor
} else {
launcherImplementation project(':main-extensions:mogo-module-main-launcher')
independentImplementation project(':main-extensions:mogo-module-main-independent')
@@ -284,12 +285,12 @@ dependencies {
implementation project(':modules:mogo-module-service')
implementation project(':modules:mogo-module-splash')
implementation project(':modules:mogo-module-v2x')
+ implementation project(':modules:mogo-module-monitor')
}
apply from: "./functions/baseservices.gradle"
apply from: "./functions/socketpush.gradle"
apply from: "./functions/gpssimulator.gradle"
- apply from: "./functions/eventpanel.gradle"
apply from: "./functions/leftpanel.gradle"
}
diff --git a/app/functions/eventpanel.gradle b/app/functions/eventpanel.gradle
deleted file mode 100644
index 335614ab29..0000000000
--- a/app/functions/eventpanel.gradle
+++ /dev/null
@@ -1,25 +0,0 @@
-// 道路事件操作面板
-
-project.dependencies {
- if (Boolean.valueOf(RELEASE)) {
- d8xxImplementation rootProject.ext.dependencies.moduleventpanelnoop
-
- d82xImplementation rootProject.ext.dependencies.moduleventpanelnoop
- em1Implementation rootProject.ext.dependencies.moduleventpanelnoop
- bydautoImplementation rootProject.ext.dependencies.moduleventpanelnoop
- em4Implementation rootProject.ext.dependencies.moduleventpanelnoop
- e8xxImplementation rootProject.ext.dependencies.moduleventpanelnoop
- f8xxImplementation rootProject.ext.dependencies.moduleventpanelnoop
- em3Implementation rootProject.ext.dependencies.moduleventpanelnoop
- } else {
- d8xxImplementation project(':modules:mogo-module-event-panel-noop')
-
- d82xImplementation project(':modules:mogo-module-event-panel-noop')
- em1Implementation project(':modules:mogo-module-event-panel-noop')
- bydautoImplementation project(':modules:mogo-module-event-panel-noop')
- em4Implementation project(':modules:mogo-module-event-panel-noop')
- e8xxImplementation project(':modules:mogo-module-event-panel-noop')
- f8xxImplementation project(':modules:mogo-module-event-panel-noop')
- em3Implementation project(':modules:mogo-module-event-panel-noop')
- }
-}
\ No newline at end of file
diff --git a/app/src/main/java/com/mogo/launcher/MogoApplication.java b/app/src/main/java/com/mogo/launcher/MogoApplication.java
index a067f4bf8e..2a3c941289 100644
--- a/app/src/main/java/com/mogo/launcher/MogoApplication.java
+++ b/app/src/main/java/com/mogo/launcher/MogoApplication.java
@@ -29,7 +29,6 @@ import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.LogLevel;
import com.mogo.utils.logger.Logger;
import com.zhidao.boot.persistent.lib.PersistentManager;
-import com.zhidao.mogo.module.event.panel.EventPanelConstants;
import com.zhidao.mogo.module.left.panel.LeftPanelConst;
/**
@@ -67,11 +66,11 @@ public class MogoApplication extends AbsMogoApplication {
MogoModulePaths.addModule( new MogoModule( TanluConstants.TAG, TanluConstants.MODEL_NAME ) );
MogoModulePaths.addModule( new MogoModule( MogoServicePaths.PATH_SHARE, "ShareControl" ) );
- MogoModulePaths.addModule( new MogoModule( EventPanelConstants.PATH_NAME, EventPanelConstants.MODULE_NAME ) );
MogoModulePaths.addModule( new MogoModule( LeftPanelConst.PATH_NAME, LeftPanelConst.MODULE_NAME ) );
MogoModulePaths.addBaseModule( new MogoModule( ServiceConst.PATH_REFRESH_STRATEGY, ServiceConst.PATH_REFRESH_STRATEGY ) );
- MogoModulePaths.addBaseModule( new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.PATH_V2X_UI ) );
+ MogoModulePaths.addBaseModule( new MogoModule( V2XConst.PATH_V2X_UI, V2XConst.MODULE_NAME ) );
+ MogoModulePaths.addModule( new MogoModule( V2XConst.PATH_EVENT_PANEL, V2XConst.MODULE_NAME_EVENT_PANEL ) );
MogoModulePaths.addModule( new MogoModule( PushUIConstants.PATH, PushUIConstants.NAME ) );
if ( !DebugConfig.isLauncher() ) {
diff --git a/config.gradle b/config.gradle
index e5a0c4e313..5eac4c2d47 100644
--- a/config.gradle
+++ b/config.gradle
@@ -21,6 +21,7 @@ targetSdkVersion : 22,
androidxviewpager2 : "androidx.viewpager2:viewpager2:1.0.0",
androidxrecyclerview : "androidx.recyclerview:recyclerview:1.1.0",
androidxcardview : "androidx.cardview:cardview:1.0.0",
+ localbroadcastmanager : "androidx.localbroadcastmanager:localbroadcastmanager:1.0.0",
// flexbox
flexbox : 'com.google.android:flexbox:2.0.1',
// 测试
@@ -76,7 +77,7 @@ targetSdkVersion : 22,
roomRxjava : "android.arch.persistence.room:rxjava2:1.1.1",
// material
- material : 'com.google.android.material:material:1.0.0',
+ material : 'com.google.android.material:material:1.1.0',
// modules
@@ -174,6 +175,8 @@ targetSdkVersion : 22,
mogobaseserviceapk : "com.mogo.base:services-apk:${MOGO_BASE_SERVICES_APK_VERSION}",
// loglib
mogologlib : "com.mogo.module:module-loglib:${LOGLIB_VERSION}",
+ // monitor
+ mogomonitor : "com.mogo.module:module-monitor:${MOGO_MODULE_MONITOR_VERSION}",
// google
googlezxing : "com.google.zxing:core:3.3.3",
diff --git a/foudations/mogo-commons/src/main/java/com/mogo/commons/mvp/MvpFragment.java b/foudations/mogo-commons/src/main/java/com/mogo/commons/mvp/MvpFragment.java
index 3561592a54..be7f2bac04 100644
--- a/foudations/mogo-commons/src/main/java/com/mogo/commons/mvp/MvpFragment.java
+++ b/foudations/mogo-commons/src/main/java/com/mogo/commons/mvp/MvpFragment.java
@@ -37,8 +37,9 @@ public abstract class MvpFragment> exten
mRootView = inflater.inflate( getLayoutId(), container, false );
} else {
ViewGroup viewGroup = ( ViewGroup ) mRootView.getParent();
- if ( viewGroup != null )
+ if ( viewGroup != null ) {
viewGroup.removeView( mRootView );
+ }
}
mRootView = inflater.inflate(getLayoutId(), container, false);
return mRootView;
diff --git a/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/BaseDao.kt b/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/BaseDao.kt
deleted file mode 100644
index b144237096..0000000000
--- a/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/BaseDao.kt
+++ /dev/null
@@ -1,432 +0,0 @@
-package com.mogo.utils.sqlite
-
-import android.content.ContentValues
-import android.database.Cursor
-import android.database.sqlite.SQLiteDatabase
-import com.mogo.utils.logger.Logger
-import com.mogo.utils.sqlite.annotation.DbField
-import com.mogo.utils.sqlite.annotation.DbTable
-import java.lang.reflect.Field
-import java.util.*
-
-
-/**
- * 数据类操作实现
- *Created by donghongyu on 2019/9/6.
- */
-//T必须指明上界是Any且不为null,下面会用到反射获取对象实例,默认是Any?
-open class BaseDao : IBaseDao {
- private val TAG = "BaseDao"
-
- //数据库操作的引用
- private var sqLiteDatabase: SQLiteDatabase? = null
-
- //要操作的数据实体的引用
- private var entityClass: Class? = null
-
- //要操作的数据表名称
- private var tableName: String? = null
-
- //记录数据表是否存在
- private var isInit = false
-
- //因为反射会消耗时间,这里使用缓存,进行性能优化
- //缓存空间(key-字段名,标注的自定义注解 value-成员变量)
- private var cacheField: HashMap? = null
-
- override fun init(sqLiteDatabase: SQLiteDatabase, entityClass: Class): Boolean {
- this.sqLiteDatabase = sqLiteDatabase
- this.entityClass = entityClass
- //自动建表(只创建一次)
- if (!isInit) {
- //获取表名
- tableName = entityClass.getAnnotation(DbTable::class.java).tableName
-
- //如果数据库没有建立连接跳出操作防止异常信息
- if (!sqLiteDatabase.isOpen) {
- return false
- }
-
- //执行Sql进行自动建表
- val createTableSql = getCreateTableSql()
- Logger.d(TAG, "执行SQL:$createTableSql")
-
- sqLiteDatabase.execSQL(createTableSql)
-
- //初始化缓存空间
- cacheField = HashMap()
- initCacheField()
-
- //标记已经创建过数据表
- isInit = true
- }
-
- return isInit
- }
-
- /**
- * 初始化字段缓存
- */
- private fun initCacheField() {
- //1.取到所有的列名(查询一个空表获取表结构,不影响性能)
- if (sqLiteDatabase != null && sqLiteDatabase!!.isOpen) {
- val sqlQuery = "select * from $tableName limit 1,0"
- val cursor = sqLiteDatabase!!.rawQuery(sqlQuery, null)
- //获取所有的列名
- val columnNames = cursor.columnNames
- //关闭资源
- cursor.close()
- //2.取所有成员名
- val columnFields = entityClass!!.declaredFields
- //3.通过两层循环,进行对应关系建立
- columnNames.forEach ColumnFor@{ columnName ->
- columnFields.forEach FieldFor@{ columnField ->
- if (columnName == columnField.getAnnotation(DbField::class.java).fieldName) {
- columnField.isAccessible = true
- cacheField!![columnName] = columnField
- }
- return@FieldFor
- }
- }
- }
- }
-
- /**
- * 拼装创建数据表的SQL语句
- */
- private fun getCreateTableSql(): String? {
- //create table if not exists tb_name(_id integer,name varchar2(20))
- val sqlCreateTable = StringBuffer()
- sqlCreateTable.append("create table if not exists ")
- sqlCreateTable.append("$tableName (")
- //反射获取所有的数据对象内的成员变量
- val fields = entityClass!!.declaredFields
-
- fields.forEachIndexed { index, field ->
- //字段名称
- val columnName = field.getAnnotation(DbField::class.java).fieldName
- //获取成员变量数据类型
-
- when (val fieldType = field.type) {
- java.lang.String::class.java -> {
- sqlCreateTable.append("$columnName TEXT,")
- }
- java.lang.Integer::class.java -> {
- sqlCreateTable.append("$columnName INTEGER,")
- }
- java.lang.Long::class.java -> {
- sqlCreateTable.append("$columnName BIGINT,")
- }
- java.lang.Double::class.java -> {
- sqlCreateTable.append("$columnName DOUBLE,")
- }
- ByteArray::class.java -> {
- sqlCreateTable.append("$columnName BLOB,")
- }
- else -> {
- //未知类型
- throw UnsupportedOperationException("未定义的数据类型:fieldName= $columnName fieldType= $fieldType")
- }
- }
-
- if (index == fields.size - 1) {
- if (sqlCreateTable.endsWith(","))
- sqlCreateTable.deleteCharAt(sqlCreateTable.length - 1)
- }
- }
- sqlCreateTable.append(")")
-
- return sqlCreateTable.toString()
- }
-
- /**
- * 插入数据
- */
- override fun insert(entity: T): Long {
- //1、准备好ContentValues中的数据
- //2、设置插入的内容
- val values: ContentValues = getContentValuesForInsert(entity)
- //3、执行插入
- return if (sqLiteDatabase != null && sqLiteDatabase!!.isOpen) {
- sqLiteDatabase!!.insert(tableName, null, values)
- } else {
- -1
- }
- }
-
- /**
- * 删除数据
- */
- override fun delete(where: T): Int {
- val condition = Condition(getContentValuesForQuery(where))
-
- return if (sqLiteDatabase != null && sqLiteDatabase!!.isOpen) {
- //受影响行数
- sqLiteDatabase!!
- .delete(
- tableName,
- condition.getWhereCause(),
- condition.getWhereArgs()
- )
- } else {
- -1
- }
- }
-
- /**
- * 更新数据
- */
- override fun update(where: T, newEntity: T): Int {
- val condition = Condition(getContentValuesForQuery(where))
-
- return if (sqLiteDatabase != null && sqLiteDatabase!!.isOpen) {
- //受影响行数
- sqLiteDatabase!!
- .update(
- tableName,
- getContentValuesForInsert(newEntity),
- condition.getWhereCause(),
- condition.getWhereArgs()
- )
- } else {
- -1
- }
- }
-
- /**
- * 查询数据
- * @param where 查询条件对象,同时也用来初始化对象使用
- */
- override fun query(where: T): MutableList {
- return query(where, null, null, null)
- }
-
- /**
- * 查询数据
- * @param where 查询条件对象
- * @param orderBy 排序规则
- * @param startIndex 开始的位置
- * @param limit 限制查询得到的数据个数
- */
- fun query(where: T, orderBy: String?, startIndex: Int?, limit: Int?): MutableList {
- //拼接分页语句
- var limitString: String? = null
- if (startIndex != null && limit != null) {
- limitString = "$startIndex,$limit"
- }
-
- val condition = Condition(getContentValuesForQuery(where))
-
- var cursor: Cursor? = null
-
- //定义查询结果
- val result = mutableListOf()
- if (sqLiteDatabase != null && sqLiteDatabase!!.isOpen) {
- try {
- //查询数据库
- cursor = sqLiteDatabase!!
- .query(
- tableName,
- null,
- condition.getWhereCause(),
- condition.getWhereArgs(),
- null,
- null,
- orderBy,
- limitString
- )
- //将查到结果添加到返回集合中
- result.addAll(getQueryResult(cursor, where))
- } catch (e: Exception) {
- e.printStackTrace()
- } finally {
- cursor?.close()
- }
- }
- return result
- }
-
- /**
- * 获取查询使用的ContentValues
- */
- private fun getContentValuesForQuery(entity: T): ContentValues {
- val contentValues = ContentValues()
- try {
- cacheField!!.forEach {
- if (it.value.get(entity) == null) {
- return@forEach
- }
- contentValues.put(it.key, it.value.get(entity).toString())
- }
- } catch (e: IllegalAccessError) {
- e.printStackTrace()
- }
-
- return contentValues
- }
-
- /**
- * 条件拼接
- */
- class Condition(whereContent: ContentValues) {
- /**
- * 条件拼接
- * _id=?&&name=?
- */
- private var whereCause: String? = null
-
- private var whereArgs: Array? = null
-
- //根据传入的contentValues转换成查询条件
- init {
- //记录后面填充到查询语句“?”上的数据参数
- val argList = mutableListOf()
- //拼接查询语句
- val whereCaseSb = StringBuilder()
-
- /**
- * 是为了链接下面的查询条件条件,也或者是替换没有查询条件的语句。
- * 比如:要把检索条件作为一个参数传递给SQL,
- * 那么,当这个检索语句不存在的话就可以给它赋值为1=1.
- * 这样就避免了SQL出错,也就可以把加条件的SQL和不加条件的SQL合二为一。
- */
- whereCaseSb.append(" 1=1 ")
-
- val keys = whereContent.keySet()
- val iterator = keys.iterator()
-
- //因为使用了“1=1”,所以即便是这里没有任何数据拼接,也是可以正常
- while (iterator.hasNext()) {
- val key = iterator.next() as String
- val valueObject = whereContent.get(key)
- if (valueObject != null) {
- val value = valueObject as String
- //拼接查询条件语句
- //1:1 and _id=? and name=?
- whereCaseSb.append(" and $key =?")
-
- //记录?对应的value
- argList.add(value)
- }
- }
- //集合转成数组
- this.whereArgs = argList.toTypedArray()
- this.whereCause = whereCaseSb.toString()
- }
-
- fun getWhereCause(): String {
- return this.whereCause!!
- }
-
- fun getWhereArgs(): Array {
- return this.whereArgs!!
- }
- }
-
- /**
- * 获取查询db结果
- */
- private fun getQueryResult(cursor: Cursor, where: T): MutableList {
- //定义查询结果
- val result = mutableListOf()
- //Cursor从头读到尾
- //游标从头读到尾
- cursor.moveToFirst()
- //移动游标获取下一行数据
- while (!cursor.isAfterLast) {
- //通过反射构建一个查询结果对象
- val item = where.javaClass.newInstance()
-
- //拿到缓存的当前数据对象的成员变量与数据库的键值关系
- val fieldIterator = cacheField!!.entries.iterator()
- fieldIterator.forEach IteratorFor@{
- //获取数据库字段名称
- val columnName = it.key
- //数据库字段名对应的数据对象的成员变量
- val field = it.value
- //获取指定列名对应的索引
- val columnIndex = cursor.getColumnIndex(columnName)
- //获取成员变量数据类型
- val fieldType = field.type
-
- if (columnIndex != -1) {
- when (fieldType) {
- java.lang.String::class.java -> {
- field.set(item, cursor.getString(columnIndex))
- }
- java.lang.Integer::class.java -> {
- field.set(item, cursor.getInt(columnIndex))
- }
- java.lang.Long::class.java -> {
- field.set(item, cursor.getLong(columnIndex))
- }
- java.lang.Double::class.java -> {
- field.set(item, cursor.getDouble(columnIndex))
- }
- ByteArray::class.java -> {
- field.set(item, cursor.getBlob(columnIndex))
- }
- else -> {
- //未知类型
- throw UnsupportedOperationException("未定义的数据类型:columnName= $columnName fieldType= $fieldType")
- }
- }
- }
- }
- //添加到结果集
- result.add(item)
- //移动到下一个位置
- cursor.moveToNext()
- }
- cursor.close()
- return result
- }
-
- /**
- * 获取插入使用的ContentValues
- */
- private fun getContentValuesForInsert(entity: T): ContentValues {
- val contentValues = ContentValues()
-
- val fieldIterator = cacheField!!.entries.iterator()
-
- fieldIterator.forEach IteratorFor@{
- try {
- //获取变量的值
- val valueObject = it.value.get(entity) ?: return@IteratorFor
- //获取列名
- val columnName = it.key
- //获取成员变量数据类型
- val fieldType = it.value.type
- when (fieldType) {
- java.lang.String::class.java -> {
- contentValues.put(columnName, valueObject as String)
- }
- java.lang.Integer::class.java -> {
- contentValues.put(columnName, valueObject as Int)
- }
- java.lang.Long::class.java -> {
- contentValues.put(columnName, valueObject as Long)
- }
- java.lang.Double::class.java -> {
- contentValues.put(columnName, valueObject as Double)
- }
- ByteArray::class.java -> {
- contentValues.put(columnName, valueObject as ByteArray)
- }
- else -> {
- //未知类型
- throw UnsupportedOperationException("未定义的数据类型:columnName= $columnName fieldType= $fieldType")
- }
- }
- } catch (e: IllegalArgumentException) {
- e.printStackTrace()
- }
- }
-
- Logger.d(TAG, "contentValues:$contentValues")
-
- return contentValues
- }
-
-}
\ No newline at end of file
diff --git a/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/IBaseDao.kt b/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/IBaseDao.kt
deleted file mode 100644
index 7af36200b8..0000000000
--- a/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/IBaseDao.kt
+++ /dev/null
@@ -1,35 +0,0 @@
-package com.mogo.utils.sqlite
-
-import android.database.sqlite.SQLiteDatabase
-
-/**
- * 操作SQLite数据库的顶层接口
- * Created by donghongyu on 2019/9/6.
- */
-interface IBaseDao {
- /**
- * 初始化数据库连接
- */
- fun init(sqLiteDatabase: SQLiteDatabase, entityClass: Class): Boolean
-
- /**
- * 将 [entity] 进行数据插入
- */
- fun insert(entity: T): Long
-
- /**
- * 根据条件 [where] 进行数据删除
- */
- fun delete(where: T): Int
-
- /**
- * 根据条件 [where] 进行数据更新,如果[where]==null 则代表删除所有数据
- */
- fun update(where: T, newEntity: T): Int
-
- /**
- * 根据条件 [where] 进行数据查询,如果[where]==null 则代表查询所有数据
- */
- fun query(where: T): MutableList
-
-}
\ No newline at end of file
diff --git a/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/SQLBaseDao.java b/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/SQLBaseDao.java
new file mode 100644
index 0000000000..6d36051aee
--- /dev/null
+++ b/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/SQLBaseDao.java
@@ -0,0 +1,462 @@
+package com.mogo.utils.sqlite;
+
+import android.content.ContentValues;
+import android.database.Cursor;
+import android.database.sqlite.SQLiteDatabase;
+
+import com.mogo.utils.logger.Logger;
+import com.mogo.utils.sqlite.annotation.DbField;
+import com.mogo.utils.sqlite.annotation.DbTable;
+
+import org.jetbrains.annotations.NotNull;
+
+import java.lang.reflect.Field;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+import java.util.Set;
+
+/**
+ * 数据库操作
+ *
+ * @param
+ * @author donghongyu
+ */
+public class SQLBaseDao implements SQLIDao {
+ private String TAG = "SQLBaseDao";
+
+ //数据库操作的引用
+ private SQLiteDatabase sqLiteDatabase;
+ //要操作的数据实体的引用
+ private Class entityClass;
+ //要操作的数据表名称
+ private String tableName;
+ //记录数据表是否存在
+ private boolean isInit = false;
+
+ //因为反射会消耗时间,这里使用缓存,进行性能优化
+ //缓存空间(key-字段名,标注的自定义注解 value-成员变量)
+ private HashMap cacheField;
+
+ @Override
+ public boolean init(@NotNull SQLiteDatabase sqLiteDatabase, @NotNull Class entityClass) {
+ this.sqLiteDatabase = sqLiteDatabase;
+ this.entityClass = entityClass;
+ //自动建表(只创建一次)
+ if (!isInit) {
+ //获取表名
+ tableName = entityClass.getAnnotation(DbTable.class).tableName();
+
+ //如果数据库没有建立连接跳出操作防止异常信息
+ if (!sqLiteDatabase.isOpen()) {
+ return false;
+ }
+
+ //执行Sql进行自动建表
+ String createTableSql = getCreateTableSql();
+ Logger.d(TAG, "执行SQL:" + createTableSql);
+ sqLiteDatabase.execSQL(createTableSql);
+
+ //初始化缓存空间
+ cacheField = new HashMap();
+ initCacheField();
+
+ //标记已经创建过数据表
+ isInit = true;
+ }
+
+ return isInit;
+ }
+
+ /**
+ * 插入数据
+ *
+ * @param entity 要插入数据的数据对象爱你那个
+ * @return 插入结果ID,如果发生错误则为-1
+ */
+ @Override
+ public long insert(T entity) {
+ //1、准备好ContentValues中的数据
+ //2、设置插入的内容
+ ContentValues values = getContentValuesForInsert(entity);
+ //3、执行插入
+ long result;
+ if (sqLiteDatabase != null && sqLiteDatabase.isOpen()) {
+ result = sqLiteDatabase.insert(tableName, null, values);
+ } else {
+ result = -1;
+ }
+ return result;
+ }
+
+ /**
+ * 删除数据
+ *
+ * @param where 要删除的对象,对象的字段如果赋值,则代表查询条件
+ * @return 受影响行数
+ */
+ @Override
+ public int delete(T where) {
+ // 拼接查询条件
+ Condition condition = new Condition(getContentValuesForQuery(where));
+ int result;
+ if (sqLiteDatabase != null && sqLiteDatabase.isOpen()) {
+ //受影响行数
+ result = sqLiteDatabase.delete(
+ tableName,
+ condition.getWhereCause(),
+ condition.getWhereArgs()
+ );
+ } else {
+ result = -1;
+ }
+ return result;
+ }
+
+ /**
+ * 更新数据
+ *
+ * @param where 要更新的对象,对象的字段如果赋值,则代表查询条件
+ * @param newEntity 新的数据内容
+ * @return 受影响行数
+ */
+ @Override
+ public int update(T where, T newEntity) {
+ Condition condition = new Condition(getContentValuesForQuery(where));
+ int result;
+ if (sqLiteDatabase != null && sqLiteDatabase.isOpen()) {
+ //受影响行数
+ result = sqLiteDatabase.update(
+ tableName,
+ getContentValuesForInsert(newEntity),
+ condition.getWhereCause(),
+ condition.getWhereArgs()
+ );
+ } else {
+ result = -1;
+ }
+ return result;
+ }
+
+ /**
+ * 查询数据
+ *
+ * @param where 查询条件对象,同时也用来初始化对象使用
+ */
+ @NotNull
+ @Override
+ public List query(T where) {
+ return query(where, null, null, null);
+ }
+
+
+ /**
+ * 查询数据
+ *
+ * @param where 查询条件对象,同时也用来初始化对象使用
+ */
+ @NotNull
+ @Override
+ public List query(T where, String orderBy) {
+ return query(where, orderBy, null, null);
+ }
+
+ /**
+ * @param where 根据条件 [where] 进行数据查询,如果[where]==只初始化不赋值 则代表查询所有数据
+ * @param orderBy 排序字段
+ * @param isOrderDESC 是否倒序 true-倒序,false-正序
+ * @return 结果集合
+ */
+ @Override
+ public List query(T where, String orderBy, boolean isOrderDESC) {
+ if (isOrderDESC) {
+ orderBy = orderBy + " DESC";
+ }
+ return query(where, orderBy, null, null);
+ }
+
+ /**
+ * 查询数据
+ *
+ * @param where 查询条件对象
+ * @param orderBy 排序规则
+ * @param startIndex 开始的位置
+ * @param limit 限制查询得到的数据个数
+ */
+ public ArrayList query(T where, String orderBy, Integer startIndex, Integer limit) {
+ //拼接分页语句
+ String limitString = null;
+ if (startIndex != null && limit != null) {
+ limitString = startIndex + "," + limit;
+ }
+ Condition condition = new Condition(getContentValuesForQuery(where));
+ Cursor cursor = null;
+ //定义查询结果
+ ArrayList result = new ArrayList<>();
+ if (sqLiteDatabase != null && sqLiteDatabase.isOpen()) {
+ try {
+ //查询数据库
+ cursor = sqLiteDatabase.query(
+ tableName,
+ null,
+ condition.getWhereCause(),
+ condition.getWhereArgs(),
+ null,
+ null,
+ orderBy,
+ limitString
+ );
+ //将查到结果添加到返回集合中
+ result.addAll(getQueryResult(cursor, where));
+ } catch (Exception e) {
+ e.printStackTrace();
+ } finally {
+ if (cursor != null) {
+ cursor.close();
+ }
+ }
+ }
+ return result;
+ }
+
+ /**
+ * 获取查询db结果
+ */
+ private ArrayList getQueryResult(Cursor cursor, T where) {
+ //定义查询结果
+ ArrayList result = new ArrayList<>();
+ //Cursor从头读到尾
+ //游标从头读到尾
+ cursor.moveToFirst();
+ try {
+ if (where != null) {
+ //移动游标获取下一行数据
+ while (!cursor.isAfterLast()) {
+ //通过反射构建一个查询结果对象
+ T item = (T) where.getClass().newInstance();
+ Set> fieldIterator = cacheField.entrySet();
+ for (Map.Entry stringFieldEntry : fieldIterator) {
+ //获取数据库字段名称
+ String columnName = stringFieldEntry.getKey();
+ //数据库字段名对应的数据对象的成员变量
+ Field field = stringFieldEntry.getValue();
+ //获取指定列名对应的索引
+ int columnIndex = cursor.getColumnIndex(columnName);
+ //获取成员变量数据类型
+ Class fieldType = field.getType();
+ if (columnIndex != -1) {
+ if (fieldType == (String.class)) {
+ field.set(item, cursor.getString(columnIndex));
+ } else if (fieldType == (Integer.class)) {
+ field.set(item, cursor.getInt(columnIndex));
+ } else if (fieldType == (Long.class)) {
+ field.set(item, cursor.getLong(columnIndex));
+ } else if (fieldType == (Double.class)) {
+ field.set(item, cursor.getDouble(columnIndex));
+ } else if (fieldType == (byte[].class)) {
+ field.set(item, cursor.getBlob(columnIndex));
+ } else {
+ //未知类型
+ throw new UnsupportedOperationException("未定义的数据类型:fieldName= " + columnName + " fieldType= " + fieldType);
+ }
+ }
+ }
+ //添加到结果集
+ result.add(item);
+ //移动到下一个位置
+ cursor.moveToNext();
+ }
+ }
+ } catch (IllegalAccessException | InstantiationException e) {
+ e.printStackTrace();
+ }
+ cursor.close();
+ return result;
+ }
+
+ /**
+ * 初始化字段缓存
+ */
+ private void initCacheField() {
+ //1.取到所有的列名(查询一个空表获取表结构,不影响性能)
+ if (sqLiteDatabase != null && sqLiteDatabase.isOpen()) {
+ String sqlQuery = "select * from " + tableName + " limit 1,0";
+ Cursor cursor = sqLiteDatabase.rawQuery(sqlQuery, null);
+ //获取所有的列名
+ String[] columnNames = cursor.getColumnNames();
+ //关闭资源
+ cursor.close();
+ //2.取所有成员名
+ Field[] columnFields = entityClass.getDeclaredFields();
+ //3.通过两层循环,进行对应关系建立
+ for (String columnName : columnNames) {
+ for (Field columnField : columnFields) {
+ if (columnName.equals(columnField.getAnnotation(DbField.class).fieldName())) {
+ columnField.setAccessible(true);
+ cacheField.put(columnName, columnField);
+ }
+ }
+ }
+ }
+ }
+
+ /**
+ * 拼装创建数据表的SQL语句
+ */
+ private String getCreateTableSql() {
+ //create table if not exists tb_name(_id integer,name varchar2(20))
+ StringBuffer sqlCreateTable = new StringBuffer();
+ sqlCreateTable.append("create table if not exists ");
+ sqlCreateTable.append(tableName + " (");
+ //反射获取所有的数据对象内的成员变量
+ Field[] fields = entityClass.getDeclaredFields();
+
+ for (int index = 0; index < fields.length; index++) {
+ //字段名称
+ String columnName = fields[index].getAnnotation(DbField.class).fieldName();
+ //获取成员变量数据类型
+ Class fieldType = fields[index].getType();
+
+ if (fieldType == (String.class)) {
+ sqlCreateTable.append(columnName).append(" TEXT,");
+ } else if (fieldType == (Integer.class)) {
+ sqlCreateTable.append(columnName).append(" INTEGER,");
+ } else if (fieldType == (Long.class)) {
+ sqlCreateTable.append(columnName).append(" BIGINT,");
+ } else if (fieldType == (Double.class)) {
+ sqlCreateTable.append(columnName).append(" DOUBLE,");
+ } else if (fieldType == (byte[].class)) {
+ sqlCreateTable.append(columnName).append(" BLOB,");
+ } else {
+ //未知类型
+ throw new UnsupportedOperationException("未定义的数据类型:fieldName= " + columnName + " fieldType= " + fieldType);
+ }
+
+ if (index == fields.length - 1) {
+ if (sqlCreateTable.toString().endsWith(",")) {
+ sqlCreateTable.deleteCharAt(sqlCreateTable.length() - 1);
+ }
+ }
+ }
+ sqlCreateTable.append(")");
+ return sqlCreateTable.toString();
+ }
+
+ /**
+ * 获取插入使用的ContentValues
+ */
+ private ContentValues getContentValuesForInsert(T entity) {
+ ContentValues contentValues = new ContentValues();
+ Set> fieldIterator = cacheField.entrySet();
+ for (Map.Entry stringFieldEntry : fieldIterator) {
+ try {
+ //获取变量的值
+ Object valueObject = stringFieldEntry.getValue().get(entity);
+ //获取列名
+ String columnName = stringFieldEntry.getKey();
+ //获取成员变量数据类型
+ Class fieldType = stringFieldEntry.getValue().getType();
+
+ if (fieldType == (String.class)) {
+ contentValues.put(columnName, (String) valueObject);
+ } else if (fieldType == (Integer.class)) {
+ contentValues.put(columnName, (Integer) valueObject);
+ } else if (fieldType == (Long.class)) {
+ contentValues.put(columnName, (Long) valueObject);
+ } else if (fieldType == (Double.class)) {
+ contentValues.put(columnName, (Double) valueObject);
+ } else if (fieldType == (byte[].class)) {
+ contentValues.put(columnName, (byte[]) valueObject);
+ } else {
+ //未知类型
+ throw new UnsupportedOperationException("未定义的数据类型:fieldName= " + columnName + " fieldType= " + fieldType);
+ }
+ } catch (IllegalAccessException e) {
+ e.printStackTrace();
+ }
+ }
+ Logger.d(TAG, "contentValues:" + contentValues);
+ return contentValues;
+ }
+
+ /**
+ * 获取查询使用的 条件值对象
+ */
+ private ContentValues getContentValuesForQuery(T entity) {
+ ContentValues contentValues = new ContentValues();
+ try {
+ if (entity != null) {
+ Set> fieldIterator = cacheField.entrySet();
+ for (Map.Entry stringFieldEntry : fieldIterator) {
+ if (stringFieldEntry.getValue().get(entity) != null) {
+ contentValues.put(stringFieldEntry.getKey(),
+ stringFieldEntry.getValue().get(entity).toString());
+ }
+ }
+ }
+ } catch (IllegalAccessError | IllegalAccessException e) {
+ e.printStackTrace();
+ }
+
+ return contentValues;
+ }
+
+ /**
+ * 条件拼接对象
+ */
+ static class Condition {
+ /**
+ * 条件key拼接
+ * _id=?&&name=?
+ */
+ private String whereCause;
+
+ /**
+ * 条件值,与 whereCause 顺序一致
+ */
+ private String[] whereArgs;
+
+ //根据传入的contentValues转换成查询条件
+ public Condition(ContentValues whereContent) {
+ //记录后面填充到查询语句“?”上的数据参数
+ ArrayList argList = new ArrayList<>();
+ //拼接查询语句
+ StringBuilder whereCaseSb = new StringBuilder();
+
+ /*
+ * 是为了链接下面的查询条件条件,也或者是替换没有查询条件的语句。
+ * 比如:要把检索条件作为一个参数传递给SQL,
+ * 那么,当这个检索语句不存在的话就可以给它赋值为1=1.
+ * 这样就避免了SQL出错,也就可以把加条件的SQL和不加条件的SQL合二为一。
+ */
+ whereCaseSb.append(" 1=1 ");
+
+ Set keys = whereContent.keySet();
+
+ //因为使用了“1=1”,所以即便是这里没有任何数据拼接,也是可以正常
+ for (String key : keys) {
+ Object valueObject = whereContent.get(key);
+ if (valueObject != null) {
+ String value = (String) valueObject;
+ //拼接查询条件语句
+ //1:1 and _id=? and name=?
+ whereCaseSb.append(" and " + key + " =?");
+ //记录?对应的value
+ argList.add(value);
+ }
+ }
+ //集合转成数组
+ this.whereArgs = argList.toArray(new String[argList.size()]);
+ this.whereCause = whereCaseSb.toString();
+ }
+
+ public String getWhereCause() {
+ return this.whereCause;
+ }
+
+ public String[] getWhereArgs() {
+ return this.whereArgs;
+ }
+ }
+}
diff --git a/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/BaseDaoFactory.kt b/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/SQLDaoFactory.kt
similarity index 71%
rename from foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/BaseDaoFactory.kt
rename to foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/SQLDaoFactory.kt
index 605043bf5a..ad3a98da14 100644
--- a/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/BaseDaoFactory.kt
+++ b/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/SQLDaoFactory.kt
@@ -10,14 +10,14 @@ import com.mogo.utils.sqlite.proxy.BaseDaoProxyLog
* 数据库处理工厂
* Created by donghongyu on 2019/9/6.
*/
-open class BaseDaoFactory {
+open class SQLDaoFactory {
//默认数据库名称
private var dbName = "MoGoSQLite.db"
companion object {
//单利工厂
- private var baseDaoFactory: BaseDaoFactory? = null
+ private var sqlDaoFactory: SQLDaoFactory? = null
//数据库存储路径
private lateinit var sqLiteDatabasePath: String
@@ -25,21 +25,21 @@ open class BaseDaoFactory {
//数据库操作类
private var sqLiteDatabase: SQLiteDatabase? = null
- fun getInstance(): BaseDaoFactory {
- if (baseDaoFactory == null) {
- synchronized(BaseDaoFactory::class.java) {
- if (baseDaoFactory == null) {
- baseDaoFactory = BaseDaoFactory()
+ fun getInstance(): SQLDaoFactory {
+ if (sqlDaoFactory == null) {
+ synchronized(SQLDaoFactory::class.java) {
+ if (sqlDaoFactory == null) {
+ sqlDaoFactory = SQLDaoFactory()
}
}
}
- return baseDaoFactory!!
+ return sqlDaoFactory!!
}
}
//获取数据库操作对象
- fun getBaseDao(context: Context, entityClass: Class): IBaseDao? {
- var baseDao: IBaseDao? = null
+ fun getBaseDao(context: Context, entityClass: Class): SQLIDao? {
+ var baseDao: SQLIDao? = null
try {
//获取数据库名称,如果没有设置则使用默认名称
@@ -49,12 +49,14 @@ open class BaseDaoFactory {
}
//openOrCreateDatabase 如果不存在则先创建再打开数据库,如果存在则直接打开。
sqLiteDatabasePath =
- "${context.getDir("database", Context.MODE_APPEND).path}/$dbName"
+ "${context.getDir("database", Context.MODE_APPEND).path}/$dbName"
sqLiteDatabase = SQLiteDatabase.openOrCreateDatabase(sqLiteDatabasePath, null)
// 这里为了演示,添加了日志工具的叠加使用,根据需要可以自己修改
// baseDao = BaseDaoProxyShow().bind(BaseDaoProxyLog().bind(BaseDao())) as IBaseDao
- baseDao = BaseDaoProxyLog().bind(BaseDao()) as IBaseDao
+ // baseDao = BaseDaoProxyLog().bind(SQLBaseDao()) as IBaseDao
+ // baseDao = BaseDao()
+ baseDao = BaseDaoProxyLog().bind(SQLBaseDao()) as SQLIDao
baseDao.init(sqLiteDatabase!!, entityClass)
} catch (e: Exception) {
diff --git a/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/SQLIDao.java b/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/SQLIDao.java
new file mode 100644
index 0000000000..012a8aa6e2
--- /dev/null
+++ b/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/SQLIDao.java
@@ -0,0 +1,53 @@
+package com.mogo.utils.sqlite;
+
+import android.database.sqlite.SQLiteDatabase;
+
+import java.util.List;
+
+/**
+ * 数据库操作接口
+ *
+ * @author donghongyu
+ */
+public interface SQLIDao {
+ /**
+ * 初始化数据库连接
+ */
+ boolean init(SQLiteDatabase sqLiteDatabase, Class entityClass);
+
+ /**
+ * 将 [entity] 进行数据插入
+ */
+ long insert(T entity);
+
+ /**
+ * 根据条件 [where] 进行数据删除,如果[where]==只初始化不赋值 则代表删除所有数据
+ */
+ int delete(T where);
+
+ /**
+ * 根据条件 [where] 进行数据更新,如果[where]==只初始化不赋值 则代表删除所有数据
+ */
+ int update(T where, T newEntity);
+
+ /**
+ * @param where 根据条件 [where] 进行数据查询,如果[where]==只初始化不赋值 则代表查询所有数据
+ * @return 结果集合
+ */
+ List query(T where);
+
+ /**
+ * @param where 根据条件 [where] 进行数据查询,如果[where]==只初始化不赋值 则代表查询所有数据
+ * @param orderBy 排序字段
+ * @return 结果集合
+ */
+ List query(T where, String orderBy);
+
+ /**
+ * @param where 根据条件 [where] 进行数据查询,如果[where]==只初始化不赋值 则代表查询所有数据
+ * @param orderBy 排序字段
+ * @param isOrderDESC 是否倒序
+ * @return 结果集合
+ */
+ List query(T where, String orderBy, boolean isOrderDESC);
+}
diff --git a/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/proxy/BaseDaoProxy.kt b/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/proxy/BaseDaoProxy.kt
deleted file mode 100644
index f48adc9f79..0000000000
--- a/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/proxy/BaseDaoProxy.kt
+++ /dev/null
@@ -1,51 +0,0 @@
-package com.mogo.utils.sqlite.proxy
-
-import android.database.sqlite.SQLiteDatabase
-import android.util.Log
-import com.mogo.utils.sqlite.IBaseDao
-
-/**
- * 静态代理数据库操作类,用来记录日志
- * Created by donghongyu on 2019/9/6.
- */
-class BaseDaoProxy(var iBaseDao: IBaseDao) : IBaseDao by iBaseDao {
- override fun init(sqLiteDatabase: SQLiteDatabase, entityClass: Class): Boolean {
- Log.i("数据库代理", "初始化数据库连接……")
- val isInitSuccess = iBaseDao.init(sqLiteDatabase, entityClass)
- if (isInitSuccess) {
- Log.i("数据库代理", "数据库连接成功……")
- } else {
- Log.e("数据库代理", "数据库连接失败……")
- }
- return isInitSuccess
- }
-
- override fun insert(entity: T): Long {
- Log.i("数据库代理", "开始插入数据……")
- val result = iBaseDao.insert(entity)
- Log.i("数据库代理", "插入数据索引位置> $result <……")
- return result
- }
-
- override fun delete(where: T): Int {
- Log.i("数据库代理", "开始删除数据……")
- val result = iBaseDao.delete(where)
- Log.i("数据库代理", "删除了> $result <条数据……")
- return result
- }
-
- override fun update(where: T, newEntity: T): Int {
- Log.i("数据库代理", "开始更新数据……")
- val result = iBaseDao.update(where, newEntity)
- Log.i("数据库代理", "更新了> $result <条数据……")
- return result
- }
-
- override fun query(where: T): MutableList {
- Log.i("数据库代理", "开始查询数据……")
- val result = iBaseDao.query(where)
- Log.i("数据库代理", "查询到> ${result.size} <条数据……")
- return result
- }
-
-}
\ No newline at end of file
diff --git a/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/proxy/BaseDaoProxyLog.kt b/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/proxy/BaseDaoProxyLog.kt
index d65dd810dd..0d64420bb2 100644
--- a/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/proxy/BaseDaoProxyLog.kt
+++ b/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/proxy/BaseDaoProxyLog.kt
@@ -1,6 +1,7 @@
package com.mogo.utils.sqlite.proxy
-import android.util.Log
+import com.mogo.utils.logger.Logger
+import com.mogo.utils.network.utils.GsonUtil
import java.lang.reflect.InvocationHandler
import java.lang.reflect.Method
import java.lang.reflect.Proxy
@@ -24,8 +25,8 @@ class BaseDaoProxyLog : InvocationHandler {
this.target = target
//取得代理对象
return Proxy.newProxyInstance(
- target.javaClass.classLoader,
- target.javaClass.interfaces, this
+ target.javaClass.classLoader,
+ target.javaClass.interfaces, this
)
}
@@ -40,11 +41,11 @@ class BaseDaoProxyLog : InvocationHandler {
override fun invoke(proxy: Any, method: Method, args: Array): Any? {
var result: Any? = null
//反射方法前调用
- Log.i("数据库代理", "当前执行>>${method.name}")
+ Logger.i("SQL数据库管理", "当前执行>>${method.name}>>")
//反射执行方法 相当于调用target.sayHelllo;
result = method.invoke(target, *args)
//反射方法后调用.
- Log.i("数据库代理", "执行结果>>$result")
+ Logger.i("SQL数据库管理", "执行结果>>$result")
return result
}
}
diff --git a/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/proxy/BaseDaoProxyShow.kt b/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/proxy/BaseDaoProxyShow.kt
deleted file mode 100644
index d924191ba1..0000000000
--- a/foudations/mogo-utils/src/main/java/com/mogo/utils/sqlite/proxy/BaseDaoProxyShow.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.mogo.utils.sqlite.proxy
-
-import android.util.Log
-import java.lang.reflect.InvocationHandler
-import java.lang.reflect.Method
-import java.lang.reflect.Proxy
-
-/**
- * 使用java实现动态代理数据库操作类,加入更多额外的功能,来测试代理类的叠加功能
- * Created by donghongyu on 2019/9/6.
- */
-class BaseDaoProxyShow : InvocationHandler {
-
- private var target: Any? = null
-
- /**
- * 绑定委托对象并返回一个【代理占位】
- *
- * @param target 真实对象
- * @return 代理对象【占位】
- */
- fun bind(target: Any): Any {
- this.target = target
- //取得代理对象
- return Proxy.newProxyInstance(
- target.javaClass.classLoader,
- target.javaClass.interfaces, this
- )
- }
-
- /**
- * 同过代理对象调用方法首先进入这个方法.
- *
- * @param proxy --代理对象
- * @param method -- 方法,被调用方法.
- * @param args -- 方法的参数
- */
- @Throws(Throwable::class)
- override fun invoke(proxy: Any, method: Method, args: Array): Any? {
- var result: Any? = null
- //反射方法前调用
- Log.i("数据库代理", "显示执行>>${method.name}")
- //反射执行方法 相当于调用target.sayHelllo;
- result = method.invoke(target, *args)
- //反射方法后调用.
- Log.i("数据库代理", "执行结果>>$result")
- return result
- }
-}
diff --git a/gradle.properties b/gradle.properties
index 1e0a49e824..2fd887a5c9 100644
--- a/gradle.properties
+++ b/gradle.properties
@@ -81,7 +81,7 @@ MOGO_MODULE_PUSH_NOOP_VERSION=1.1.5.6
# 广告资源位
MOGO_MODULE_AD_CARD_VERSION=1.0.1
# 探路上报和分享模块
-TANLULIB_VERSION=1.3.1.16
+TANLULIB_VERSION=1.3.1.24
MOGO_MODULE_EVENT_PANEL_VERSION = 1.0.0-SNAPSHOT
MOGO_MODULE_EVENT_PANEL_NOOP_VERSION = 1.0.0-SNAPSHOT
#左侧面板模块
@@ -101,7 +101,9 @@ MOGO_MODULE_SPLASH_VERSION = 1.0.0-SNAPSHOT
MOGO_MODULE_SPLASH_NOOP_VERSION = 1.0.0-SNAPSHOT
# loglib
-LOGLIB_VERSION = 1.0.0-SNAPSHOT
+LOGLIB_VERSION = 1.0.1-SNAPSHOT
+# monitor
+MOGO_MODULE_MONITOR_VERSION = 1.0.0-SNAPSHOT
## 产品库必备配置,产品库自动对versionCode和versionName版本进行升级
applicationId=com.mogo.launcer
diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java
index 3896ae58c4..61e425aaba 100644
--- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java
+++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/MarkerCardResult.java
@@ -16,6 +16,7 @@ public class MarkerCardResult extends BaseData {
private List onlineCar;
private List exploreWay;
+ private long messageTime;
public List getCarChat() {
return carChat;
@@ -65,15 +66,11 @@ public class MarkerCardResult extends BaseData {
this.dataType = dataType;
}
- @Override
- public String toString() {
- return "MarkerCardResult{" +
- "dataType=" + dataType +
- ", carChat=" + carChat +
- ", exploreWay=" + exploreWay +
- ", onlineCar=" + onlineCar +
- ", shareMusic=" + shareMusic +
- ", noveltyInfo=" + noveltyInfo +
- '}';
+ public long getMessageTime() {
+ return messageTime;
+ }
+
+ public void setMessageTime(long messageTime) {
+ this.messageTime = messageTime;
}
}
diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XEventShowEntity.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XEventShowEntity.java
index e0ee2e5bec..4b6d621d60 100644
--- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XEventShowEntity.java
+++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XEventShowEntity.java
@@ -109,14 +109,16 @@ public class V2XEventShowEntity implements Serializable {
@IntDef(value = {
- V2XWindowTypeEnum.DEFAULT_WINDOW,
- V2XWindowTypeEnum.LIVE_CAR_WINDOW,
- V2XWindowTypeEnum.ROAD_EVENT_WINDOW,
- V2XWindowTypeEnum.PUSH_EVENT_WINDOW,
- V2XWindowTypeEnum.ANIMATION_WINDOW,
- V2XWindowTypeEnum.FATIGUE_DRIVING_WINDOW,
- V2XWindowTypeEnum.SEEK_HELP_WINDOW,
- V2XWindowTypeEnum.ILLEGAL_PARK_WINDOW,
+ V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING,
+ V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING,
+ V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING,
+ V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING,
+ V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_TOAST_WARNING,
+ V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING,
+ V2XMessageEntity.V2XTypeEnum.ALERT_ANIMATION_WARNING,
+ V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING,
+ V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING,
+ V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP,
})
@Target({
ElementType.PARAMETER,
diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XHistoryScenarioData.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XHistoryScenarioData.java
index 57e9953db1..046ca12db3 100644
--- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XHistoryScenarioData.java
+++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XHistoryScenarioData.java
@@ -4,6 +4,8 @@ import com.mogo.utils.sqlite.annotation.DbDatabase;
import com.mogo.utils.sqlite.annotation.DbField;
import com.mogo.utils.sqlite.annotation.DbTable;
+import java.util.Objects;
+
/**
* V2X 道路历史事件
*
diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XMessageEntity.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XMessageEntity.java
index 3e52d000f7..6dcf23400f 100644
--- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XMessageEntity.java
+++ b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XMessageEntity.java
@@ -80,6 +80,8 @@ public class V2XMessageEntity implements Serializable {
* V2X 场景类型
*/
public interface V2XTypeEnum {
+ // 默认展示详情
+ int DEFAULT_WINDOW = 0;
// 道路事件预警
int ALERT_ROAD_WARNING = 1_000;
// 他车求助预警
diff --git a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XWindowTypeEnum.java b/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XWindowTypeEnum.java
deleted file mode 100644
index f8ed519770..0000000000
--- a/modules/mogo-module-common/src/main/java/com/mogo/module/common/entity/V2XWindowTypeEnum.java
+++ /dev/null
@@ -1,27 +0,0 @@
-package com.mogo.module.common.entity;
-
-/**
- * author : donghongyu
- * e-mail : 1358506549@qq.com
- * date : 2020/3/31 4:53 PM
- * desc : V2X 道路提醒类型
- * version: 1.0
- */
-public interface V2XWindowTypeEnum {
- // 默认展示详情
- int DEFAULT_WINDOW = 0;
- // 直播
- int LIVE_CAR_WINDOW = 1;
- // 道路事件详情
- int ROAD_EVENT_WINDOW = 2;
- // 推送事件详情
- int PUSH_EVENT_WINDOW = 3;
- // 演示动画场景
- int ANIMATION_WINDOW = 4;
- // 疲劳驾驶
- int FATIGUE_DRIVING_WINDOW = 5;
- // 他人故障求助
- int SEEK_HELP_WINDOW = 6;
- // 违章停车
- int ILLEGAL_PARK_WINDOW = 7;
-}
diff --git a/modules/mogo-module-event-panel-noop/consumer-rules.pro b/modules/mogo-module-event-panel-noop/consumer-rules.pro
deleted file mode 100644
index da191c00b8..0000000000
--- a/modules/mogo-module-event-panel-noop/consumer-rules.pro
+++ /dev/null
@@ -1 +0,0 @@
--keep class com.zhidao.mogo.module.event.panel.EventPanelConstants
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel-noop/gradle.properties b/modules/mogo-module-event-panel-noop/gradle.properties
deleted file mode 100644
index df90d55670..0000000000
--- a/modules/mogo-module-event-panel-noop/gradle.properties
+++ /dev/null
@@ -1,3 +0,0 @@
-GROUP=com.mogo.module
-POM_ARTIFACT_ID=module-event-panel-noop
-VERSION_CODE=1
diff --git a/modules/mogo-module-event-panel-noop/src/androidTest/java/com/zhidao/mogo/module/event/panel/ExampleInstrumentedTest.kt b/modules/mogo-module-event-panel-noop/src/androidTest/java/com/zhidao/mogo/module/event/panel/ExampleInstrumentedTest.kt
deleted file mode 100644
index 6a8c2bfcea..0000000000
--- a/modules/mogo-module-event-panel-noop/src/androidTest/java/com/zhidao/mogo/module/event/panel/ExampleInstrumentedTest.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.zhidao.mogo.module.event.panel
-
-import androidx.test.platform.app.InstrumentationRegistry
-import androidx.test.ext.junit.runners.AndroidJUnit4
-
-import org.junit.Test
-import org.junit.runner.RunWith
-
-import org.junit.Assert.*
-
-/**
- * Instrumented test, which will execute on an Android device.
- *
- * See [testing documentation](http://d.android.com/tools/testing).
- */
-@RunWith(AndroidJUnit4::class)
-class ExampleInstrumentedTest {
- @Test
- fun useAppContext() {
- // Context of the app under test.
- val appContext = InstrumentationRegistry.getInstrumentation().targetContext
- assertEquals("com.zhidao.mogo.module.event.panel.test", appContext.packageName)
- }
-}
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel-noop/src/main/java/com/zhidao/mogo/module/event/panel/EventPanelConstants.kt b/modules/mogo-module-event-panel-noop/src/main/java/com/zhidao/mogo/module/event/panel/EventPanelConstants.kt
deleted file mode 100644
index dc22fdbc7a..0000000000
--- a/modules/mogo-module-event-panel-noop/src/main/java/com/zhidao/mogo/module/event/panel/EventPanelConstants.kt
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.zhidao.mogo.module.event.panel
-
-/**
- * 事件面板相关常量
- *
- * @author tongchenfei
- */
-object EventPanelConstants {
- const val MODULE_NAME = "MODULE_EVENT_PANEL"
- const val PATH_NAME = "/event/panel"
-}
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel-noop/src/main/java/com/zhidao/mogo/module/event/panel/EventPanelModuleProvider.kt b/modules/mogo-module-event-panel-noop/src/main/java/com/zhidao/mogo/module/event/panel/EventPanelModuleProvider.kt
deleted file mode 100644
index a5c31d2f2a..0000000000
--- a/modules/mogo-module-event-panel-noop/src/main/java/com/zhidao/mogo/module/event/panel/EventPanelModuleProvider.kt
+++ /dev/null
@@ -1,94 +0,0 @@
-package com.zhidao.mogo.module.event.panel
-
-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.service.MogoServicePaths
-import com.mogo.service.eventpanel.IEventPanelProvider
-import com.mogo.service.module.IMogoModuleLifecycle
-import com.mogo.utils.logger.Logger
-import com.zhidao.mogo.module.event.panel.EventPanelConstants.MODULE_NAME
-
-/**
- * 事件面板provider的空方法实现
- *
- * @author tongchenfei
- */
-
-
-const val TAG = "EventPanelNoopModule"
-
-@Route(path = MogoServicePaths.PATH_EVENT_PANEL)
-class EventPanelModuleProvider : IEventPanelProvider {
- override fun init(context: Context) {
- Logger.d(TAG, "模块初始化====")
- }
-
- override fun createFragment(context: Context, data: Bundle?): Fragment? {
- return null
- }
-
- /**
- * 显示面板
- */
- override fun showPanel() {
- }
-
-
- /**
- * 隐藏面板
- */
- override fun hidePanel() {
- }
-
- override fun createView(context: Context): View? {
- return null
- }
-
- override fun getModuleName(): String {
- return MODULE_NAME
- }
-
- override fun getCardLifecycle(): IMogoModuleLifecycle? {
- return null
- }
-
- override fun getMapListener(): IMogoMapListener? {
- return null
- }
-
- override fun getType(): Int {
- return 0
- }
-
- override fun getNaviListener(): IMogoNaviListener? {
- return null
- }
-
- override fun getLocationListener(): IMogoLocationListener? {
- return null
- }
-
- override fun getMarkerClickListener(): IMogoMarkerClickListener? {
- return null
- }
-
- override fun getAppPackage(): String? {
- return null
- }
-
- override fun getAppName(): String? {
- return null
- }
-
- override fun isPanelShow(): Boolean {
- return false
- }
-
-}
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel-noop/src/test/java/com/zhidao/mogo/module/event/panel/ExampleUnitTest.kt b/modules/mogo-module-event-panel-noop/src/test/java/com/zhidao/mogo/module/event/panel/ExampleUnitTest.kt
deleted file mode 100644
index f41429e9e1..0000000000
--- a/modules/mogo-module-event-panel-noop/src/test/java/com/zhidao/mogo/module/event/panel/ExampleUnitTest.kt
+++ /dev/null
@@ -1,17 +0,0 @@
-package com.zhidao.mogo.module.event.panel
-
-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)
- }
-}
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/.gitignore b/modules/mogo-module-event-panel/.gitignore
deleted file mode 100644
index 42afabfd2a..0000000000
--- a/modules/mogo-module-event-panel/.gitignore
+++ /dev/null
@@ -1 +0,0 @@
-/build
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/build.gradle b/modules/mogo-module-event-panel/build.gradle
deleted file mode 100644
index 4fdf60062d..0000000000
--- a/modules/mogo-module-event-panel/build.gradle
+++ /dev/null
@@ -1,63 +0,0 @@
-apply plugin: 'com.android.library'
-apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-android-extensions'
-apply plugin: 'kotlin-kapt'
-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")
-
- javaCompileOptions {
- annotationProcessorOptions {
- arguments = [AROUTER_MODULE_NAME: project.getName()]
- }
- }
-
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- consumerProguardFiles 'consumer-rules.pro'
- }
-
- buildTypes {
- release {
- minifyEnabled false
- proguardFiles getDefaultProguardFile('proguard-android-optimize.txt'), 'proguard-rules.pro'
- }
- }
-
- compileOptions {
- targetCompatibility 1.8
- sourceCompatibility 1.8
- }
-
-}
-
-dependencies {
- implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation rootProject.ext.dependencies.androidxccorektx
- implementation rootProject.ext.dependencies.kotlinstdlibjdk7
- implementation rootProject.ext.dependencies.androidxappcompat
- implementation rootProject.ext.dependencies.androidxconstraintlayout
- implementation rootProject.ext.dependencies.arouter
- kapt rootProject.ext.dependencies.aroutercompiler
- implementation rootProject.ext.dependencies.rxjava
- implementation rootProject.ext.dependencies.rxandroid
- implementation rootProject.ext.dependencies.androidxviewpager2
- implementation rootProject.ext.dependencies.androidxrecyclerview
- implementation rootProject.ext.dependencies.room
- kapt rootProject.ext.dependencies.roomAnnotationProcessor
- implementation rootProject.ext.dependencies.roomRxjava
-
- if (Boolean.valueOf(RELEASE)) {
- compileOnly rootProject.ext.dependencies.modulecommon
- } else {
- compileOnly project(':modules:mogo-module-common')
- }
-}
-
-apply from: new File(rootProject.rootDir, "gradle/upload.gradle").toString()
diff --git a/modules/mogo-module-event-panel/consumer-rules.pro b/modules/mogo-module-event-panel/consumer-rules.pro
deleted file mode 100644
index 6cd2a10967..0000000000
--- a/modules/mogo-module-event-panel/consumer-rules.pro
+++ /dev/null
@@ -1,5 +0,0 @@
-#-----EventPanel------
--keep class com.zhidao.mogo.module.event.panel.bean.** {*;}
--keep class com.zhidao.mogo.module.event.panel.dao.** {*;}
--keep class com.zhidao.mogo.module.event.panel.listener.** {*;}
--keep class com.zhidao.mogo.module.event.panel.EventPanelConstants
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/proguard-rules.pro b/modules/mogo-module-event-panel/proguard-rules.pro
deleted file mode 100644
index e778de0a5a..0000000000
--- a/modules/mogo-module-event-panel/proguard-rules.pro
+++ /dev/null
@@ -1,27 +0,0 @@
-# Add project specific ProGuard rules here.
-# You can control the set of applied configuration files using the
-# proguardFiles setting in build.gradle.
-#
-# For more details, see
-# http://developer.android.com/guide/developing/tools/proguard.html
-
-# If your project uses WebView with JS, uncomment the following
-# and specify the fully qualified class name to the JavaScript interface
-# class:
-#-keepclassmembers class fqcn.of.javascript.interface.for.webview {
-# public *;
-#}
-
-# Uncomment this to preserve the line number information for
-# debugging stack traces.
-#-keepattributes SourceFile,LineNumberTable
-
-# If you keep the line number information, uncomment this to
-# hide the original source file name.
-#-renamesourcefileattribute SourceFile
-
-#-----EventPanel------
--keep class com.zhidao.mogo.module.event.panel.bean.** {*;}
--keep class com.zhidao.mogo.module.event.panel.dao.** {*;}
--keep class com.zhidao.mogo.module.event.panel.listener.** {*;}
--keep class com.zhidao.mogo.module.event.panel.EventPanelConstants
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/AndroidManifest.xml b/modules/mogo-module-event-panel/src/main/AndroidManifest.xml
deleted file mode 100644
index c865fb2efe..0000000000
--- a/modules/mogo-module-event-panel/src/main/AndroidManifest.xml
+++ /dev/null
@@ -1,5 +0,0 @@
-
-
- /
-
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/EventPanelConstants.kt b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/EventPanelConstants.kt
deleted file mode 100644
index 31e0c28a34..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/EventPanelConstants.kt
+++ /dev/null
@@ -1,15 +0,0 @@
-package com.zhidao.mogo.module.event.panel
-
-/**
- * 事件面板相关常量
- *
- * @author tongchenfei
- */
-object EventPanelConstants {
- const val MODULE_NAME = "MODULE_EVENT_PANEL"
- const val PATH_NAME = "/event/panel"
-
- const val ROAD_EVENT_USEFUL = "2"
- const val ROAD_EVENT_UNUSEFUL = "1"
- const val ROAD_EVENT_USEFUL_STATUS_UNSET = "0"
-}
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/EventPanelModuleProvider.kt b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/EventPanelModuleProvider.kt
deleted file mode 100644
index 461581fc28..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/EventPanelModuleProvider.kt
+++ /dev/null
@@ -1,103 +0,0 @@
-package com.zhidao.mogo.module.event.panel
-
-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.service.eventpanel.IEventPanelProvider
-import com.mogo.service.module.IMogoModuleLifecycle
-import com.mogo.service.module.IMogoModuleProvider
-import com.mogo.utils.logger.Logger
-import com.zhidao.mogo.module.event.panel.EventPanelConstants.MODULE_NAME
-import com.zhidao.mogo.module.event.panel.EventPanelConstants.PATH_NAME
-import com.zhidao.mogo.module.event.panel.fragment.EventPanelFragment
-import com.zhidao.mogo.module.event.panel.util.MogoApiManager
-import com.zhidao.mogo.module.event.panel.util.TripRecordDataManager
-
-/**
- * 事件面板provider
- *
- * @author tongchenfei
- */
-@Route(path = PATH_NAME)
-class EventPanelModuleProvider : IEventPanelProvider {
- /**
- * Do your init work in this method, it well be call when processor has been load.
- *
- * @param context ctx
- */
- override fun init(context: Context) {
- Logger.d(MODULE_NAME, "模块初始化====")
- MogoApiManager.init(context)
- TripRecordDataManager.init(context)
- }
-
- override fun createFragment(context: Context, data: Bundle?): Fragment? {
- return EventPanelFragment.getInstance()
- }
-
- /**
- * 显示面板
- */
- override fun showPanel() {
- EventPanelFragment.getInstance().showPanel()
- }
-
- override fun isPanelShow(): Boolean {
- return EventPanelFragment.getInstance().isPanelShow()
- }
-
-
- /**
- * 隐藏面板
- */
- override fun hidePanel() {
- EventPanelFragment.getInstance().hidePanel()
- }
-
- override fun createView(context: Context): View? {
- return null
- }
-
- override fun getModuleName(): String {
- return MODULE_NAME
- }
-
- override fun getCardLifecycle(): IMogoModuleLifecycle? {
- return null
- }
-
- override fun getMapListener(): IMogoMapListener? {
- return null
- }
-
- override fun getType(): Int {
- return 0
- }
-
- override fun getNaviListener(): IMogoNaviListener? {
- return null
- }
-
- override fun getLocationListener(): IMogoLocationListener? {
- return null
- }
-
- override fun getMarkerClickListener(): IMogoMarkerClickListener? {
- return null
- }
-
- override fun getAppPackage(): String? {
- return null
- }
-
- override fun getAppName(): String? {
- return null
- }
-
-}
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/adapter/EventPagerAdapter.kt b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/adapter/EventPagerAdapter.kt
deleted file mode 100644
index d958b6bff1..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/adapter/EventPagerAdapter.kt
+++ /dev/null
@@ -1,24 +0,0 @@
-package com.zhidao.mogo.module.event.panel.adapter
-
-import androidx.fragment.app.Fragment
-import androidx.viewpager2.adapter.FragmentStateAdapter
-import com.zhidao.mogo.module.event.panel.fragment.MyShareFragment
-import com.zhidao.mogo.module.event.panel.fragment.ShareEventsFragment
-import com.zhidao.mogo.module.event.panel.fragment.SurroundingEventFragment
-import com.zhidao.mogo.module.event.panel.fragment.TripRecordFragment
-
-/**
- * 事件面板viewpager2的adapter
- *
- * @author tongchenfei
- */
-class EventPagerAdapter(fragment: Fragment) : FragmentStateAdapter(fragment) {
- private val fragments:Array = arrayOf(TripRecordFragment(), SurroundingEventFragment(), ShareEventsFragment())
-
- /**
- * 目前一共就三个fragment
- */
- override fun getItemCount(): Int = fragments.size
-
- override fun createFragment(position: Int): Fragment = fragments[position]
-}
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/bean/TripRecord.kt b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/bean/TripRecord.kt
deleted file mode 100644
index d2738b3b4c..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/bean/TripRecord.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.zhidao.mogo.module.event.panel.bean
-
-import androidx.room.Entity
-import androidx.room.PrimaryKey
-import com.zhidao.mogo.module.event.panel.EventPanelConstants.ROAD_EVENT_USEFUL_STATUS_UNSET
-
-/**
- * 出行记录本地存储封装类,此类标识了数据库表名以及字段名
- *
- * @author tongchenfei
- */
-@Entity
-data class TripRecord(@PrimaryKey(autoGenerate = false)
- var id: Int,
- var eventId: String = "",
- var eventType: Int,
- /**
- * 是否有用
- * 1 - 没用
- * 2 - 有用
- * 0 - 未设置
- */
- var usefulStatus: String = ROAD_EVENT_USEFUL_STATUS_UNSET,
- var entity: String = "",
- var recordTime: Long = System.currentTimeMillis())
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/dao/TripRecordDao.kt b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/dao/TripRecordDao.kt
deleted file mode 100644
index 23860e8534..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/dao/TripRecordDao.kt
+++ /dev/null
@@ -1,48 +0,0 @@
-package com.zhidao.mogo.module.event.panel.dao
-
-import androidx.room.*
-import com.zhidao.mogo.module.event.panel.bean.TripRecord
-
-/**
- * 出行动态dao,全部使用同步方法,在线程中执行
- *
- * @author tongchenfei
- */
-@Dao
-interface TripRecordDao {
- /**
- * 查询当日数据
- * @param limitTime 当日0点的时间戳
- */
- @Query(value = "SELECT * FROM TripRecord WHERE recordTime > :limitTime ORDER BY recordTime DESC")
- fun queryAllTripRecord(limitTime: Long): List
-
- /**
- * 根据事件id获取出行动态
- *
- * @param eventId 事件id [com.mogo.module.common.entity.V2XRoadEventEntity.noveltyInfo.infoId]
- */
- @Query(value = "SELECT * FROM TripRecord WHERE eventId = :eventId")
- fun queryTripRecordByEventId(eventId: String): TripRecord?
-
- @Query(value = "SELECT * FROM TripRecord WHERE id = :id")
- fun queryTripRecordById(id: Int): TripRecord?
-
- @Insert(onConflict = OnConflictStrategy.REPLACE)
- fun insert(vararg tripRecord: TripRecord)
-
- @Update
- fun update(vararg tripRecord: TripRecord)
-
- @Delete
- fun delete(vararg tripRecord: TripRecord)
-
- /**
- * 删除超时的数据,即当天0时以前的数据
- * 虽然注解是Query,但是目的是执行后面的sql语句,所以就不要在意这些细节了
- *
- * @param limitTime 当日0点的时间戳
- */
- @Query(value = "DELETE FROM TripRecord WHERE recordTime < :limitTime")
- fun deleteOvertimeTripRecord(limitTime: Long)
-}
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/dao/TripRecordDatabase.kt b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/dao/TripRecordDatabase.kt
deleted file mode 100644
index 92dafed8a4..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/dao/TripRecordDatabase.kt
+++ /dev/null
@@ -1,25 +0,0 @@
-package com.zhidao.mogo.module.event.panel.dao
-
-import android.content.Context
-import androidx.room.Database
-import androidx.room.Room
-import androidx.room.RoomDatabase
-import com.zhidao.mogo.module.event.panel.bean.TripRecord
-
-@Database(entities = [TripRecord::class], version = 1, exportSchema = false)
-abstract class TripRecordDatabase : RoomDatabase() {
- companion object{
- private var instance:TripRecordDatabase? = null
- fun getInstance(context: Context):TripRecordDatabase{
- if (instance == null) {
- synchronized(TripRecordDatabase::class.java) {
- if (instance == null) {
- instance = Room.databaseBuilder(context, TripRecordDatabase::class.java, "TripRecordDatabase.db").build()
- }
- }
- }
- return instance!!
- }
- }
- abstract fun getTripRecordDao():TripRecordDao
-}
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/EventPanelFragment.kt b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/EventPanelFragment.kt
deleted file mode 100644
index 6f5a5f8912..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/EventPanelFragment.kt
+++ /dev/null
@@ -1,61 +0,0 @@
-package com.zhidao.mogo.module.event.panel.fragment
-
-import android.view.View
-import androidx.fragment.app.Fragment
-import com.mogo.commons.mvp.MvpFragment
-import com.mogo.utils.logger.Logger
-import com.zhidao.mogo.module.event.panel.EventPanelConstants.MODULE_NAME
-import com.zhidao.mogo.module.event.panel.R
-import com.zhidao.mogo.module.event.panel.adapter.EventPagerAdapter
-import com.zhidao.mogo.module.event.panel.presenter.EventPanelPresenter
-import kotlinx.android.synthetic.main.module_event_panel_fragment_event_panel.*
-
-/**
- * 事件面板主fragment
- *
- * @author tongchenfei
- */
-class EventPanelFragment : MvpFragment() {
-
- companion object{
- private val fragment = EventPanelFragment()
- fun getInstance():EventPanelFragment{
- return fragment
- }
- }
-
- override fun getLayoutId(): Int {
- return R.layout.module_event_panel_fragment_event_panel
- }
-
- override fun initViews() {
- Logger.d(MODULE_NAME, "EventPanelFragment init view===")
- vpEventPanel.adapter = EventPagerAdapter(this)
- btnShowOrHidePanels.setOnClickListener {
- if (vpEventPanel.visibility == View.GONE) {
- showPanel()
- }else{
- hidePanel()
- }
- }
- }
- override fun createPresenter(): EventPanelPresenter {
- return EventPanelPresenter(this)
- }
-
- fun showPanel(){
- Logger.d(MODULE_NAME,"in fragment show panel")
- vpEventPanel.visibility = View.VISIBLE
- btnShowOrHidePanels.text = "隐藏面板"
- }
-
- fun hidePanel(){
- Logger.d(MODULE_NAME,"in fragment hide panel")
- vpEventPanel.visibility = View.GONE
- btnShowOrHidePanels.text = "显示面板"
- }
-
- fun isPanelShow():Boolean{
- return vpEventPanel.visibility == View.VISIBLE
- }
-}
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/MyShareFragment.kt b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/MyShareFragment.kt
deleted file mode 100644
index 06c387766a..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/MyShareFragment.kt
+++ /dev/null
@@ -1,28 +0,0 @@
-package com.zhidao.mogo.module.event.panel.fragment
-
-import com.mogo.commons.mvp.MvpFragment
-import com.zhidao.mogo.module.event.panel.R
-import com.zhidao.mogo.module.event.panel.presenter.MySharePresenter
-
-class MyShareFragment : MvpFragment() {
- /**
- * 布局资源
- *
- * @return
- */
- override fun getLayoutId(): Int = R.layout.module_event_panel_share_item
-
- /**
- * 初始化控件,必须在初始化完成之后才可以实例化presenter,避免
- * presenter 生命周期错乱
- */
- override fun initViews() {
- }
-
- /**
- * 创建 presenter 实例
- *
- * @return
- */
- override fun createPresenter(): MySharePresenter = MySharePresenter(this)
-}
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/ShareEventsFragment.java b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/ShareEventsFragment.java
deleted file mode 100644
index 20567d7ca7..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/ShareEventsFragment.java
+++ /dev/null
@@ -1,156 +0,0 @@
-package com.zhidao.mogo.module.event.panel.fragment;
-
-import android.os.Bundle;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.MotionEvent;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.Button;
-
-import androidx.annotation.NonNull;
-import androidx.annotation.Nullable;
-import androidx.recyclerview.widget.LinearLayoutManager;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.alibaba.android.arouter.launcher.ARouter;
-import com.mogo.commons.mvp.MvpFragment;
-import com.mogo.commons.network.SubscribeImpl;
-import com.mogo.commons.network.Utils;
-import com.mogo.service.MogoServicePaths;
-import com.mogo.service.network.IMogoNetwork;
-import com.mogo.utils.network.RequestOptions;
-import com.mogo.utils.network.utils.GsonUtil;
-import com.zhidao.mogo.module.event.panel.R;
-import com.zhidao.mogo.module.event.panel.adapter.ShareEventAdapter;
-import com.zhidao.mogo.module.event.panel.bean.ShareEventDescription;
-import com.zhidao.mogo.module.event.panel.bean.ShareEventItem;
-import com.zhidao.mogo.module.event.panel.network.HostConstant;
-import com.zhidao.mogo.module.event.panel.network.ShareEventApiService;
-import com.zhidao.mogo.module.event.panel.network.ShareEventParameter;
-import com.zhidao.mogo.module.event.panel.presenter.ShareEventsPresenter;
-
-import java.util.ArrayList;
-import java.util.HashMap;
-import java.util.Map;
-
-import io.reactivex.android.schedulers.AndroidSchedulers;
-import io.reactivex.schedulers.Schedulers;
-
-public class ShareEventsFragment extends MvpFragment {
-
- private static final String TAG = "ShareEventsFragment";
- private RecyclerView recyclerView;
- private View view;
- private ShareEventAdapter adapter;
- private ArrayList dataArrayList = new ArrayList();
- private ShareEventApiService shareEventApiService;
- private int pageNum = 1;
- private View emptyView;
- private Button shareBtn;
-
- @Override
- protected int getLayoutId() {
- return R.layout.module_event_panel_share_recylerview;
- }
-
- @Override
- protected void initViews() {
- }
-
- @Nullable
- @Override
- public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
- view = inflater.inflate(R.layout.module_event_panel_share_recylerview, container, false);
- emptyView = inflater.inflate(R.layout.module_event_panel_share_empty,container,false);
- initRecyclerView();
- initData();
- return view;
- }
-
- private void initRecyclerView() {
- recyclerView = view.findViewById(R.id.road_case_share_list);
- adapter = new ShareEventAdapter(getActivity(), dataArrayList);
- recyclerView.setAdapter(adapter);
- LinearLayoutManager linearLayoutManager =
- new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
- recyclerView.setLayoutManager(linearLayoutManager);
- }
-
- private void initData() {
- IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(getContext());
- this.shareEventApiService = network.create(ShareEventApiService.class, HostConstant.getNetHost());
-
- getShareEventDescription();
- getShareEventList(pageNum, 10);
- }
-
- /*
- * 热心指数等
- * */
- private void getShareEventDescription() {
- //ZD802B1932L00622 测试数据sn
- ShareEventParameter parameter = new ShareEventParameter(Utils.getSn());
- Map parameters = new HashMap<>();
- parameters.put("data", GsonUtil.jsonFromObject(parameter));
-
- shareEventApiService.getEnthusiasmIndex(parameters)
- .subscribeOn(Schedulers.io())
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe(new SubscribeImpl(RequestOptions.create(getContext())) {
- @Override
- public void onSuccess(ShareEventDescription resultData) {
- if (resultData != null && resultData.getResult() != null
- && resultData.getResult().getEnthusiasmIndex() != null) {
- dataArrayList.add(resultData.getResult().getEnthusiasmIndex());
- adapter.notifyDataSetChanged();
- Log.d(TAG, "热心指数---:" + resultData.getResult().getEnthusiasmIndex());
- }
- }
-
- @Override
- public void onError(String message, int code) {
- super.onError(message, code);
- }
-
- });
- }
-
- /*
- * 分享列表
- * */
- private void getShareEventList(int page, int size) {
- ShareEventParameter parameter = new ShareEventParameter(Utils.getSn(), pageNum, 10);
- HashMap parameters = new HashMap<>();
- parameters.put("data", GsonUtil.jsonFromObject(parameter));
-
- shareEventApiService.getShareEventList(parameters)
- .subscribeOn(Schedulers.io())
- .observeOn(AndroidSchedulers.mainThread())
- .subscribe(new SubscribeImpl(RequestOptions.create(getContext())) {
- @Override
- public void onSuccess(ShareEventItem resultData) {
- if (resultData != null && resultData.getResult() != null
- && resultData.getResult().getPage().getContent().size() > 0) {
- adapter.setEmptylist(false);
- dataArrayList.addAll(resultData.getResult().getPage().getContent());
- Log.d(TAG, "分享列表---:" + dataArrayList.get(0));
- } else {
- adapter.setEmptylist(true);
- }
- adapter.notifyDataSetChanged();
- }
-
- @Override
- public void onError(String message, int code) {
- super.onError(message, code);
- }
- });
- }
-
- @NonNull
- @Override
- protected ShareEventsPresenter createPresenter() {
- return new ShareEventsPresenter(this);
- }
-}
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/SurroundingEventFragment.kt b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/SurroundingEventFragment.kt
deleted file mode 100644
index b9ffbd4e46..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/SurroundingEventFragment.kt
+++ /dev/null
@@ -1,32 +0,0 @@
-package com.zhidao.mogo.module.event.panel.fragment
-
-import com.mogo.commons.mvp.MvpFragment
-import com.zhidao.mogo.module.event.panel.R
-import com.zhidao.mogo.module.event.panel.presenter.SurroundingEventPresenter
-import kotlinx.android.synthetic.main.module_event_panel_fragment_surrounding_event.*
-
-class SurroundingEventFragment:MvpFragment(){
- /**
- * 布局资源
- *
- * @return
- */
- override fun getLayoutId(): Int = R.layout.module_event_panel_fragment_surrounding_event
-
- /**
- * 初始化控件,必须在初始化完成之后才可以实例化presenter,避免
- * presenter 生命周期错乱
- */
- override fun initViews() {
- tvTitle.setOnClickListener {
- EventPanelFragment.getInstance().hidePanel()
- }
- }
-
- /**
- * 创建 presenter 实例
- *
- * @return
- */
- override fun createPresenter(): SurroundingEventPresenter = SurroundingEventPresenter(this)
-}
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/TripRecordFragment.kt b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/TripRecordFragment.kt
deleted file mode 100644
index 09854c3542..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/fragment/TripRecordFragment.kt
+++ /dev/null
@@ -1,49 +0,0 @@
-package com.zhidao.mogo.module.event.panel.fragment
-
-import android.util.Log
-import com.mogo.commons.mvp.MvpFragment
-import com.mogo.module.common.entity.V2XMessageEntity
-import com.mogo.utils.logger.Logger
-import com.zhidao.mogo.module.event.panel.EventPanelConstants.MODULE_NAME
-import com.zhidao.mogo.module.event.panel.R
-import com.zhidao.mogo.module.event.panel.bean.TripRecord
-import com.zhidao.mogo.module.event.panel.presenter.TripRecordPresenter
-import com.zhidao.mogo.module.event.panel.util.TripRecordDataManager
-import kotlinx.android.synthetic.main.module_event_panel_fragment_trip_record.*
-import kotlin.random.Random
-
-/**
- * 出行动态fragment
- */
-class TripRecordFragment : MvpFragment() {
- private val tripRecordList = ArrayList()
- override fun getLayoutId(): Int = R.layout.module_event_panel_fragment_trip_record
-
- override fun initViews() {
- btnInsert.setOnClickListener {
- TripRecordDataManager.insertTripRecord(TripRecord(id = 456, eventType = 456,eventId = "456"))
- }
- btnUpdate.setOnClickListener {
- TripRecordDataManager.syncRoadEventModifyState(eventId = "456", modifyType = "2")
- }
- btnQuery.setOnClickListener {
- Log.d(MODULE_NAME, "local list: $tripRecordList")
- mPresenter.queryAllTripRecord()
- }
- }
-
- override fun createPresenter(): TripRecordPresenter = TripRecordPresenter(this)
-
- fun refreshTripRecordList(tripRecords: List) {
- Logger.d(MODULE_NAME, "刷新出行动态列表:$tripRecords")
- tripRecordList.clear()
- tripRecordList.addAll(tripRecords)
- }
-
- /**
- * 刷新单个出行动态,如果无此动态,新增动态
- */
- fun refreshTripRecord(tripRecord: TripRecord) {
- Logger.d(MODULE_NAME, "刷新单个出行动态: $tripRecord")
- }
-}
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/listener/ITripRecordCallback.kt b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/listener/ITripRecordCallback.kt
deleted file mode 100644
index 6bf2e6208e..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/listener/ITripRecordCallback.kt
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.zhidao.mogo.module.event.panel.listener
-
-import com.zhidao.mogo.module.event.panel.bean.TripRecord
-
-/**
- * 数据库异步操作数据回调
- */
-interface ITripRecordCallback {
- /**
- * 查询全部出行动态成功
- */
- fun queryTripRecordListSuccess(tripRecordList:List)
-
- /**
- * 有出行动态新增或更新后,回调此接口
- */
- fun insertOrUpdateTripRecordSuccess(tripRecord:TripRecord)
-}
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/network/HostConstant.java b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/network/HostConstant.java
deleted file mode 100644
index ba4c4a4695..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/network/HostConstant.java
+++ /dev/null
@@ -1,23 +0,0 @@
-package com.zhidao.mogo.module.event.panel.network;
-
-import com.mogo.commons.debug.DebugConfig;
-
-public class HostConstant {
- public static final String HOST_DEV = "http://dzt-test.zhidaohulian.com";
- public static final String HOST_TEST = "http://dzt-test.zhidaohulian.com";
- public static final String HOST_DEMO = "http://dzt-show.zhidaohulian.com";
- public static final String HOST_PRODUCT = "https://dzt.zhidaohulian.com";
-
- public static String getNetHost() {
- switch ( DebugConfig.getNetMode() ) {
- case DebugConfig.NET_MODE_DEV:
- return HOST_DEV;
- case DebugConfig.NET_MODE_QA:
- return HOST_TEST;
- case DebugConfig.NET_MODE_DEMO:
- return HOST_DEMO;
- default:
- return HOST_PRODUCT;
- }
- }
-}
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/network/ShareEventApiService.java b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/network/ShareEventApiService.java
deleted file mode 100644
index e449c87c38..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/network/ShareEventApiService.java
+++ /dev/null
@@ -1,26 +0,0 @@
-package com.zhidao.mogo.module.event.panel.network;
-
-import com.zhidao.mogo.module.event.panel.bean.ShareEventDescription;
-import com.zhidao.mogo.module.event.panel.bean.ShareEventItem;
-
-import java.util.Map;
-
-import io.reactivex.Observable;
-import retrofit2.http.FieldMap;
-import retrofit2.http.FormUrlEncoded;
-import retrofit2.http.POST;
-import retrofit2.http.QueryMap;
-
-public interface ShareEventApiService {
-
- //我的分享-热心指数等
- @FormUrlEncoded
- @POST("/deva/poiInfoFabulous/car/poi/no/queryEnthusiasmIndex/v1")
- Observable getEnthusiasmIndex(@FieldMap Map parames);
-
- //我的分享-列表
- @FormUrlEncoded
- @POST("/deva/car/pathAndPoi/no/queryInfo")
- Observable getShareEventList(@FieldMap Map parames);
-
-}
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/network/ShareEventParameter.java b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/network/ShareEventParameter.java
deleted file mode 100644
index 906a55770f..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/network/ShareEventParameter.java
+++ /dev/null
@@ -1,18 +0,0 @@
-package com.zhidao.mogo.module.event.panel.network;
-
-public class ShareEventParameter {
- private String sn;
- private int pageNum;
- private int pageSize;
-
- public ShareEventParameter(String sn) {
- this.sn = sn;
- }
-
- public ShareEventParameter(String sn, int pageNum, int pageSize) {
- this.sn = sn;
- this.pageNum = pageNum;
- this.pageSize = pageSize;
- }
-
-}
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/presenter/EventPanelPresenter.kt b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/presenter/EventPanelPresenter.kt
deleted file mode 100644
index 2aa237ed72..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/presenter/EventPanelPresenter.kt
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.zhidao.mogo.module.event.panel.presenter
-
-import com.mogo.commons.mvp.Presenter
-import com.zhidao.mogo.module.event.panel.fragment.EventPanelFragment
-
-/**
- * 事件面板presenter
- *
- * @author tongchenfei
- */
-class EventPanelPresenter(view: EventPanelFragment) : Presenter(view)
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/presenter/MySharePresenter.kt b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/presenter/MySharePresenter.kt
deleted file mode 100644
index ab49fba81a..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/presenter/MySharePresenter.kt
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.zhidao.mogo.module.event.panel.presenter
-
-import com.mogo.commons.mvp.Presenter
-import com.zhidao.mogo.module.event.panel.fragment.MyShareFragment
-
-class MySharePresenter(view: MyShareFragment) : Presenter(view) {
-}
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/presenter/ShareEventsPresenter.java b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/presenter/ShareEventsPresenter.java
deleted file mode 100644
index 4538dd7a7d..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/presenter/ShareEventsPresenter.java
+++ /dev/null
@@ -1,11 +0,0 @@
-package com.zhidao.mogo.module.event.panel.presenter;
-
-import com.mogo.commons.mvp.IView;
-import com.mogo.commons.mvp.Presenter;
-import com.zhidao.mogo.module.event.panel.fragment.ShareEventsFragment;
-
-public class ShareEventsPresenter extends Presenter {
- public ShareEventsPresenter(IView view) {
- super((ShareEventsFragment) view);
- }
-}
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/presenter/SurroundingEventPresenter.kt b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/presenter/SurroundingEventPresenter.kt
deleted file mode 100644
index 871272bb5b..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/presenter/SurroundingEventPresenter.kt
+++ /dev/null
@@ -1,7 +0,0 @@
-package com.zhidao.mogo.module.event.panel.presenter
-
-import com.mogo.commons.mvp.Presenter
-import com.zhidao.mogo.module.event.panel.fragment.SurroundingEventFragment
-
-class SurroundingEventPresenter(view: SurroundingEventFragment) : Presenter(view) {
-}
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/presenter/TripRecordPresenter.kt b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/presenter/TripRecordPresenter.kt
deleted file mode 100644
index e1dd809210..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/presenter/TripRecordPresenter.kt
+++ /dev/null
@@ -1,33 +0,0 @@
-package com.zhidao.mogo.module.event.panel.presenter
-
-import androidx.lifecycle.LifecycleOwner
-import com.mogo.commons.mvp.Presenter
-import com.zhidao.mogo.module.event.panel.bean.TripRecord
-import com.zhidao.mogo.module.event.panel.fragment.TripRecordFragment
-import com.zhidao.mogo.module.event.panel.listener.ITripRecordCallback
-import com.zhidao.mogo.module.event.panel.util.TripRecordDataManager
-
-class TripRecordPresenter(view: TripRecordFragment) : Presenter(view),ITripRecordCallback {
-
- init {
- TripRecordDataManager.addTripRecordCallback(this)
- }
-
- override fun onDestroy(owner: LifecycleOwner) {
- super.onDestroy(owner)
- TripRecordDataManager.removeTripRecordCallback(this)
- }
-
- fun queryAllTripRecord(){
- TripRecordDataManager.queryAllTripRecord()
- }
-
- override fun queryTripRecordListSuccess(tripRecordList: List) {
- mView.refreshTripRecordList(tripRecordList)
- }
-
- override fun insertOrUpdateTripRecordSuccess(tripRecord: TripRecord) {
- mView.refreshTripRecord(tripRecord)
- }
-
-}
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/util/MogoApiManager.kt b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/util/MogoApiManager.kt
deleted file mode 100644
index d4d52b3c2d..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/util/MogoApiManager.kt
+++ /dev/null
@@ -1,14 +0,0 @@
-package com.zhidao.mogo.module.event.panel.util
-
-import android.content.Context
-import com.alibaba.android.arouter.launcher.ARouter
-import com.mogo.service.IMogoServiceApis
-import com.mogo.service.MogoServicePaths
-
-object MogoApiManager {
- lateinit var serviceApis:IMogoServiceApis
-
- fun init(context: Context) {
- serviceApis = ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context) as IMogoServiceApis
- }
-}
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/util/TripRecordDataManager.kt b/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/util/TripRecordDataManager.kt
deleted file mode 100644
index 7a373ed714..0000000000
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/util/TripRecordDataManager.kt
+++ /dev/null
@@ -1,171 +0,0 @@
-package com.zhidao.mogo.module.event.panel.util
-
-import android.content.BroadcastReceiver
-import android.content.Context
-import android.content.Intent
-import android.content.IntentFilter
-import android.os.Handler
-import androidx.localbroadcastmanager.content.LocalBroadcastManager
-import com.mogo.module.common.entity.V2XMessageEntity
-import com.mogo.module.common.entity.V2XMessageEntity.V2XTypeEnum.*
-import com.mogo.module.common.entity.V2XRoadEventEntity
-import com.mogo.utils.ThreadPoolService
-import com.mogo.utils.logger.Logger
-import com.mogo.utils.network.utils.GsonUtil
-import com.zhidao.mogo.module.event.panel.EventPanelConstants.MODULE_NAME
-import com.zhidao.mogo.module.event.panel.bean.TripRecord
-import com.zhidao.mogo.module.event.panel.dao.TripRecordDao
-import com.zhidao.mogo.module.event.panel.dao.TripRecordDatabase
-import com.zhidao.mogo.module.event.panel.listener.ITripRecordCallback
-import java.util.*
-import kotlin.collections.ArrayList
-
-
-private const val BROADCAST_SCENE_EVENT_ACTION = "com.v2x.scene_local_broadcast"
-private const val BROADCAST_SCENE_MODIFY_ACTION = "com.zhidao.tanlu.dataerror"
-
-private const val BROADCAST_SCENE_EXTRA_KEY = "V2XMessageEntity"
-private const val BORADCAST_SCENE_MODIFY_EVENT_ID_KEY = "id"
-private const val BROADCAST_SCENE_MODIFY_EVENT_UPDATE_TYPE_KEY = "updateType"
-
-/**
- * 出行动态的数据管理类,由于TripRecordFragment初始化时机较晚,所以封装一个单例类,提早初始化
- */
-object TripRecordDataManager {
- private lateinit var context: Context
- private val sceneEventReceiver = SceneEventReceiver()
- private lateinit var tripRecordDao: TripRecordDao
-
- private val tripRecordCallbackList = ArrayList()
-
- fun init(context: Context) {
- this.context = context
- LocalBroadcastManager.getInstance(context).registerReceiver(sceneEventReceiver, IntentFilter(BROADCAST_SCENE_EVENT_ACTION))
- context.registerReceiver(sceneEventReceiver, IntentFilter(BROADCAST_SCENE_MODIFY_ACTION))
- tripRecordDao = TripRecordDatabase.getInstance(TripRecordDataManager.context).getTripRecordDao()
- }
-
- fun addTripRecordCallback(callback: ITripRecordCallback) {
- tripRecordCallbackList.add(callback)
- }
-
- fun removeTripRecordCallback(callback: ITripRecordCallback) {
- tripRecordCallbackList.remove(callback)
- }
-
- private val handler = Handler()
- fun queryAllTripRecord() {
- ThreadPoolService.singleExecute {
- val limitTime = countLimitTime()
- // 查询所有的出行动态
- val tripRecordList = tripRecordDao.queryAllTripRecord(limitTime)
- Logger.d(MODULE_NAME, "查询所有出行动态,limitTime: $limitTime, list: $tripRecordList")
- // 删除超时的出行动态
- tripRecordDao.deleteOvertimeTripRecord(limitTime)
- // 切换线程回调
- handler.post {
- tripRecordCallbackList.forEach { callback ->
- callback.queryTripRecordListSuccess(tripRecordList)
- }
- }
- }
- }
-
- fun insertTripRecord(record: TripRecord) {
- ThreadPoolService.singleExecute {
- // 先查一下此数据是否存在
- Logger.d(MODULE_NAME, "出行动态入库===$record")
-
- var check = tripRecordDao.queryTripRecordById(record.id)
-
- if (check == null) {
- Logger.d(MODULE_NAME, "数据库中不存在此数据,直接插入")
- check = record
- tripRecordDao.insert(record)
- } else {
- Logger.d(MODULE_NAME, "数据库中存在此数据,更新recordTime即可,其他参数不变")
- check.recordTime = System.currentTimeMillis()
- tripRecordDao.update(check)
- }
- // 为了防止只进不出,所以在插入新数据时,进行过期数据删除操作
- tripRecordDao.deleteOvertimeTripRecord(countLimitTime())
- // 切换线程回调
- handler.post {
- tripRecordCallbackList.forEach { callback ->
- callback.insertOrUpdateTripRecordSuccess(check)
- }
- }
- }
- }
-
- /**
- * 计算约束时间,即当日0时
- */
- private fun countLimitTime(): Long {
- val calendar = Calendar.getInstance()
- calendar.time = Date()
- calendar.set(Calendar.HOUR_OF_DAY, 0)
- calendar.set(Calendar.MINUTE, 0)
- calendar.set(Calendar.SECOND, 0)
- return calendar.timeInMillis
- }
-
- /**
- * 处理道路事件推送,保存到本地数据库
- * 目前只处理道路事件,违章提醒,他车求助,其他事件暂不处理
- */
- private fun dealSceneMessage(type: Int, content: Any) {
- if (type in arrayOf(ALERT_ROAD_WARNING, ALERT_ILLEGAL_PARK_WARNING, ALERT_SEEK_WARNING)) {
- val eventId = if (type == ALERT_ROAD_WARNING) {
- val event = content as V2XRoadEventEntity
- event.noveltyInfo.infoId
- } else {
- ""
- }
- Logger.d(MODULE_NAME, "处理场景事件,准备插入数据库===eventId: $eventId")
- insertTripRecord(TripRecord(id = content.hashCode(), eventId = eventId, eventType = type, entity = GsonUtil.jsonFromObject(content)))
- }
- }
-
- /**
- * 本地数据库同步v2x传过来的纠错信息
- */
- fun syncRoadEventModifyState(eventId: String, modifyType: String) {
- Logger.d(MODULE_NAME, "准备同步纠错信息: $eventId, $modifyType")
- ThreadPoolService.singleExecute {
- // 找出需要纠错的数据
- val willModify = tripRecordDao.queryTripRecordByEventId(eventId)
- if (willModify != null) {
- // 查到数据进行修改,如果查不到数据,就不做操作了
- Logger.d(MODULE_NAME, "准备修改纠错状态:$willModify")
- willModify.usefulStatus = modifyType
- tripRecordDao.update(willModify)
- // 切线程回调
- handler.post {
- tripRecordCallbackList.forEach { callback ->
- callback.insertOrUpdateTripRecordSuccess(willModify)
- }
- }
- }
- }
- }
-
- class SceneEventReceiver : BroadcastReceiver() {
- override fun onReceive(context: Context, intent: Intent) {
- Logger.d(MODULE_NAME, "收到V2X事件推送===")
- when (intent.action) {
- BROADCAST_SCENE_EVENT_ACTION -> {
- // 道路事件推送
- val message = intent.getSerializableExtra(BROADCAST_SCENE_EXTRA_KEY) as V2XMessageEntity<*>
- Logger.d(MODULE_NAME, "道路事件推送 type: ${message.type}, content: ${message.content}")
- dealSceneMessage(message.type, message.content)
- }
- BROADCAST_SCENE_MODIFY_ACTION -> {
- // 纠错推送
- syncRoadEventModifyState(intent.getStringExtra(BORADCAST_SCENE_MODIFY_EVENT_ID_KEY), intent.getStringExtra(BROADCAST_SCENE_MODIFY_EVENT_UPDATE_TYPE_KEY))
- }
- }
-
- }
- }
-}
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/res/layout/module_event_panel_fragment_event_panel.xml b/modules/mogo-module-event-panel/src/main/res/layout/module_event_panel_fragment_event_panel.xml
deleted file mode 100644
index 29228279d2..0000000000
--- a/modules/mogo-module-event-panel/src/main/res/layout/module_event_panel_fragment_event_panel.xml
+++ /dev/null
@@ -1,25 +0,0 @@
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/res/layout/module_event_panel_fragment_surrounding_event.xml b/modules/mogo-module-event-panel/src/main/res/layout/module_event_panel_fragment_surrounding_event.xml
deleted file mode 100644
index 58d69b494e..0000000000
--- a/modules/mogo-module-event-panel/src/main/res/layout/module_event_panel_fragment_surrounding_event.xml
+++ /dev/null
@@ -1,15 +0,0 @@
-
-
-
-
-
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/res/layout/module_event_panel_fragment_trip_record.xml b/modules/mogo-module-event-panel/src/main/res/layout/module_event_panel_fragment_trip_record.xml
deleted file mode 100644
index 734133c3be..0000000000
--- a/modules/mogo-module-event-panel/src/main/res/layout/module_event_panel_fragment_trip_record.xml
+++ /dev/null
@@ -1,77 +0,0 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/res/layout/module_event_panel_share_recylerview.xml b/modules/mogo-module-event-panel/src/main/res/layout/module_event_panel_share_recylerview.xml
deleted file mode 100644
index 6d61dcb641..0000000000
--- a/modules/mogo-module-event-panel/src/main/res/layout/module_event_panel_share_recylerview.xml
+++ /dev/null
@@ -1,14 +0,0 @@
-
-
-
diff --git a/modules/mogo-module-event-panel/src/main/res/values-xhdpi/dimens.xml b/modules/mogo-module-event-panel/src/main/res/values-xhdpi/dimens.xml
deleted file mode 100644
index a6b3daec93..0000000000
--- a/modules/mogo-module-event-panel/src/main/res/values-xhdpi/dimens.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel/src/main/res/values/dimens.xml b/modules/mogo-module-event-panel/src/main/res/values/dimens.xml
deleted file mode 100644
index a6b3daec93..0000000000
--- a/modules/mogo-module-event-panel/src/main/res/values/dimens.xml
+++ /dev/null
@@ -1,2 +0,0 @@
-
-
\ No newline at end of file
diff --git a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java
index bfb66cffe1..768006b117 100644
--- a/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java
+++ b/modules/mogo-module-extensions/src/main/java/com/mogo/module/extensions/entrance/EntranceFragment.java
@@ -204,6 +204,11 @@ public class EntranceFragment extends MvpFragment{
+ mApis.getMogoMonitorApi().showLogDebugDialog();
+ return true;
+ });
}
ConstraintLayout rootView = findViewById(R.id.module_entrance_id_top_motion_layout);
diff --git a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java
index 1ee636cab7..4a6d5f4869 100644
--- a/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java
+++ b/modules/mogo-module-main/src/main/java/com/mogo/module/main/MainActivity.java
@@ -31,6 +31,7 @@ import com.mogo.service.fragmentmanager.IMogoFragmentManager;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.map.IMogoMapService;
import com.mogo.service.module.IMogoModuleProvider;
+import com.mogo.service.monitor.IMogoMonitorProvider;
import com.mogo.service.statusmanager.IMogoStatusManager;
import com.mogo.utils.logger.Logger;
import com.zhidao.autopilot.support.api.AutopilotServiceManage;
@@ -170,6 +171,11 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
hideLayout();
}
} );
+
+ // 初始化MonitorModule
+ IMogoMonitorProvider monitorProvider = (IMogoMonitorProvider) ARouter.getInstance().build(MogoServicePaths.PATH_MOGO_MONITOR).navigation(this);
+ monitorProvider.resetActivityContext(this);
+
}
private void startBaseService() {
diff --git a/modules/mogo-module-event-panel-noop/.gitignore b/modules/mogo-module-monitor/.gitignore
similarity index 100%
rename from modules/mogo-module-event-panel-noop/.gitignore
rename to modules/mogo-module-monitor/.gitignore
diff --git a/modules/mogo-module-event-panel-noop/build.gradle b/modules/mogo-module-monitor/build.gradle
similarity index 77%
rename from modules/mogo-module-event-panel-noop/build.gradle
rename to modules/mogo-module-monitor/build.gradle
index 2bd80f619d..d91c74e164 100644
--- a/modules/mogo-module-event-panel-noop/build.gradle
+++ b/modules/mogo-module-monitor/build.gradle
@@ -1,7 +1,4 @@
apply plugin: 'com.android.library'
-apply plugin: 'kotlin-android'
-apply plugin: 'kotlin-android-extensions'
-apply plugin: 'kotlin-kapt'
apply plugin: 'com.alibaba.arouter'
android {
@@ -13,14 +10,13 @@ android {
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()]
}
}
-
- testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
- consumerProguardFiles 'consumer-rules.pro'
}
buildTypes {
@@ -31,20 +27,17 @@ android {
}
compileOptions {
- targetCompatibility 1.8
- sourceCompatibility 1.8
+ sourceCompatibility JavaVersion.VERSION_1_8
+ targetCompatibility JavaVersion.VERSION_1_8
}
}
dependencies {
implementation fileTree(dir: 'libs', include: ['*.jar'])
- implementation rootProject.ext.dependencies.androidxccorektx
- implementation rootProject.ext.dependencies.kotlinstdlibjdk7
- implementation rootProject.ext.dependencies.androidxappcompat
+ implementation rootProject.ext.dependencies.mogologlib
implementation rootProject.ext.dependencies.arouter
- kapt rootProject.ext.dependencies.aroutercompiler
-
+ annotationProcessor rootProject.ext.dependencies.aroutercompiler
if (Boolean.valueOf(RELEASE)) {
compileOnly rootProject.ext.dependencies.modulecommon
} else {
diff --git a/modules/mogo-module-monitor/consumer-rules.pro b/modules/mogo-module-monitor/consumer-rules.pro
new file mode 100644
index 0000000000..e69de29bb2
diff --git a/modules/mogo-module-event-panel/gradle.properties b/modules/mogo-module-monitor/gradle.properties
similarity index 51%
rename from modules/mogo-module-event-panel/gradle.properties
rename to modules/mogo-module-monitor/gradle.properties
index 6bd32ac3d6..db3ee2befd 100644
--- a/modules/mogo-module-event-panel/gradle.properties
+++ b/modules/mogo-module-monitor/gradle.properties
@@ -1,3 +1,3 @@
GROUP=com.mogo.module
-POM_ARTIFACT_ID=module-event-panel
+POM_ARTIFACT_ID=module-monitor
VERSION_CODE=1
diff --git a/modules/mogo-module-event-panel-noop/proguard-rules.pro b/modules/mogo-module-monitor/proguard-rules.pro
similarity index 87%
rename from modules/mogo-module-event-panel-noop/proguard-rules.pro
rename to modules/mogo-module-monitor/proguard-rules.pro
index 58b6896c9d..481bb43481 100644
--- a/modules/mogo-module-event-panel-noop/proguard-rules.pro
+++ b/modules/mogo-module-monitor/proguard-rules.pro
@@ -18,6 +18,4 @@
# If you keep the line number information, uncomment this to
# hide the original source file name.
-#-renamesourcefileattribute SourceFile
-
--keep class com.zhidao.mogo.module.event.panel.EventPanelConstants
\ No newline at end of file
+#-renamesourcefileattribute SourceFile
\ No newline at end of file
diff --git a/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml b/modules/mogo-module-monitor/src/main/AndroidManifest.xml
similarity index 63%
rename from modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml
rename to modules/mogo-module-monitor/src/main/AndroidManifest.xml
index c865fb2efe..9fdb2a839e 100644
--- a/modules/mogo-module-event-panel-noop/src/main/AndroidManifest.xml
+++ b/modules/mogo-module-monitor/src/main/AndroidManifest.xml
@@ -1,5 +1,5 @@
+ package="com.zhidao.mogo.module.monitor">
/
\ No newline at end of file
diff --git a/modules/mogo-module-monitor/src/main/java/com/zhidao/mogo/module/monitor/MogoMonitorConst.java b/modules/mogo-module-monitor/src/main/java/com/zhidao/mogo/module/monitor/MogoMonitorConst.java
new file mode 100644
index 0000000000..41e54354ae
--- /dev/null
+++ b/modules/mogo-module-monitor/src/main/java/com/zhidao/mogo/module/monitor/MogoMonitorConst.java
@@ -0,0 +1,11 @@
+package com.zhidao.mogo.module.monitor;
+
+class MogoMonitorConst {
+ public static final String MODULE_NAME = "MogoMonitor";
+ public static final String MODULE_PATH = "/monitor/api";
+
+ public static final int LOG_PUSH_TYPE = 500000;
+
+ public static final int START_CATCH_LOG = 1;
+ public static final int STOP_CATCH_LOG = 2;
+}
diff --git a/modules/mogo-module-monitor/src/main/java/com/zhidao/mogo/module/monitor/MogoMonitorProvider.java b/modules/mogo-module-monitor/src/main/java/com/zhidao/mogo/module/monitor/MogoMonitorProvider.java
new file mode 100644
index 0000000000..08bf4df033
--- /dev/null
+++ b/modules/mogo-module-monitor/src/main/java/com/zhidao/mogo/module/monitor/MogoMonitorProvider.java
@@ -0,0 +1,118 @@
+package com.zhidao.mogo.module.monitor;
+
+import android.content.Context;
+import android.util.ArrayMap;
+
+import com.alibaba.android.arouter.facade.annotation.Route;
+import com.alibaba.android.arouter.launcher.ARouter;
+import com.mogo.service.IMogoServiceApis;
+import com.mogo.service.MogoServicePaths;
+import com.mogo.service.connection.IMogoOnMessageListener;
+import com.mogo.service.monitor.IMogoMonitorProvider;
+import com.mogo.utils.logger.LogLevel;
+import com.mogo.utils.logger.Logger;
+import com.zhidao.loglib.LogInfoManager;
+import com.zhidao.loglib.bean.RemoteLogPushContent;
+import com.zhidao.loglib.dialog.ILogDialogListener;
+import com.zhidao.loglib.upload.UploadManager;
+import com.zhidao.loglib.util.LogInfoManagerFactory;
+import com.zhidao.loglib.util.LoggingNotice;
+
+import java.util.Map;
+
+/**
+ * 应用监控模块provider
+ * @author tongchenfei
+ */
+@Route(path = MogoMonitorConst.MODULE_PATH)
+public class MogoMonitorProvider implements IMogoMonitorProvider, IMogoOnMessageListener, ILogDialogListener {
+ private static final String TAG = MogoMonitorConst.MODULE_NAME;
+ private LogInfoManager manualCatchLog = null;
+ private Map managerCache = new ArrayMap<>();
+ private Context context;
+
+ @Override
+ public void showLogDebugDialog() {
+ if (manualCatchLog == null) {
+ manualCatchLog = LogInfoManagerFactory.createManualLogInfoManager(context);
+ }
+ manualCatchLog.showDebugWindow().setDialogListener(this);
+ }
+
+ @Override
+ public void init(Context context) {
+ IMogoServiceApis apis =
+ (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
+ apis.getSocketManagerApi(context).registerOnMessageListener(MogoMonitorConst.LOG_PUSH_TYPE,this);
+ }
+
+ @Override
+ public void resetActivityContext(Context context) {
+ this.context = context;
+ UploadManager.getInstance().init(context);
+ LoggingNotice.getInstance().init(context);
+ }
+
+ @Override
+ public Class target() {
+ return RemoteLogPushContent.class;
+ }
+
+ @Override
+ public void onMsgReceived(RemoteLogPushContent obj) {
+ Logger.d(TAG, "收到push消息: " + obj);
+ switch (obj.getType()){
+ case MogoMonitorConst.START_CATCH_LOG:
+ if (managerCache.containsKey(obj.getPkgName())) {
+ Logger.d(TAG, "这个包名的日志正在抓了: " + obj);
+ return;
+ }
+ openLoggerLevel();
+ LogInfoManager infoManager =
+ LogInfoManagerFactory.createPushLogInfoManager(context, obj);
+ infoManager.start();
+ managerCache.put(obj.getPkgName(), infoManager);
+ break;
+ case MogoMonitorConst.STOP_CATCH_LOG:
+ LogInfoManager stopManager = managerCache.remove(obj.getPkgName());
+ if (stopManager != null) {
+ stopManager.stop();
+ }
+ closeLoggerLevel();
+ break;
+ default:
+ break;
+ }
+ }
+
+ @Override
+ public void onLogStart() {
+ // 这个是通过对话框点击开始的回调
+ isInManualCatchLog = true;
+ openLoggerLevel();
+ }
+
+ @Override
+ public void onLogStop() {
+ // 这个是通过对话框点击结束的回调
+ isInManualCatchLog = false;
+ closeLoggerLevel();
+ }
+ private boolean isInManualCatchLog = false;
+
+ /**
+ * 放开Logger的限制
+ */
+ private void openLoggerLevel(){
+ Logger.init(LogLevel.DEBUG);
+ }
+
+ /**
+ * 根据状态收紧Logger的限制
+ */
+ private void closeLoggerLevel(){
+ if (!isInManualCatchLog && managerCache.size() == 0) {
+ Logger.init( BuildConfig.DEBUG ? LogLevel.DEBUG : LogLevel.OFF );
+ }
+ }
+}
diff --git a/modules/mogo-module-push-base/.gitignore b/modules/mogo-module-push-base/.gitignore
index 796b96d1c4..426a199cc8 100644
--- a/modules/mogo-module-push-base/.gitignore
+++ b/modules/mogo-module-push-base/.gitignore
@@ -1 +1,14 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
/build
+/captures
+.externalNativeBuild
+.cxx
\ No newline at end of file
diff --git a/modules/mogo-module-push-noop/.gitignore b/modules/mogo-module-push-noop/.gitignore
index 796b96d1c4..426a199cc8 100644
--- a/modules/mogo-module-push-noop/.gitignore
+++ b/modules/mogo-module-push-noop/.gitignore
@@ -1 +1,14 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
/build
+/captures
+.externalNativeBuild
+.cxx
\ No newline at end of file
diff --git a/modules/mogo-module-push/.gitignore b/modules/mogo-module-push/.gitignore
index 796b96d1c4..426a199cc8 100644
--- a/modules/mogo-module-push/.gitignore
+++ b/modules/mogo-module-push/.gitignore
@@ -1 +1,14 @@
+*.iml
+.gradle
+/local.properties
+/.idea/caches
+/.idea/libraries
+/.idea/modules.xml
+/.idea/workspace.xml
+/.idea/navEditor.xml
+/.idea/assetWizardSettings.xml
+.DS_Store
/build
+/captures
+.externalNativeBuild
+.cxx
\ No newline at end of file
diff --git a/modules/mogo-module-v2x/build.gradle b/modules/mogo-module-v2x/build.gradle
index bafd090ea7..769d209c48 100644
--- a/modules/mogo-module-v2x/build.gradle
+++ b/modules/mogo-module-v2x/build.gradle
@@ -1,6 +1,7 @@
apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-android-extensions'
+apply plugin: 'kotlin-kapt'
apply plugin: 'com.alibaba.arouter'
apply plugin: 'android-aspectjx'
@@ -53,6 +54,16 @@ dependencies {
implementation rootProject.ext.dependencies.carcallprovider
implementation rootProject.ext.dependencies.carcall
+ implementation rootProject.ext.dependencies.androidxccorektx
+ implementation rootProject.ext.dependencies.kotlinstdlibjdk7
+ implementation rootProject.ext.dependencies.material
+ implementation rootProject.ext.dependencies.rxjava
+ implementation rootProject.ext.dependencies.androidxviewpager2
+ implementation rootProject.ext.dependencies.localbroadcastmanager
+
+ kapt rootProject.ext.dependencies.roomAnnotationProcessor
+ kapt rootProject.ext.dependencies.aroutercompiler
+
if (Boolean.valueOf(RELEASE)) {
implementation rootProject.ext.dependencies.mogomap
implementation rootProject.ext.dependencies.mogoutils
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java
index 270da46d61..4c85d75e0c 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XConst.java
@@ -9,14 +9,22 @@ package com.mogo.module.v2x;
*/
public class V2XConst {
/**
- * 类型
+ * V2X面板名称
*/
public static final String MODULE_NAME = "V2X_UI";
/**
* V2X模块地址
*/
public static final String PATH_V2X_UI = "/v2x/ui";
- public static final String SEEK_HELP_TIME = "seek_help_time";
+
+ /**
+ * 事件面板名称
+ */
+ public static final String MODULE_NAME_EVENT_PANEL = "MODULE_EVENT_PANEL";
+ /**
+ * 事件面板路径
+ */
+ public static final String PATH_EVENT_PANEL = "/event/panel";
/**
* V2X 场景广播 Action
@@ -25,7 +33,7 @@ public class V2XConst {
public static final String BROADCAST_SCENE_EXTRA_KEY = "V2XMessageEntity";
public static final String BROADCAST_SCENE_ACTION = "com.v2x.scene_local_broadcast";
-
+ public static final String SEEK_HELP_TIME = "seek_help_time";
public static final String V2X_ACC_ON_TIME_STR = "v2x_acc_on_time_str";
public static final String V2X_ACC_OFF_TIME_STR = "v2x_acc_off_time_str";
public static final String V2X_STRATEGY_PUSH = "v2x_strategy_push";
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XEventPanelModuleProvider.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XEventPanelModuleProvider.java
new file mode 100644
index 0000000000..4b101c27e5
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XEventPanelModuleProvider.java
@@ -0,0 +1,95 @@
+package com.mogo.module.v2x;
+
+import android.content.Context;
+import android.os.Bundle;
+import android.view.View;
+
+import androidx.annotation.NonNull;
+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.v2x.fragment.V2XEventPanelFragment;
+import com.mogo.service.module.IMogoModuleLifecycle;
+import com.mogo.service.module.IMogoModuleProvider;
+import com.mogo.service.module.ModuleType;
+import com.mogo.utils.logger.Logger;
+
+import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
+
+/**
+ * author : donghongyu
+ * e-mail : 1358506549@qq.com
+ * date : 2020-01-2114:03
+ * desc : V2X的管理
+ * version: 2.0
+ */
+@Route(path = V2XConst.PATH_EVENT_PANEL)
+public class V2XEventPanelModuleProvider implements
+ IMogoModuleProvider {
+ private final String TAG = "EventPanelModuleProvider";
+
+ @Override
+ public Fragment createFragment(Context context, Bundle data) {
+ return V2XEventPanelFragment.Companion.getInstance();
+ }
+
+ @Override
+ public View createView(Context context) {
+ return null;
+ }
+
+ @NonNull
+ @Override
+ public String getModuleName() {
+ return V2XConst.MODULE_NAME_EVENT_PANEL;
+ }
+
+ @Override
+ public IMogoModuleLifecycle getCardLifecycle() {
+ return null;
+ }
+
+ @Override
+ public IMogoMapListener getMapListener() {
+ return null;
+ }
+
+ @Override
+ public int getType() {
+ return ModuleType.TYPE_CARD_FRAGMENT;
+ }
+
+ @Override
+ public IMogoNaviListener getNaviListener() {
+ return null;
+ }
+
+ @Override
+ public IMogoLocationListener getLocationListener() {
+ return null;
+ }
+
+ @Override
+ public IMogoMarkerClickListener getMarkerClickListener() {
+ return null;
+ }
+
+ @Override
+ public String getAppPackage() {
+ return null;
+ }
+
+ @Override
+ public String getAppName() {
+ return null;
+ }
+
+ @Override
+ public void init(Context context) {
+ Logger.e(MODULE_NAME, "事件模版 模块初始化。。。。");
+ }
+}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java
index 05fa325662..162f5d6713 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XModuleProvider.java
@@ -15,7 +15,6 @@ import com.alibaba.android.arouter.facade.annotation.Route;
import com.mogo.map.MogoLatLng;
import com.mogo.map.listener.IMogoMapListener;
import com.mogo.map.location.IMogoLocationListener;
-import com.mogo.map.marker.IMogoMarker;
import com.mogo.map.marker.IMogoMarkerClickListener;
import com.mogo.map.model.MogoPoi;
import com.mogo.map.navi.IMogoNaviListener;
@@ -23,7 +22,6 @@ import com.mogo.map.uicontroller.EnumMapUI;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerShowEntity;
import com.mogo.module.common.entity.V2XMessageEntity;
-import com.mogo.module.service.ServiceConst;
import com.mogo.module.v2x.entity.net.V2XSeekHelpRes;
import com.mogo.module.v2x.entity.net.V2XStrategyPushRes;
import com.mogo.module.v2x.network.V2XRefreshCallback;
@@ -34,6 +32,7 @@ import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkWindow;
import com.mogo.module.v2x.scenario.scene.test.V2XTestConsoleWindow;
import com.mogo.module.v2x.utils.FatigueDrivingUtils;
import com.mogo.module.v2x.utils.TimeUtils;
+import com.mogo.module.v2x.utils.V2XSQLiteUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.service.module.IMogoModuleLifecycle;
@@ -76,7 +75,7 @@ public class V2XModuleProvider implements
@NonNull
@Override
public String getModuleName() {
- return ServiceConst.TYPE;
+ return MODULE_NAME;
}
@Override
@@ -121,18 +120,15 @@ public class V2XModuleProvider implements
@Override
public void init(Context context) {
- Logger.e(MODULE_NAME, "V2X模块初始化。。。。");
+ Logger.e(MODULE_NAME, "V2X 模块初始化。。。。");
mContext = context;
V2XUtils.init(context);
V2XServiceManager.init(context);
- initVoice(context);
- handleAdas();
+ V2XVoiceManager.INSTANCE.init(context);
+ registerListener();
initData();
-
- V2XServiceManager.getMogoRegisterCenter().registerMogoMapListener(V2XConst.MODULE_NAME, this);
-
// 注册广播接收场景弹窗使用的
SceneBroadcastReceiver localReceiver = new SceneBroadcastReceiver();
LocalBroadcastManager localBroadcastManager = LocalBroadcastManager.getInstance(context);
@@ -148,10 +144,6 @@ public class V2XModuleProvider implements
}
}
- private void initVoice(Context context) {
- V2XVoiceManager.INSTANCE.init(context);
- }
-
private void initData() {
try {
// 查询ACC状态
@@ -171,33 +163,14 @@ public class V2XModuleProvider implements
}
// 刷新配置文件
refreshStrategyConfig();
-
- // 响应违章停车的POI点击
- V2XServiceManager
- .getMogoRegisterCenter()
- .registerMogoMarkerClickListener(V2XConst.MODULE_NAME,
- new IMogoMarkerClickListener() {
- @Override
- public boolean onMarkerClicked(IMogoMarker marker) {
- try {
- MarkerExploreWay markerExploreWay =
- (MarkerExploreWay) ((MarkerShowEntity) marker.getObject()).getBindObj();
- Logger.d(V2XConst.MODULE_NAME,
- "V2X===违章停车:onMarkerClicked=" + markerExploreWay);
-
- ((V2XIllegalParkWindow) V2XIllegalParkScenario.getInstance()
- .getV2XWindow())
- .show(markerExploreWay, false);
- } catch (Exception e) {
- e.printStackTrace();
- }
- return true;
- }
- });
+ // 清除V2X事件数据库中过期的数据,数据有效期为24小时
+ V2XSQLiteUtils.clearYesterdayScenarioHistoryData();
}
+ /**
+ * 获取疲劳驾驶的配置
+ */
private void refreshStrategyConfig() {
- // 获取疲劳驾驶的配置
V2XServiceManager
.getV2XRefreshModel()
.getStrategyPush(new V2XRefreshCallback() {
@@ -219,21 +192,53 @@ public class V2XModuleProvider implements
});
}
- private void handleAdas() {
+ /**
+ * 注册各种监听
+ */
+ private void registerListener() {
+ // 初始化监听
+ V2XServiceManager.getMogoRegisterCenter()
+ .registerMogoMapListener(V2XConst.MODULE_NAME, this);
V2XServiceManager.getMoGoStatusManager()
.registerStatusChangedListener(MODULE_NAME, StatusDescriptor.ACC_STATUS, this);
V2XServiceManager.getMoGoStatusManager()
.registerStatusChangedListener(MODULE_NAME, StatusDescriptor.SEEK_HELPING, this);
+
+ // 响应违章停车的POI点击
+ V2XServiceManager
+ .getMogoRegisterCenter()
+ .registerMogoMarkerClickListener(V2XConst.MODULE_NAME,
+ marker -> {
+ try {
+ MarkerExploreWay markerExploreWay =
+ (MarkerExploreWay) ((MarkerShowEntity) marker.getObject()).getBindObj();
+ Logger.d(V2XConst.MODULE_NAME,
+ "V2X===违章停车:onMarkerClicked=" + markerExploreWay);
+
+ ((V2XIllegalParkWindow) V2XIllegalParkScenario.getInstance()
+ .getV2XWindow())
+ .show(markerExploreWay, false);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ return true;
+ });
+
// 注册V2X场景Socket
V2XServiceManager.getV2XSocketManager().registerSocketMessage();
- // 开启自动刷新
+ // 开启自动刷新,暂时关闭间隔查询来降低流量消耗
V2XServiceManager.getV2XMarkerService().startAutoRefresh();
// 锁车就是将地图视图移植中心点,因为行驶中的车和地图要相对的跟随
V2XServiceManager.getMapUIController().recoverLockMode();
}
- private void handleSeekHelp(boolean isTrue) {
+ /**
+ * 刷新自车求助状态
+ *
+ * @param isTrue
+ */
+ private void refreshMeSeekHelp(boolean isTrue) {
V2XMessageEntity entity = new V2XMessageEntity<>();
entity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP);
entity.setContent(isTrue);
@@ -256,16 +261,24 @@ public class V2XModuleProvider implements
.putString(V2XConst.V2X_ACC_OFF_TIME_STR, TimeUtils.getNowString());
}
} else if (descriptor == StatusDescriptor.SEEK_HELPING) {
- handleSeekHelp(isTrue);
+ refreshMeSeekHelp(isTrue);
}
}
+ /**
+ * 是否是ACC ON操作
+ *
+ * @return true-ACC ON | false - ACC OFF
+ */
public boolean isAccOn() {
int accState = Settings.System.getInt(mContext.getContentResolver(), "mcu_state", -0x02);
Logger.d(MODULE_NAME, "状态发生改变\ndescriptor:ACC_STSTUS" + "\nisTrue:" + accState);
return accState == 1;
}
+ /**
+ * 刷新自车求助状态
+ */
private void initCarForHelpStatus() {
//本地查询是否超时
V2XServiceManager.getV2XRefreshModel().getHelpSignal(new V2XRefreshCallback() {
@@ -278,12 +291,12 @@ public class V2XModuleProvider implements
//故障车
if (vehicleType == 4) {
if (!V2XServiceManager.getMoGoStatusManager().isSeekHelping()) {
- handleSeekHelp(true);
+ refreshMeSeekHelp(true);
V2XServiceManager.getMoGoStatusManager().setSeekHelping(MODULE_NAME, true);
}
} else {
if (V2XServiceManager.getMoGoStatusManager().isSeekHelping()) {
- handleSeekHelp(false);
+ refreshMeSeekHelp(false);
V2XServiceManager.getMoGoStatusManager().setSeekHelping(MODULE_NAME, false);
}
}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XStatusManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XStatusManager.java
index 12396a786e..1dfdf64b5a 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XStatusManager.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/V2XStatusManager.java
@@ -3,6 +3,7 @@ package com.mogo.module.v2x;
import com.mogo.map.MogoLatLng;
import com.mogo.map.location.MogoLocation;
import com.mogo.module.common.entity.V2XRoadEventEntity;
+import com.mogo.utils.logger.Logger;
/**
* author : donghongyu
@@ -53,6 +54,7 @@ public class V2XStatusManager {
if (mLocation == null) {
mLocation = new MogoLocation();
}
+ Logger.d(V2XConst.MODULE_NAME, "当前车辆位置:" + mLocation.toString());
return mLocation;
}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/SurroundingEventAdapter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/SurroundingEventAdapter.java
new file mode 100644
index 0000000000..3da4f2f19f
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/SurroundingEventAdapter.java
@@ -0,0 +1,62 @@
+package com.mogo.module.v2x.adapter;
+
+import android.content.Context;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.TextView;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.amap.api.maps.model.Text;
+import com.mogo.module.v2x.R;
+import com.mogo.module.v2x.entity.panel.SurroundingResponse;
+
+import java.util.List;
+
+/**
+ * @author lixiaopeng
+ * @description 周边
+ * @since 2020/7/29
+ */
+public class SurroundingEventAdapter extends RecyclerView.Adapter{
+ private List mPoiInfosList;
+ private Context mContext;
+ private TextView mAddressTv;
+
+
+ public SurroundingEventAdapter(Context context, List poiInfosList) {
+ mContext = context;
+ mPoiInfosList = poiInfosList;
+ }
+
+ @Override
+ public int getItemViewType(int position) {
+ return super.getItemViewType(position);
+ }
+
+ @NonNull
+ @Override
+ public SurroundingEventViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ View inflate = LayoutInflater.from(parent.getContext())
+ .inflate(R.layout.module_fragment_surrounding_event_item, parent, false);
+ return new SurroundingEventViewHolder(inflate);
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull SurroundingEventViewHolder holder, int position) {
+ final SurroundingResponse.ResultBean.PoiInfosBean poiInfosBean = mPoiInfosList.get(position);
+ if (poiInfosBean == null) {
+ return;
+ }
+
+// mAddressTv = holder.itemView.findViewById(R.id.tv_information);
+ }
+
+ @Override
+ public int getItemCount() {
+ return mPoiInfosList == null ? 0 : mPoiInfosList.size();
+ }
+
+}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/SurroundingEventViewHolder.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/SurroundingEventViewHolder.java
new file mode 100644
index 0000000000..0472e09e58
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/SurroundingEventViewHolder.java
@@ -0,0 +1,19 @@
+package com.mogo.module.v2x.adapter;
+
+import android.view.View;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.RecyclerView;
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2020/7/29
+ */
+public class SurroundingEventViewHolder extends RecyclerView.ViewHolder{
+
+ public SurroundingEventViewHolder(@NonNull View itemView) {
+ super(itemView);
+ }
+
+}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XEventPagerAdapter.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XEventPagerAdapter.kt
new file mode 100644
index 0000000000..716ce9734b
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XEventPagerAdapter.kt
@@ -0,0 +1,21 @@
+package com.mogo.module.v2x.adapter
+
+import androidx.fragment.app.Fragment
+import androidx.viewpager2.adapter.FragmentStateAdapter
+
+/**
+ * 事件面板viewpager2的adapter
+ *
+ * @author tongchenfei
+ */
+class V2XEventPagerAdapter(fragment: Fragment,
+ private val fragments: Array) :
+ FragmentStateAdapter(fragment) {
+
+ /**
+ * 目前一共就三个fragment
+ */
+ override fun getItemCount(): Int = fragments.size
+
+ override fun createFragment(position: Int): Fragment = fragments[position]
+}
\ No newline at end of file
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadEventAdapter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadEventAdapter.java
index 273422e80b..6bb1b00400 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadEventAdapter.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XRoadEventAdapter.java
@@ -6,7 +6,7 @@ import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.mogo.module.common.entity.V2XEventShowEntity;
-import com.mogo.module.common.entity.V2XWindowTypeEnum;
+import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.v2x.adapter.holder.V2XFatigueDrivingVH;
import com.mogo.module.v2x.adapter.holder.V2XIllegalParkVH;
import com.mogo.module.v2x.adapter.holder.V2XLiveVideoVH;
@@ -37,27 +37,27 @@ public class V2XRoadEventAdapter extends RecyclerView.Adapter {
+
+ private ArrayList mV2XHistoryScenarioData;
+
+ public V2XScenarioHistoryAdapter(ArrayList v2XHistoryScenarioData) {
+ if (v2XHistoryScenarioData != null) {
+ this.mV2XHistoryScenarioData = v2XHistoryScenarioData;
+ }
+ }
+
+ @NonNull
+ @Override
+ public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
+ RecyclerView.ViewHolder holder;
+ switch (viewType) {
+ //道路事件详情
+ case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING:
+ holder = new V2XScenarioHistoryRoadEventVH(parent);
+ break;
+ //违章停车
+ case V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING:
+ holder = new V2XScenarioHistoryIllegalParkVH(parent);
+ break;
+ //推送展示
+ case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING:
+ holder = new V2XScenarioHistoryPushEventVH(parent);
+ break;
+ //疲劳驾驶
+ case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING:
+ holder = new V2XScenarioHistoryFatigueDrivingVH(parent);
+ break;
+ //他人故障求助
+ case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING:
+ holder = new V2XScenarioHistoryOtherSeekHelpVH(parent);
+ break;
+ default:
+ holder = new V2XScenarioHistoryRoadEventVH(parent);
+ }
+
+ return holder;
+ }
+
+ @Override
+ public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
+ if (holder instanceof V2XScenarioHistoryRoadEventVH) {
+ ((V2XScenarioHistoryRoadEventVH) holder).initView(mV2XHistoryScenarioData.get(position));
+ }
+ if (holder instanceof V2XScenarioHistoryIllegalParkVH) {
+ ((V2XScenarioHistoryIllegalParkVH) holder).initView(mV2XHistoryScenarioData.get(position));
+ }
+ if (holder instanceof V2XScenarioHistoryPushEventVH) {
+ ((V2XScenarioHistoryPushEventVH) holder).initView(mV2XHistoryScenarioData.get(position));
+ }
+ if (holder instanceof V2XScenarioHistoryFatigueDrivingVH) {
+ ((V2XScenarioHistoryFatigueDrivingVH) holder).initView(mV2XHistoryScenarioData.get(position));
+ }
+ if (holder instanceof V2XScenarioHistoryOtherSeekHelpVH) {
+ ((V2XScenarioHistoryOtherSeekHelpVH) holder).initView(mV2XHistoryScenarioData.get(position));
+ }
+ }
+
+ @Override
+ public int getItemViewType(int position) {
+ return mV2XHistoryScenarioData.get(position).getScenarioType();
+ }
+
+
+ @Override
+ public int getItemCount() {
+ return mV2XHistoryScenarioData == null ? 0 : mV2XHistoryScenarioData.size();
+ }
+
+}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XSeekHelpAdapter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XSeekHelpAdapter.java
deleted file mode 100644
index f1d36a428f..0000000000
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XSeekHelpAdapter.java
+++ /dev/null
@@ -1,224 +0,0 @@
-package com.mogo.module.v2x.adapter;
-
-import android.content.Context;
-import android.text.TextUtils;
-import android.util.Log;
-import android.view.LayoutInflater;
-import android.view.View;
-import android.view.ViewGroup;
-import android.widget.ImageView;
-import android.widget.TextView;
-
-import androidx.annotation.NonNull;
-import androidx.recyclerview.widget.RecyclerView;
-
-import com.mogo.module.carchattingprovider.ICarsChattingProvider;
-import com.mogo.module.v2x.R;
-import com.mogo.module.v2x.V2XConst;
-import com.mogo.module.v2x.V2XServiceManager;
-import com.mogo.module.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity;
-import com.mogo.module.v2x.utils.ChartingUtil;
-import com.mogo.module.v2x.utils.SpanUtils;
-import com.mogo.module.v2x.utils.V2XUtils;
-import com.mogo.service.imageloader.MogoImageView;
-import com.mogo.utils.logger.Logger;
-import com.zhidao.carchattingprovider.ICallChatResponse;
-
-import org.jetbrains.annotations.Nullable;
-
-import java.text.SimpleDateFormat;
-import java.util.ArrayList;
-import java.util.Date;
-import java.util.List;
-import java.util.Locale;
-
-import static android.view.View.GONE;
-import static android.view.View.VISIBLE;
-
-/**
- * author : fenghualong
- * e-mail : 1358506549@qq.com
- * date : 2020/3/11 4:05 PM
- * desc : V2X 其他车辆发起的故障求助
- * version: 1.0
- */
-public class V2XSeekHelpAdapter extends RecyclerView.Adapter {
- private static final String TAG = V2XSeekHelpAdapter.class.getSimpleName();
- private List itemList;
- private LayoutInflater mInflater;
-
- public V2XSeekHelpAdapter(Context context) {
- itemList = new ArrayList<>();
- mInflater = LayoutInflater.from(context);
- }
-
- public void addDataList(List list) {
- if (itemList == null) {
- itemList = new ArrayList<>();
- }
- itemList.addAll(list);
- }
-
- public void addData(V2XMarkerEntity entity) {
- if (itemList == null) {
- itemList = new ArrayList<>();
- }
- itemList.add(entity);
- }
-
- public void removeData(V2XMarkerEntity entity) {
- if (itemList != null) {
- itemList.remove(entity);
- }
- }
-
- public void removeData(int position) {
- if (isPositionValid(position)) {
- itemList.remove(position);
- }
- }
-
- public void clearData() {
- if (itemList != null) {
- itemList.clear();
- }
- }
-
- public boolean isPositionValid(int position) {
- return position > -1 && itemList != null && itemList.size() > position;
- }
-
- @NonNull
- @Override
- public MyViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
- View view = mInflater.inflate(R.layout.item_v2x_fault_help, parent, false);
- return new MyViewHolder(view);
- }
-
- @Override
- public void onBindViewHolder(@NonNull MyViewHolder holder, int position) {
- if (isPositionValid(position)) {
- V2XMarkerEntity entity = itemList.get(position);
- if (entity != null) {
- V2XMarkerEntity.UserInfoBean infoBean = entity.getUserInfo();
- if (infoBean != null) {
- long time = entity.getCreateTime();
- SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.CHINA);
- String eventDistance = String.format("%d", entity.getDistance());
- String eventTime = String.format("%s发布求助信息", sdf.format(new Date(time)));
- holder.initView(infoBean.getHeadImgUrl(), infoBean.getDisplayName(), eventDistance, eventTime);
- }
- }
- Log.d(TAG, "onBindViewHolder position=$position, entity= " + entity);
- setCallData(holder.ivCall, entity);
- //setCallDataWait(holder.ivCall, entity);
- holder.ivNavi.setOnClickListener(v -> {
- if (mListener != null && !V2XUtils.isFastClick()) {
-
- mListener.onViewNaviClick(entity.getLat(), entity.getLon());
- }
- });
- }
- }
-
- private void setCallData(ImageView ivCall, V2XMarkerEntity entity) {
- ICarsChattingProvider provider = V2XServiceManager.getCarsChattingProvider();
- // 判断是否可以打电话
- ChartingUtil.isCanCall(b -> {
- if (b) {
- // 判断是否可以打电话
- ChartingUtil.isOnLine(entity.getSn(), b1 -> {
- if (b1) {
- ivCall.setVisibility(VISIBLE);
- } else {
- ivCall.setVisibility(GONE);
- }
- });
- } else {
- ivCall.setVisibility(GONE);
- }
- });
- ivCall.setOnClickListener(v -> {
- if (!V2XUtils.isFastClick()) {
- provider.isOnLine(V2XConst.MODULE_NAME, ivCall.getContext(), entity.getSn(), new ICallChatResponse() {
- @Override
- public void isOnLine(boolean isOnline, @Nullable String s) {
- provider.canCall(V2XConst.MODULE_NAME, ivCall.getContext(), new ICallChatResponse() {
- @Override
- public void canCall(boolean canCall) {
- Logger.d(TAG, "调用车聊聊,查询状态! SN=" + entity.getSn() + " is online: " + isOnline + " canCall: " + canCall + ", thread: " + Thread.currentThread().getName());
- V2XUtils.runOnUiThread(() -> {
- if (mListener != null && isOnline && canCall) {
- mListener.onViewChatClick(entity);
- }
- });
-
- }
- });
- }
- }
- );
- }
- });
- }
-
- @Override
- public int getItemCount() {
- return itemList != null ? itemList.size() : 0;
- }
-
- static class MyViewHolder extends RecyclerView.ViewHolder {
- MogoImageView ivHead;
- TextView tvName;
- TextView tvDistance;
- TextView tvEventTime;
- ImageView ivCall;
- ImageView ivNavi;
-
- MyViewHolder(@NonNull View itemView) {
- super(itemView);
- ivHead = itemView.findViewById(R.id.ivFaultHelpHead);
- tvName = itemView.findViewById(R.id.tvFaultHelpName);
- tvDistance = itemView.findViewById(R.id.tvFaultHelpDistance);
- tvEventTime = itemView.findViewById(R.id.tvFaultHelpEventTime);
- ivCall = itemView.findViewById(R.id.ivFaultHelpEventCall);
- ivNavi = itemView.findViewById(R.id.ivFaultHelpEventNavi);
- }
-
- void initView(String headUrl, String name, String distance, String eventTime) {
- if (!TextUtils.isEmpty(headUrl)) {
- V2XServiceManager.getImageLoader()
- .displayImage(headUrl, ivHead);
- }
- tvName.setText(name);
- tvDistance.setText(distance);
- SpanUtils.with(tvDistance)
- .append("" + distance)
- .setFontSize((int) tvDistance.getResources().getDimension(R.dimen.dp_80))
- .append("M")
- .setFontSize((int) tvDistance.getResources().getDimension(R.dimen.dp_30))
- .create();
- tvEventTime.setText(eventTime);
- }
- }
-
- private OnViewClickListener mListener;
-
- public void setOnViewClickListener(OnViewClickListener listener) {
- mListener = listener;
- }
-
- public interface OnViewClickListener {
- /**
- * 点击事件,打电话给车聊聊
- *
- * @param entity
- */
- void onViewChatClick(V2XMarkerEntity entity);
-
- /**
- * 点击事件,导航去故障车位置
- */
- void onViewNaviClick(double lat, double lng);
- }
-}
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/adapter/ShareEventAdapter.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XShareEventAdapter.java
similarity index 69%
rename from modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/adapter/ShareEventAdapter.java
rename to modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XShareEventAdapter.java
index c5a302e305..094b0b00d9 100644
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/adapter/ShareEventAdapter.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/V2XShareEventAdapter.java
@@ -1,41 +1,41 @@
-package com.zhidao.mogo.module.event.panel.adapter;
+package com.mogo.module.v2x.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
+import android.widget.RatingBar;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.launcher.ARouter;
+import com.mogo.module.v2x.R;
+import com.mogo.module.v2x.entity.panel.ShareEventDescription;
+import com.mogo.module.v2x.entity.panel.ShareEventItem;
+import com.mogo.module.v2x.entity.panel.ShareEventItemEnum;
+import com.mogo.module.v2x.entity.panel.ShareEventLoadMoreItem;
+import com.mogo.module.v2x.fragment.V2XEventPanelFragment;
+import com.mogo.module.v2x.listener.AdapterCallback;
import com.mogo.service.IMogoServiceApis;
import com.mogo.service.MogoServicePaths;
import com.mogo.utils.DateTimeUtils;
-import com.zhidao.mogo.module.event.panel.R;
-import com.zhidao.mogo.module.event.panel.bean.ShareEventDescription;
-import com.zhidao.mogo.module.event.panel.bean.ShareEventItem;
-import com.zhidao.mogo.module.event.panel.bean.ShareEventItemEnum;
-import com.zhidao.mogo.module.event.panel.fragment.EventPanelFragment;
import java.util.ArrayList;
-public class ShareEventAdapter extends RecyclerView.Adapter {
+public class V2XShareEventAdapter extends RecyclerView.Adapter {
private Context context;
private ArrayList dataArrayList;
private final LayoutInflater shareLayoutInflater;
- private boolean emptylist;//分享空白页
private IMogoServiceApis mApis;
+ private AdapterCallback callback;
- public void setEmptylist(boolean emptylist) {
- this.emptylist = emptylist;
- }
-
- public ShareEventAdapter(Context context, ArrayList dataArrayList) {
+ public V2XShareEventAdapter(Context context, ArrayList dataArrayList, AdapterCallback callback) {
this.context = context;
this.dataArrayList = dataArrayList;
+ this.callback = callback;
shareLayoutInflater = LayoutInflater.from(context);
mApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
}
@@ -45,46 +45,75 @@ public class ShareEventAdapter extends RecyclerView.Adapter position) {
ShareEventDescription.ResultBean.EnthusiasmIndexBean data = (ShareEventDescription.ResultBean.EnthusiasmIndexBean) dataArrayList.get(position);
if (data != null) {
String shareNum = String.valueOf(data.getShareNum());
String likeNum = String.valueOf(data.getLikeNum());
+ double enthusiasmIndex = data.getEnthusiasmIndex();
if (shareNum != null) {
((shareDescriptionViewHolder) holder).shareNumTextView.setText(shareNum);
}
if (likeNum != null) {
((shareDescriptionViewHolder) holder).approveNumTextView.setText(likeNum);
}
+ ((shareDescriptionViewHolder) holder).ratingBar.setRating(getEnthusuasmIndex(enthusiasmIndex));
}
}
} else if (holder instanceof shareItemViewHolder) {
+ //分享列表
if (dataArrayList.size() > position) {
ShareEventItem.ResultBean.PageBean.ContentBean data = (ShareEventItem.ResultBean.PageBean.ContentBean) dataArrayList.get(position);
if (data != null) {
@@ -112,23 +141,27 @@ public class ShareEventAdapter extends RecyclerView.Adapter {
- EventPanelFragment.Companion.getInstance().hidePanel();
+ V2XEventPanelFragment.Companion.getInstance().hidePanel();
mApis.getShareManager().showShareDialog();
});
}
@@ -190,6 +226,13 @@ public class ShareEventAdapter extends RecyclerView.Adapter
extends RecyclerView.ViewHolder
implements IMogoNaviListener {
@@ -36,6 +36,14 @@ public abstract class V2XBaseViewHolder
super(itemView);
}
+
+ /**
+ * 填充View视图
+ *
+ * @param viewData 与视图绑定的数据
+ */
+ public abstract void initView(T viewData);
+
/**
* 延迟关闭窗体视图
*/
@@ -91,10 +99,10 @@ public abstract class V2XBaseViewHolder
*/
public void triggerReportErr(MarkerExploreWay noveltyInfo) {
try {
- RoadConditionUtils.sendDataErrorReceiverInfo(
+ RoadConditionUtils.sendShareReceiverInfo(
noveltyInfo.getPoiType(),
noveltyInfo.getInfoId(),
- "1");
+ 3);
TrackUtils.trackV2xRoadEvent(
noveltyInfo.getInfoId(),
@@ -112,10 +120,10 @@ public abstract class V2XBaseViewHolder
*/
public void triggerReportTrue(MarkerExploreWay noveltyInfo) {
try {
- RoadConditionUtils.sendDataErrorReceiverInfo(
+ RoadConditionUtils.sendShareReceiverInfo(
noveltyInfo.getPoiType(),
noveltyInfo.getInfoId(),
- "2");
+ 2);
TrackUtils.trackV2xRoadEvent(
noveltyInfo.getInfoId(),
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XFatigueDrivingVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XFatigueDrivingVH.java
index 424ca24100..f3d5c12454 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XFatigueDrivingVH.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XFatigueDrivingVH.java
@@ -29,7 +29,7 @@ import com.mogo.module.v2x.voice.V2XVoiceManager;
*
* @author donghongyu
*/
-public class V2XFatigueDrivingVH extends V2XBaseViewHolder {
+public class V2XFatigueDrivingVH extends V2XBaseViewHolder {
private TextView mTvAddress, mTvAddressDistance;
private ImageView mIvToNav;
@@ -41,7 +41,7 @@ public class V2XFatigueDrivingVH extends V2XBaseViewHolder {
public V2XFatigueDrivingVH(ViewGroup viewGroup) {
super(LayoutInflater.from(viewGroup.getContext())
- .inflate(R.layout.window_fatigue_driving, viewGroup, false));
+ .inflate(R.layout.item_v2x_fatigue_driving, viewGroup, false));
mTvAddress = itemView.findViewById(R.id.tvAddress);
mTvAddressDistance = itemView.findViewById(R.id.tvAddressDistance);
mIvToNav = itemView.findViewById(R.id.ivToNav);
@@ -71,6 +71,7 @@ public class V2XFatigueDrivingVH extends V2XBaseViewHolder {
});
}
+ @Override
public void initView(V2XEventShowEntity v2XEventShowEntity) {
mV2XPushMessageEntity = v2XEventShowEntity.getV2XPushMessageEntity();
try {
@@ -97,9 +98,9 @@ public class V2XFatigueDrivingVH extends V2XBaseViewHolder {
SpanUtils.with(mTvAddressDistance)
.append("" + (int) mV2XPushMessageEntity.getDistance())
- .setFontSize((int) itemView.getResources().getDimension(R.dimen.dp_80))
- .append("M")
- .setFontSize((int) itemView.getResources().getDimension(R.dimen.dp_30))
+ .setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text))
+ .append("m")
+ .setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
.create();
}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XIllegalParkVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XIllegalParkVH.java
index d66488d4cd..22ee1d2379 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XIllegalParkVH.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XIllegalParkVH.java
@@ -29,7 +29,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
*
* @author donghongyu
*/
-public class V2XIllegalParkVH extends V2XBaseViewHolder {
+public class V2XIllegalParkVH extends V2XBaseViewHolder {
private TextView mAddressTv;
private TextView mIllegalNumTv;
private HeartLikeView mIlIllegalParkingLike;
@@ -43,7 +43,7 @@ public class V2XIllegalParkVH extends V2XBaseViewHolder {
public V2XIllegalParkVH(ViewGroup viewGroup) {
super(LayoutInflater.from(viewGroup.getContext())
- .inflate(R.layout.window_illegal_parking, viewGroup, false));
+ .inflate(R.layout.item_v2x_illegal_parking, viewGroup, false));
mAddressTv = itemView.findViewById(R.id.tvAddress);
mIllegalNumTv = itemView.findViewById(R.id.tvIllegalNum);
@@ -75,6 +75,7 @@ public class V2XIllegalParkVH extends V2XBaseViewHolder {
});
}
+ @Override
public void initView(V2XEventShowEntity v2XEventShowEntity) {
mExploreWay = v2XEventShowEntity.getV2XIllegalPark();
mAddressTv.setText(mExploreWay.getAddr());
@@ -108,10 +109,10 @@ public class V2XIllegalParkVH extends V2XBaseViewHolder {
*/
private void roadReportTrue() {
if (mExploreWay != null) {
- RoadConditionUtils.sendDataErrorReceiverInfo(
+ RoadConditionUtils.sendShareReceiverInfo(
mExploreWay.getPoiType(),
mExploreWay.getInfoId(),
- "2");
+ 2);
}
delayedCloseWindow();
}
@@ -121,10 +122,10 @@ public class V2XIllegalParkVH extends V2XBaseViewHolder {
*/
private void roadReportErr() {
if (mExploreWay != null) {
- RoadConditionUtils.sendDataErrorReceiverInfo(
+ RoadConditionUtils.sendShareReceiverInfo(
mExploreWay.getPoiType(),
mExploreWay.getInfoId(),
- "1");
+ 3);
}
delayedCloseWindow();
}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XLiveVideoVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XLiveVideoVH.java
index 61dafb34ce..37c3ab96e7 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XLiveVideoVH.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XLiveVideoVH.java
@@ -21,8 +21,9 @@ import com.mogo.service.imageloader.MogoImageView;
* date : 2020/3/11 4:35 PM
* desc : 直播类型的卡片
* version: 1.0
+ * @author donghongyu
*/
-public class V2XLiveVideoVH extends V2XBaseViewHolder {
+public class V2XLiveVideoVH extends V2XBaseViewHolder {
private V2XLiveGSYVideoView videoPlayer;
private MogoImageView ivReportHead;
@@ -40,6 +41,7 @@ public class V2XLiveVideoVH extends V2XBaseViewHolder {
ivReportHead = itemView.findViewById(R.id.ivReportHead);
}
+ @Override
public void initView(V2XEventShowEntity v2XLiveCarEntity) {
mV2XRoadEventEntity = v2XLiveCarEntity.getV2XRoadEventEntity();
mV2XLiveCarEntity = v2XLiveCarEntity.getV2XLiveCarInfoRes();
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XOtherSeekHelpVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XOtherSeekHelpVH.java
index a4d323c44e..9a823dea8d 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XOtherSeekHelpVH.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XOtherSeekHelpVH.java
@@ -16,7 +16,6 @@ import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
-import com.mogo.module.v2x.scenario.scene.fatigue.V2XFatigueDrivingScenario;
import com.mogo.module.v2x.scenario.scene.seek.V2XSeekHelpScenario;
import com.mogo.module.v2x.utils.ChartingUtil;
import com.mogo.module.v2x.utils.SpanUtils;
@@ -41,7 +40,7 @@ import static android.view.View.VISIBLE;
*
* @author donghongyu
*/
-public class V2XOtherSeekHelpVH extends V2XBaseViewHolder {
+public class V2XOtherSeekHelpVH extends V2XBaseViewHolder {
private MogoImageView ivHead;
private TextView tvName;
@@ -116,6 +115,7 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder {
});
}
+ @Override
public void initView(V2XEventShowEntity v2XEventShowEntity) {
mV2XPushMessageEntity = v2XEventShowEntity.getV2XPushMessageEntity();
// 只有自研车机才会 有车聊聊通话
@@ -170,9 +170,9 @@ public class V2XOtherSeekHelpVH extends V2XBaseViewHolder {
tvName.setText(mV2XPushMessageEntity.getDisplayName());
SpanUtils.with(tvDistance)
.append("" + (int) mV2XPushMessageEntity.getDistance())
- .setFontSize((int) tvDistance.getResources().getDimension(R.dimen.dp_80))
- .append("M")
- .setFontSize((int) tvDistance.getResources().getDimension(R.dimen.dp_30))
+ .setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_text))
+ .append("m")
+ .setFontSize((int) itemView.getResources().getDimension(R.dimen.module_v2x_event_distance_title))
.create();
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.CHINA);
String eventTime = String.format("%s发布求助信息",
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XPushEventVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XPushEventVH.java
index 134926fe46..65c130fde1 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XPushEventVH.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XPushEventVH.java
@@ -27,8 +27,9 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* date : 2020/3/11 4:35 PM
* desc : TODO 这里是前瞻演示需求,推送的消息,
* version: 1.0
+ * @author donghongyu
*/
-public class V2XPushEventVH extends V2XBaseViewHolder {
+public class V2XPushEventVH extends V2XBaseViewHolder {
private MogoImageView ivImg;
private MogoImageView ivReportHead;
@@ -136,6 +137,7 @@ public class V2XPushEventVH extends V2XBaseViewHolder {
});
}
+ @Override
public void initView(V2XEventShowEntity v2XEventShowEntity) {
mV2XRoadEventEntity = v2XEventShowEntity.getV2XPushMessageEntity();
mNoveltyInfo = new MarkerExploreWay();
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java
index 75c28a20f1..aa46a1c0ef 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XRoadEventVH.java
@@ -15,7 +15,6 @@ import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XLiveCarInfoEntity;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
-import com.mogo.module.common.entity.V2XWindowTypeEnum;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
@@ -49,8 +48,9 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* date : 2020/3/11 4:35 PM
* desc : 道路事件详情
* version: 1.0
+ * @author donghongyu
*/
-public class V2XRoadEventVH extends V2XBaseViewHolder {
+public class V2XRoadEventVH extends V2XBaseViewHolder {
private MogoImageView ivEventImg;
private MogoImageView ivReportHead;
private ImageView ivEventPlay;
@@ -156,6 +156,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder {
});
}
+ @Override
public void initView(V2XEventShowEntity v2XEventShowEntity) {
try {
if (v2XEventShowEntity == null) {
@@ -255,7 +256,7 @@ public class V2XRoadEventVH extends V2XBaseViewHolder {
List eventShowEntityArrayList = new ArrayList<>();
for (V2XLiveCarInfoEntity v2XLiveCarInfoRes : v2XEventShowEntity.getV2XLiveCarList()) {
V2XEventShowEntity showEntity = new V2XEventShowEntity();
- showEntity.setViewType(V2XWindowTypeEnum.LIVE_CAR_WINDOW);
+ showEntity.setViewType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING);
showEntity.setV2XLiveCarInfoRes(v2XLiveCarInfoRes);
showEntity.setV2XRoadEventEntity(mV2XRoadEventEntity);
eventShowEntityArrayList.add(showEntity);
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryFatigueDrivingVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryFatigueDrivingVH.java
new file mode 100644
index 0000000000..aed740257c
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryFatigueDrivingVH.java
@@ -0,0 +1,29 @@
+package com.mogo.module.v2x.adapter.holder;
+
+import android.view.LayoutInflater;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+
+import com.mogo.module.common.entity.V2XHistoryScenarioData;
+import com.mogo.module.v2x.R;
+
+/**
+ * @author donghongyu
+ */
+public class V2XScenarioHistoryFatigueDrivingVH extends V2XBaseViewHolder {
+ public V2XScenarioHistoryFatigueDrivingVH(@NonNull ViewGroup viewGroup) {
+ super(LayoutInflater.from(viewGroup.getContext())
+ .inflate(R.layout.item_v2x_fatigue_driving, viewGroup, false));
+ }
+
+ @Override
+ public void initView(V2XHistoryScenarioData viewData) {
+
+ }
+
+ @Override
+ public void delayedCloseWindow() {
+
+ }
+}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryIllegalParkVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryIllegalParkVH.java
new file mode 100644
index 0000000000..22095ad319
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryIllegalParkVH.java
@@ -0,0 +1,29 @@
+package com.mogo.module.v2x.adapter.holder;
+
+import android.view.LayoutInflater;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+
+import com.mogo.module.common.entity.V2XHistoryScenarioData;
+import com.mogo.module.v2x.R;
+
+/**
+ * @author donghongyu
+ */
+public class V2XScenarioHistoryIllegalParkVH extends V2XBaseViewHolder {
+ public V2XScenarioHistoryIllegalParkVH(@NonNull ViewGroup viewGroup) {
+ super(LayoutInflater.from(viewGroup.getContext())
+ .inflate(R.layout.item_v2x_illegal_parking, viewGroup, false));
+ }
+
+ @Override
+ public void initView(V2XHistoryScenarioData viewData) {
+
+ }
+
+ @Override
+ public void delayedCloseWindow() {
+
+ }
+}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryOtherSeekHelpVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryOtherSeekHelpVH.java
new file mode 100644
index 0000000000..21638e8a2e
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryOtherSeekHelpVH.java
@@ -0,0 +1,29 @@
+package com.mogo.module.v2x.adapter.holder;
+
+import android.view.LayoutInflater;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+
+import com.mogo.module.common.entity.V2XHistoryScenarioData;
+import com.mogo.module.v2x.R;
+
+/**
+ * @author donghongyu
+ */
+public class V2XScenarioHistoryOtherSeekHelpVH extends V2XBaseViewHolder {
+ public V2XScenarioHistoryOtherSeekHelpVH(@NonNull ViewGroup viewGroup) {
+ super(LayoutInflater.from(viewGroup.getContext())
+ .inflate(R.layout.item_v2x_fault_help, viewGroup, false));
+ }
+
+ @Override
+ public void initView(V2XHistoryScenarioData viewData) {
+
+ }
+
+ @Override
+ public void delayedCloseWindow() {
+
+ }
+}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryPushEventVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryPushEventVH.java
new file mode 100644
index 0000000000..897764473b
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryPushEventVH.java
@@ -0,0 +1,29 @@
+package com.mogo.module.v2x.adapter.holder;
+
+import android.view.LayoutInflater;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+
+import com.mogo.module.common.entity.V2XHistoryScenarioData;
+import com.mogo.module.v2x.R;
+
+/**
+ * @author donghongyu
+ */
+public class V2XScenarioHistoryPushEventVH extends V2XBaseViewHolder {
+ public V2XScenarioHistoryPushEventVH(@NonNull ViewGroup viewGroup) {
+ super(LayoutInflater.from(viewGroup.getContext())
+ .inflate(R.layout.item_v2x_push_event_detail, viewGroup, false));
+ }
+
+ @Override
+ public void initView(V2XHistoryScenarioData viewData) {
+
+ }
+
+ @Override
+ public void delayedCloseWindow() {
+
+ }
+}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryRoadEventVH.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryRoadEventVH.java
new file mode 100644
index 0000000000..d6dd0e022c
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/adapter/holder/V2XScenarioHistoryRoadEventVH.java
@@ -0,0 +1,29 @@
+package com.mogo.module.v2x.adapter.holder;
+
+import android.view.LayoutInflater;
+import android.view.ViewGroup;
+
+import androidx.annotation.NonNull;
+
+import com.mogo.module.common.entity.V2XHistoryScenarioData;
+import com.mogo.module.v2x.R;
+
+/**
+ * @author donghongyu
+ */
+public class V2XScenarioHistoryRoadEventVH extends V2XBaseViewHolder {
+ public V2XScenarioHistoryRoadEventVH(@NonNull ViewGroup viewGroup) {
+ super(LayoutInflater.from(viewGroup.getContext())
+ .inflate(R.layout.item_v2x_event_detail, viewGroup, false));
+ }
+
+ @Override
+ public void initView(V2XHistoryScenarioData viewData) {
+
+ }
+
+ @Override
+ public void delayedCloseWindow() {
+
+ }
+}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/alarm/V2XAlarmServer.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/alarm/V2XAlarmServer.java
index 2fdd7b412f..4067c6c0a4 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/alarm/V2XAlarmServer.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/alarm/V2XAlarmServer.java
@@ -29,8 +29,8 @@ import com.mogo.module.v2x.utils.TimeUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.utils.ArrayUtils;
import com.mogo.utils.logger.Logger;
-import com.mogo.utils.storage.SharedPrefsMgr;
import com.mogo.utils.network.utils.GsonUtil;
+import com.mogo.utils.storage.SharedPrefsMgr;
import java.util.ArrayList;
import java.util.HashMap;
@@ -41,7 +41,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
- * author : donghongyu
+ * @author donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/4/13 11:02 AM
* desc :
@@ -96,7 +96,6 @@ public class V2XAlarmServer {
eventLocation.getLat(),
(int) currentLocation.getBearing()
);
- // Logger.w(MODULE_NAME, "V2X预警--事件位置===" + eventLocation);
if (0 <= eventAngle && eventAngle <= 20) {
// 判断是否已经提示过道路事件
boolean isAlreadyAlert = false;
@@ -112,12 +111,12 @@ public class V2XAlarmServer {
isAlreadyAlert = true;
}
}
-// Logger.w(MODULE_NAME, "V2X预警--车辆与事件信息:" +
-// "\n距离:" + v2XRoadEventEntity.getDistance() + "米" +
-// "\n是否已经提醒:" + isAlreadyAlert +
-// "\n事件ID:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
-// "\n事件详情:" + GsonUtil.jsonFromObject(v2XRoadEventEntity.getNoveltyInfo())
-// );
+ Logger.w(MODULE_NAME, "V2X预警--车辆与事件信息:" +
+ "\n距离:" + v2XRoadEventEntity.getDistance() + "米" +
+ "\n是否已经提醒:" + isAlreadyAlert +
+ "\n事件ID:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId() +
+ "\n事件详情:" + GsonUtil.jsonFromObject(v2XRoadEventEntity.getNoveltyInfo())
+ );
// 进行提醒
if (!isAlreadyAlert) {
mAlertRoadEventList.put(v2XRoadEventEntity, TimeUtils.getNowString());
@@ -125,22 +124,23 @@ public class V2XAlarmServer {
}
return null;
} else {
-// Logger.w(MODULE_NAME, "V2X预警--车辆与事件信息:" +
-// "\n角度:" + eventAngle + " 度" +
-// "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId()
-// );
+ Logger.w(MODULE_NAME, "V2X预警--事件与车头角度夹角过大:" +
+ "\n角度:" + eventAngle + " 度" +
+ "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId()
+ );
}
} else {
-// Logger.w(MODULE_NAME, "V2X预警--车辆与事件信息:" +
-// "\n距离:" + v2XRoadEventEntity.getDistance() + "米" +
-// "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId()
-// );
+ Logger.w(MODULE_NAME, "V2X预警--车辆距离事件距离大于500米了:" +
+ "\n距离:" + v2XRoadEventEntity.getDistance() + "米" +
+ "\n事件详情:" + v2XRoadEventEntity.getNoveltyInfo().getInfoId()
+ );
}
} else {
-// Logger.w(MODULE_NAME,
-// "车头方向: " + currentLocation.getAngle() +
-// "\n事件方向:" + v2XRoadEventEntity.getLocation().getAngle()
-// );
+ Logger.w(MODULE_NAME,
+ "V2X预警--车头方向与事件方向角度不一致:" +
+ "\n车头方向: " + currentLocation.getBearing() +
+ "\n事件方向:" + v2XRoadEventEntity.getLocation().getAngle()
+ );
}
}
}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/Center.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/Center.kt
new file mode 100644
index 0000000000..c8a758acfa
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/Center.kt
@@ -0,0 +1,12 @@
+package com.mogo.module.v2x.entity.panel
+
+/**
+ * @description
+ *
+ * @author lixiaopeng
+ * @since 2019-10-24
+ */
+data class Center (
+ val lat: Double,
+ val lon: Double
+)
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/bean/ShareEventDescription.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventDescription.java
similarity index 96%
rename from modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/bean/ShareEventDescription.java
rename to modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventDescription.java
index 4cae136d3f..cd0fe1d10a 100644
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/bean/ShareEventDescription.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventDescription.java
@@ -1,4 +1,4 @@
-package com.zhidao.mogo.module.event.panel.bean;
+package com.mogo.module.v2x.entity.panel;
import com.mogo.commons.data.BaseData;
@@ -45,11 +45,11 @@ public class ShareEventDescription extends BaseData implements Serializable {
this.enthusiasmIndex = enthusiasmIndex;
}
- public static class EnthusiasmIndexBean {
+ public static class EnthusiasmIndexBean{
@Override
public String toString() {
return "EnthusiasmIndexBean{" +
- "id=" + id +
+ ", id=" + id +
", sn='" + sn + '\'' +
", score=" + score +
", shareNum=" + shareNum +
@@ -72,7 +72,6 @@ public class ShareEventDescription extends BaseData implements Serializable {
* createTime : 2020-07-28T06:21:11.523+0000
* updateTime : 2020-07-28T06:21:11.523+0000
*/
-
private int id;
private String sn;
private int score;
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/bean/ShareEventItem.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventItem.java
similarity index 51%
rename from modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/bean/ShareEventItem.java
rename to modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventItem.java
index 9b7fdce6d2..b4b437b734 100644
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/bean/ShareEventItem.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventItem.java
@@ -1,4 +1,4 @@
-package com.zhidao.mogo.module.event.panel.bean;
+package com.mogo.module.v2x.entity.panel;
import com.mogo.commons.data.BaseData;
@@ -7,12 +7,6 @@ import java.util.List;
public class ShareEventItem extends BaseData implements Serializable {
-
- /**
- * detailMsg :
- * result : {"page":{"total":1024,"pageSize":1,"pageNum":4,"content":[{"coordinates":[116.407653,39.966487],"uploadTimestamp":1592901273966,"timeout":1593100800000,"uploadAddress":"安定门外大街","distance":0,"dbId":"725026095564550144","poiType":"10002","sn":"ZD802B1932L00622","userId":0,"userName":"小松鼠艾德蒙","userHead":"http://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592476328925.png","likeNum":18,"notLikeNum":0,"uploadType":2,"uploadUser":"123","imgUrl":null,"content":null,"gasStationId":null,"gasStationName":null,"gasImg":null,"gasPrices":null,"endDate":"2020-06-26 00:00:00","fabulous":false,"direction":180,"virtualLikeNum":822,"status":1,"sourceType":"10002","hitId":"0K-mf3MBeovPWpwE9IfR","userType":2,"data":[{"url":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592546939076.mp4%3Fsign%3Dq-sign-algorithm%253Dsha1%2526q-ak%253DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%2526q-sign-time%253D1592546939%253B1592550539%2526q-key-time%253D1592546939%253B1592550539%2526q-header-list%253D%2526q-url-param-list%253D%2526q-signature%253D74a4058ad7579ea210dafcf78d7a19460cffb899?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1595574735%3B1595578335%26q-key-time%3D1595574735%3B1595578335%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D679bff1838c7d497d38f48ef999b50e80c5856c4","thumbnail":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592546956790.png%3Fsign%3Dq-sign-algorithm%253Dsha1%2526q-ak%253DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%2526q-sign-time%253D1592546956%253B1592550556%2526q-key-time%253D1592546956%253B1592550556%2526q-header-list%253D%2526q-url-param-list%253D%2526q-signature%253Dcc9a35349fc55e433f934af88df576ae792b3987?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1595574735%3B1595578335%26q-key-time%3D1595574735%3B1595578335%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D99b5a92a4f97909d8c217dbeec2ec6e9ec1052f4","content":null,"illegalCount":null}]}]}}
- */
-
private String detailMsg;
private ResultBean result;
@@ -33,10 +27,6 @@ public class ShareEventItem extends BaseData implements Serializable {
}
public static class ResultBean {
- /**
- * page : {"total":1024,"pageSize":1,"pageNum":4,"content":[{"coordinates":[116.407653,39.966487],"uploadTimestamp":1592901273966,"timeout":1593100800000,"uploadAddress":"安定门外大街","distance":0,"dbId":"725026095564550144","poiType":"10002","sn":"ZD802B1932L00622","userId":0,"userName":"小松鼠艾德蒙","userHead":"http://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592476328925.png","likeNum":18,"notLikeNum":0,"uploadType":2,"uploadUser":"123","imgUrl":null,"content":null,"gasStationId":null,"gasStationName":null,"gasImg":null,"gasPrices":null,"endDate":"2020-06-26 00:00:00","fabulous":false,"direction":180,"virtualLikeNum":822,"status":1,"sourceType":"10002","hitId":"0K-mf3MBeovPWpwE9IfR","userType":2,"data":[{"url":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592546939076.mp4%3Fsign%3Dq-sign-algorithm%253Dsha1%2526q-ak%253DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%2526q-sign-time%253D1592546939%253B1592550539%2526q-key-time%253D1592546939%253B1592550539%2526q-header-list%253D%2526q-url-param-list%253D%2526q-signature%253D74a4058ad7579ea210dafcf78d7a19460cffb899?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1595574735%3B1595578335%26q-key-time%3D1595574735%3B1595578335%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D679bff1838c7d497d38f48ef999b50e80c5856c4","thumbnail":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592546956790.png%3Fsign%3Dq-sign-algorithm%253Dsha1%2526q-ak%253DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%2526q-sign-time%253D1592546956%253B1592550556%2526q-key-time%253D1592546956%253B1592550556%2526q-header-list%253D%2526q-url-param-list%253D%2526q-signature%253Dcc9a35349fc55e433f934af88df576ae792b3987?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1595574735%3B1595578335%26q-key-time%3D1595574735%3B1595578335%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D99b5a92a4f97909d8c217dbeec2ec6e9ec1052f4","content":null,"illegalCount":null}]}]}
- */
-
private PageBean page;
public PageBean getPage() {
@@ -48,12 +38,6 @@ public class ShareEventItem extends BaseData implements Serializable {
}
public static class PageBean {
- /**
- * total : 1024
- * pageSize : 1
- * pageNum : 4
- * content : [{"coordinates":[116.407653,39.966487],"uploadTimestamp":1592901273966,"timeout":1593100800000,"uploadAddress":"安定门外大街","distance":0,"dbId":"725026095564550144","poiType":"10002","sn":"ZD802B1932L00622","userId":0,"userName":"小松鼠艾德蒙","userHead":"http://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592476328925.png","likeNum":18,"notLikeNum":0,"uploadType":2,"uploadUser":"123","imgUrl":null,"content":null,"gasStationId":null,"gasStationName":null,"gasImg":null,"gasPrices":null,"endDate":"2020-06-26 00:00:00","fabulous":false,"direction":180,"virtualLikeNum":822,"status":1,"sourceType":"10002","hitId":"0K-mf3MBeovPWpwE9IfR","userType":2,"data":[{"url":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592546939076.mp4%3Fsign%3Dq-sign-algorithm%253Dsha1%2526q-ak%253DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%2526q-sign-time%253D1592546939%253B1592550539%2526q-key-time%253D1592546939%253B1592550539%2526q-header-list%253D%2526q-url-param-list%253D%2526q-signature%253D74a4058ad7579ea210dafcf78d7a19460cffb899?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1595574735%3B1595578335%26q-key-time%3D1595574735%3B1595578335%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D679bff1838c7d497d38f48ef999b50e80c5856c4","thumbnail":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592546956790.png%3Fsign%3Dq-sign-algorithm%253Dsha1%2526q-ak%253DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%2526q-sign-time%253D1592546956%253B1592550556%2526q-key-time%253D1592546956%253B1592550556%2526q-header-list%253D%2526q-url-param-list%253D%2526q-signature%253Dcc9a35349fc55e433f934af88df576ae792b3987?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1595574735%3B1595578335%26q-key-time%3D1595574735%3B1595578335%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D99b5a92a4f97909d8c217dbeec2ec6e9ec1052f4","content":null,"illegalCount":null}]}]
- */
private int total;
private int pageSize;
@@ -96,7 +80,8 @@ public class ShareEventItem extends BaseData implements Serializable {
@Override
public String toString() {
return "ContentBean{" +
- "uploadTimestamp=" + uploadTimestamp +
+ "viewType=" + viewType +
+ ", uploadTimestamp=" + uploadTimestamp +
", timeout=" + timeout +
", uploadAddress='" + uploadAddress + '\'' +
", distance=" + distance +
@@ -129,75 +114,43 @@ public class ShareEventItem extends BaseData implements Serializable {
'}';
}
- /**
- * coordinates : [116.407653,39.966487]
- * uploadTimestamp : 1592901273966
- * timeout : 1593100800000
- * uploadAddress : 安定门外大街
- * distance : 0
- * dbId : 725026095564550144
- * poiType : 10002
- * sn : ZD802B1932L00622
- * userId : 0
- * userName : 小松鼠艾德蒙
- * userHead : http://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592476328925.png
- * likeNum : 18
- * notLikeNum : 0
- * uploadType : 2
- * uploadUser : 123
- * imgUrl : null
- * content : null
- * gasStationId : null
- * gasStationName : null
- * gasImg : null
- * gasPrices : null
- * endDate : 2020-06-26 00:00:00
- * fabulous : false
- * direction : 180
- * virtualLikeNum : 822
- * status : 1
- * sourceType : 10002
- * hitId : 0K-mf3MBeovPWpwE9IfR
- * userType : 2
- * data : [{"url":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592546939076.mp4%3Fsign%3Dq-sign-algorithm%253Dsha1%2526q-ak%253DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%2526q-sign-time%253D1592546939%253B1592550539%2526q-key-time%253D1592546939%253B1592550539%2526q-header-list%253D%2526q-url-param-list%253D%2526q-signature%253D74a4058ad7579ea210dafcf78d7a19460cffb899?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1595574735%3B1595578335%26q-key-time%3D1595574735%3B1595578335%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D679bff1838c7d497d38f48ef999b50e80c5856c4","thumbnail":"http://petchfile-1255510688.cos.ap-beijing.myqcloud.com/sso-server-image/1592546956790.png%3Fsign%3Dq-sign-algorithm%253Dsha1%2526q-ak%253DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%2526q-sign-time%253D1592546956%253B1592550556%2526q-key-time%253D1592546956%253B1592550556%2526q-header-list%253D%2526q-url-param-list%253D%2526q-signature%253Dcc9a35349fc55e433f934af88df576ae792b3987?sign=q-sign-algorithm%3Dsha1%26q-ak%3DAKIDCWfcNwD5PXVWLxwejccR3Tiz5zhIkx0T%26q-sign-time%3D1595574735%3B1595578335%26q-key-time%3D1595574735%3B1595578335%26q-header-list%3D%26q-url-param-list%3D%26q-signature%3D99b5a92a4f97909d8c217dbeec2ec6e9ec1052f4","content":null,"illegalCount":null}]
- */
-
- private long uploadTimestamp;
+ private int viewType = ShareEventItemEnum.ITEM_TYPE_SHARE_LIST;
+ private Long uploadTimestamp;
private long timeout;
private String uploadAddress;
- private int distance;
+ private Integer distance;
private String dbId;
private String poiType;
private String sn;
- private int userId;
+ private Long userId;
private String userName;
private String userHead;
- private int likeNum;
+ private Integer likeNum;
private int notLikeNum;
- private int uploadType;
+ private Integer uploadType;
private String uploadUser;
- private Object imgUrl;
- private Object content;
- private Object gasStationId;
- private Object gasStationName;
- private Object gasImg;
- private Object gasPrices;
+ private String imgUrl;
+ private String content;
+ private String gasStationId;
+ private String gasStationName;
+ private String gasImg;
+ private String gasPrices;
private String endDate;
private boolean fabulous;
- private int direction;
- private int virtualLikeNum;
- private int status;
+ private Integer direction;
+ private Integer virtualLikeNum;
+ private Integer status;
private String sourceType;
private String hitId;
- private int userType;
+ private Integer userType;
private List coordinates;
private List data;
- public long getUploadTimestamp() {
+ public Long getUploadTimestamp() {
return uploadTimestamp;
}
- public void setUploadTimestamp(long uploadTimestamp) {
+ public void setUploadTimestamp(Long uploadTimestamp) {
this.uploadTimestamp = uploadTimestamp;
}
@@ -205,7 +158,7 @@ public class ShareEventItem extends BaseData implements Serializable {
return timeout;
}
- public void setTimeout(long timeout) {
+ public void setTimeout(Long timeout) {
this.timeout = timeout;
}
@@ -217,11 +170,11 @@ public class ShareEventItem extends BaseData implements Serializable {
this.uploadAddress = uploadAddress;
}
- public int getDistance() {
+ public Integer getDistance() {
return distance;
}
- public void setDistance(int distance) {
+ public void setDistance(Integer distance) {
this.distance = distance;
}
@@ -249,11 +202,11 @@ public class ShareEventItem extends BaseData implements Serializable {
this.sn = sn;
}
- public int getUserId() {
+ public Long getUserId() {
return userId;
}
- public void setUserId(int userId) {
+ public void setUserId(Long userId) {
this.userId = userId;
}
@@ -273,11 +226,11 @@ public class ShareEventItem extends BaseData implements Serializable {
this.userHead = userHead;
}
- public int getLikeNum() {
+ public Integer getLikeNum() {
return likeNum;
}
- public void setLikeNum(int likeNum) {
+ public void setLikeNum(Integer likeNum) {
this.likeNum = likeNum;
}
@@ -289,11 +242,11 @@ public class ShareEventItem extends BaseData implements Serializable {
this.notLikeNum = notLikeNum;
}
- public int getUploadType() {
+ public Integer getUploadType() {
return uploadType;
}
- public void setUploadType(int uploadType) {
+ public void setUploadType(Integer uploadType) {
this.uploadType = uploadType;
}
@@ -305,51 +258,51 @@ public class ShareEventItem extends BaseData implements Serializable {
this.uploadUser = uploadUser;
}
- public Object getImgUrl() {
+ public String getImgUrl() {
return imgUrl;
}
- public void setImgUrl(Object imgUrl) {
+ public void setImgUrl(String imgUrl) {
this.imgUrl = imgUrl;
}
- public Object getContent() {
+ public String getContent() {
return content;
}
- public void setContent(Object content) {
+ public void setContent(String content) {
this.content = content;
}
- public Object getGasStationId() {
+ public String getGasStationId() {
return gasStationId;
}
- public void setGasStationId(Object gasStationId) {
+ public void setGasStationId(String gasStationId) {
this.gasStationId = gasStationId;
}
- public Object getGasStationName() {
+ public String getGasStationName() {
return gasStationName;
}
- public void setGasStationName(Object gasStationName) {
+ public void setGasStationName(String gasStationName) {
this.gasStationName = gasStationName;
}
- public Object getGasImg() {
+ public String getGasImg() {
return gasImg;
}
- public void setGasImg(Object gasImg) {
+ public void setGasImg(String gasImg) {
this.gasImg = gasImg;
}
- public Object getGasPrices() {
+ public String getGasPrices() {
return gasPrices;
}
- public void setGasPrices(Object gasPrices) {
+ public void setGasPrices(String gasPrices) {
this.gasPrices = gasPrices;
}
@@ -369,27 +322,27 @@ public class ShareEventItem extends BaseData implements Serializable {
this.fabulous = fabulous;
}
- public int getDirection() {
+ public Integer getDirection() {
return direction;
}
- public void setDirection(int direction) {
+ public void setDirection(Integer direction) {
this.direction = direction;
}
- public int getVirtualLikeNum() {
+ public Integer getVirtualLikeNum() {
return virtualLikeNum;
}
- public void setVirtualLikeNum(int virtualLikeNum) {
+ public void setVirtualLikeNum(Integer virtualLikeNum) {
this.virtualLikeNum = virtualLikeNum;
}
- public int getStatus() {
+ public Integer getStatus() {
return status;
}
- public void setStatus(int status) {
+ public void setStatus(Integer status) {
this.status = status;
}
@@ -409,11 +362,11 @@ public class ShareEventItem extends BaseData implements Serializable {
this.hitId = hitId;
}
- public int getUserType() {
+ public Integer getUserType() {
return userType;
}
- public void setUserType(int userType) {
+ public void setUserType(Integer userType) {
this.userType = userType;
}
@@ -443,7 +396,7 @@ public class ShareEventItem extends BaseData implements Serializable {
private String url;
private String thumbnail;
- private Object content;
+ private String content;
private Object illegalCount;
public String getUrl() {
@@ -462,11 +415,11 @@ public class ShareEventItem extends BaseData implements Serializable {
this.thumbnail = thumbnail;
}
- public Object getContent() {
+ public String getContent() {
return content;
}
- public void setContent(Object content) {
+ public void setContent(String content) {
this.content = content;
}
diff --git a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/bean/ShareEventItemEnum.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventItemEnum.java
similarity index 71%
rename from modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/bean/ShareEventItemEnum.java
rename to modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventItemEnum.java
index 2881b9aec9..a7446411c0 100644
--- a/modules/mogo-module-event-panel/src/main/java/com/zhidao/mogo/module/event/panel/bean/ShareEventItemEnum.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventItemEnum.java
@@ -1,4 +1,4 @@
-package com.zhidao.mogo.module.event.panel.bean;
+package com.mogo.module.v2x.entity.panel;
public interface ShareEventItemEnum {
@@ -6,5 +6,6 @@ public interface ShareEventItemEnum {
int ITEM_TYPE_SHARE_LIST = 1;
int ITEM_TYPE_SHARE_EMPTY = 2;
int ITEM_TYPE_LOAD_MORE_STATUS = 3;
+ int ITEM_TYPE_NO_MORE = 4;
}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventLoadMoreItem.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventLoadMoreItem.java
new file mode 100644
index 0000000000..880b10c957
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/ShareEventLoadMoreItem.java
@@ -0,0 +1,29 @@
+package com.mogo.module.v2x.entity.panel;
+
+import com.mogo.commons.data.BaseData;
+
+import java.io.Serializable;
+
+/*
+ * 没有任何分享,去分享/加载更多/没有更多了
+ * */
+public class ShareEventLoadMoreItem extends BaseData implements Serializable {
+ private String statusText;
+ private int viewType;
+
+ public int getViewType() {
+ return viewType;
+ }
+
+ public void setViewType(int viewType) {
+ this.viewType = viewType;
+ }
+
+ public void setStatusText(String statusText) {
+ this.statusText = statusText;
+ }
+
+ public String getStatusText() {
+ return statusText;
+ }
+}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingRequest.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingRequest.java
new file mode 100644
index 0000000000..f0664eab84
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingRequest.java
@@ -0,0 +1,21 @@
+package com.mogo.module.v2x.entity.panel;
+
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2020/7/29
+ */
+public class SurroundingRequest {
+ private Center center;
+ private String[] poiTypes;
+ private int radius;
+ private int limit;
+
+ public SurroundingRequest(Center center, String[] poiTypes, int radius, int limit) {
+ this.center = center;
+ this.poiTypes = poiTypes;
+ this.radius = radius;
+ this.limit = limit;
+ }
+}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingResponse.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingResponse.java
new file mode 100644
index 0000000000..1b491e4845
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/entity/panel/SurroundingResponse.java
@@ -0,0 +1,347 @@
+package com.mogo.module.v2x.entity.panel;
+
+import com.mogo.commons.data.BaseData;
+
+import java.util.List;
+
+/**
+ * @author lixiaopeng
+ * @description
+ * @since 2020/7/29
+ */
+public class SurroundingResponse extends BaseData {
+ /**
+ * code : 0
+ * msg : success
+ * result : {"total":1,"poiInfos":[{"coordinates":[116.410712,39.96833],"uploadTimestamp":1596003623000,"timeout":1596090023000,"uploadAddress":"","distance":0,"dbId":"738038266231427072","poiType":"10002","sn":"VN000017","userId":0,"userName":"伤心狼","userHead":"https://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/defaultUserHeadImg/VN000016.jpg","likeNum":1,"uploadType":2,"uploadUser":"","imgUrl":"","content":"封路了","gasStationId":"","gasStationName":"","gasImg":"","gasPrices":"","endDate":"2020-07-30 14:20:23","fabulous":false,"direction":90,"virtualLikeNum":"","status":1,"sourceType":"10002","hitId":"Odo6mXMBEXitzfRvznNL","userType":2,"data":""}]}
+ */
+ private ResultBean result;
+
+ public ResultBean getResult() {
+ return result;
+ }
+
+ public void setResult(ResultBean result) {
+ this.result = result;
+ }
+
+ public static class ResultBean {
+ /**
+ * total : 1
+ * poiInfos : [{"coordinates":[116.410712,39.96833],"uploadTimestamp":1596003623000,"timeout":1596090023000,"uploadAddress":"","distance":0,"dbId":"738038266231427072","poiType":"10002","sn":"VN000017","userId":0,"userName":"伤心狼","userHead":"https://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/defaultUserHeadImg/VN000016.jpg","likeNum":1,"uploadType":2,"uploadUser":"","imgUrl":"","content":"封路了","gasStationId":"","gasStationName":"","gasImg":"","gasPrices":"","endDate":"2020-07-30 14:20:23","fabulous":false,"direction":90,"virtualLikeNum":"","status":1,"sourceType":"10002","hitId":"Odo6mXMBEXitzfRvznNL","userType":2,"data":""}]
+ */
+ private int total;
+ private List poiInfos;
+
+ public int getTotal() {
+ return total;
+ }
+
+ public void setTotal(int total) {
+ this.total = total;
+ }
+
+ public List getPoiInfos() {
+ return poiInfos;
+ }
+
+ public void setPoiInfos(List poiInfos) {
+ this.poiInfos = poiInfos;
+ }
+
+ public static class PoiInfosBean {
+ /**
+ * coordinates : [116.410712,39.96833]
+ * uploadTimestamp : 1596003623000
+ * timeout : 1596090023000
+ * uploadAddress :
+ * distance : 0
+ * dbId : 738038266231427072
+ * poiType : 10002
+ * sn : VN000017
+ * userId : 0
+ * userName : 伤心狼
+ * userHead : https://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/defaultUserHeadImg/VN000016.jpg
+ * likeNum : 1
+ * uploadType : 2
+ * uploadUser :
+ * imgUrl :
+ * content : 封路了
+ * gasStationId :
+ * gasStationName :
+ * gasImg :
+ * gasPrices :
+ * endDate : 2020-07-30 14:20:23
+ * fabulous : false
+ * direction : 90
+ * virtualLikeNum :
+ * status : 1
+ * sourceType : 10002
+ * hitId : Odo6mXMBEXitzfRvznNL
+ * userType : 2
+ * data :
+ */
+ private long uploadTimestamp;
+ private long timeout;
+ private String uploadAddress;
+ private int distance;
+ private String dbId;
+ private String poiType;
+ private String sn;
+ private int userId;
+ private String userName;
+ private String userHead;
+ private int likeNum;
+ private int uploadType;
+ private String uploadUser;
+ private String imgUrl;
+ private String content;
+ private String gasStationId;
+ private String gasStationName;
+ private String gasImg;
+ private String gasPrices;
+ private String endDate;
+ private boolean fabulous;
+ private int direction;
+ private String virtualLikeNum;
+ private int status;
+ private String sourceType;
+ private String hitId;
+ private int userType;
+ private String data;
+ private List coordinates;
+
+ public long getUploadTimestamp() {
+ return uploadTimestamp;
+ }
+
+ public void setUploadTimestamp(long uploadTimestamp) {
+ this.uploadTimestamp = uploadTimestamp;
+ }
+
+ public long getTimeout() {
+ return timeout;
+ }
+
+ public void setTimeout(long timeout) {
+ this.timeout = timeout;
+ }
+
+ public String getUploadAddress() {
+ return uploadAddress;
+ }
+
+ public void setUploadAddress(String uploadAddress) {
+ this.uploadAddress = uploadAddress;
+ }
+
+ public int getDistance() {
+ return distance;
+ }
+
+ public void setDistance(int distance) {
+ this.distance = distance;
+ }
+
+ public String getDbId() {
+ return dbId;
+ }
+
+ public void setDbId(String dbId) {
+ this.dbId = dbId;
+ }
+
+ public String getPoiType() {
+ return poiType;
+ }
+
+ public void setPoiType(String poiType) {
+ this.poiType = poiType;
+ }
+
+ public String getSn() {
+ return sn;
+ }
+
+ public void setSn(String sn) {
+ this.sn = sn;
+ }
+
+ public int getUserId() {
+ return userId;
+ }
+
+ public void setUserId(int userId) {
+ this.userId = userId;
+ }
+
+ public String getUserName() {
+ return userName;
+ }
+
+ public void setUserName(String userName) {
+ this.userName = userName;
+ }
+
+ public String getUserHead() {
+ return userHead;
+ }
+
+ public void setUserHead(String userHead) {
+ this.userHead = userHead;
+ }
+
+ public int getLikeNum() {
+ return likeNum;
+ }
+
+ public void setLikeNum(int likeNum) {
+ this.likeNum = likeNum;
+ }
+
+ public int getUploadType() {
+ return uploadType;
+ }
+
+ public void setUploadType(int uploadType) {
+ this.uploadType = uploadType;
+ }
+
+ public String getUploadUser() {
+ return uploadUser;
+ }
+
+ public void setUploadUser(String uploadUser) {
+ this.uploadUser = uploadUser;
+ }
+
+ public String getImgUrl() {
+ return imgUrl;
+ }
+
+ public void setImgUrl(String imgUrl) {
+ this.imgUrl = imgUrl;
+ }
+
+ public String getContent() {
+ return content;
+ }
+
+ public void setContent(String content) {
+ this.content = content;
+ }
+
+ public String getGasStationId() {
+ return gasStationId;
+ }
+
+ public void setGasStationId(String gasStationId) {
+ this.gasStationId = gasStationId;
+ }
+
+ public String getGasStationName() {
+ return gasStationName;
+ }
+
+ public void setGasStationName(String gasStationName) {
+ this.gasStationName = gasStationName;
+ }
+
+ public String getGasImg() {
+ return gasImg;
+ }
+
+ public void setGasImg(String gasImg) {
+ this.gasImg = gasImg;
+ }
+
+ public String getGasPrices() {
+ return gasPrices;
+ }
+
+ public void setGasPrices(String gasPrices) {
+ this.gasPrices = gasPrices;
+ }
+
+ public String getEndDate() {
+ return endDate;
+ }
+
+ public void setEndDate(String endDate) {
+ this.endDate = endDate;
+ }
+
+ public boolean isFabulous() {
+ return fabulous;
+ }
+
+ public void setFabulous(boolean fabulous) {
+ this.fabulous = fabulous;
+ }
+
+ public int getDirection() {
+ return direction;
+ }
+
+ public void setDirection(int direction) {
+ this.direction = direction;
+ }
+
+ public String getVirtualLikeNum() {
+ return virtualLikeNum;
+ }
+
+ public void setVirtualLikeNum(String virtualLikeNum) {
+ this.virtualLikeNum = virtualLikeNum;
+ }
+
+ public int getStatus() {
+ return status;
+ }
+
+ public void setStatus(int status) {
+ this.status = status;
+ }
+
+ public String getSourceType() {
+ return sourceType;
+ }
+
+ public void setSourceType(String sourceType) {
+ this.sourceType = sourceType;
+ }
+
+ public String getHitId() {
+ return hitId;
+ }
+
+ public void setHitId(String hitId) {
+ this.hitId = hitId;
+ }
+
+ public int getUserType() {
+ return userType;
+ }
+
+ public void setUserType(int userType) {
+ this.userType = userType;
+ }
+
+ public String getData() {
+ return data;
+ }
+
+ public void setData(String data) {
+ this.data = data;
+ }
+
+ public List getCoordinates() {
+ return coordinates;
+ }
+
+ public void setCoordinates(List coordinates) {
+ this.coordinates = coordinates;
+ }
+ }
+ }
+}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/SurroundingEventFragment.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/SurroundingEventFragment.java
new file mode 100644
index 0000000000..26a26f6b98
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/SurroundingEventFragment.java
@@ -0,0 +1,126 @@
+package com.mogo.module.v2x.fragment;
+
+import android.os.Bundle;
+import android.util.Log;
+import android.view.View;
+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.mogo.commons.mvp.MvpFragment;
+import com.mogo.module.v2x.R;
+import com.mogo.module.v2x.adapter.SurroundingEventAdapter;
+import com.mogo.module.v2x.entity.panel.SurroundingResponse;
+import com.mogo.module.v2x.presenter.SurroundingEventPresenter;
+import com.mogo.module.v2x.view.SurroundingEventView;
+
+import java.util.ArrayList;
+import java.util.List;
+
+import static android.view.View.OVER_SCROLL_NEVER;
+
+/**
+ * 周边事件
+ */
+public class SurroundingEventFragment extends MvpFragment implements SurroundingEventView {
+ private static final String TAG = "SurroundingFragment";
+ private RecyclerView mRecyclerView;
+ private RelativeLayout mEmptyLayout;
+ private TextView mShareTv;
+ private TextView mFreshTv;
+ private SurroundingEventAdapter mAdapter;
+ private SurroundingEventPresenter surroundingEventPresenter;
+ private List poiInfosList = new ArrayList<>();
+
+
+ @Override
+ protected int getLayoutId() {
+ return R.layout.module_event_panel_fragment_surrounding;
+ }
+
+ @Override
+ protected void initViews() {
+ Log.d("liyz", "initViews --------> ");
+ mRecyclerView = findViewById(R.id.surrounding_recycleview);
+ mEmptyLayout = findViewById(R.id.layout_empty_data_show);
+ mShareTv = findViewById(R.id.tv_main_share);
+ mFreshTv = findViewById(R.id.tv_main_refresh);
+
+
+ mRecyclerView.setHasFixedSize(true);
+ mRecyclerView.setOverScrollMode(OVER_SCROLL_NEVER);
+ GridLayoutManager layoutManage = new GridLayoutManager(getContext(), 1);
+ mRecyclerView.setLayoutManager(layoutManage);
+
+ mAdapter = new SurroundingEventAdapter(getActivity(), poiInfosList); //TODO
+ mRecyclerView.setAdapter(mAdapter);
+
+ initData();
+
+ }
+
+ @NonNull
+ @Override
+ protected SurroundingEventPresenter createPresenter() {
+ return surroundingEventPresenter;
+ }
+
+ @Override
+ public void onViewCreated(@NonNull View view, @Nullable Bundle savedInstanceState) {
+ super.onViewCreated(view, savedInstanceState);
+ surroundingEventPresenter = new SurroundingEventPresenter(getContext(), this);
+ Log.d("liyz", "onViewCreated ---------");
+
+ }
+
+ /**
+ * 获取和刷新数据
+ */
+ private void initData() {
+ surroundingEventPresenter.getSurroundingEventData();
+ }
+
+ /**
+ * 展示列表数据 TODO
+ */
+ @Override
+ public void showSurroudingData(SurroundingResponse data) {
+ if (data.getResult() != null) {
+ SurroundingResponse.ResultBean resultBean = data.getResult();
+ if (resultBean != null && resultBean.getPoiInfos() != null && resultBean.getPoiInfos().size() > 0) {
+ mRecyclerView.setVisibility(View.VISIBLE);
+ mEmptyLayout.setVisibility(View.GONE);
+
+ poiInfosList.clear();
+ poiInfosList.addAll(resultBean.getPoiInfos());
+ mAdapter.notifyDataSetChanged();
+ } else {
+ mRecyclerView.setVisibility(View.GONE);
+ mEmptyLayout.setVisibility(View.VISIBLE);
+ }
+ } else {
+ mRecyclerView.setVisibility(View.GONE);
+ mEmptyLayout.setVisibility(View.VISIBLE);
+ }
+ }
+
+ @Override
+ public void onDestroy() {
+ super.onDestroy();
+ if (poiInfosList != null) {
+ poiInfosList.clear();
+ poiInfosList = null;
+ }
+ }
+
+ @Override
+ public void onDestroyView() {
+ super.onDestroyView();
+ }
+
+
+}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XEventPanelFragment.kt b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XEventPanelFragment.kt
new file mode 100644
index 0000000000..5654dd65f0
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XEventPanelFragment.kt
@@ -0,0 +1,145 @@
+package com.mogo.module.v2x.fragment
+
+import android.content.res.ColorStateList
+import android.graphics.Typeface
+import android.view.Gravity
+import android.view.View
+import android.widget.TextView
+import androidx.fragment.app.Fragment
+import androidx.viewpager2.widget.ViewPager2
+import androidx.viewpager2.widget.ViewPager2.OnPageChangeCallback
+import com.google.android.material.tabs.TabLayoutMediator
+import com.google.android.material.tabs.TabLayoutMediator.TabConfigurationStrategy
+import com.mogo.commons.mvp.MvpFragment
+import com.mogo.module.v2x.R
+import com.mogo.module.v2x.V2XConst.MODULE_NAME
+import com.mogo.module.v2x.V2XServiceManager
+import com.mogo.module.v2x.adapter.V2XEventPagerAdapter
+import com.mogo.module.v2x.presenter.EventPanelPresenter
+import com.mogo.utils.logger.Logger
+import kotlinx.android.synthetic.main.module_v2x_event_panel_fragment_event_panel.*
+
+
+/**
+ * 事件面板主fragment
+ *
+ * @author tongchenfei
+ */
+class V2XEventPanelFragment : MvpFragment() {
+
+ private val TAG = "EventPanelFragment"
+
+ private val tabsTitle = arrayOf("出行动态", "周边事件", "我的分享")
+ private var fragments: Array? = null
+
+ private var mediator: TabLayoutMediator? = null
+
+ private val activeColor: Int = android.graphics.Color.parseColor("#ff678f")
+ private val normalColor: Int = android.graphics.Color.parseColor("#EE00FF")
+
+ private val activeSize = 35
+ private val normalSize = 30
+
+ private var selectPosition = 0
+
+ companion object {
+ private val fragment = V2XEventPanelFragment()
+ fun getInstance(): V2XEventPanelFragment {
+ return fragment
+ }
+ }
+
+ override fun getLayoutId(): Int {
+ return R.layout.module_v2x_event_panel_fragment_event_panel
+ }
+
+ override fun initViews() {
+ Logger.d(MODULE_NAME, "EventPanelFragment init view===")
+ fragments = arrayOf(
+ V2XScenarioHistoryFragment(),
+ SurroundingEventFragment(),
+ V2XShareEventsFragment()
+ )
+ //禁用预加载
+ vpEventPanel.offscreenPageLimit = ViewPager2.OFFSCREEN_PAGE_LIMIT_DEFAULT
+ vpEventPanel.adapter = V2XEventPagerAdapter(this, fragments!!)
+ //viewPager 页面切换监听
+ vpEventPanel.registerOnPageChangeCallback(changeCallback)
+
+ //这里可以自定义TabView
+ mediator = TabLayoutMediator(tabLayout, vpEventPanel, TabConfigurationStrategy { tab, position ->
+ val tabView = TextView(context)
+ tabView.gravity = Gravity.CENTER
+ val states = arrayOfNulls(2)
+ states[0] = intArrayOf(android.R.attr.state_selected)
+ states[1] = intArrayOf()
+ val colors = intArrayOf(activeColor, normalColor)
+ val colorStateList = ColorStateList(states, colors)
+ tabView.text = tabsTitle[position]
+ tabView.textSize = normalSize.toFloat()
+ tabView.setTextColor(colorStateList)
+ tab.customView = tabView
+ })
+ //要执行这一句才是真正将两者绑定起来
+ mediator!!.attach()
+
+ btnShowOrHidePanels.setOnClickListener {
+ if (clPanelContainer.visibility == View.GONE) {
+ showPanel()
+ // 选中指定的Tab
+ tabLayout.getTabAt(selectPosition)?.select()
+ vpEventPanel.setCurrentItem(selectPosition, false)
+ } else {
+ hidePanel()
+ }
+ }
+ }
+
+ private val changeCallback: OnPageChangeCallback = object : OnPageChangeCallback() {
+ override fun onPageSelected(position: Int) {
+ selectPosition = position
+ //可以来设置选中时tab的大小
+ val tabCount = tabLayout.tabCount
+ for (i in 0 until tabCount) {
+ val tab = tabLayout.getTabAt(i)
+ val tabView = tab!!.customView as TextView?
+ if (tab.position == position) {
+ tabView!!.textSize = activeSize.toFloat()
+ tabView.typeface = Typeface.DEFAULT_BOLD
+ } else {
+ tabView!!.textSize = normalSize.toFloat()
+ tabView.typeface = Typeface.DEFAULT
+ }
+ }
+ }
+ }
+
+ override fun onDestroyView() {
+ mediator?.detach()
+ vpEventPanel?.unregisterOnPageChangeCallback(changeCallback)
+ super.onDestroyView()
+ }
+
+ override fun createPresenter(): EventPanelPresenter {
+ return EventPanelPresenter(this)
+ }
+
+ fun showPanel() {
+ Logger.d(MODULE_NAME, "in fragment show panel")
+ clPanelContainer.visibility = View.VISIBLE
+ btnShowOrHidePanels.text = "隐藏面板"
+ V2XServiceManager.getMoGoV2XStatusManager().setEventPanelWindowShow(TAG, true)
+ }
+
+ fun hidePanel() {
+ Logger.d(MODULE_NAME, "in fragment hide panel")
+ clPanelContainer.visibility = View.GONE
+ btnShowOrHidePanels.text = "显示面板"
+ V2XServiceManager.getMoGoV2XStatusManager().setEventPanelWindowShow(TAG, false)
+
+ }
+
+ fun isPanelShow(): Boolean {
+ return clPanelContainer.visibility == View.VISIBLE
+ }
+}
\ No newline at end of file
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XScenarioHistoryFragment.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XScenarioHistoryFragment.java
new file mode 100644
index 0000000000..692625187a
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XScenarioHistoryFragment.java
@@ -0,0 +1,101 @@
+package com.mogo.module.v2x.fragment;
+
+import android.content.Context;
+import android.util.Log;
+
+import androidx.annotation.NonNull;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.mogo.commons.mvp.MvpFragment;
+import com.mogo.module.common.entity.V2XHistoryScenarioData;
+import com.mogo.module.v2x.R;
+import com.mogo.module.v2x.V2XServiceManager;
+import com.mogo.module.v2x.adapter.V2XScenarioHistoryAdapter;
+import com.mogo.module.v2x.manager.IMoGoV2XStatusChangedListener;
+import com.mogo.module.v2x.manager.V2XStatusDescriptor;
+import com.mogo.module.v2x.presenter.ScenarioHistoryPresenter;
+import com.mogo.utils.logger.Logger;
+import com.mogo.utils.network.utils.GsonUtil;
+
+import java.util.ArrayList;
+import java.util.List;
+
+/**
+ * 出行动态,V2X 提示过的场景历史
+ *
+ * @author donghongyu
+ */
+public class V2XScenarioHistoryFragment
+ extends MvpFragment {
+ private String TAG = "ScenarioHistoryFragment";
+
+ private RecyclerView mRecyclerView;
+ private V2XScenarioHistoryAdapter mV2XScenarioHistoryAdapter;
+ private ArrayList mV2XHistoryScenarioData = new ArrayList<>();
+
+ @Override
+ protected int getLayoutId() {
+ return R.layout.module_v2x_event_panel_fragment_scenario_history;
+ }
+
+ @Override
+ protected void initViews() {
+ Log.d(TAG, "initViews --------> ");
+ mRecyclerView = (RecyclerView) findViewById(R.id.recyclerView);
+ mV2XScenarioHistoryAdapter = new V2XScenarioHistoryAdapter(mV2XHistoryScenarioData);
+ mRecyclerView.setAdapter(mV2XScenarioHistoryAdapter);
+ // 配置列表朝向
+ LinearLayoutManager layoutManager = new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
+ mRecyclerView.setLayoutManager(layoutManager);
+ initListener();
+ }
+
+ /**
+ * 初始化页面用到得监听
+ */
+ private void initListener() {
+ V2XServiceManager.getMoGoV2XStatusManager()
+ .registerStatusChangedListener(
+ TAG,
+ V2XStatusDescriptor.EventPanelWindow_UI,
+ new IMoGoV2XStatusChangedListener() {
+ @Override
+ public void onStatusChanged(V2XStatusDescriptor descriptor, boolean isTrue) {
+ Logger.d(TAG, descriptor + " initViews --------> " + isTrue);
+ if (descriptor == V2XStatusDescriptor.EventPanelWindow_UI) {
+ mPresenter.loadHistory();
+ }
+ }
+
+ @Override
+ public void init(Context context) {
+ Logger.d(TAG, "init --------> ");
+ }
+ });
+ }
+
+ /**
+ * 列表加载数据
+ *
+ * @param v2XHistoryScenarioData 最新数据
+ */
+ public void loadHistory(List v2XHistoryScenarioData) {
+ Logger.d(TAG, "查询到历史消息:" + GsonUtil.jsonFromObject(v2XHistoryScenarioData));
+ mV2XHistoryScenarioData.clear();
+ mV2XHistoryScenarioData.addAll(v2XHistoryScenarioData);
+ mV2XScenarioHistoryAdapter.notifyDataSetChanged();
+ }
+
+ @Override
+ public void onResume() {
+ super.onResume();
+ mPresenter.loadHistory();
+ }
+
+ @NonNull
+ @Override
+ protected ScenarioHistoryPresenter createPresenter() {
+ return new ScenarioHistoryPresenter(this);
+ }
+}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XShareEventsFragment.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XShareEventsFragment.java
new file mode 100644
index 0000000000..4127633019
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/fragment/V2XShareEventsFragment.java
@@ -0,0 +1,209 @@
+package com.mogo.module.v2x.fragment;
+
+import android.nfc.Tag;
+import android.os.Bundle;
+import android.util.Log;
+import android.view.LayoutInflater;
+import android.view.View;
+import android.view.ViewGroup;
+import android.widget.Button;
+import android.widget.ImageView;
+
+import androidx.annotation.NonNull;
+import androidx.annotation.Nullable;
+import androidx.recyclerview.widget.LinearLayoutManager;
+import androidx.recyclerview.widget.RecyclerView;
+
+import com.mogo.commons.mvp.MvpFragment;
+import com.mogo.module.v2x.R;
+import com.mogo.module.v2x.adapter.V2XShareEventAdapter;
+import com.mogo.module.v2x.entity.panel.ShareEventDescription;
+import com.mogo.module.v2x.entity.panel.ShareEventItem;
+import com.mogo.module.v2x.entity.panel.ShareEventItemEnum;
+import com.mogo.module.v2x.entity.panel.ShareEventLoadMoreItem;
+import com.mogo.module.v2x.listener.AdapterCallback;
+import com.mogo.module.v2x.network.V2XRefreshCallback;
+import com.mogo.module.v2x.network.V2XShareNetworkModel;
+import com.mogo.module.v2x.presenter.ShareEventsPresenter;
+import com.mogo.module.v2x.utils.animation.V2XAnimationManager;
+import com.mogo.module.v2x.utils.animation.AnimationResources;
+
+import java.util.ArrayList;
+import java.util.concurrent.CountDownLatch;
+
+public class V2XShareEventsFragment extends MvpFragment implements AdapterCallback {
+
+ private static final String TAG = "ShareEventsFragment";
+ private RecyclerView recyclerView;
+ private V2XShareEventAdapter adapter;
+ private ArrayList dataArrayList = new ArrayList();
+ private int pageNum = 1;
+ final CountDownLatch countDownLatch = new CountDownLatch(1);
+ private V2XShareNetworkModel v2XShareNetworkModel;
+
+ //动画
+ private ImageView loadingImageView;
+ private V2XAnimationManager v2XAnimationManager;
+ private Button reloadBUtton;
+
+ @Override
+ protected int getLayoutId() {
+ return R.layout.module_v2x_event_share_recylerview;
+ }
+
+ @Override
+ protected void initViews() {
+ v2XShareNetworkModel = new V2XShareNetworkModel(getContext());
+ v2XAnimationManager = new V2XAnimationManager();
+ initRecyclerView();
+ initData();
+ }
+
+ @Nullable
+ @Override
+ public View onCreateView(@NonNull LayoutInflater inflater, @Nullable ViewGroup container, @Nullable Bundle savedInstanceState) {
+ super.onCreateView(inflater, container, savedInstanceState);
+ return mRootView;
+ }
+
+ private void initRecyclerView() {
+ recyclerView = mRootView.findViewById(R.id.road_case_share_list);
+ adapter = new V2XShareEventAdapter(getActivity(), dataArrayList, this);
+ recyclerView.setAdapter(adapter);
+ LinearLayoutManager linearLayoutManager =
+ new LinearLayoutManager(getActivity(), LinearLayoutManager.VERTICAL, false);
+ recyclerView.setLayoutManager(linearLayoutManager);
+ }
+
+ private void initData() {
+ loadingImageView = mRootView.findViewById(R.id.loading_imageview);
+ v2XAnimationManager.animationWithTarget(loadingImageView, AnimationResources.loadingRes, 100);
+ getShareEventResponse();
+ }
+
+ /*
+ * 获取热心指数,分享列表等分享内容
+ * */
+ private void getShareEventResponse() {
+ v2XShareNetworkModel.getShareEventResponse(pageNum, 10, new V2XRefreshCallback() {
+ @Override
+ public void onSuccess(Object result) {
+ if (result instanceof ShareEventDescription) {
+ ShareEventDescription resultData = (ShareEventDescription) result;
+
+ if (resultData != null && resultData.getResult() != null
+ && resultData.getResult().getEnthusiasmIndex() != null) {
+ dataArrayList.add(resultData.getResult().getEnthusiasmIndex());
+ Log.d(TAG, "热心指数:" + resultData.getResult().getEnthusiasmIndex());
+ }
+ } else if (result instanceof ShareEventItem) {
+ loadSuccessWithShareEventList(result);
+ }
+ }
+
+ @Override
+ public void onFail(String msg) {
+ loadingError(true);
+ }
+ });
+
+ }
+
+ /*
+ * 我的分享列表数据处理
+ * */
+ private void loadSuccessWithShareEventList(Object result) {
+ ShareEventItem resultData = (ShareEventItem) result;
+ ShareEventLoadMoreItem item = new ShareEventLoadMoreItem();
+ if (resultData != null && resultData.getResult() != null) {
+ if (resultData.getResult().getPage() != null) {
+ int total = resultData.getResult().getPage().getTotal();
+ if (total == 0) {
+ //空白
+ item.setViewType(ShareEventItemEnum.ITEM_TYPE_SHARE_EMPTY);
+ dataArrayList.add(item);
+ } else {
+ if (resultData.getResult().getPage().getContent().size() > 0) {
+ //当前页有数据
+ if (dataArrayList.size() > 0) {
+ Object data = dataArrayList.get(dataArrayList.size() - 1);
+ if (data instanceof ShareEventLoadMoreItem) {
+ dataArrayList.remove(dataArrayList.size() - 1);
+ }
+ }
+ dataArrayList.addAll(resultData.getResult().getPage().getContent());
+ item.setViewType(ShareEventItemEnum.ITEM_TYPE_LOAD_MORE_STATUS);
+ item.setStatusText("查看更早记录");
+ } else {
+ //当前页没有数据
+ item.setViewType(ShareEventItemEnum.ITEM_TYPE_NO_MORE);
+ item.setStatusText("没有更多了");
+ }
+ if (total > 10) {
+ dataArrayList.add(item);
+ }
+ }
+ }
+ Log.d(TAG, "分享列表:" + dataArrayList.get(0));
+ } else {
+ //空白
+ item.setViewType(ShareEventItemEnum.ITEM_TYPE_SHARE_EMPTY);
+ dataArrayList.add(item);
+ }
+ adapter.notifyDataSetChanged();
+ v2XAnimationManager.stop();
+ }
+
+ /*
+ * error界面
+ * */
+ private void loadingError(boolean error) {
+ reloadBUtton = mRootView.findViewById(R.id.loading_error);
+ if (error) {
+ reloadBUtton.setVisibility(View.VISIBLE);
+ reloadBUtton.setOnClickListener(new View.OnClickListener() {
+ @Override
+ public void onClick(View v) {
+ v2XShareNetworkModel.getShareEventList(pageNum, 10, new V2XRefreshCallback() {
+ @Override
+ public void onSuccess(Object result) {
+ loadSuccessWithShareEventList(result);
+ }
+
+ @Override
+ public void onFail(String msg) {
+
+ }
+ });
+ reloadBUtton.setVisibility(View.INVISIBLE);
+ }
+ });
+ } else {
+
+ }
+ v2XAnimationManager.stop();
+ }
+
+
+ @NonNull
+ @Override
+ protected ShareEventsPresenter createPresenter() {
+ Log.d(TAG, "createPresenter");
+ return new ShareEventsPresenter(this);
+ }
+
+ @Override
+ public void loadMoreShareEventList() {
+ v2XShareNetworkModel.getShareEventList(pageNum + 1, 10, new V2XRefreshCallback() {
+ @Override
+ public void onSuccess(Object result) {
+ loadSuccessWithShareEventList(result);
+ }
+
+ @Override
+ public void onFail(String msg) {
+
+ }
+ });
+ }
+}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/AdapterCallback.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/AdapterCallback.java
new file mode 100644
index 0000000000..ced68b8aae
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/AdapterCallback.java
@@ -0,0 +1,9 @@
+package com.mogo.module.v2x.listener;
+
+/**
+ * @author liujing
+ */
+public interface AdapterCallback {
+ //分享列表加载更多
+ void loadMoreShareEventList();
+}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/CarStatusListener.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/CarStatusListener.java
index f147a94a7c..ca613c8c6a 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/CarStatusListener.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/CarStatusListener.java
@@ -3,7 +3,7 @@ package com.mogo.module.v2x.listener;
import com.mogo.map.location.MogoLocation;
/**
- * author : donghongyu
+ * @author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/4/13 11:02 AM
* desc : 车辆速度状态回调
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XLocationListener.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XLocationListener.java
index 9643089795..15654165b7 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XLocationListener.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XLocationListener.java
@@ -81,7 +81,7 @@ public class V2XLocationListener implements IMogoLocationListener, CarStatusList
V2XServiceManager.getV2XCalculateServer().addCarStatusListener(TAG, this);
V2XServiceManager.getV2XCalculateServer().addCarTrajectory(location);
- // 下面是道路刷新逻辑
+ // 首次定位的刷新道路事件逻辑,下面是道路刷新逻辑
if (mLastCarLocation == null) {
V2XServiceManager.getV2XMarkerService().refreshMarkerData(location);
mLastCarLocation = location;
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401009.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401009.java
index 2b081aba24..8b49a3a3a9 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401009.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/listener/V2XMessageListener_401009.java
@@ -1,15 +1,11 @@
package com.mogo.module.v2x.listener;
-import android.view.Gravity;
-import android.view.LayoutInflater;
-
-import com.mogo.module.v2x.R;
-import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.common.entity.V2XPushMessageEntity;
+import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.entity.net.V2XGiveLike;
import com.mogo.module.v2x.utils.ADASUtils;
-import com.mogo.module.v2x.utils.ToastUtils;
import com.mogo.service.connection.IMogoOnMessageListener;
+import com.mogo.utils.TipToast;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
@@ -40,11 +36,9 @@ public class V2XMessageListener_401009 implements IMogoOnMessageListener 0) {
- MarkerExploreWay markerExploreWay = response.getExploreWay().get(0);
- MarkerLocation markerLocation = markerExploreWay.getLocation();
- // 记录道路事件
- V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity();
- v2XRoadEventEntity.setLocation(markerLocation);
- // 探路目前只有上报拥堵
- v2XRoadEventEntity.setPoiType(markerExploreWay.getPoiType());
- // 当前车辆数据
- MogoLocation currentLocation = V2XServiceManager.getV2XStatusManager().getLocation();
- float calculateDistance = Utils.calculateLineDistance(
- new MogoLatLng(markerLocation.getLat(), markerLocation.getLon()),
- new MogoLatLng(currentLocation.getLatitude(), currentLocation.getLongitude())
- );
- v2XRoadEventEntity.setDistance(calculateDistance);
- v2XRoadEventEntity.setNoveltyInfo(markerExploreWay);
- v2XRoadEventEntity.setExpireTime(20000);
+ long timeSpan = TimeUtils.getTimeSpan(TimeUtils.getNowMills(), response.getMessageTime(), TimeConstants.MIN);
+ // 三分钟以内的消息才会提示用户
+ if (timeSpan <= 3) {
+ if (response.getExploreWay() != null && response.getExploreWay().size() > 0) {
+ MarkerExploreWay markerExploreWay = response.getExploreWay().get(0);
+ MarkerLocation markerLocation = markerExploreWay.getLocation();
+ // 记录道路事件
+ V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity();
+ v2XRoadEventEntity.setLocation(markerLocation);
+ // 探路目前只有上报拥堵
+ v2XRoadEventEntity.setPoiType(markerExploreWay.getPoiType());
+ // 当前车辆数据
+ MogoLocation currentLocation = V2XServiceManager.getV2XStatusManager().getLocation();
+ float calculateDistance;
+ if (currentLocation.getLatitude() > 0 || currentLocation.getLongitude() > 0) {
+ calculateDistance = Utils.calculateLineDistance(
+ new MogoLatLng(markerLocation.getLat(), markerLocation.getLon()),
+ new MogoLatLng(currentLocation.getLatitude(), currentLocation.getLongitude())
+ );
+ markerExploreWay.setDistance(calculateDistance);
+ }
+ v2XRoadEventEntity.setDistance(markerExploreWay.getDistance());
+ v2XRoadEventEntity.setNoveltyInfo(markerExploreWay);
+ v2XRoadEventEntity.setExpireTime(20000);
- // 记录播报过的道路事件
- V2XAlarmServer.mAlertRoadEventList.put(v2XRoadEventEntity, TimeUtils.getNowString());
+ // 记录播报过的道路事件
+ V2XAlarmServer.mAlertRoadEventList.put(v2XRoadEventEntity, TimeUtils.getNowString());
- V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>();
- // 控制类型
- v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING);
- // 设置数据
- v2xMessageEntity.setContent(v2XRoadEventEntity);
- // 控制展示状态
- v2xMessageEntity.setShowState(true);
+ V2XMessageEntity v2xMessageEntity = new V2XMessageEntity<>();
+ // 控制类型
+ v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING);
+ // 设置数据
+ v2xMessageEntity.setContent(v2XRoadEventEntity);
+ // 控制展示状态
+ v2xMessageEntity.setShowState(true);
- Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
- intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity);
- LocalBroadcastManager.getInstance(V2XUtils.getApp()).sendBroadcast(intent);
+ Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
+ intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2xMessageEntity);
+ LocalBroadcastManager.getInstance(V2XUtils.getApp()).sendBroadcast(intent);
+ }
+ } else {
+ Logger.e(MODULE_NAME, "V2XMessageListener_401012==V2X服务端下发:消息已过期,大于3分钟了不进行消费");
}
} catch (Exception e) {
e.printStackTrace();
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XStatusManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XStatusManager.java
index ca47257765..015fb0eea2 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XStatusManager.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/IMoGoV2XStatusManager.java
@@ -72,6 +72,11 @@ public interface IMoGoV2XStatusManager extends IProvider {
*/
boolean isFatigueDrivingWindowShow();
+ /**
+ * 事件面板状态 状态
+ */
+ boolean isEventPanelWindowShow();
+
/**
* 设置 V2X道路预警POI 是否在展示
*
@@ -168,6 +173,14 @@ public interface IMoGoV2XStatusManager extends IProvider {
*/
void setFatigueDrivingWindowShow(String tag, boolean show);
+ /**
+ * 事件面板状态 是否在展示
+ *
+ * @param tag
+ * @param show
+ */
+ void setEventPanelWindowShow(String tag, boolean show);
+
/**
* 注册监听
*
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/V2XStatusDescriptor.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/V2XStatusDescriptor.java
index 0cf7973e0a..8cf3c46ab3 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/V2XStatusDescriptor.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/V2XStatusDescriptor.java
@@ -67,4 +67,9 @@ public enum V2XStatusDescriptor {
* 疲劳驾驶弹窗
*/
FatigueDrivingWindow_UI,
+
+ /**
+ * 事件面板状态
+ */
+ EventPanelWindow_UI,
}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XStatusManager.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XStatusManager.java
index e45906f085..44b0282c80 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XStatusManager.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/manager/impl/MoGoV2XStatusManager.java
@@ -107,6 +107,11 @@ public class MoGoV2XStatusManager implements IMoGoV2XStatusManager {
return get_bool_val(V2XStatusDescriptor.FatigueDrivingWindow_UI);
}
+ @Override
+ public boolean isEventPanelWindowShow() {
+ return get_bool_val(V2XStatusDescriptor.EventPanelWindow_UI);
+ }
+
@Override
public void setRoadEventPOIShow(String tag, boolean show) {
V2XServiceManager.getMoGoStatusManager().setV2XUIShow(V2XConst.MODULE_NAME, show);
@@ -194,6 +199,13 @@ public class MoGoV2XStatusManager implements IMoGoV2XStatusManager {
recordStatusModifier(tag, V2XStatusDescriptor.FatigueDrivingWindow_UI);
}
+ @Override
+ public void setEventPanelWindowShow(String tag, boolean show) {
+ mStatus.put(V2XStatusDescriptor.EventPanelWindow_UI, show);
+ invokeStatusChangedListener(V2XStatusDescriptor.EventPanelWindow_UI, show);
+ recordStatusModifier(tag, V2XStatusDescriptor.EventPanelWindow_UI);
+ }
+
@Override
public void registerStatusChangedListener(String tag, V2XStatusDescriptor descriptor, IMoGoV2XStatusChangedListener listener) {
if (listener == null || descriptor == null) {
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiService.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiService.java
index 7ae9f4d74e..45db4f5fc9 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiService.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XApiService.java
@@ -1,14 +1,16 @@
package com.mogo.module.v2x.network;
import com.mogo.commons.data.BaseData;
-import com.mogo.module.common.entity.MarkerCardResult;
import com.mogo.module.common.entity.MarkerResponse;
-import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
import com.mogo.module.v2x.entity.net.V2XDemoUserInfoRes;
import com.mogo.module.v2x.entity.net.V2XLiveCarRes;
import com.mogo.module.v2x.entity.net.V2XLivePushVoRes;
import com.mogo.module.v2x.entity.net.V2XSeekHelpRes;
import com.mogo.module.v2x.entity.net.V2XStrategyPushRes;
+import com.mogo.module.v2x.entity.net.V2XUserInfoRes;
+import com.mogo.module.v2x.entity.panel.ShareEventDescription;
+import com.mogo.module.v2x.entity.panel.ShareEventItem;
+import com.mogo.module.v2x.entity.panel.SurroundingResponse;
import java.util.Map;
@@ -20,6 +22,7 @@ import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.Headers;
import retrofit2.http.POST;
+import retrofit2.http.Query;
/**
* @author congtaowang
@@ -108,4 +111,33 @@ public interface V2XApiService {
@FormUrlEncoded
@POST("/yycp-launcherSnapshot/launcherSnapshot/queryIllegalPark")
Observable queryIllegalPark(@FieldMap Map parameters);
+
+ /**
+ * 我的分享-热心指数等
+ */
+ @FormUrlEncoded
+ @POST("/deva/poiInfoFabulous/car/poi/no/queryEnthusiasmIndex/v1")
+ Observable getEnthusiasmIndex(@FieldMap Map parames);
+
+ /**
+ * 我的分享-列表
+ */
+ @FormUrlEncoded
+ @POST("/deva/car/pathAndPoi/no/queryInfo")
+ Observable getShareEventList(@FieldMap Map parames);
+
+ /*
+ * 周边列表
+ *
+ * */
+ @Headers({"Content-Type:application/json", "Accept:application/json"})
+ @POST("/deva/car/poi/no/queryNovelty/v1")
+ Observable getSurroundingEventList(@Query("sn") String sn, @Body RequestBody jsonStr);
+
+ /**
+ * 点赞接口
+ */
+ @FormUrlEncoded
+ @POST("/deva/poiInfoFabulous/car/poi/no/addPoiInfoFabulous/v1")
+ Observable addPoiInfoFabulous(@FieldMap Map params);
}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XRefreshModel.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XRefreshModel.java
index 44f6404d7c..acdc22e20b 100644
--- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XRefreshModel.java
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XRefreshModel.java
@@ -28,6 +28,7 @@ import com.mogo.utils.network.utils.GsonUtil;
import java.util.HashMap;
import java.util.Map;
+
import io.reactivex.android.schedulers.AndroidSchedulers;
import io.reactivex.schedulers.Schedulers;
import okhttp3.RequestBody;
@@ -472,4 +473,49 @@ public class V2XRefreshModel {
});
}
}
+
+ /**
+ * 点赞接口
+ */
+ public void addPoiInfoFabulous(V2XRefreshCallback callback,
+ String infoId,
+ String poiType,
+ int likeOrDislike) {
+ if (mV2XApiService != null) {
+ final Map map = new ParamsProvider.Builder(mContext).build();
+ String json = new StringBuilder()
+ .append("{")
+ .append("\"infoId\":").append(infoId)
+ .append(",")
+ .append("\"poiType\":").append(poiType)
+ .append(",")
+ .append("\"likeOrdislike\":").append(likeOrDislike)
+ .append(",")
+ .append("\"sn\":").append(Utils.getSn())
+ .append("}").toString();
+ map.put("data", json);
+ mV2XApiService.addPoiInfoFabulous(map).subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(new SubscribeImpl(RequestOptions.create(mContext)) {
+ @Override
+ public void onSuccess(BaseData o) {
+ super.onSuccess(o);
+ if (callback != null) {
+ callback.onSuccess(o);
+ }
+ }
+
+ @Override
+ public void onError(String message, int code) {
+ super.onError(message, code);
+ if (callback != null) {
+ if (TextUtils.isEmpty(message)) {
+ message = "网络错误,请稍后重试";
+ }
+ callback.onFail(message);
+ }
+ }
+ });
+ }
+ }
}
diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XShareNetworkModel.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XShareNetworkModel.java
new file mode 100644
index 0000000000..5fe35ea297
--- /dev/null
+++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/network/V2XShareNetworkModel.java
@@ -0,0 +1,165 @@
+package com.mogo.module.v2x.network;
+
+import android.content.Context;
+
+import com.alibaba.android.arouter.launcher.ARouter;
+import com.mogo.commons.data.BaseData;
+import com.mogo.commons.network.ParamsProvider;
+import com.mogo.commons.network.SubscribeImpl;
+import com.mogo.commons.network.Utils;
+import com.mogo.service.MogoServicePaths;
+import com.mogo.service.network.IMogoNetwork;
+import com.mogo.utils.network.RequestOptions;
+import com.mogo.utils.network.utils.GsonUtil;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import io.reactivex.Observable;
+import io.reactivex.ObservableEmitter;
+import io.reactivex.ObservableOnSubscribe;
+import io.reactivex.ObservableSource;
+import io.reactivex.Observer;
+import io.reactivex.android.schedulers.AndroidSchedulers;
+import io.reactivex.disposables.Disposable;
+import io.reactivex.functions.Function;
+import io.reactivex.schedulers.Schedulers;
+
+public class V2XShareNetworkModel {
+ private final Context mContext;
+ private V2XApiService mRefreshApiService;
+ private static final String TAG = "V2XShareNetworkModel";
+
+ public V2XShareNetworkModel(Context context) {
+ this.mContext = context;
+ IMogoNetwork network = (IMogoNetwork) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICES_NETWORK).navigation(context);
+ this.mRefreshApiService = network.create(V2XApiService.class, HttpConstant.Companion.getNetHost());
+ }
+
+ /*
+ * 两个任务串行
+ * 1.分享次数,热心指数
+ * 2.分享列表
+ * */
+ public void getShareEventResponse(int page, int size, V2XRefreshCallback callback) {
+ final ParamsProvider.Builder builder = new ParamsProvider.Builder(mContext);
+ HashMap hashMap = new HashMap<>();
+ hashMap.put("sn", Utils.getSn());
+ builder.append("data", GsonUtil.jsonFromObject(hashMap));
+ Map parameters = builder.build();
+
+ Observable indexObservable = Observable.create(new ObservableOnSubscribe() {
+
+ @Override
+ public void subscribe(ObservableEmitter emitter) throws Exception {
+ try {
+ //热心指数
+ mRefreshApiService.getEnthusiasmIndex(parameters)
+ .subscribeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(new SubscribeImpl(RequestOptions.create((mContext))) {
+ @Override
+ public void onSuccess(BaseData resultData) {
+ super.onSuccess(resultData);
+ if (callback != null) {
+ callback.onSuccess(resultData);
+ }
+ }
+
+ @Override
+ public void onError(String message, int code) {
+ super.onError(message, code);
+ if (callback != null) {
+ callback.onFail(message);
+ }
+ }
+
+ });
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ emitter.onNext("1");
+ emitter.onComplete();
+ }
+ });
+
+ Observable listObservable = Observable.create(new ObservableOnSubscribe() {
+ @Override
+ public void subscribe(ObservableEmitter emitter) throws Exception {
+ try {
+ getShareEventList(page, size, callback);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ emitter.onNext("2");
+ emitter.onComplete();
+ }
+ });
+
+ indexObservable.flatMap(new Function>() {
+ @Override
+ public ObservableSource> apply(String s) throws Exception {
+ return listObservable;
+ }
+ })
+ .observeOn(Schedulers.io())
+ .observeOn(AndroidSchedulers.mainThread())
+ .subscribe(new Observer