Merge branch 'dev' of gitlab.zhidaoauto.com:ecos/yycp-service/Launcher into dev
This commit is contained in:
@@ -16,6 +16,7 @@ public class MarkerCardResult extends BaseData {
|
||||
|
||||
private List<MarkerOnlineCar> onlineCar;
|
||||
private List<MarkerExploreWay> exploreWay;
|
||||
private long messageTime;
|
||||
|
||||
public List<MarkerCarChat> 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;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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,
|
||||
|
||||
@@ -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 道路历史事件
|
||||
*
|
||||
|
||||
@@ -80,6 +80,8 @@ public class V2XMessageEntity<T> implements Serializable {
|
||||
* V2X 场景类型
|
||||
*/
|
||||
public interface V2XTypeEnum {
|
||||
// 默认展示详情
|
||||
int DEFAULT_WINDOW = 0;
|
||||
// 道路事件预警
|
||||
int ALERT_ROAD_WARNING = 1_000;
|
||||
// 他车求助预警
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
@@ -1 +0,0 @@
|
||||
-keep class com.zhidao.mogo.module.event.panel.EventPanelConstants
|
||||
@@ -1,3 +0,0 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=module-event-panel-noop
|
||||
VERSION_CODE=1
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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)
|
||||
}
|
||||
}
|
||||
1
modules/mogo-module-event-panel/.gitignore
vendored
1
modules/mogo-module-event-panel/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
/build
|
||||
@@ -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()
|
||||
@@ -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
|
||||
@@ -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
|
||||
@@ -1,5 +0,0 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.zhidao.mogo.module.event.panel">
|
||||
|
||||
/
|
||||
</manifest>
|
||||
@@ -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"
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<Fragment> = arrayOf(TripRecordFragment(), SurroundingEventFragment(), ShareEventsFragment())
|
||||
|
||||
/**
|
||||
* 目前一共就三个fragment
|
||||
*/
|
||||
override fun getItemCount(): Int = fragments.size
|
||||
|
||||
override fun createFragment(position: Int): Fragment = fragments[position]
|
||||
}
|
||||
@@ -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())
|
||||
@@ -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<TripRecord>
|
||||
|
||||
/**
|
||||
* 根据事件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)
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
@@ -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<EventPanelFragment, EventPanelPresenter>() {
|
||||
|
||||
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
|
||||
}
|
||||
}
|
||||
@@ -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<MyShareFragment, MySharePresenter>() {
|
||||
/**
|
||||
* 布局资源
|
||||
*
|
||||
* @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)
|
||||
}
|
||||
@@ -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<ShareEventsFragment, ShareEventsPresenter> {
|
||||
|
||||
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<String, Object> parameters = new HashMap<>();
|
||||
parameters.put("data", GsonUtil.jsonFromObject(parameter));
|
||||
|
||||
shareEventApiService.getEnthusiasmIndex(parameters)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<ShareEventDescription>(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<String, Object> parameters = new HashMap<>();
|
||||
parameters.put("data", GsonUtil.jsonFromObject(parameter));
|
||||
|
||||
shareEventApiService.getShareEventList(parameters)
|
||||
.subscribeOn(Schedulers.io())
|
||||
.observeOn(AndroidSchedulers.mainThread())
|
||||
.subscribe(new SubscribeImpl<ShareEventItem>(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);
|
||||
}
|
||||
}
|
||||
@@ -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<SurroundingEventFragment,SurroundingEventPresenter>(){
|
||||
/**
|
||||
* 布局资源
|
||||
*
|
||||
* @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)
|
||||
}
|
||||
@@ -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<TripRecordFragment, TripRecordPresenter>() {
|
||||
private val tripRecordList = ArrayList<TripRecord>()
|
||||
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<TripRecord>) {
|
||||
Logger.d(MODULE_NAME, "刷新出行动态列表:$tripRecords")
|
||||
tripRecordList.clear()
|
||||
tripRecordList.addAll(tripRecords)
|
||||
}
|
||||
|
||||
/**
|
||||
* 刷新单个出行动态,如果无此动态,新增动态
|
||||
*/
|
||||
fun refreshTripRecord(tripRecord: TripRecord) {
|
||||
Logger.d(MODULE_NAME, "刷新单个出行动态: $tripRecord")
|
||||
}
|
||||
}
|
||||
@@ -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<TripRecord>)
|
||||
|
||||
/**
|
||||
* 有出行动态新增或更新后,回调此接口
|
||||
*/
|
||||
fun insertOrUpdateTripRecordSuccess(tripRecord:TripRecord)
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<ShareEventDescription> getEnthusiasmIndex(@FieldMap Map<String, Object> parames);
|
||||
|
||||
//我的分享-列表
|
||||
@FormUrlEncoded
|
||||
@POST("/deva/car/pathAndPoi/no/queryInfo")
|
||||
Observable<ShareEventItem> getShareEventList(@FieldMap Map<String, Object> parames);
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<EventPanelFragment>(view)
|
||||
@@ -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<MyShareFragment>(view) {
|
||||
}
|
||||
@@ -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 <ShareEventsFragment>{
|
||||
public ShareEventsPresenter(IView view) {
|
||||
super((ShareEventsFragment) view);
|
||||
}
|
||||
}
|
||||
@@ -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<SurroundingEventFragment>(view) {
|
||||
}
|
||||
@@ -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<TripRecordFragment>(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<TripRecord>) {
|
||||
mView.refreshTripRecordList(tripRecordList)
|
||||
}
|
||||
|
||||
override fun insertOrUpdateTripRecordSuccess(tripRecord: TripRecord) {
|
||||
mView.refreshTripRecord(tripRecord)
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -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<ITripRecordCallback>()
|
||||
|
||||
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))
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,25 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/clPanelContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<androidx.viewpager2.widget.ViewPager2
|
||||
android:id="@+id/vpEventPanel"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:visibility="gone" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnShowOrHidePanels"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="300dp"
|
||||
android:layout_marginEnd="10dp"
|
||||
android:text="显示面板"
|
||||
android:textColor="#000"
|
||||
android:textSize="20sp"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,15 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:id="@+id/clPanelContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="Surrounding Event"
|
||||
android:textColor="#fff"
|
||||
android:textSize="40sp" />
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,77 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.constraintlayout.widget.ConstraintLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
android:id="@+id/clPanelContainer"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvTitle"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:gravity="center"
|
||||
android:text="Trip Record"
|
||||
android:textColor="#000"
|
||||
android:textSize="40sp" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnInsert"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Insert"
|
||||
android:textColor="#000"
|
||||
android:textSize="30sp"
|
||||
android:layout_marginTop="100dp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toLeftOf="@+id/btnUpdate"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnUpdate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Update"
|
||||
android:textColor="#000"
|
||||
android:textSize="30sp"
|
||||
android:layout_marginTop="100dp"
|
||||
app:layout_constraintLeft_toRightOf="@+id/btnInsert"
|
||||
app:layout_constraintRight_toLeftOf="@+id/btnDelete"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnDelete"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Delete"
|
||||
android:textColor="#000"
|
||||
android:textSize="30sp"
|
||||
android:layout_marginTop="100dp"
|
||||
app:layout_constraintLeft_toRightOf="@+id/btnUpdate"
|
||||
app:layout_constraintRight_toLeftOf="@+id/btnQuery"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnQuery"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="Query"
|
||||
android:textColor="#000"
|
||||
android:textSize="30sp"
|
||||
android:layout_marginTop="100dp"
|
||||
app:layout_constraintLeft_toRightOf="@+id/btnDelete"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<Button
|
||||
android:id="@+id/btnGenerate"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="20dp"
|
||||
android:text="GenerateLimitTime"
|
||||
android:textColor="#000"
|
||||
android:textSize="30sp"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintRight_toRightOf="parent"
|
||||
app:layout_constraintTop_toBottomOf="@id/btnInsert" />
|
||||
|
||||
</androidx.constraintlayout.widget.ConstraintLayout>
|
||||
@@ -1,14 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<androidx.recyclerview.widget.RecyclerView xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:id="@+id/road_case_share_list"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:orientation="vertical"
|
||||
android:overScrollMode="never"
|
||||
android:background="#000000"
|
||||
tools:itemCount="1"
|
||||
tools:listitem="@layout/module_event_panel_share_description"
|
||||
app:layoutManager="androidx.recyclerview.widget.LinearLayoutManager"/>
|
||||
|
||||
@@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
||||
@@ -1,2 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<resources></resources>
|
||||
@@ -204,6 +204,11 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mApis.getSearchManagerApi().goSettings();
|
||||
return true;
|
||||
});
|
||||
|
||||
mUploadRoadCondition.setOnLongClickListener(view->{
|
||||
mApis.getMogoMonitorApi().showLogDebugDialog();
|
||||
return true;
|
||||
});
|
||||
}
|
||||
|
||||
ConstraintLayout rootView = findViewById(R.id.module_entrance_id_top_motion_layout);
|
||||
|
||||
@@ -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() {
|
||||
|
||||
@@ -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 {
|
||||
0
modules/mogo-module-monitor/consumer-rules.pro
Normal file
0
modules/mogo-module-monitor/consumer-rules.pro
Normal file
@@ -1,3 +1,3 @@
|
||||
GROUP=com.mogo.module
|
||||
POM_ARTIFACT_ID=module-event-panel
|
||||
POM_ARTIFACT_ID=module-monitor
|
||||
VERSION_CODE=1
|
||||
@@ -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
|
||||
#-renamesourcefileattribute SourceFile
|
||||
@@ -1,5 +1,5 @@
|
||||
<manifest xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
package="com.zhidao.mogo.module.event.panel">
|
||||
package="com.zhidao.mogo.module.monitor">
|
||||
|
||||
/
|
||||
</manifest>
|
||||
@@ -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;
|
||||
}
|
||||
@@ -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<RemoteLogPushContent>, ILogDialogListener {
|
||||
private static final String TAG = MogoMonitorConst.MODULE_NAME;
|
||||
private LogInfoManager manualCatchLog = null;
|
||||
private Map<String, LogInfoManager> 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<RemoteLogPushContent> 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 );
|
||||
}
|
||||
}
|
||||
}
|
||||
13
modules/mogo-module-push-base/.gitignore
vendored
13
modules/mogo-module-push-base/.gitignore
vendored
@@ -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
|
||||
13
modules/mogo-module-push-noop/.gitignore
vendored
13
modules/mogo-module-push-noop/.gitignore
vendored
@@ -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
|
||||
13
modules/mogo-module-push/.gitignore
vendored
13
modules/mogo-module-push/.gitignore
vendored
@@ -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
|
||||
@@ -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
|
||||
|
||||
@@ -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";
|
||||
|
||||
@@ -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, "事件模版 模块初始化。。。。");
|
||||
}
|
||||
}
|
||||
@@ -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<V2XStrategyPushRes>() {
|
||||
@@ -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<Boolean> 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<V2XSeekHelpRes>() {
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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<SurroundingEventViewHolder>{
|
||||
private List<SurroundingResponse.ResultBean.PoiInfosBean> mPoiInfosList;
|
||||
private Context mContext;
|
||||
private TextView mAddressTv;
|
||||
|
||||
|
||||
public SurroundingEventAdapter(Context context, List<SurroundingResponse.ResultBean.PoiInfosBean> 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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<Fragment>) :
|
||||
FragmentStateAdapter(fragment) {
|
||||
|
||||
/**
|
||||
* 目前一共就三个fragment
|
||||
*/
|
||||
override fun getItemCount(): Int = fragments.size
|
||||
|
||||
override fun createFragment(position: Int): Fragment = fragments[position]
|
||||
}
|
||||
@@ -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<RecyclerView.ViewH
|
||||
RecyclerView.ViewHolder holder;
|
||||
switch (viewType) {
|
||||
// 直播
|
||||
case V2XWindowTypeEnum.LIVE_CAR_WINDOW:
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_LIVE_CAR_WARNING:
|
||||
holder = new V2XLiveVideoVH(parent);
|
||||
break;
|
||||
//道路事件详情
|
||||
case V2XWindowTypeEnum.ROAD_EVENT_WINDOW:
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING:
|
||||
holder = new V2XRoadEventVH(parent);
|
||||
break;
|
||||
//违章停车
|
||||
case V2XWindowTypeEnum.ILLEGAL_PARK_WINDOW:
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_ILLEGAL_PARK_WARNING:
|
||||
holder = new V2XIllegalParkVH(parent);
|
||||
break;
|
||||
//推送展示
|
||||
case V2XWindowTypeEnum.PUSH_EVENT_WINDOW:
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_WINDOW_WARNING:
|
||||
holder = new V2XPushEventVH(parent);
|
||||
break;
|
||||
//疲劳驾驶
|
||||
case V2XWindowTypeEnum.FATIGUE_DRIVING_WINDOW:
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_FATIGUE_DRIVING:
|
||||
holder = new V2XFatigueDrivingVH(parent);
|
||||
break;
|
||||
//他人故障求助
|
||||
case V2XWindowTypeEnum.SEEK_HELP_WINDOW:
|
||||
case V2XMessageEntity.V2XTypeEnum.ALERT_SEEK_WARNING:
|
||||
holder = new V2XOtherSeekHelpVH(parent);
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -0,0 +1,93 @@
|
||||
package com.mogo.module.v2x.adapter;
|
||||
|
||||
import android.view.ViewGroup;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.module.common.entity.V2XHistoryScenarioData;
|
||||
import com.mogo.module.common.entity.V2XMessageEntity;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XScenarioHistoryFatigueDrivingVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XScenarioHistoryIllegalParkVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XScenarioHistoryOtherSeekHelpVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XScenarioHistoryPushEventVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XScenarioHistoryRoadEventVH;
|
||||
|
||||
import java.util.ArrayList;
|
||||
|
||||
/**
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XScenarioHistoryAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
|
||||
private ArrayList<V2XHistoryScenarioData> mV2XHistoryScenarioData;
|
||||
|
||||
public V2XScenarioHistoryAdapter(ArrayList<V2XHistoryScenarioData> 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();
|
||||
}
|
||||
|
||||
}
|
||||
@@ -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<V2XSeekHelpAdapter.MyViewHolder> {
|
||||
private static final String TAG = V2XSeekHelpAdapter.class.getSimpleName();
|
||||
private List<V2XMarkerEntity> itemList;
|
||||
private LayoutInflater mInflater;
|
||||
|
||||
public V2XSeekHelpAdapter(Context context) {
|
||||
itemList = new ArrayList<>();
|
||||
mInflater = LayoutInflater.from(context);
|
||||
}
|
||||
|
||||
public void addDataList(List<V2XMarkerEntity> 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);
|
||||
}
|
||||
}
|
||||
@@ -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<RecyclerView.ViewHolder> {
|
||||
public class V2XShareEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewHolder> {
|
||||
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<RecyclerView.ViewHol
|
||||
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
|
||||
//根据viewType创建自定义布局
|
||||
if (viewType == ShareEventItemEnum.ITEM_TYPE_NUM_DES) {
|
||||
View v = shareLayoutInflater.inflate(R.layout.module_event_panel_share_description, parent,
|
||||
View v = shareLayoutInflater.inflate(R.layout.module_v2x_event_share_description, parent,
|
||||
false);
|
||||
shareDescriptionViewHolder holder = new shareDescriptionViewHolder(v);
|
||||
return holder;
|
||||
} else if (viewType == ShareEventItemEnum.ITEM_TYPE_SHARE_LIST) {
|
||||
View v = shareLayoutInflater.inflate(R.layout.module_event_panel_share_item, parent,
|
||||
View v = shareLayoutInflater.inflate(R.layout.module_v2x_event_share_item, parent,
|
||||
false);
|
||||
shareItemViewHolder holder = new shareItemViewHolder(v);
|
||||
return holder;
|
||||
} else if (viewType == ShareEventItemEnum.ITEM_TYPE_SHARE_EMPTY) {
|
||||
View v = shareLayoutInflater.inflate(R.layout.module_event_panel_share_empty, parent,
|
||||
View v = shareLayoutInflater.inflate(R.layout.module_v2x_event_share_empty, parent,
|
||||
false);
|
||||
shareEmptyViewHolder holder = new shareEmptyViewHolder(v);
|
||||
return holder;
|
||||
} else {
|
||||
View v = shareLayoutInflater.inflate(R.layout.module_event_panel_share_load_status, parent,
|
||||
View v = shareLayoutInflater.inflate(R.layout.module_v2x_event_share_load_status, parent,
|
||||
false);
|
||||
shareLoadStatusViewHolder holder = new shareLoadStatusViewHolder(v);
|
||||
return holder;
|
||||
}
|
||||
}
|
||||
|
||||
private float getEnthusuasmIndex(double score) {
|
||||
if (score <= 0) {
|
||||
return 0;
|
||||
} else if (0 < score && score <= 5) {
|
||||
return (float) 0.5;
|
||||
} else if (5 < score && score <= 10) {
|
||||
return 1;
|
||||
} else if (10 < score && score <= 15) {
|
||||
return (float) 1.5;
|
||||
} else if (15 < score && score <= 20) {
|
||||
return 2;
|
||||
} else if (20 < score && score <= 25) {
|
||||
return (float) 2.5;
|
||||
} else if (25 < score && score <= 30) {
|
||||
return 3;
|
||||
} else if (30 < score && score <= 35) {
|
||||
return (float) 3.5;
|
||||
} else if (35 < score && score <= 40) {
|
||||
return 4;
|
||||
} else if (40 < score && score <= 45) {
|
||||
return (float) 4.5;
|
||||
}
|
||||
return 5;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onBindViewHolder(@NonNull RecyclerView.ViewHolder holder, int position) {
|
||||
|
||||
if (holder instanceof shareDescriptionViewHolder) {
|
||||
//分享次数,车友认同次数,热心指数
|
||||
if (dataArrayList.size() > 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<RecyclerView.ViewHol
|
||||
|
||||
}
|
||||
} else if (holder instanceof shareLoadStatusViewHolder) {
|
||||
((shareLoadStatusViewHolder) holder).statusButton.setText("加载更多");
|
||||
ShareEventLoadMoreItem item = (ShareEventLoadMoreItem) dataArrayList.get(dataArrayList.size() - 1);
|
||||
((shareLoadStatusViewHolder) holder).statusButton.setText(item.getStatusText());
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemCount() {
|
||||
return dataArrayList.size() + ((this.emptylist == true) ? 1 : 0);
|
||||
int size = dataArrayList.size();
|
||||
return dataArrayList.size();
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getItemViewType(int position) {
|
||||
if (position == 0) {
|
||||
Object item = dataArrayList.get(position);
|
||||
if (item instanceof ShareEventDescription.ResultBean.EnthusiasmIndexBean) {
|
||||
return ShareEventItemEnum.ITEM_TYPE_NUM_DES;
|
||||
}
|
||||
if (emptylist == true) {
|
||||
return ShareEventItemEnum.ITEM_TYPE_SHARE_EMPTY;
|
||||
} else if (item instanceof ShareEventItem.ResultBean.PageBean.ContentBean) {
|
||||
return ShareEventItemEnum.ITEM_TYPE_SHARE_LIST;
|
||||
} else if (item instanceof ShareEventLoadMoreItem) {
|
||||
return ((ShareEventLoadMoreItem) dataArrayList.get(position)).getViewType();
|
||||
}
|
||||
return ShareEventItemEnum.ITEM_TYPE_SHARE_LIST;
|
||||
}
|
||||
@@ -159,11 +192,13 @@ public class ShareEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
class shareDescriptionViewHolder extends RecyclerView.ViewHolder {
|
||||
private TextView shareNumTextView;
|
||||
private TextView approveNumTextView;
|
||||
private RatingBar ratingBar;
|
||||
|
||||
public shareDescriptionViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
shareNumTextView = itemView.findViewById(R.id.share_num);
|
||||
approveNumTextView = itemView.findViewById(R.id.share_approve);
|
||||
ratingBar = itemView.findViewById(R.id.rating_bar);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -173,9 +208,10 @@ public class ShareEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
class shareEmptyViewHolder extends RecyclerView.ViewHolder {
|
||||
public shareEmptyViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
|
||||
Button shareBtn = itemView.findViewById(R.id.share_event_button);
|
||||
shareBtn.setOnClickListener(view -> {
|
||||
EventPanelFragment.Companion.getInstance().hidePanel();
|
||||
V2XEventPanelFragment.Companion.getInstance().hidePanel();
|
||||
mApis.getShareManager().showShareDialog();
|
||||
});
|
||||
}
|
||||
@@ -190,6 +226,13 @@ public class ShareEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewHol
|
||||
public shareLoadStatusViewHolder(@NonNull View itemView) {
|
||||
super(itemView);
|
||||
statusButton = itemView.findViewById(R.id.event_share_load_status);
|
||||
statusButton.setOnClickListener(new View.OnClickListener() {
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
callback.loadMoreShareEventList();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -28,7 +28,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public abstract class V2XBaseViewHolder
|
||||
public abstract class V2XBaseViewHolder<T>
|
||||
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(),
|
||||
|
||||
@@ -29,7 +29,7 @@ import com.mogo.module.v2x.voice.V2XVoiceManager;
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XFatigueDrivingVH extends V2XBaseViewHolder {
|
||||
public class V2XFatigueDrivingVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
|
||||
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();
|
||||
}
|
||||
|
||||
|
||||
@@ -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<V2XEventShowEntity> {
|
||||
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();
|
||||
}
|
||||
|
||||
@@ -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<V2XEventShowEntity> {
|
||||
|
||||
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();
|
||||
|
||||
@@ -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<V2XEventShowEntity> {
|
||||
|
||||
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发布求助信息",
|
||||
|
||||
@@ -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<V2XEventShowEntity> {
|
||||
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();
|
||||
|
||||
@@ -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<V2XEventShowEntity> {
|
||||
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<V2XEventShowEntity> 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);
|
||||
|
||||
@@ -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<V2XHistoryScenarioData> {
|
||||
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() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<V2XHistoryScenarioData> {
|
||||
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() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<V2XHistoryScenarioData> {
|
||||
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() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<V2XHistoryScenarioData> {
|
||||
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() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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<V2XHistoryScenarioData> {
|
||||
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() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -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()
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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
|
||||
)
|
||||
@@ -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;
|
||||
@@ -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<Double> coordinates;
|
||||
private List<DataBean> 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;
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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;
|
||||
}
|
||||
}
|
||||
@@ -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<PoiInfosBean> poiInfos;
|
||||
|
||||
public int getTotal() {
|
||||
return total;
|
||||
}
|
||||
|
||||
public void setTotal(int total) {
|
||||
this.total = total;
|
||||
}
|
||||
|
||||
public List<PoiInfosBean> getPoiInfos() {
|
||||
return poiInfos;
|
||||
}
|
||||
|
||||
public void setPoiInfos(List<PoiInfosBean> 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<Double> 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<Double> getCoordinates() {
|
||||
return coordinates;
|
||||
}
|
||||
|
||||
public void setCoordinates(List<Double> coordinates) {
|
||||
this.coordinates = coordinates;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -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<SurroundingEventView, SurroundingEventPresenter> 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<SurroundingResponse.ResultBean.PoiInfosBean> 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();
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
@@ -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<V2XEventPanelFragment, EventPanelPresenter>() {
|
||||
|
||||
private val TAG = "EventPanelFragment"
|
||||
|
||||
private val tabsTitle = arrayOf("出行动态", "周边事件", "我的分享")
|
||||
private var fragments: Array<Fragment>? = 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<IntArray>(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
|
||||
}
|
||||
}
|
||||
@@ -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<V2XScenarioHistoryFragment, ScenarioHistoryPresenter> {
|
||||
private String TAG = "ScenarioHistoryFragment";
|
||||
|
||||
private RecyclerView mRecyclerView;
|
||||
private V2XScenarioHistoryAdapter mV2XScenarioHistoryAdapter;
|
||||
private ArrayList<V2XHistoryScenarioData> 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> 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);
|
||||
}
|
||||
}
|
||||
@@ -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) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,9 @@
|
||||
package com.mogo.module.v2x.listener;
|
||||
|
||||
/**
|
||||
* @author liujing
|
||||
*/
|
||||
public interface AdapterCallback {
|
||||
//分享列表加载更多
|
||||
void loadMoreShareEventList();
|
||||
}
|
||||
@@ -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 : 车辆速度状态回调
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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<V2XGive
|
||||
v2XAlarmMessage.setExpireTime(20000);
|
||||
v2XAlarmMessage.setSceneId("000000");
|
||||
ADASUtils.broadcastToADAS_TTS(V2XServiceManager.getContext(), v2XAlarmMessage);
|
||||
TipToast.tip(message.getResult());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
|
||||
ToastUtils.setGravity(Gravity.CENTER, 0, 0);
|
||||
ToastUtils.showCustomLong(LayoutInflater.from(V2XServiceManager.getContext()).inflate(R.layout.toast_view_feedback_img_text, null));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.mogo.module.service.Utils;
|
||||
import com.mogo.module.v2x.V2XConst;
|
||||
import com.mogo.module.v2x.V2XServiceManager;
|
||||
import com.mogo.module.v2x.alarm.V2XAlarmServer;
|
||||
import com.mogo.module.v2x.utils.TimeConstants;
|
||||
import com.mogo.module.v2x.utils.TimeUtils;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
import com.mogo.service.connection.IMogoOnMessageListener;
|
||||
@@ -42,38 +43,48 @@ public class V2XMessageListener_401012 implements IMogoOnMessageListener<MarkerC
|
||||
Logger.d(MODULE_NAME, "V2XMessageListener_401012==V2X服务端下发:\n"
|
||||
+ GsonUtil.jsonFromObject(response));
|
||||
try {
|
||||
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 = 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<V2XRoadEventEntity> v2xMessageEntity = new V2XMessageEntity<>();
|
||||
// 控制类型
|
||||
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_ROAD_WARNING);
|
||||
// 设置数据
|
||||
v2xMessageEntity.setContent(v2XRoadEventEntity);
|
||||
// 控制展示状态
|
||||
v2xMessageEntity.setShowState(true);
|
||||
V2XMessageEntity<V2XRoadEventEntity> 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();
|
||||
|
||||
@@ -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);
|
||||
|
||||
/**
|
||||
* 注册监听
|
||||
*
|
||||
|
||||
@@ -67,4 +67,9 @@ public enum V2XStatusDescriptor {
|
||||
* 疲劳驾驶弹窗
|
||||
*/
|
||||
FatigueDrivingWindow_UI,
|
||||
|
||||
/**
|
||||
* 事件面板状态
|
||||
*/
|
||||
EventPanelWindow_UI,
|
||||
}
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user