This commit is contained in:
unknown
2020-07-30 19:24:21 +08:00
90 changed files with 2972 additions and 1070 deletions

View File

@@ -109,6 +109,7 @@ android {
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'false'
// 车机类型主要用于区分自研车机还是别人家的车机自研车机类型为0
buildConfigField 'int', 'CAR_MACHINE_TYPE', '0'
buildConfigField 'boolean', 'ROAD_EVENT_ANIMATED', 'true'
}
// e系列采用Launcher方案
e8xx {
@@ -118,6 +119,7 @@ android {
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'true'
// 车机类型主要用于区分自研车机还是别人家的车机自研车机类型为0
buildConfigField 'int', 'CAR_MACHINE_TYPE', '0'
buildConfigField 'boolean', 'ROAD_EVENT_ANIMATED', 'true'
}
// 同上
em4 {
@@ -127,6 +129,7 @@ android {
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'true'
// 车机类型主要用于区分自研车机还是别人家的车机自研车机类型为0
buildConfigField 'int', 'CAR_MACHINE_TYPE', '0'
buildConfigField 'boolean', 'ROAD_EVENT_ANIMATED', 'true'
}
// e系列-2+32对标D系列2+32采用独立app的形式
em3 {
@@ -136,6 +139,7 @@ android {
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'true'
// 车机类型主要用于区分自研车机还是别人家的车机自研车机类型为0
buildConfigField 'int', 'CAR_MACHINE_TYPE', '0'
buildConfigField 'boolean', 'ROAD_EVENT_ANIMATED', 'false'
}
// e系列-1+16对标D系列1+16采用独立app形式
em1 {
@@ -145,6 +149,7 @@ android {
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'true'
// 车机类型主要用于区分自研车机还是别人家的车机自研车机类型为0
buildConfigField 'int', 'CAR_MACHINE_TYPE', '0'
buildConfigField 'boolean', 'ROAD_EVENT_ANIMATED', 'false'
}
// d系列
d8xx {
@@ -154,6 +159,7 @@ android {
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'true'
// 车机类型主要用于区分自研车机还是别人家的车机自研车机类型为0
buildConfigField 'int', 'CAR_MACHINE_TYPE', '0'
buildConfigField 'boolean', 'ROAD_EVENT_ANIMATED', 'false'
}
// d系列 1+16 版本
d82x{
@@ -163,6 +169,7 @@ android {
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'true'
// 车机类型主要用于区分自研车机还是别人家的车机自研车机类型为0
buildConfigField 'int', 'CAR_MACHINE_TYPE', '0'
buildConfigField 'boolean', 'ROAD_EVENT_ANIMATED', 'false'
}
// 比亚迪
bydauto{
@@ -172,6 +179,7 @@ android {
buildConfigField 'boolean', 'AI_ASSIST_ACTIVE_STAUTS', 'false'
// 车机类型主要用于区分自研车机还是别人家的车机其他车机比亚迪定为1
buildConfigField 'int', 'CAR_MACHINE_TYPE', '1'
buildConfigField 'boolean', 'ROAD_EVENT_ANIMATED', 'true'
}
qa {
dimension "env"

View File

@@ -2,24 +2,24 @@
project.dependencies {
if (Boolean.valueOf(RELEASE)) {
d8xxImplementation rootProject.ext.dependencies.moduleventpanel
d82xImplementation rootProject.ext.dependencies.moduleventpanelnoop
em1Implementation rootProject.ext.dependencies.moduleventpanelnoop
bydautoImplementation rootProject.ext.dependencies.moduleventpanelnoop
d8xxImplementation rootProject.ext.dependencies.moduleventpanel
em4Implementation rootProject.ext.dependencies.moduleventpanel
e8xxImplementation rootProject.ext.dependencies.moduleventpanel
f8xxImplementation rootProject.ext.dependencies.moduleventpanel
em3Implementation rootProject.ext.dependencies.moduleventpanel
em4Implementation rootProject.ext.dependencies.moduleventpanelnoop
e8xxImplementation rootProject.ext.dependencies.moduleventpanelnoop
f8xxImplementation rootProject.ext.dependencies.moduleventpanelnoop
em3Implementation rootProject.ext.dependencies.moduleventpanelnoop
} else {
d8xxImplementation project(':modules:mogo-module-event-panel')
d82xImplementation project(':modules:mogo-module-event-panel-noop')
em1Implementation project(':modules:mogo-module-event-panel-noop')
bydautoImplementation project(':modules:mogo-module-event-panel-noop')
d8xxImplementation project(':modules:mogo-module-event-panel')
em4Implementation project(':modules:mogo-module-event-panel')
e8xxImplementation project(':modules:mogo-module-event-panel')
f8xxImplementation project(':modules:mogo-module-event-panel')
em3Implementation project(':modules:mogo-module-event-panel')
em4Implementation project(':modules:mogo-module-event-panel-noop')
e8xxImplementation project(':modules:mogo-module-event-panel-noop')
f8xxImplementation project(':modules:mogo-module-event-panel-noop')
em3Implementation project(':modules:mogo-module-event-panel-noop')
}
}

View File

@@ -95,6 +95,7 @@ public class MogoApplication extends AbsMogoApplication {
DebugConfig.setCarMachineType( BuildConfig.CAR_MACHINE_TYPE );
DebugConfig.setProductFlavor( BuildConfig.FLAVOR_product );
DebugConfig.setSocketAppId( BuildConfig.SOCKET_APP_ID );
DebugConfig.setRoadEventAnimated( BuildConfig.ROAD_EVENT_ANIMATED );
}
@Override

View File

@@ -237,4 +237,17 @@ public class DebugConfig {
public static String getSocketAppId() {
return sSocketAppId;
}
/**
* 道路事件动画
*/
private static boolean sRoadEventAnimated = false;
public static boolean isRoadEventAnimated() {
return sRoadEventAnimated;
}
public static void setRoadEventAnimated( boolean sRoadEventAnimated ) {
DebugConfig.sRoadEventAnimated = sRoadEventAnimated;
}
}

View File

@@ -3,6 +3,7 @@ package com.mogo.utils.sqlite
import android.content.ContentValues
import android.database.Cursor
import android.database.sqlite.SQLiteDatabase
import com.mogo.utils.logger.Logger
import com.mogo.utils.sqlite.annotation.DbField
import com.mogo.utils.sqlite.annotation.DbTable
import java.lang.reflect.Field
@@ -15,13 +16,17 @@ import java.util.*
*/
//T必须指明上界是Any且不为null下面会用到反射获取对象实例默认是Any?
open class BaseDao<T : Any> : IBaseDao<T> {
private val TAG = "BaseDao"
//数据库操作的引用
private var sqLiteDatabase: SQLiteDatabase? = null
//要操作的数据实体的引用
private var entityClass: Class<T>? = null
//要操作的数据表名称
private var tableName: String? = null
//记录数据表是否存在
private var isInit = false
@@ -44,6 +49,8 @@ open class BaseDao<T : Any> : IBaseDao<T> {
//执行Sql进行自动建表
val createTableSql = getCreateTableSql()
Logger.d(TAG, "执行SQL$createTableSql")
sqLiteDatabase.execSQL(createTableSql)
//初始化缓存空间
@@ -101,16 +108,16 @@ open class BaseDao<T : Any> : IBaseDao<T> {
//获取成员变量数据类型
when (val fieldType = field.type) {
String::class.java -> {
java.lang.String::class.java -> {
sqlCreateTable.append("$columnName TEXT,")
}
Integer::class.java -> {
java.lang.Integer::class.java -> {
sqlCreateTable.append("$columnName INTEGER,")
}
Long::class.java -> {
java.lang.Long::class.java -> {
sqlCreateTable.append("$columnName BIGINT,")
}
Double::class.java -> {
java.lang.Double::class.java -> {
sqlCreateTable.append("$columnName DOUBLE,")
}
ByteArray::class.java -> {
@@ -156,11 +163,11 @@ open class BaseDao<T : Any> : IBaseDao<T> {
return if (sqLiteDatabase != null && sqLiteDatabase!!.isOpen) {
//受影响行数
sqLiteDatabase!!
.delete(
tableName,
condition.getWhereCause(),
condition.getWhereArgs()
)
.delete(
tableName,
condition.getWhereCause(),
condition.getWhereArgs()
)
} else {
-1
}
@@ -175,12 +182,12 @@ open class BaseDao<T : Any> : IBaseDao<T> {
return if (sqLiteDatabase != null && sqLiteDatabase!!.isOpen) {
//受影响行数
sqLiteDatabase!!
.update(
tableName,
getContentValuesForInsert(newEntity),
condition.getWhereCause(),
condition.getWhereArgs()
)
.update(
tableName,
getContentValuesForInsert(newEntity),
condition.getWhereCause(),
condition.getWhereArgs()
)
} else {
-1
}
@@ -218,16 +225,16 @@ open class BaseDao<T : Any> : IBaseDao<T> {
try {
//查询数据库
cursor = sqLiteDatabase!!
.query(
tableName,
null,
condition.getWhereCause(),
condition.getWhereArgs(),
null,
null,
orderBy,
limitString
)
.query(
tableName,
null,
condition.getWhereCause(),
condition.getWhereArgs(),
null,
null,
orderBy,
limitString
)
//将查到结果添加到返回集合中
result.addAll(getQueryResult(cursor, where))
} catch (e: Exception) {
@@ -344,16 +351,16 @@ open class BaseDao<T : Any> : IBaseDao<T> {
if (columnIndex != -1) {
when (fieldType) {
String::class.java -> {
java.lang.String::class.java -> {
field.set(item, cursor.getString(columnIndex))
}
Integer::class.java -> {
java.lang.Integer::class.java -> {
field.set(item, cursor.getInt(columnIndex))
}
Long::class.java -> {
java.lang.Long::class.java -> {
field.set(item, cursor.getLong(columnIndex))
}
Double::class.java -> {
java.lang.Double::class.java -> {
field.set(item, cursor.getDouble(columnIndex))
}
ByteArray::class.java -> {
@@ -392,16 +399,16 @@ open class BaseDao<T : Any> : IBaseDao<T> {
//获取成员变量数据类型
val fieldType = it.value.type
when (fieldType) {
String::class.java -> {
java.lang.String::class.java -> {
contentValues.put(columnName, valueObject as String)
}
Integer::class.java -> {
java.lang.Integer::class.java -> {
contentValues.put(columnName, valueObject as Int)
}
Long::class.java -> {
java.lang.Long::class.java -> {
contentValues.put(columnName, valueObject as Long)
}
Double::class.java -> {
java.lang.Double::class.java -> {
contentValues.put(columnName, valueObject as Double)
}
ByteArray::class.java -> {
@@ -417,6 +424,8 @@ open class BaseDao<T : Any> : IBaseDao<T> {
}
}
Logger.d(TAG, "contentValues:$contentValues")
return contentValues
}

View File

@@ -103,5 +103,5 @@ MOGO_MODULE_SPLASH_NOOP_VERSION = 1.0.0-SNAPSHOT
## 产品库必备配置
applicationId=com.mogo.launcer
applicationName=IntelligentPilot
versionCode=80006
versionName=8.0.6
versionCode=80007
versionName=8.0.7-qa_1.1

View File

@@ -114,6 +114,14 @@ public class MarkerUserInfo implements Serializable {
this.gender = gender;
}
public void setGender(int gender) {
if (gender == 0) {
this.gender = "";
} else {
this.gender = "";
}
}
public String getSn() {
if (TextUtils.isEmpty(sn)) {
return "";

View File

@@ -1,7 +1,13 @@
package com.mogo.module.common.entity;
import androidx.annotation.IntDef;
import java.io.Serializable;
import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;
import java.util.List;
import java.util.Objects;
@@ -14,7 +20,8 @@ import java.util.Objects;
*/
public class V2XEventShowEntity implements Serializable {
// 0---默认展示详情1--直播,4--道路事件详情
// 0---默认展示详情1--直播,
@ViewType
private int viewType;
// 道路事件详情
@@ -23,6 +30,10 @@ public class V2XEventShowEntity implements Serializable {
private V2XLiveCarInfoEntity v2XLiveCarInfoRes;
// 直播车机列表
private List<V2XLiveCarInfoEntity> v2XLiveCarList;
// 推送信息,疲劳驾驶,他人发起故障求助
private V2XPushMessageEntity v2XPushMessageEntity;
// 违章停车
private MarkerExploreWay v2XIllegalPark;
public int getViewType() {
return viewType;
@@ -56,6 +67,22 @@ public class V2XEventShowEntity implements Serializable {
this.v2XLiveCarList = v2XLiveCarList;
}
public V2XPushMessageEntity getV2XPushMessageEntity() {
return v2XPushMessageEntity;
}
public void setV2XPushMessageEntity(V2XPushMessageEntity v2XPushMessageEntity) {
this.v2XPushMessageEntity = v2XPushMessageEntity;
}
public MarkerExploreWay getV2XIllegalPark() {
return v2XIllegalPark;
}
public void setV2XIllegalPark(MarkerExploreWay v2XIllegalPark) {
this.v2XIllegalPark = v2XIllegalPark;
}
@Override
public boolean equals(Object o) {
if (this == o) {
@@ -68,21 +95,35 @@ public class V2XEventShowEntity implements Serializable {
return viewType == that.viewType &&
Objects.equals(v2XRoadEventEntity, that.v2XRoadEventEntity) &&
Objects.equals(v2XLiveCarInfoRes, that.v2XLiveCarInfoRes) &&
Objects.equals(v2XLiveCarList, that.v2XLiveCarList);
Objects.equals(v2XLiveCarList, that.v2XLiveCarList) &&
Objects.equals(v2XPushMessageEntity, that.v2XPushMessageEntity) &&
Objects.equals(v2XIllegalPark, that.v2XIllegalPark);
}
@Override
public int hashCode() {
return Objects.hash(viewType, v2XRoadEventEntity, v2XLiveCarInfoRes, v2XLiveCarList);
return Objects.hash(viewType, v2XRoadEventEntity,
v2XLiveCarInfoRes, v2XLiveCarList,
v2XPushMessageEntity, v2XIllegalPark);
}
@Override
public String toString() {
return "V2XEventShowEntity{" +
"viewType=" + viewType +
", v2XRoadEventEntity=" + v2XRoadEventEntity +
", v2XLiveCarInfoRes=" + v2XLiveCarInfoRes +
", v2XLiveCarList=" + v2XLiveCarList +
'}';
@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,
})
@Target({
ElementType.PARAMETER,
ElementType.FIELD,
ElementType.METHOD,
}) //表示注解作用范围,参数注解,成员注解,方法注解
@Retention(RetentionPolicy.SOURCE) //表示注解所存活的时间,在运行时,而不会存在 .class 文件中
public @interface ViewType { //接口,定义新的注解类型
}
}

View File

@@ -0,0 +1,57 @@
package com.mogo.module.common.entity;
import com.mogo.utils.sqlite.annotation.DbDatabase;
import com.mogo.utils.sqlite.annotation.DbField;
import com.mogo.utils.sqlite.annotation.DbTable;
/**
* V2X 道路历史事件
*
* @author donghongyu
*/
@DbDatabase(dbName = "MoGoScenario.db")
@DbTable(tableName = "tb_history_scenario")
public class V2XHistoryScenarioData {
/**
* 事件类型
*/
@DbField(fieldName = "scenarioType")
public Integer scenarioType;
/**
* 事件触发时间
*/
@DbField(fieldName = "triggerTime")
public Long triggerTime;
/**
* 事件json
*/
@DbField(fieldName = "eventJsonData")
public String eventJsonData;
public Integer getScenarioType() {
return scenarioType;
}
public void setScenarioType(Integer scenarioType) {
this.scenarioType = scenarioType;
}
public String getEventJsonData() {
return eventJsonData;
}
public void setEventJsonData(String eventJsonData) {
this.eventJsonData = eventJsonData;
}
public Long getTriggerTime() {
return triggerTime;
}
public void setTriggerTime(Long triggerTime) {
this.triggerTime = triggerTime;
}
}

View File

@@ -18,14 +18,14 @@ public interface V2XPoiTypeEnum extends MarkerPoiTypeEnum {
String ALERT_TRAFFIC_LIGHT_WARNING = "99996";
// 故障车辆
int ALERT_CAR_TROUBLE_WARNING = 20007;
// 疲劳驾驶
String ALERT_FATIGUE_DRIVING = "99993";
// 违章停车
String ALERT_ILLEGAL_PARK = "99992";
// TODO 这里目前是演示DEMO会用到想着是打算商用先这么处理的
// 取快递
String ALERT_TRAFFIC_EXPRESS = "99995";
// 顺风车
String ALERT_TRAFFIC_TAXI = "99994";
// 疲劳驾驶
String ALERT_FATIGUE_DRIVING = "99993";
// 违章停车
String ALERT_ILLEGAL_PARK = "99992";
}

View File

@@ -28,6 +28,7 @@ public class V2XPushMessageEntity implements Serializable {
private String videoSn;
private String videoChannel;
private int expireTime;
private long createTime;
private double lat;
private double lon;
private String sn;
@@ -37,6 +38,11 @@ public class V2XPushMessageEntity implements Serializable {
private double distance;
private boolean isShowWindow;
private int age;
private String displayName;
private int sex;
private long userId;
public int getViewType() {
return viewType;
}
@@ -220,10 +226,54 @@ public class V2XPushMessageEntity implements Serializable {
isShowWindow = showWindow;
}
public long getCreateTime() {
return createTime;
}
public void setCreateTime(long createTime) {
this.createTime = createTime;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public String getDisplayName() {
return displayName;
}
public void setDisplayName(String displayName) {
this.displayName = displayName;
}
public int getSex() {
return sex;
}
public void setSex(int sex) {
this.sex = sex;
}
public long getUserId() {
return userId;
}
public void setUserId(long userId) {
this.userId = userId;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (o == null || getClass() != o.getClass()) return false;
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
V2XPushMessageEntity that = (V2XPushMessageEntity) o;
return Objects.equals(sceneId, that.sceneId) &&
Objects.equals(tts, that.tts);
@@ -234,31 +284,5 @@ public class V2XPushMessageEntity implements Serializable {
return Objects.hash(sceneId, tts);
}
@Override
public String toString() {
return "V2XPushMessageEntity{" +
"viewType=" + viewType +
", sceneId='" + sceneId + '\'' +
", sceneName='" + sceneName + '\'' +
", sceneCategory=" + sceneCategory +
", sceneLevel=" + sceneLevel +
", sceneDescription='" + sceneDescription + '\'' +
", zoom=" + zoom +
", zoomScale=" + zoomScale +
", alarmContent='" + alarmContent + '\'' +
", tts='" + tts + '\'' +
", videoUrl='" + videoUrl + '\'' +
", videoSn='" + videoSn + '\'' +
", videoChannel='" + videoChannel + '\'' +
", expireTime=" + expireTime +
", lat=" + lat +
", lon=" + lon +
", sn='" + sn + '\'' +
", headImgUrl='" + headImgUrl + '\'' +
", msgImgUrl='" + msgImgUrl + '\'' +
", address='" + address + '\'' +
", distance=" + distance +
", isShowWindow=" + isShowWindow +
'}';
}
}

View File

@@ -3,6 +3,7 @@ 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
@@ -12,7 +13,7 @@ import com.zhidao.mogo.module.event.panel.fragment.TripRecordFragment
* @author tongchenfei
*/
class EventPagerAdapter(fragment: Fragment) : FragmentStateAdapter(fragment) {
private val fragments:Array<Fragment> = arrayOf(TripRecordFragment(), SurroundingEventFragment(), MyShareFragment())
private val fragments:Array<Fragment> = arrayOf(TripRecordFragment(), SurroundingEventFragment(), ShareEventsFragment())
/**
* 目前一共就三个fragment

View File

@@ -0,0 +1,195 @@
package com.zhidao.mogo.module.event.panel.adapter;
import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.alibaba.android.arouter.launcher.ARouter;
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> {
private Context context;
private ArrayList dataArrayList;
private final LayoutInflater shareLayoutInflater;
private boolean emptylist;//分享空白页
private IMogoServiceApis mApis;
public void setEmptylist(boolean emptylist) {
this.emptylist = emptylist;
}
public ShareEventAdapter(Context context, ArrayList dataArrayList) {
this.context = context;
this.dataArrayList = dataArrayList;
shareLayoutInflater = LayoutInflater.from(context);
mApis = (IMogoServiceApis) ARouter.getInstance().build(MogoServicePaths.PATH_SERVICE_APIS).navigation(context);
}
@NonNull
@Override
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,
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,
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,
false);
shareEmptyViewHolder holder = new shareEmptyViewHolder(v);
return holder;
} else {
View v = shareLayoutInflater.inflate(R.layout.module_event_panel_share_load_status, parent,
false);
shareLoadStatusViewHolder holder = new shareLoadStatusViewHolder(v);
return holder;
}
}
@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());
if (shareNum != null) {
((shareDescriptionViewHolder) holder).shareNumTextView.setText(shareNum);
}
if (likeNum != null) {
((shareDescriptionViewHolder) holder).approveNumTextView.setText(likeNum);
}
}
}
} else if (holder instanceof shareItemViewHolder) {
if (dataArrayList.size() > position) {
ShareEventItem.ResultBean.PageBean.ContentBean data = (ShareEventItem.ResultBean.PageBean.ContentBean) dataArrayList.get(position);
if (data != null) {
String poitype = data.getPoiType();
String address = data.getUploadAddress();
String time = DateTimeUtils.getTimeText(data.getUploadTimestamp());
String likeNum = String.valueOf(data.getLikeNum());
String notLikeNum = String.valueOf(data.getNotLikeNum());
if (poitype != null) {
((shareItemViewHolder) holder).caseStyleTextView.setText(poitype);
}
if (address != null) {
((shareItemViewHolder) holder).caseAddressTextView.setText(address);
}
if (time != null) {
((shareItemViewHolder) holder).caseTimeTextView.setText(time);
}
if (likeNum != null) {
((shareItemViewHolder) holder).caseUsefulTextView.setText(likeNum);
}
if (notLikeNum != null) {
((shareItemViewHolder) holder).caseUselessTextView.setText(notLikeNum);
}
}
}
} else if (holder instanceof shareLoadStatusViewHolder) {
((shareLoadStatusViewHolder) holder).statusButton.setText("加载更多");
}
}
@Override
public int getItemCount() {
return dataArrayList.size() + ((this.emptylist == true) ? 1 : 0);
}
@Override
public int getItemViewType(int position) {
if (position == 0) {
return ShareEventItemEnum.ITEM_TYPE_NUM_DES;
}
if (emptylist == true) {
return ShareEventItemEnum.ITEM_TYPE_SHARE_EMPTY;
}
return ShareEventItemEnum.ITEM_TYPE_SHARE_LIST;
}
/*
* 分享列表
* */
class shareItemViewHolder extends RecyclerView.ViewHolder {
private TextView caseStyleTextView;
private TextView caseAddressTextView;
private TextView caseTimeTextView;
private TextView caseUsefulTextView;
private TextView caseUselessTextView;
public shareItemViewHolder(@NonNull View itemView) {
super(itemView);
caseStyleTextView = itemView.findViewById(R.id.road_case_style);
caseAddressTextView = itemView.findViewById(R.id.road_case_address);
caseTimeTextView = itemView.findViewById(R.id.road_case_share_time);
caseUsefulTextView = itemView.findViewById(R.id.road_case_useful_num);
caseUselessTextView = itemView.findViewById(R.id.road_case_useless_num);
}
}
/*
* 分享次数,热心指数...
* */
class shareDescriptionViewHolder extends RecyclerView.ViewHolder {
private TextView shareNumTextView;
private TextView approveNumTextView;
public shareDescriptionViewHolder(@NonNull View itemView) {
super(itemView);
shareNumTextView = itemView.findViewById(R.id.share_num);
approveNumTextView = itemView.findViewById(R.id.share_approve);
}
}
/*
* 去分享
* */
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();
mApis.getShareManager().showShareDialog();
});
}
}
/*
* 加载更多/没有更多
* */
class shareLoadStatusViewHolder extends RecyclerView.ViewHolder {
private TextView statusButton;
public shareLoadStatusViewHolder(@NonNull View itemView) {
super(itemView);
statusButton = itemView.findViewById(R.id.event_share_load_status);
}
}
}

View File

@@ -0,0 +1,159 @@
package com.zhidao.mogo.module.event.panel.bean;
import com.mogo.commons.data.BaseData;
import java.io.Serializable;
public class ShareEventDescription extends BaseData implements Serializable {
/**
* detailMsg :
* result : {"enthusiasmIndex":{"id":68,"sn":"ZD802B1932L00622","score":10,"shareNum":1024,"likeNum":0,"notLikeNum":0,"enthusiasmIndex":1,"createTime":"2020-07-28T06:21:11.523+0000","updateTime":"2020-07-28T06:21:11.523+0000"}}
*/
private String detailMsg;
private ResultBean result;
public String getDetailMsg() {
return detailMsg;
}
public void setDetailMsg(String detailMsg) {
this.detailMsg = detailMsg;
}
public ResultBean getResult() {
return result;
}
public void setResult(ResultBean result) {
this.result = result;
}
public static class ResultBean {
/**
* enthusiasmIndex : {"id":68,"sn":"ZD802B1932L00622","score":10,"shareNum":1024,"likeNum":0,"notLikeNum":0,"enthusiasmIndex":1,"createTime":"2020-07-28T06:21:11.523+0000","updateTime":"2020-07-28T06:21:11.523+0000"}
*/
private EnthusiasmIndexBean enthusiasmIndex;
public EnthusiasmIndexBean getEnthusiasmIndex() {
return enthusiasmIndex;
}
public void setEnthusiasmIndex(EnthusiasmIndexBean enthusiasmIndex) {
this.enthusiasmIndex = enthusiasmIndex;
}
public static class EnthusiasmIndexBean {
@Override
public String toString() {
return "EnthusiasmIndexBean{" +
"id=" + id +
", sn='" + sn + '\'' +
", score=" + score +
", shareNum=" + shareNum +
", likeNum=" + likeNum +
", notLikeNum=" + notLikeNum +
", enthusiasmIndex=" + enthusiasmIndex +
", createTime='" + createTime + '\'' +
", updateTime='" + updateTime + '\'' +
'}';
}
/**
* id : 68
* sn : ZD802B1932L00622
* score : 10
* shareNum : 1024
* likeNum : 0
* notLikeNum : 0
* enthusiasmIndex : 1.0
* 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;
private int shareNum;
private int likeNum;
private int notLikeNum;
private double enthusiasmIndex;
private String createTime;
private String updateTime;
public int getId() {
return id;
}
public void setId(int id) {
this.id = id;
}
public String getSn() {
return sn;
}
public void setSn(String sn) {
this.sn = sn;
}
public int getScore() {
return score;
}
public void setScore(int score) {
this.score = score;
}
public int getShareNum() {
return shareNum;
}
public void setShareNum(int shareNum) {
this.shareNum = shareNum;
}
public int getLikeNum() {
return likeNum;
}
public void setLikeNum(int likeNum) {
this.likeNum = likeNum;
}
public int getNotLikeNum() {
return notLikeNum;
}
public void setNotLikeNum(int notLikeNum) {
this.notLikeNum = notLikeNum;
}
public double getEnthusiasmIndex() {
return enthusiasmIndex;
}
public void setEnthusiasmIndex(double enthusiasmIndex) {
this.enthusiasmIndex = enthusiasmIndex;
}
public String getCreateTime() {
return createTime;
}
public void setCreateTime(String createTime) {
this.createTime = createTime;
}
public String getUpdateTime() {
return updateTime;
}
public void setUpdateTime(String updateTime) {
this.updateTime = updateTime;
}
}
}
}

View File

@@ -0,0 +1,486 @@
package com.zhidao.mogo.module.event.panel.bean;
import com.mogo.commons.data.BaseData;
import java.io.Serializable;
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;
public String getDetailMsg() {
return detailMsg;
}
public void setDetailMsg(String detailMsg) {
this.detailMsg = detailMsg;
}
public ResultBean getResult() {
return result;
}
public void setResult(ResultBean result) {
this.result = result;
}
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() {
return page;
}
public void setPage(PageBean page) {
this.page = page;
}
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;
private int pageNum;
private List<ContentBean> content;
public int getTotal() {
return total;
}
public void setTotal(int total) {
this.total = total;
}
public int getPageSize() {
return pageSize;
}
public void setPageSize(int pageSize) {
this.pageSize = pageSize;
}
public int getPageNum() {
return pageNum;
}
public void setPageNum(int pageNum) {
this.pageNum = pageNum;
}
public List<ContentBean> getContent() {
return content;
}
public void setContent(List<ContentBean> content) {
this.content = content;
}
public static class ContentBean {
@Override
public String toString() {
return "ContentBean{" +
"uploadTimestamp=" + uploadTimestamp +
", timeout=" + timeout +
", uploadAddress='" + uploadAddress + '\'' +
", distance=" + distance +
", dbId='" + dbId + '\'' +
", poiType='" + poiType + '\'' +
", sn='" + sn + '\'' +
", userId=" + userId +
", userName='" + userName + '\'' +
", userHead='" + userHead + '\'' +
", likeNum=" + likeNum +
", notLikeNum=" + notLikeNum +
", uploadType=" + uploadType +
", uploadUser='" + uploadUser + '\'' +
", imgUrl=" + imgUrl +
", content=" + content +
", gasStationId=" + gasStationId +
", gasStationName=" + gasStationName +
", gasImg=" + gasImg +
", gasPrices=" + gasPrices +
", endDate='" + endDate + '\'' +
", fabulous=" + fabulous +
", direction=" + direction +
", virtualLikeNum=" + virtualLikeNum +
", status=" + status +
", sourceType='" + sourceType + '\'' +
", hitId='" + hitId + '\'' +
", userType=" + userType +
", coordinates=" + coordinates +
", data=" + data +
'}';
}
/**
* 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 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 notLikeNum;
private int uploadType;
private String uploadUser;
private Object imgUrl;
private Object content;
private Object gasStationId;
private Object gasStationName;
private Object gasImg;
private Object gasPrices;
private String endDate;
private boolean fabulous;
private int direction;
private int virtualLikeNum;
private int status;
private String sourceType;
private String hitId;
private int userType;
private List<Double> coordinates;
private List<DataBean> data;
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 getNotLikeNum() {
return notLikeNum;
}
public void setNotLikeNum(int notLikeNum) {
this.notLikeNum = notLikeNum;
}
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 Object getImgUrl() {
return imgUrl;
}
public void setImgUrl(Object imgUrl) {
this.imgUrl = imgUrl;
}
public Object getContent() {
return content;
}
public void setContent(Object content) {
this.content = content;
}
public Object getGasStationId() {
return gasStationId;
}
public void setGasStationId(Object gasStationId) {
this.gasStationId = gasStationId;
}
public Object getGasStationName() {
return gasStationName;
}
public void setGasStationName(Object gasStationName) {
this.gasStationName = gasStationName;
}
public Object getGasImg() {
return gasImg;
}
public void setGasImg(Object gasImg) {
this.gasImg = gasImg;
}
public Object getGasPrices() {
return gasPrices;
}
public void setGasPrices(Object 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 int getVirtualLikeNum() {
return virtualLikeNum;
}
public void setVirtualLikeNum(int 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 List<Double> getCoordinates() {
return coordinates;
}
public void setCoordinates(List<Double> coordinates) {
this.coordinates = coordinates;
}
public List<DataBean> getData() {
return data;
}
public void setData(List<DataBean> data) {
this.data = data;
}
public static class DataBean {
/**
* 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 url;
private String thumbnail;
private Object content;
private Object illegalCount;
public String getUrl() {
return url;
}
public void setUrl(String url) {
this.url = url;
}
public String getThumbnail() {
return thumbnail;
}
public void setThumbnail(String thumbnail) {
this.thumbnail = thumbnail;
}
public Object getContent() {
return content;
}
public void setContent(Object content) {
this.content = content;
}
public Object getIllegalCount() {
return illegalCount;
}
public void setIllegalCount(Object illegalCount) {
this.illegalCount = illegalCount;
}
}
}
}
}
}

View File

@@ -0,0 +1,10 @@
package com.zhidao.mogo.module.event.panel.bean;
public interface ShareEventItemEnum {
int ITEM_TYPE_NUM_DES = 0;
int ITEM_TYPE_SHARE_LIST = 1;
int ITEM_TYPE_SHARE_EMPTY = 2;
int ITEM_TYPE_LOAD_MORE_STATUS = 3;
}

View File

@@ -10,7 +10,7 @@ class MyShareFragment : MvpFragment<MyShareFragment, MySharePresenter>() {
*
* @return
*/
override fun getLayoutId(): Int = R.layout.module_event_panel_fragment_my_share
override fun getLayoutId(): Int = R.layout.module_event_panel_share_item
/**
* 初始化控件必须在初始化完成之后才可以实例化presenter避免

View File

@@ -0,0 +1,156 @@
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);
}
}

View File

@@ -0,0 +1,23 @@
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;
}
}
}

View File

@@ -0,0 +1,26 @@
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);
}

View File

@@ -0,0 +1,18 @@
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;
}
}

View File

@@ -0,0 +1,11 @@
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);
}
}

View File

@@ -15,7 +15,7 @@
android:id="@+id/btnShowOrHidePanels"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="200dp"
android:layout_marginTop="300dp"
android:layout_marginEnd="10dp"
android:text="显示面板"
android:textColor="#000"

View File

@@ -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="My Share"
android:textColor="#fff"
android:textSize="40sp" />
</androidx.constraintlayout.widget.ConstraintLayout>

View File

@@ -0,0 +1,95 @@
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:orientation="horizontal">
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="80dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/share_num"
android:layout_width="match_parent"
android:layout_height="50dp"
android:layout_gravity="center"
android:gravity="center"
android:text="0"
android:textColor="#FFFFFF"
android:textSize="25sp" />
<TextView
android:id="@+id/shre_num_des"
android:layout_width="match_parent"
android:layout_height="30dp"
android:layout_gravity="center"
android:gravity="center"
android:text="分享次数"
android:textColor="#FFFFFF"
android:textSize="20sp" />
</LinearLayout>
<ImageView
android:layout_width="1dp"
android:layout_height="80dp"
android:background="#FFFFFF" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="80dp"
android:layout_weight="1"
android:orientation="vertical">
<TextView
android:id="@+id/share_approve"
android:layout_width="match_parent"
android:layout_height="50dp"
android:gravity="center"
android:text="0"
android:textColor="#FFFFFF"
android:textSize="25sp" />
<TextView
android:id="@+id/share_approve_des"
android:layout_width="match_parent"
android:layout_height="30dp"
android:gravity="center"
android:text="车友认同次数"
android:textColor="#FFFFFF"
android:textSize="20sp" />
</LinearLayout>
<ImageView
android:layout_width="1dp"
android:layout_height="80dp"
android:background="#FFFFFF" />
<LinearLayout
android:layout_width="fill_parent"
android:layout_height="80dp"
android:layout_weight="1"
android:orientation="vertical">
<ImageView
android:id="@+id/share_index"
android:layout_width="match_parent"
android:layout_height="50dp"
android:background="@drawable/amap_ride" />
<TextView
android:id="@+id/share_index_des"
android:layout_width="match_parent"
android:layout_height="30dp"
android:gravity="center"
android:text="热心指数"
android:textColor="#FFFFFF"
android:textSize="20sp" />
</LinearLayout>
</LinearLayout>

View File

@@ -0,0 +1,39 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/share_event_guide_des"
android:layout_width="wrap_content"
android:layout_height="30dp"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="小窍门:分享路况、点赞其他车友,有助于提高热心指数"
android:textColor="#FFFFFF"
android:textSize="16sp">
</TextView>
<TextView
android:id="@+id/share_event_null_des"
android:layout_width="wrap_content"
android:layout_height="100dp"
android:layout_below="@+id/share_event_guide_des"
android:layout_centerHorizontal="true"
android:gravity="center"
android:text="你还没有分享过道路事件,快去试试吧" />
<Button
android:id="@+id/share_event_button"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@+id/share_event_null_des"
android:layout_centerHorizontal="true"
android:background="#FFFFFF"
android:text="去分享"
android:clickable="true"
android:onClick="shareEventAction"
android:textSize="25sp" />
</RelativeLayout>

View File

@@ -0,0 +1,85 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
xmlns:app="http://schemas.android.com/apk/res-auto"
android:id="@+id/road_case_liset_item"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<TextView
android:id="@+id/road_case_style"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:gravity="center"
android:layout_marginLeft="20dp"
android:paddingTop="10dp"
android:background="#1E90FF"
android:text="道路类型"
android:textColor="#FFFFFF"
android:textSize="15sp" />
<TextView
android:id="@+id/road_case_address"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/road_case_style"
android:gravity="center"
android:layout_marginLeft="20dp"
android:text="东城区北三环"
android:textColor="#FFFFFF"
android:textSize="20sp" />
<TextView
android:id="@+id/road_case_share_time"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_below="@id/road_case_address"
android:gravity="center"
android:layout_marginLeft="20dp"
android:text="时间:"
android:textColor="#FFFFFF"
android:textSize="13sp" />
<Button
android:id="@+id/road_case_useless"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignParentRight="true"
android:layout_marginTop="25dp"
android:layout_marginRight="20dp"
android:background="@drawable/amap_bus" />
<TextView
android:id="@+id/road_case_useless_num"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_below="@id/road_case_useless"
android:layout_alignLeft="@id/road_case_useless"
android:layout_alignRight="@id/road_case_useless"
android:gravity="center"
android:text="10"
android:textColor="#FFFFFF"
android:textSize="15sp" />
<TextView
android:id="@+id/road_case_uselful"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_alignTop="@id/road_case_useless"
android:layout_alignBottom="@id/road_case_useless"
android:layout_marginRight="20dp"
android:layout_toLeftOf="@id/road_case_useless"
android:background="@drawable/amap_ride" />
<TextView
android:id="@+id/road_case_useful_num"
android:layout_width="40dp"
android:layout_height="40dp"
android:layout_below="@id/road_case_useless"
android:layout_alignLeft="@id/road_case_uselful"
android:layout_alignRight="@id/road_case_uselful"
android:gravity="center"
android:text="5"
android:textColor="#FFFFFF"
android:textSize="15sp" />
</RelativeLayout>

View File

@@ -0,0 +1,15 @@
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:layout_width="match_parent"
android:layout_height="wrap_content">
<Button
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:id="@+id/event_share_load_status"
android:textColor="#000000"
android:text="没有更多了"
android:textSize="18sp"
android:gravity="center"/>
</RelativeLayout>

View File

@@ -0,0 +1,14 @@
<?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"/>

View File

@@ -1,6 +1,5 @@
package com.mogo.module.extensions.entrance;
import android.content.Intent;
import android.graphics.Rect;
import android.os.Bundle;
import android.text.TextUtils;
@@ -45,7 +44,6 @@ import com.mogo.service.MogoServicePaths;
import com.mogo.service.analytics.IMogoAnalytics;
import com.mogo.service.entrance.ButtonIndex;
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
import com.mogo.service.intent.IMogoIntentListener;
import com.mogo.service.map.IMogoMapService;
import com.mogo.service.module.IMogoRegisterCenter;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
@@ -240,34 +238,25 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
} else {
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
}
// mCameraMode.setSelected(!mCameraMode.isSelected());
// mCameraMode.setText(getString(mCameraMode.isSelected() ? R.string.mode_car_up :
// R.string.mode_north_up));
});
mApis.getIntentManagerApi().registerIntentListener(AUTONAVI_STANDARD_BROADCAST_RECV,
new IMogoIntentListener() {
@Override
public void onIntentReceived(String intentStr, Intent intent) {
int key_type = intent.getIntExtra("KEY_TYPE", 0);
int type = intent.getIntExtra("EXTRA_TYPE", -1);
int opera_type = intent.getIntExtra("EXTRA_OPERA", -1);
if (key_type == 10027) {
if (opera_type == 0) {
mCameraMode.setSelected(false);
} else if (opera_type == 1) {
mCameraMode.setSelected(true);
}
mCameraMode.setText(getString(mCameraMode.isSelected() ?
R.string.mode_car_up : R.string.mode_north_up));
}
}
});
MogoEntranceButtons.save(ButtonIndex.BUTTON1,
findViewById(R.id.module_entrance_id_button1));
MogoEntranceButtons.save(ButtonIndex.BUTTON2,
findViewById(R.id.module_entrance_id_button2));
mApis.getIntentManagerApi().registerIntentListener( AUTONAVI_STANDARD_BROADCAST_RECV, (( intentStr, intent ) -> {
int key_type = intent.getIntExtra( "KEY_TYPE", 0 );
int type = intent.getIntExtra( "EXTRA_TYPE", -1 );
int opera_type = intent.getIntExtra( "EXTRA_OPERA", -1 );
if ( key_type == 10027 ) {
if ( opera_type == 0 ) {
mCameraMode.setSelected( false );
} else if ( opera_type == 1 ) {
mCameraMode.setSelected( true );
}
mCameraMode.setText( getString( mCameraMode.isSelected() ? R.string.mode_car_up : R.string.mode_north_up ) );
} else if( key_type == 10021 ){
onStopNavi();
}
}) );
MogoEntranceButtons.save( ButtonIndex.BUTTON1, findViewById( R.id.module_entrance_id_button1 ) );
MogoEntranceButtons.save( ButtonIndex.BUTTON2, findViewById( R.id.module_entrance_id_button2 ) );
mDisplayOverviewBounds = new Rect(
ResourcesHelper.getDimensionPixelSize(getContext(),
@@ -312,8 +301,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
// 埋点
final Map<String, Object> properties = new HashMap<>();
properties.put("type", 3);
ServiceApisManager.serviceApis.getAnalyticsApi().track("Launcher_APP_Icon",
properties);
ServiceApisManager.serviceApis.getAnalyticsApi().track("Launcher_APP_Icon", properties);
} catch (Exception e) {
Logger.e(TAG, e, "打开个人中心Exception");
}
@@ -321,8 +309,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
mUserHeadImg.setVisibility(DebugConfig.isLauncher() ? View.VISIBLE : View.GONE);
mUploadButtonAnimatorController = new UploadButtonAnimatorController(mUploading, mUpload,
mStatusManager);
mUploadButtonAnimatorController = new UploadButtonAnimatorController(mUploading, mUpload, mStatusManager);
debugTopView();
}
@@ -333,8 +320,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
traceData("1");
}
private static final String AUTONAVI_STANDARD_BROADCAST_RECV =
"AUTONAVI_STANDARD_BROADCAST_RECV";
private static final String AUTONAVI_STANDARD_BROADCAST_RECV = "AUTONAVI_STANDARD_BROADCAST_RECV";
@NonNull
@Override
@@ -389,8 +375,7 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
TopViewAnimHelper.getInstance().showNaviView();
mMApUIController.changeMapMode(mCameraMode.isSelected() ? EnumMapUI.NorthUP_2D :
EnumMapUI.CarUp_2D);
MapCenterPointStrategy.setMapCenterPointBySceneAndDelay(mMApUIController, Scene.NAVI, 500
, () -> {
MapCenterPointStrategy.setMapCenterPointBySceneAndDelay(mMApUIController, Scene.NAVI, 500, () -> {
return !mMogoNavi.isNaviing();
});
if (CustomNaviInterrupter.getInstance().interrupt()) {

View File

@@ -18,6 +18,9 @@ import com.mogo.utils.TipToast;
import com.mogo.utils.UiThreadHandler;
import com.mogo.utils.logger.Logger;
import java.util.HashMap;
import java.util.Map;
/**
* @author congtaowang
* @since 2020-04-20
@@ -82,6 +85,9 @@ public class SchemeIntent implements IMogoStatusChangedListener {
break;
case "/main/share":
Logger.d(TAG,"收到打开分享框的scheme准备打开分享框");
Map< String, Object > properties = new HashMap<>();
properties.put( "from", "1" );
mApis.getAnalyticsApi().track("v2x_share_click", properties);
mApis.getShareManager().showShareDialog();
break;
default:

View File

@@ -109,10 +109,7 @@ public class MapPresenter extends Presenter< MapView > implements
if ( key_type == 10027 ) {
if ( type == 0 ) {
onChangeTrafficMode( opera_type );
} else if ( type == 1 ) {
zoomMap( opera_type == 0 );
} else if ( type == 2 ) {
// mMogoIntentManager.invoke( AUTONAVI_STANDARD_BROADCAST_RECV, intent );
onChangeCameraMode( opera_type );
}
} else if ( key_type == 10048 ) {
@@ -157,6 +154,7 @@ public class MapPresenter extends Presenter< MapView > implements
mLauncher.backToLauncher( getContext() );
}
}, 500L );
mMogoIntentManager.invoke( AUTONAVI_STANDARD_BROADCAST_RECV, intent );
return;
}
onStopNaviInternal();
@@ -183,6 +181,7 @@ public class MapPresenter extends Presenter< MapView > implements
mMogoMapService.getNavi( getContext() ).reCalculateRoute( config );
}
mMogoIntentManager.invoke( AUTONAVI_STANDARD_BROADCAST_RECV, intent );
}
};

View File

@@ -164,8 +164,8 @@ public class VoiceConstants {
static {
// 免唤醒
// sVoiceCmds.put( VoiceConstants.CMD_MAP_ZOOM_IN_UN_WAKEUP, VoiceConstants.CMD_MAP_ZOOM_IN_TRIGGER_WORDS );
// sVoiceCmds.put( VoiceConstants.CMD_MAP_ZOOM_OUT_UN_WAKEUP, VoiceConstants.CMD_MAP_ZOOM_OUT_TRIGGER_WORDS );
sVoiceCmds.put( VoiceConstants.CMD_MAP_ZOOM_IN_UN_WAKEUP, VoiceConstants.CMD_MAP_ZOOM_IN_TRIGGER_WORDS );
sVoiceCmds.put( VoiceConstants.CMD_MAP_ZOOM_OUT_UN_WAKEUP, VoiceConstants.CMD_MAP_ZOOM_OUT_TRIGGER_WORDS );
//sVoiceCmds.put( VoiceConstants.CMD_MAP_2D_UN_WAKEUP, VoiceConstants.CMD_MAP_2D_TRIGGER_WORDS );
//sVoiceCmds.put( VoiceConstants.CMD_MAP_3D_UN_WAKEUP, VoiceConstants.CMD_MAP_3D_TRIGGER_WORDS );
//sVoiceCmds.put( VoiceConstants.CMD_MAP_DAY_TIME_MODE_UN_WAKEUP, VoiceConstants.CMD_MAP_DAY_TIME_MODE_TRIGGER_WORDS );

View File

@@ -11,6 +11,7 @@ import android.widget.TextView;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.commons.voice.AIAssist;
import com.mogo.commons.voice.IMogoVoiceCmdCallBack;
import com.mogo.module.media.MediaConstants;
import com.mogo.module.media.R;
import com.mogo.module.media.ServiceMediaHandler;
import com.mogo.module.media.constants.MusicConstant;
@@ -22,6 +23,8 @@ import com.mogo.module.media.view.IMusicView;
import com.mogo.module.media.widget.AnimCircleImageView;
import com.mogo.module.media.widget.NoScrollSeekBar;
import com.mogo.module.media.widget.ScrollingTextView;
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
import com.mogo.service.statusmanager.StatusDescriptor;
import com.mogo.utils.WindowUtils;
import com.mogo.utils.glide.GlideApp;
import com.mogo.utils.logger.Logger;
@@ -72,11 +75,20 @@ public class MediaWindow2 implements IMusicView {
});
}
ServiceMediaHandler.getIMogoStatusManager().registerStatusChangedListener(MediaConstants.MODULE_TYPE, StatusDescriptor.ACC_STATUS, (descriptor, isTrue) -> {
if (descriptor == StatusDescriptor.ACC_STATUS&&!isTrue) {
ServiceMediaHandler.getMogoWindowManager().removeView(mWindowView);
mHasAddWindow = false;
}
});
isFirstPlay = true;
}
private void addWindowView() {
Log.d(TAG, "addWindowView===" + mHasAddWindow);
if (ServiceMediaHandler.getMogoWindowManager() == null) {
Log.d(TAG, "addWindowView return");
return;
}

View File

@@ -5,9 +5,7 @@
android:layout_height="match_parent"
android:background="#2D2E3D"
android:clickable="true"
android:orientation="vertical"
>
android:orientation="vertical">
<RelativeLayout
android:id="@+id/rl_navi_setting_title"
@@ -35,7 +33,7 @@
android:layout_toRightOf="@id/iv_back"
android:text="@string/navi_setting"
android:textColor="@color/white"
android:textSize="@dimen/txt_title" />
android:textSize="@dimen/module_search_title_textSize" />
</RelativeLayout>
@@ -44,8 +42,8 @@
android:layout_width="match_parent"
android:layout_height="0dp"
android:overScrollMode="never"
android:paddingLeft="@dimen/module_search_dp_160"
android:paddingRight="@dimen/module_search_dp_160"
android:paddingLeft="@dimen/module_search_setting_container_padding"
android:paddingRight="@dimen/module_search_setting_container_padding"
android:scrollbars="none"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintTop_toBottomOf="@+id/rl_navi_setting_title">
@@ -53,12 +51,12 @@
<androidx.constraintlayout.widget.ConstraintLayout
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:paddingBottom="@dimen/module_search_dp_150">
android:paddingBottom="@dimen/module_search_setting_container_paddingBottom">
<LinearLayout
android:id="@+id/ll_navi_sound"
android:layout_width="@dimen/module_search_180dp"
android:layout_height="@dimen/module_search_dp_120"
android:layout_width="@dimen/module_search_setting_item_width"
android:layout_height="@dimen/module_search_setting_item_height"
android:layout_marginTop="@dimen/dp_24"
android:background="@drawable/shape_round_gray"
android:gravity="center_vertical"

View File

@@ -55,7 +55,7 @@
<View
android:layout_width="1dp"
android:layout_height="@dimen/module_search_dp_72"
android:layout_height="@dimen/module_search_address_divider_height"
android:background="#17D8D8D8" />
<TextView
@@ -74,11 +74,11 @@
<RelativeLayout
android:id="@+id/rl_navi_history"
android:layout_width="@dimen/module_search_dp_1200"
android:layout_height="@dimen/module_search_dp_778"
android:layout_marginTop="@dimen/module_search_dp_32"
android:layout_width="@dimen/module_search_histories_list_width"
android:layout_height="@dimen/module_search_histories_list_height"
android:layout_marginTop="@dimen/module_search_histories_list_marginTop"
android:background="@drawable/shape_round_gray"
android:padding="@dimen/module_search_dp_40"
android:padding="@dimen/module_search_histories_list_marginPadding"
app:layout_constraintLeft_toLeftOf="parent"
app:layout_constraintTop_toBottomOf="@+id/ll_navi_search">
@@ -105,18 +105,18 @@
android:id="@+id/rv_navi_history"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:layout_marginTop="@dimen/module_search_dp_60" />
android:layout_marginTop="@dimen/module_search_histories_inner_list_marginTop" />
</RelativeLayout>
<androidx.recyclerview.widget.RecyclerView
android:id="@+id/rv_navi_search"
android:layout_width="@dimen/module_search_dp_1200"
android:layout_width="@dimen/module_search_histories_list_width"
android:layout_height="0dp"
android:layout_marginTop="@dimen/dp_32"
android:background="@drawable/shape_round_gray"
android:padding="@dimen/module_search_dp_37"
android:padding="@dimen/module_search_list_padding"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/tv_navi_wash"
app:layout_constraintLeft_toLeftOf="parent"
@@ -125,13 +125,13 @@
<TextView
android:id="@+id/tv_navi_list_empty"
android:layout_width="@dimen/module_search_dp_1200"
android:layout_width="@dimen/module_search_histories_list_width"
android:layout_height="0dp"
android:layout_marginTop="@dimen/dp_32"
android:background="@drawable/shape_round_gray"
android:gravity="center"
android:textColor="@color/white"
android:textSize="@dimen/txt_large"
android:textSize="@dimen/module_search_empty_tip_textSize"
android:visibility="gone"
app:layout_constraintBottom_toBottomOf="@id/tv_navi_wash"
app:layout_constraintLeft_toLeftOf="parent"

View File

@@ -1,6 +1,7 @@
<?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"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="match_parent"
android:paddingLeft="@dimen/module_search_search_padding"
@@ -11,7 +12,7 @@
<androidx.cardview.widget.CardView
android:id="@+id/cv_search_result"
android:layout_width="@dimen/module_search_dp_838"
android:layout_width="@dimen/module_search_category_panel_width"
android:layout_height="0dp"
android:layout_marginTop="@dimen/module_search_search_result_marginTop"
app:cardBackgroundColor="#3F4057"
@@ -37,7 +38,7 @@
android:id="@+id/tv_navi_navi"
style="@style/txt_btn"
android:layout_width="match_parent"
android:layout_height="@dimen/module_search_dp_104"
android:layout_height="@dimen/module_search_start_navi_button_height"
android:layout_gravity="bottom"
android:layout_marginLeft="@dimen/module_search_start_button"
android:layout_marginRight="@dimen/module_search_start_button"
@@ -48,8 +49,8 @@
<ImageView
android:id="@+id/iv_path_fail"
android:layout_width="@dimen/module_search_dp_120"
android:layout_height="@dimen/module_search_dp_120"
android:layout_width="@dimen/module_search_setting_item_height"
android:layout_height="@dimen/module_search_setting_item_height"
android:layout_marginTop="@dimen/dp_224"
android:src="@mipmap/icon_path_fail"
app:layout_constraintLeft_toLeftOf="@+id/cv_search_result"
@@ -75,9 +76,9 @@
android:visibility="gone"
app:constraint_referenced_ids="iv_path_fail,tv_path_notice" />
<LinearLayout xmlns:tools="http://schemas.android.com/tools"
<LinearLayout
android:id="@+id/ll_navi_search"
android:layout_width="@dimen/module_search_dp_838"
android:layout_width="@dimen/module_search_category_panel_width"
android:layout_height="@dimen/module_search_et_hight"
android:background="@drawable/shape_round_gray"
android:gravity="center_vertical"

View File

@@ -3,13 +3,13 @@
xmlns:app="http://schemas.android.com/apk/res-auto"
xmlns:tools="http://schemas.android.com/tools"
android:layout_width="match_parent"
android:layout_height="@dimen/module_search_dp_180"
android:layout_height="@dimen/module_search_poi_item_height"
>
<ImageView
android:id="@+id/iv_position"
android:layout_width="@dimen/module_search_dp_80"
android:layout_height="@dimen/module_search_dp_80"
android:layout_width="@dimen/module_search_poi_item_icon_size"
android:layout_height="@dimen/module_search_poi_item_icon_size"
android:src="@mipmap/icon_navi_position"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintLeft_toLeftOf="parent"
@@ -19,12 +19,12 @@
<TextView
android:id="@+id/tv_position"
android:layout_width="0dp"
android:layout_height="@dimen/module_search_dp_70"
android:layout_height="@dimen/module_search_poi_item_position_height"
android:layout_marginLeft="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_30"
android:gravity="center_vertical"
android:textColor="@color/white"
android:textSize="@dimen/module_search_25sp"
android:textSize="@dimen/module_search_poi_item_position_textSize"
app:layout_constraintLeft_toRightOf="@id/iv_position"
app:layout_constraintRight_toRightOf="parent"
app:layout_constraintTop_toTopOf="parent"
@@ -34,7 +34,7 @@
<TextView
android:id="@+id/tv_position_des"
android:layout_width="0dp"
android:layout_height="@dimen/module_search_dp_42"
android:layout_height="@dimen/module_search_poi_item_desc_height"
android:layout_marginTop="@dimen/dp_8"
android:ellipsize="marquee"
android:singleLine="true"

View File

@@ -2,7 +2,8 @@
<resources>
<!-- module_main_activity_main.xml-->
<dimen name="module_search_fragment_padding" >32px</dimen>
<dimen name="module_search_title_textSize">20px</dimen>
<dimen name="module_search_fragment_padding">32px</dimen>
<dimen name="module_search_fragment_padding_top">32px</dimen>
<dimen name="module_search_et_width">640px</dimen>
<dimen name="module_search_et_hight">64px</dimen>
@@ -19,32 +20,31 @@
<dimen name="module_search_navi_home_height">64px</dimen>
<dimen name="module_search_navi_home_margin_left">16px</dimen>
<dimen name="txt_normal">18px</dimen>
<dimen name="module_search_dp_72">38px</dimen>
<dimen name="module_search_dp_75">75px</dimen>
<dimen name="module_search_address_divider_height">38px</dimen>
<dimen name="module_search_navi_home_padding_left">40px</dimen>
<dimen name="module_search_dp_778">410px</dimen>
<dimen name="module_search_dp_1200">640px</dimen>
<dimen name="module_search_dp_32">16px</dimen>
<dimen name="module_search_dp_40">20px</dimen>
<dimen name="module_search_dp_60">30px</dimen>
<dimen name="module_search_dp_37">20px</dimen>
<dimen name="txt_large">28px</dimen>
<dimen name="module_search_dp_268">144px</dimen>
<dimen name="module_search_dp_236">126px</dimen>
<dimen name="module_search_dp_180">96px</dimen>
<dimen name="module_search_dp_80">42px</dimen>
<dimen name="module_search_dp_70">38px</dimen>
<dimen name="module_search_25sp">28px</dimen>
<dimen name="module_search_dp_42">23px</dimen>
<dimen name="module_search_dp_160">96px</dimen>
<dimen name="module_search_dp_150">69px</dimen>
<dimen name="module_search_180dp">192px</dimen>
<dimen name="module_search_dp_120">64px</dimen>
<dimen name="module_search_histories_list_height">410px</dimen>
<dimen name="module_search_histories_list_width">640px</dimen>
<dimen name="module_search_histories_list_marginTop">16px</dimen>
<dimen name="module_search_histories_list_marginPadding">20px</dimen>
<dimen name="module_search_histories_inner_list_marginTop">30px</dimen>
<dimen name="module_search_list_padding">20px</dimen>
<dimen name="module_search_empty_tip_textSize">28px</dimen>
<dimen name="module_search_category_width">144px</dimen>
<dimen name="module_search_category_height">126px</dimen>
<dimen name="module_search_poi_item_height">96px</dimen>
<dimen name="module_search_poi_item_icon_size">42px</dimen>
<dimen name="module_search_poi_item_position_height">38px</dimen>
<dimen name="module_search_poi_item_position_textSize">28px</dimen>
<dimen name="module_search_poi_item_desc_height">23px</dimen>
<dimen name="module_search_setting_container_padding">96px</dimen>
<dimen name="module_search_setting_container_paddingBottom">69px</dimen>
<dimen name="module_search_setting_item_width">192px</dimen>
<dimen name="module_search_setting_item_height">64px</dimen>
<dimen name="module_search_txt_setting_width">24px</dimen>
<dimen name="module_search_dp_838">446px</dimen>
<dimen name="module_search_category_panel_width">446px</dimen>
<dimen name="module_search_category_margin_bottom">83px</dimen>
<dimen name="module_search_dp_104">56px</dimen>
<dimen name="module_search_strategy_name_width" >100px</dimen>
<dimen name="module_search_start_navi_button_height">56px</dimen>
<dimen name="module_search_strategy_name_width">100px</dimen>
<dimen name="module_search_marker_number_textSize">18px</dimen>
<dimen name="module_search_choose_path_item_height">111px</dimen>
<dimen name="module_search_calculate_item_strategy_name_textSize">16px</dimen>

View File

@@ -2,7 +2,8 @@
<resources>
<!-- module_main_activity_main.xml-->
<dimen name="module_search_fragment_padding" >32px</dimen>
<dimen name="module_search_title_textSize">20px</dimen>
<dimen name="module_search_fragment_padding">32px</dimen>
<dimen name="module_search_fragment_padding_top">32px</dimen>
<dimen name="module_search_et_width">640px</dimen>
<dimen name="module_search_et_hight">64px</dimen>
@@ -19,32 +20,31 @@
<dimen name="module_search_navi_home_height">64px</dimen>
<dimen name="module_search_navi_home_margin_left">16px</dimen>
<dimen name="txt_normal">18px</dimen>
<dimen name="module_search_dp_72">38px</dimen>
<dimen name="module_search_dp_75">75px</dimen>
<dimen name="module_search_address_divider_height">38px</dimen>
<dimen name="module_search_navi_home_padding_left">40px</dimen>
<dimen name="module_search_dp_778">410px</dimen>
<dimen name="module_search_dp_1200">640px</dimen>
<dimen name="module_search_dp_32">16px</dimen>
<dimen name="module_search_dp_40">20px</dimen>
<dimen name="module_search_dp_60">30px</dimen>
<dimen name="module_search_dp_37">20px</dimen>
<dimen name="txt_large">28px</dimen>
<dimen name="module_search_dp_268">144px</dimen>
<dimen name="module_search_dp_236">126px</dimen>
<dimen name="module_search_dp_180">96px</dimen>
<dimen name="module_search_dp_80">42px</dimen>
<dimen name="module_search_dp_70">38px</dimen>
<dimen name="module_search_25sp">28px</dimen>
<dimen name="module_search_dp_42">23px</dimen>
<dimen name="module_search_dp_160">96px</dimen>
<dimen name="module_search_dp_150">69px</dimen>
<dimen name="module_search_180dp">192px</dimen>
<dimen name="module_search_dp_120">64px</dimen>
<dimen name="module_search_histories_list_height">410px</dimen>
<dimen name="module_search_histories_list_width">640px</dimen>
<dimen name="module_search_histories_list_marginTop">16px</dimen>
<dimen name="module_search_histories_list_marginPadding">20px</dimen>
<dimen name="module_search_histories_inner_list_marginTop">30px</dimen>
<dimen name="module_search_list_padding">20px</dimen>
<dimen name="module_search_empty_tip_textSize">28px</dimen>
<dimen name="module_search_category_width">144px</dimen>
<dimen name="module_search_category_height">126px</dimen>
<dimen name="module_search_poi_item_height">96px</dimen>
<dimen name="module_search_poi_item_icon_size">42px</dimen>
<dimen name="module_search_poi_item_position_height">38px</dimen>
<dimen name="module_search_poi_item_position_textSize">28px</dimen>
<dimen name="module_search_poi_item_desc_height">23px</dimen>
<dimen name="module_search_setting_container_padding">96px</dimen>
<dimen name="module_search_setting_container_paddingBottom">69px</dimen>
<dimen name="module_search_setting_item_width">192px</dimen>
<dimen name="module_search_setting_item_height">64px</dimen>
<dimen name="module_search_txt_setting_width">24px</dimen>
<dimen name="module_search_dp_838">446px</dimen>
<dimen name="module_search_category_panel_width">446px</dimen>
<dimen name="module_search_category_margin_bottom">83px</dimen>
<dimen name="module_search_dp_104">56px</dimen>
<dimen name="module_search_strategy_name_width" >100px</dimen>
<dimen name="module_search_start_navi_button_height">56px</dimen>
<dimen name="module_search_strategy_name_width">100px</dimen>
<dimen name="module_search_marker_number_textSize">18px</dimen>
<dimen name="module_search_choose_path_item_height">111px</dimen>
<dimen name="module_search_calculate_item_strategy_name_textSize">16px</dimen>

View File

@@ -2,16 +2,16 @@
<resources>
<!-- module_main_activity_main.xml-->
<dimen name="txt_normal">@dimen/sp_32</dimen>
<dimen name="txt_title">@dimen/sp_40</dimen>
<dimen name="txt_large">25sp</dimen>
<dimen name="module_search_fragment_padding">@dimen/dp_60</dimen>
<dimen name="module_search_fragment_padding_top">@dimen/dp_40</dimen>
<dimen name="module_search_title_textSize">40px</dimen>
<dimen name="module_search_empty_tip_textSize">50px</dimen>
<dimen name="module_search_fragment_padding">60px</dimen>
<dimen name="module_search_fragment_padding_top">40px</dimen>
<dimen name="module_search_et_width">600dp</dimen>
<dimen name="module_search_et_hight">@dimen/dp_120</dimen>
<dimen name="module_search_iv_back_hight">@dimen/dp_80</dimen>
<dimen name="module_search_iv_back_margin_left">@dimen/dp_24</dimen>
<dimen name="module_search_iv_back_margin_right">@dimen/dp_20</dimen>
<dimen name="module_search_et_margin_right">@dimen/dp_50</dimen>
<dimen name="module_search_et_hight">120px</dimen>
<dimen name="module_search_iv_back_hight">80px</dimen>
<dimen name="module_search_iv_back_margin_left">24px</dimen>
<dimen name="module_search_iv_back_margin_right">20px</dimen>
<dimen name="module_search_et_margin_right">50px</dimen>
<dimen name="module_search_et_text_size">40px</dimen>
<dimen name="module_search_btn_width">266px</dimen>
<dimen name="module_search_btn_right_margin">8px</dimen>
@@ -21,29 +21,28 @@
<dimen name="module_search_navi_home_height">120px</dimen>
<dimen name="module_search_navi_home_margin_left">32px</dimen>
<dimen name="module_search_navi_home_padding_left">75px</dimen>
<dimen name="module_search_dp_72">72px</dimen>
<dimen name="module_search_dp_75">75px</dimen>
<dimen name="module_search_dp_778">778px</dimen>
<dimen name="module_search_dp_1200">1200px</dimen>
<dimen name="module_search_dp_32">32px</dimen>
<dimen name="module_search_dp_40">40px</dimen>
<dimen name="module_search_dp_60">60px</dimen>
<dimen name="module_search_dp_37">37px</dimen>
<dimen name="module_search_dp_268">268px</dimen>
<dimen name="module_search_dp_236">236px</dimen>
<dimen name="module_search_dp_180">180px</dimen>
<dimen name="module_search_dp_80">80px</dimen>
<dimen name="module_search_dp_70">70px</dimen>
<dimen name="module_search_25sp">25sp</dimen>
<dimen name="module_search_dp_42">42px</dimen>
<dimen name="module_search_dp_160">160px</dimen>
<dimen name="module_search_dp_150">150px</dimen>
<dimen name="module_search_180dp">180dp</dimen>
<dimen name="module_search_dp_120">120px</dimen>
<dimen name="module_search_address_divider_height">72px</dimen>
<dimen name="module_search_histories_list_height">778px</dimen>
<dimen name="module_search_histories_list_width">1200px</dimen>
<dimen name="module_search_histories_list_marginTop">32px</dimen>
<dimen name="module_search_histories_list_marginPadding">40px</dimen>
<dimen name="module_search_histories_inner_list_marginTop">60px</dimen>
<dimen name="module_search_list_padding">37px</dimen>
<dimen name="module_search_category_width">268px</dimen>
<dimen name="module_search_category_height">236px</dimen>
<dimen name="module_search_poi_item_height">180px</dimen>
<dimen name="module_search_poi_item_icon_size">80px</dimen>
<dimen name="module_search_poi_item_position_height">70px</dimen>
<dimen name="module_search_poi_item_position_textSize">25px</dimen>
<dimen name="module_search_poi_item_desc_height">42px</dimen>
<dimen name="module_search_setting_container_padding">160px</dimen>
<dimen name="module_search_setting_container_paddingBottom">150px</dimen>
<dimen name="module_search_setting_item_width">180dp</dimen>
<dimen name="module_search_setting_item_height">120px</dimen>
<dimen name="module_search_txt_setting_width">45px</dimen>
<dimen name="module_search_dp_838">838px</dimen>
<dimen name="module_search_category_panel_width">838px</dimen>
<dimen name="module_search_category_margin_bottom">184px</dimen>
<dimen name="module_search_dp_104">104px</dimen>
<dimen name="module_search_start_navi_button_height">104px</dimen>
<dimen name="module_search_strategy_name_width" >154px</dimen>
<dimen name="module_search_marker_number_textSize">32px</dimen>
<dimen name="module_search_choose_path_item_height">212px</dimen>

View File

@@ -1,17 +1,17 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<!-- module_main_activity_main.xml-->
<dimen name="txt_normal">@dimen/sp_32</dimen>
<dimen name="fragment_left_margin">@dimen/dp_60</dimen>
<dimen name="txt_title">@dimen/sp_40</dimen>
<dimen name="txt_large">25sp</dimen>
<dimen name="module_search_fragment_padding">@dimen/dp_60</dimen>
<dimen name="module_search_fragment_padding_top">@dimen/dp_40</dimen>
<dimen name="module_search_title_textSize">40px</dimen>
<dimen name="module_search_empty_tip_textSize">50px</dimen>
<dimen name="module_search_fragment_padding">60px</dimen>
<dimen name="module_search_fragment_padding_top">40px</dimen>
<dimen name="module_search_et_width">600dp</dimen>
<dimen name="module_search_et_hight">@dimen/dp_120</dimen>
<dimen name="module_search_iv_back_hight">@dimen/dp_80</dimen>
<dimen name="module_search_iv_back_margin_left">@dimen/dp_24</dimen>
<dimen name="module_search_iv_back_margin_right">@dimen/dp_20</dimen>
<dimen name="module_search_et_margin_right">@dimen/dp_50</dimen>
<dimen name="module_search_et_hight">120px</dimen>
<dimen name="module_search_iv_back_hight">80px</dimen>
<dimen name="module_search_iv_back_margin_left">24px</dimen>
<dimen name="module_search_iv_back_margin_right">20px</dimen>
<dimen name="module_search_et_margin_right">50px</dimen>
<dimen name="module_search_et_text_size">40px</dimen>
<dimen name="module_search_btn_width">266px</dimen>
<dimen name="module_search_btn_right_margin">8px</dimen>
@@ -21,29 +21,28 @@
<dimen name="module_search_navi_home_height">120px</dimen>
<dimen name="module_search_navi_home_margin_left">32px</dimen>
<dimen name="module_search_navi_home_padding_left">75px</dimen>
<dimen name="module_search_dp_72">72px</dimen>
<dimen name="module_search_dp_75">75px</dimen>
<dimen name="module_search_dp_778">778px</dimen>
<dimen name="module_search_dp_1200">1200px</dimen>
<dimen name="module_search_dp_32">32px</dimen>
<dimen name="module_search_dp_40">40px</dimen>
<dimen name="module_search_dp_60">60px</dimen>
<dimen name="module_search_dp_37">37px</dimen>
<dimen name="module_search_dp_268">268px</dimen>
<dimen name="module_search_dp_236">236px</dimen>
<dimen name="module_search_dp_180">180px</dimen>
<dimen name="module_search_dp_80">80px</dimen>
<dimen name="module_search_dp_70">70px</dimen>
<dimen name="module_search_25sp">25sp</dimen>
<dimen name="module_search_dp_42">42px</dimen>
<dimen name="module_search_dp_160">160px</dimen>
<dimen name="module_search_dp_150">150px</dimen>
<dimen name="module_search_180dp">180dp</dimen>
<dimen name="module_search_dp_120">120px</dimen>
<dimen name="module_search_address_divider_height">72px</dimen>
<dimen name="module_search_histories_list_height">778px</dimen>
<dimen name="module_search_histories_list_width">1200px</dimen>
<dimen name="module_search_histories_list_marginTop">32px</dimen>
<dimen name="module_search_histories_list_marginPadding">40px</dimen>
<dimen name="module_search_histories_inner_list_marginTop">60px</dimen>
<dimen name="module_search_list_padding">37px</dimen>
<dimen name="module_search_category_width">268px</dimen>
<dimen name="module_search_category_height">236px</dimen>
<dimen name="module_search_poi_item_height">180px</dimen>
<dimen name="module_search_poi_item_icon_size">80px</dimen>
<dimen name="module_search_poi_item_position_height">70px</dimen>
<dimen name="module_search_poi_item_position_textSize">25px</dimen>
<dimen name="module_search_poi_item_desc_height">42px</dimen>
<dimen name="module_search_setting_container_padding">160px</dimen>
<dimen name="module_search_setting_container_paddingBottom">150px</dimen>
<dimen name="module_search_setting_item_width">180dp</dimen>
<dimen name="module_search_setting_item_height">120px</dimen>
<dimen name="module_search_txt_setting_width">45px</dimen>
<dimen name="module_search_dp_838">838px</dimen>
<dimen name="module_search_category_margin_bottom">142px</dimen>
<dimen name="module_search_dp_104">104px</dimen>
<dimen name="module_search_category_panel_width">838px</dimen>
<dimen name="module_search_category_margin_bottom">184px</dimen>
<dimen name="module_search_start_navi_button_height">104px</dimen>
<dimen name="module_search_strategy_name_width" >154px</dimen>
<dimen name="module_search_marker_number_textSize">32px</dimen>
<dimen name="module_search_choose_path_item_height">212px</dimen>

View File

@@ -17,29 +17,29 @@
</style>
<style name="txt_navi_style">
<item name="android:layout_width">@dimen/module_search_dp_268</item>
<item name="android:layout_width">@dimen/module_search_category_width</item>
<item name="android:gravity">center_horizontal</item>
<item name="android:textSize">@dimen/txt_normal</item>
<item name="android:textColor">@color/white</item>
<item name="android:background">@drawable/shape_round_gray</item>
<item name="android:layout_height">@dimen/module_search_dp_236</item>
<item name="android:layout_height">@dimen/module_search_category_height</item>
<item name="android:paddingTop">@dimen/dp_44</item>
</style>
<style name="rb_setting">
<item name="android:layout_width">@dimen/module_search_180dp</item>
<item name="android:layout_width">@dimen/module_search_setting_item_width</item>
<item name="android:button">@color/translate</item>
<item name="android:gravity">center</item>
<item name="android:textSize">@dimen/sp_40</item>
<item name="android:textColor">@color/selector_white_gray</item>
<item name="android:layout_height">@dimen/module_search_dp_120</item>
<item name="android:layout_height">@dimen/module_search_setting_item_height</item>
<item name="android:background">@drawable/selector_setting_bg</item>
</style>
<style name="txt_btn">
<item name="android:textColor">@color/white</item>
<item name="android:textSize">@dimen/txt_title</item>
<item name="android:textSize">@dimen/module_search_title_textSize</item>
<item name="android:gravity">center</item>
<item name="android:background">@drawable/shape_round_blue_grident</item>
</style>

View File

@@ -373,7 +373,11 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
if ( mogoMarker == null || mogoMarker.isDestroyed() ) {
Logger.d( TAG, "draw road condition, sn = %s", sn );
try {
post2AddAndStartAnimation( markerShowEntity, i * 100L );
if ( DebugConfig.isRoadEventAnimated() ) {
post2AddAndStartAnimation( markerShowEntity, i * 100L );
} else {
mogoMarker = drawMapMarker( markerShowEntity, ServiceConst.MARKER_Z_INDEX_HIGH );
}
} catch ( Exception e ) {
e.printStackTrace();
}

View File

@@ -140,12 +140,12 @@ public class V2XModuleProvider implements
intentFilter.addAction(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
localBroadcastManager.registerReceiver(localReceiver, intentFilter);
// if (BuildConfig.DEBUG) {
// // TODO 这是测试页面
// V2XServiceManager
// .getIMogoWindowManager()
// .addView(new V2XTestConsoleWindow(context), 0, 0, false);
// }
if (BuildConfig.DEBUG) {
// TODO 这是测试页面
V2XServiceManager
.getIMogoWindowManager()
.addView(new V2XTestConsoleWindow(context), 0, 0, false);
}
}
private void initVoice(Context context) {

View File

@@ -7,6 +7,7 @@ import com.mogo.module.v2x.listener.V2XMessageListener_401007;
import com.mogo.module.v2x.listener.V2XMessageListener_401009;
import com.mogo.module.v2x.listener.V2XMessageListener_401010;
import com.mogo.module.v2x.listener.V2XMessageListener_401011;
import com.mogo.module.v2x.listener.V2XMessageListener_401012;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
@@ -22,7 +23,8 @@ public class V2XSocketManager {
private static V2XSocketManager mV2XSocketManager;
private V2XMessageListener_401011 v2XMessageListener_401001;
private V2XMessageListener_401011 v2XMessageListener_401011;
private V2XMessageListener_401012 v2XMessageListener_401012;
private V2XMessageListener_401003 v2XMessageListener_401003;
private V2XMessageListener_401005 v2XMessageListener_401005;
private V2XMessageListener_401006 v2XMessageListener_401006;
@@ -52,6 +54,7 @@ public class V2XSocketManager {
public void registerSocketMessage() {
Logger.d(MODULE_NAME, "开始注册Socket通道....");
register401011();
register401012();
register401005();
register401007();
register401009();
@@ -66,10 +69,15 @@ public class V2XSocketManager {
*/
public void unregisterSocketMessage() {
Logger.w(MODULE_NAME, "反注册Socket通道....");
if (v2XMessageListener_401001 != null) {
if (v2XMessageListener_401011 != null) {
V2XServiceManager
.getMoGoSocketManager()
.unregisterOnMessageListener(401011, v2XMessageListener_401001);
.unregisterOnMessageListener(401011, v2XMessageListener_401011);
}
if (v2XMessageListener_401012 != null) {
V2XServiceManager
.getMoGoSocketManager()
.unregisterOnMessageListener(401012, v2XMessageListener_401012);
}
if (v2XMessageListener_401003 != null) {
V2XServiceManager
@@ -102,13 +110,27 @@ public class V2XSocketManager {
* 道路事件,在线车辆绘制
*/
private void register401011() {
v2XMessageListener_401001 = new V2XMessageListener_401011();
v2XMessageListener_401011 = new V2XMessageListener_401011();
// 道路事件,在线车辆绘制
V2XServiceManager
.getMoGoSocketManager()
.registerOnMessageListener(
401011,
v2XMessageListener_401001
v2XMessageListener_401011
);
}
/**
* 道路事件,服务端下发
*/
private void register401012() {
v2XMessageListener_401012 = new V2XMessageListener_401012();
// 道路事件,在线车辆绘制
V2XServiceManager
.getMoGoSocketManager()
.registerOnMessageListener(
401012,
v2XMessageListener_401012
);
}

View File

@@ -1,49 +0,0 @@
package com.mogo.module.v2x.adapter;
import android.view.ViewGroup;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.mogo.module.v2x.adapter.holder.V2XPushEventDetailVH;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import java.util.List;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/3/11 4:05 PM
* desc : V2X 场景事件列表中的数据适配器
* version: 1.0
*/
public class V2XPushEventAdapter extends RecyclerView.Adapter<V2XPushEventDetailVH> {
private List<V2XPushMessageEntity> itemList;
public V2XPushEventAdapter(List<V2XPushMessageEntity> itemList) {
this.itemList = itemList;
}
@NonNull
@Override
public V2XPushEventDetailVH onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
return new V2XPushEventDetailVH(parent);
}
@Override
public void onBindViewHolder(@NonNull V2XPushEventDetailVH holder, int position) {
holder.initView(itemList.get(position));
}
@Override
public int getItemViewType(int position) {
return itemList.get(position).getViewType();
}
@Override
public int getItemCount() {
return itemList == null ? 0 : itemList.size();
}
}

View File

@@ -6,9 +6,13 @@ import androidx.annotation.NonNull;
import androidx.recyclerview.widget.RecyclerView;
import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.v2x.adapter.holder.V2XLiveVideoVH;
import com.mogo.module.v2x.adapter.holder.V2XRoadEventDetailVH;
import com.mogo.module.common.entity.V2XWindowTypeEnum;
import com.mogo.module.v2x.adapter.holder.V2XFatigueDrivingVH;
import com.mogo.module.v2x.adapter.holder.V2XIllegalParkVH;
import com.mogo.module.v2x.adapter.holder.V2XLiveVideoVH;
import com.mogo.module.v2x.adapter.holder.V2XOtherSeekHelpVH;
import com.mogo.module.v2x.adapter.holder.V2XPushEventVH;
import com.mogo.module.v2x.adapter.holder.V2XRoadEventVH;
import java.util.List;
@@ -32,14 +36,32 @@ public class V2XRoadEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
public RecyclerView.ViewHolder onCreateViewHolder(@NonNull ViewGroup parent, int viewType) {
RecyclerView.ViewHolder holder;
switch (viewType) {
// 直播
case V2XWindowTypeEnum.LIVE_CAR_WINDOW:
holder = new V2XLiveVideoVH(parent);
break;
//道路事件详情
case V2XWindowTypeEnum.ROAD_EVENT_WINDOW:
holder = new V2XRoadEventDetailVH(parent);
holder = new V2XRoadEventVH(parent);
break;
//违章停车
case V2XWindowTypeEnum.ILLEGAL_PARK_WINDOW:
holder = new V2XIllegalParkVH(parent);
break;
//推送展示
case V2XWindowTypeEnum.PUSH_EVENT_WINDOW:
holder = new V2XPushEventVH(parent);
break;
//疲劳驾驶
case V2XWindowTypeEnum.FATIGUE_DRIVING_WINDOW:
holder = new V2XFatigueDrivingVH(parent);
break;
//他人故障求助
case V2XWindowTypeEnum.SEEK_HELP_WINDOW:
holder = new V2XOtherSeekHelpVH(parent);
break;
default:
holder = new V2XRoadEventDetailVH(parent);
holder = new V2XPushEventVH(parent);
}
return holder;
}
@@ -49,8 +71,20 @@ public class V2XRoadEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
if (holder instanceof V2XLiveVideoVH) {
((V2XLiveVideoVH) holder).initView(itemList.get(position));
}
if (holder instanceof V2XRoadEventDetailVH) {
((V2XRoadEventDetailVH) holder).initView(itemList.get(position));
if (holder instanceof V2XRoadEventVH) {
((V2XRoadEventVH) holder).initView(itemList.get(position));
}
if (holder instanceof V2XIllegalParkVH) {
((V2XIllegalParkVH) holder).initView(itemList.get(position));
}
if (holder instanceof V2XPushEventVH) {
((V2XPushEventVH) holder).initView(itemList.get(position));
}
if (holder instanceof V2XFatigueDrivingVH) {
((V2XFatigueDrivingVH) holder).initView(itemList.get(position));
}
if (holder instanceof V2XOtherSeekHelpVH) {
((V2XOtherSeekHelpVH) holder).initView(itemList.get(position));
}
}

View File

@@ -19,6 +19,7 @@ import com.mogo.module.v2x.utils.RoadConditionUtils;
import com.mogo.module.v2x.utils.TrackUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.utils.TipToast;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
@@ -132,13 +133,13 @@ public abstract class V2XBaseViewHolder
*/
public void triggerStartNavi(MarkerExploreWay noveltyInfo) {
try {
V2XServiceManager.getMogoRegisterCenter().registerMogoNaviListener(MODULE_NAME, this);
MogoLatLng endPoint = new MogoLatLng(
noveltyInfo.getLocation().getLat(),
noveltyInfo.getLocation().getLon());
V2XServiceManager.getNavi().naviTo(endPoint);
V2XServiceManager.getMogoRegisterCenter().unregisterMogoNaviListener(MODULE_NAME);
V2XServiceManager.getMogoRegisterCenter().registerMogoNaviListener(MODULE_NAME, this);
TrackUtils.trackV2xRoadEvent(
noveltyInfo.getInfoId(),
@@ -187,7 +188,9 @@ public abstract class V2XBaseViewHolder
@Override
public void onCalculateSuccess() {
Logger.w("V2XBaseViewHolder", "onCalculateSuccess");
V2XServiceManager.getNavi().startNavi(true);
V2XServiceManager.getMogoRegisterCenter().unregisterMogoNaviListener(MODULE_NAME);
}
@Override

View File

@@ -0,0 +1,114 @@
package com.mogo.module.v2x.adapter.holder;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.mogo.map.MogoLatLng;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.service.Utils;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.scenario.scene.fatigue.V2XFatigueDrivingScenario;
import com.mogo.module.v2x.utils.LocationUtils;
import com.mogo.module.v2x.utils.SpanUtils;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.module.v2x.voice.V2XVoiceManager;
/**
* e-mail : 1358506549@qq.com
* date : 2020/3/11 4:35 PM
* desc : 疲劳驾驶
* version: 1.0
*
* @author donghongyu
*/
public class V2XFatigueDrivingVH extends V2XBaseViewHolder {
private TextView mTvAddress, mTvAddressDistance;
private ImageView mIvToNav;
private MarkerExploreWay mNoveltyInfo;
private V2XPushMessageEntity mV2XPushMessageEntity;
// 语音控制导航
private V2XVoiceCallbackListener mNaviCb = (command, intent) -> triggerStartNavi(mNoveltyInfo);
public V2XFatigueDrivingVH(ViewGroup viewGroup) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.window_fatigue_driving, viewGroup, false));
mTvAddress = itemView.findViewById(R.id.tvAddress);
mTvAddressDistance = itemView.findViewById(R.id.tvAddressDistance);
mIvToNav = itemView.findViewById(R.id.ivToNav);
mIvToNav.setOnClickListener(v -> triggerStartNavi(mNoveltyInfo));
// 设置视图状态监听
itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
@Override
public void onViewAttachedToWindow(View v) {
//Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewAttachedToWindow");
// 注册语音交互
V2XVoiceManager.INSTANCE
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI,
mNaviCb)
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP,
mNaviCb);
}
@Override
public void onViewDetachedFromWindow(View v) {
//Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewDetachedFromWindow");
// 反注册语音交互
V2XVoiceManager.INSTANCE
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI)
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP);
}
});
}
public void initView(V2XEventShowEntity v2XEventShowEntity) {
mV2XPushMessageEntity = v2XEventShowEntity.getV2XPushMessageEntity();
try {
MarkerLocation markerLocation = new MarkerLocation();
markerLocation.setLon(mV2XPushMessageEntity.getLon());
markerLocation.setLat(mV2XPushMessageEntity.getLat());
mNoveltyInfo = new MarkerExploreWay();
mNoveltyInfo.setLocation(markerLocation);
} catch (Exception e) {
e.printStackTrace();
}
if (!TextUtils.isEmpty(mV2XPushMessageEntity.getAddress())) {
mTvAddress.setText(mV2XPushMessageEntity.getAddress());
} else {
mTvAddress.setText("");
}
// 计算距离
float calculateDistance = Utils.calculateLineDistance(
new MogoLatLng(mV2XPushMessageEntity.getLat(), mV2XPushMessageEntity.getLon()),
LocationUtils.getCurrentLatLon()
);
mV2XPushMessageEntity.setDistance(calculateDistance);
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))
.create();
}
/**
* 延迟关闭窗体
*/
@Override
public void delayedCloseWindow() {
itemView.postDelayed(() -> V2XFatigueDrivingScenario.getInstance().close(), 1000);
}
}

View File

@@ -0,0 +1,131 @@
package com.mogo.module.v2x.adapter.holder;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkScenario;
import com.mogo.module.v2x.utils.RoadConditionUtils;
import com.mogo.module.v2x.view.HeartLikeView;
import com.mogo.module.v2x.view.HeartUnLikeView;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
* e-mail : 1358506549@qq.com
* date : 2020/3/11 4:35 PM
* desc : 违章停车弹窗
* version: 1.0
*
* @author donghongyu
*/
public class V2XIllegalParkVH extends V2XBaseViewHolder {
private TextView mAddressTv;
private TextView mIllegalNumTv;
private HeartLikeView mIlIllegalParkingLike;
private HeartUnLikeView mIIllegalParkingUnLike;
private MarkerExploreWay mExploreWay;
// 反馈按钮语音操控
private V2XVoiceCallbackListener v2XVoiceCallbackYouYongListener = (command, intent) -> roadReportTrue();
private V2XVoiceCallbackListener v2XVoiceCallbackMeiYongListener = (command, intent) -> roadReportErr();
public V2XIllegalParkVH(ViewGroup viewGroup) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.window_illegal_parking, viewGroup, false));
mAddressTv = itemView.findViewById(R.id.tvAddress);
mIllegalNumTv = itemView.findViewById(R.id.tvIllegalNum);
mIlIllegalParkingLike = itemView.findViewById(R.id.llIllegalParkingLike);
mIIllegalParkingUnLike = itemView.findViewById(R.id.llIllegalParkingUnLike);
// 设置视图状态监听
itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
@Override
public void onViewAttachedToWindow(View v) {
//Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewAttachedToWindow");
// 注册语音交互
V2XVoiceManager.INSTANCE
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_YOUYONG_UN_WAKEUP,
v2XVoiceCallbackYouYongListener)
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_MEIYONG_UN_WAKEUP,
v2XVoiceCallbackMeiYongListener);
}
@Override
public void onViewDetachedFromWindow(View v) {
//Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewDetachedFromWindow");
V2XServiceManager.getMogoRegisterCenter().unregisterMogoNaviListener(MODULE_NAME);
// 反注册语音交互
V2XVoiceManager.INSTANCE
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_YOUYONG_UN_WAKEUP)
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_MEIYONG_UN_WAKEUP);
}
});
}
public void initView(V2XEventShowEntity v2XEventShowEntity) {
mExploreWay = v2XEventShowEntity.getV2XIllegalPark();
mAddressTv.setText(mExploreWay.getAddr());
try {
mIllegalNumTv.setText("违章人数:" + (int) mExploreWay.getItems().get(0).getIllegalCount());
} catch (Exception e) {
e.printStackTrace();
}
mIlIllegalParkingLike.setOnClickCallListener(v -> {
Logger.d(V2XConst.MODULE_NAME, "反馈有用");
roadReportTrue();
});
mIIllegalParkingUnLike.setOnClickCallListener(v -> {
Logger.d(V2XConst.MODULE_NAME, "反馈无用");
roadReportErr();
});
}
/**
* 延迟关闭窗体
*/
@Override
public void delayedCloseWindow() {
itemView.postDelayed(() -> V2XIllegalParkScenario.getInstance().close(), 1000);
}
/**
* 反馈路况正确
*/
private void roadReportTrue() {
if (mExploreWay != null) {
RoadConditionUtils.sendDataErrorReceiverInfo(
mExploreWay.getPoiType(),
mExploreWay.getInfoId(),
"2");
}
delayedCloseWindow();
}
/**
* 反馈路况错误
*/
private void roadReportErr() {
if (mExploreWay != null) {
RoadConditionUtils.sendDataErrorReceiverInfo(
mExploreWay.getPoiType(),
mExploreWay.getInfoId(),
"1");
}
delayedCloseWindow();
}
}

View File

@@ -0,0 +1,195 @@
package com.mogo.module.v2x.adapter.holder;
import android.content.res.Resources;
import android.text.TextUtils;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.mogo.commons.debug.DebugConfig;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerUserInfo;
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;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.service.imageloader.MogoImageView;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Locale;
import static android.view.View.GONE;
import static android.view.View.VISIBLE;
/**
* e-mail : 1358506549@qq.com
* date : 2020/3/11 4:35 PM
* desc : 他人故障求助Window
* version: 1.0
*
* @author donghongyu
*/
public class V2XOtherSeekHelpVH extends V2XBaseViewHolder {
private MogoImageView ivHead;
private TextView tvName;
private TextView tvDistance;
private TextView tvEventTime;
private ImageView ivCall;
private ImageView ivNavi;
private V2XPushMessageEntity mV2XPushMessageEntity;
private MarkerExploreWay mNoveltyInfo;
// 上传事件的用户信息
private MarkerUserInfo mUserInfo = new MarkerUserInfo();
// 语音控制导航
private V2XVoiceCallbackListener mNaviCb = (command, intent) -> triggerStartNavi(mNoveltyInfo);
// 语音控制拨打电话
private V2XVoiceCallbackListener mCallChartingCb = (command, intent) -> {
try {
mUserInfo.setSn(mV2XPushMessageEntity.getSn());
mUserInfo.setUserHead(mV2XPushMessageEntity.getHeadImgUrl());
mUserInfo.setUserName(mV2XPushMessageEntity.getDisplayName());
mUserInfo.setGender(mV2XPushMessageEntity.getSex());
mUserInfo.setAge(30);
mNoveltyInfo.setUserInfo(mUserInfo);
triggerCallChart(mNoveltyInfo);
} catch (Exception e) {
e.printStackTrace();
}
};
public V2XOtherSeekHelpVH(ViewGroup viewGroup) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.item_v2x_fault_help, viewGroup, false));
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);
ivNavi.setOnClickListener(v -> {
triggerStartNavi(mNoveltyInfo);
});
// 设置视图状态监听
itemView.addOnAttachStateChangeListener(new View.OnAttachStateChangeListener() {
@Override
public void onViewAttachedToWindow(View v) {
//Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewAttachedToWindow");
// 注册语音交互
V2XVoiceManager.INSTANCE
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI,
mNaviCb)
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP,
mNaviCb)
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING,
mCallChartingCb)
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP,
mCallChartingCb);
}
@Override
public void onViewDetachedFromWindow(View v) {
//Logger.w(MODULE_NAME, "列表View V2XPushEventDetailVH 触发 onViewDetachedFromWindow");
// 反注册语音交互
V2XVoiceManager.INSTANCE
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI)
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP)
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING)
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP);
}
});
}
public void initView(V2XEventShowEntity v2XEventShowEntity) {
mV2XPushMessageEntity = v2XEventShowEntity.getV2XPushMessageEntity();
// 只有自研车机才会 有车聊聊通话
if (DebugConfig.getCarMachineType() == DebugConfig.CAR_MACHINE_TYPE_SELF_INNOVATE) {
// 判断是否可以打电话
ChartingUtil.isCanCall(b -> {
if (b) {
// 判断是否可以打电话
ChartingUtil.isOnLine(mV2XPushMessageEntity.getSn(), b1 -> {
if (b1) {
ivCall.setVisibility(VISIBLE);
} else {
ivCall.setVisibility(GONE);
}
});
} else {
ivCall.setVisibility(GONE);
}
});
ivCall.setOnClickListener(v -> {
if (!V2XUtils.isFastClick()) {
try {
mUserInfo.setSn(mV2XPushMessageEntity.getSn());
mUserInfo.setUserHead(mV2XPushMessageEntity.getHeadImgUrl());
mUserInfo.setUserName(mV2XPushMessageEntity.getDisplayName());
mUserInfo.setGender(mV2XPushMessageEntity.getSex());
mUserInfo.setAge(30);
mNoveltyInfo.setUserInfo(mUserInfo);
triggerCallChart(mNoveltyInfo);
} catch (Exception e) {
e.printStackTrace();
}
}
});
}
try {
MarkerLocation markerLocation = new MarkerLocation();
markerLocation.setLon(mV2XPushMessageEntity.getLon());
markerLocation.setLat(mV2XPushMessageEntity.getLat());
mNoveltyInfo = new MarkerExploreWay();
mNoveltyInfo.setLocation(markerLocation);
} catch (Exception e) {
e.printStackTrace();
}
try {
if (!TextUtils.isEmpty(mV2XPushMessageEntity.getHeadImgUrl())) {
V2XServiceManager.getImageLoader()
.displayImage(mV2XPushMessageEntity.getHeadImgUrl(), ivHead);
}
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))
.create();
SimpleDateFormat sdf = new SimpleDateFormat("HH:mm", Locale.CHINA);
String eventTime = String.format("%s发布求助信息",
sdf.format(new Date(mV2XPushMessageEntity.getCreateTime())));
tvEventTime.setText(eventTime);
} catch (Resources.NotFoundException e) {
e.printStackTrace();
}
}
/**
* 延迟关闭窗体
*/
@Override
public void delayedCloseWindow() {
itemView.postDelayed(() -> V2XSeekHelpScenario.getInstance().close(), 1000);
}
}

View File

@@ -9,16 +9,15 @@ import android.widget.ImageView;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.MarkerUserInfo;
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.push.V2XPushEventScenario;
import com.mogo.module.v2x.utils.ChartingUtil;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.service.imageloader.MogoImageView;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
@@ -29,7 +28,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* desc : TODO 这里是前瞻演示需求推送的消息
* version: 1.0
*/
public class V2XPushEventDetailVH extends V2XBaseViewHolder {
public class V2XPushEventVH extends V2XBaseViewHolder {
private MogoImageView ivImg;
private MogoImageView ivReportHead;
@@ -56,6 +55,7 @@ public class V2XPushEventDetailVH extends V2XBaseViewHolder {
mUserInfo.setUserName("蘑菇用户");
mUserInfo.setGender("");
mUserInfo.setAge(30);
mNoveltyInfo.setUserInfo(mUserInfo);
triggerCallChart(mNoveltyInfo);
} catch (Exception e) {
e.printStackTrace();
@@ -64,7 +64,7 @@ public class V2XPushEventDetailVH extends V2XBaseViewHolder {
// 点赞语音回调
private V2XVoiceCallbackListener v2XVoiceCallbackLickListener = (command, intent) -> triggerZan(mNoveltyInfo);
public V2XPushEventDetailVH(ViewGroup viewGroup) {
public V2XPushEventVH(ViewGroup viewGroup) {
super(LayoutInflater.from(viewGroup.getContext())
.inflate(R.layout.item_v2x_push_event_detail, viewGroup, false));
ivImg = itemView.findViewById(R.id.ivImg);
@@ -85,6 +85,7 @@ public class V2XPushEventDetailVH extends V2XBaseViewHolder {
mUserInfo.setUserName("蘑菇用户");
mUserInfo.setGender("");
mUserInfo.setAge(30);
mNoveltyInfo.setUserInfo(mUserInfo);
triggerCallChart(mNoveltyInfo);
} catch (Exception e) {
e.printStackTrace();
@@ -119,12 +120,14 @@ public class V2XPushEventDetailVH extends V2XBaseViewHolder {
V2XServiceManager.getMogoRegisterCenter().unregisterMogoNaviListener(MODULE_NAME);
// 反注册语音交互
V2XVoiceManager.INSTANCE
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI)
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP)
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CLOSE_WINDOW)
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CLOSE_WINDOW_UN_WAKEUP)
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING)
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP)
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ZAN)
.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_REPORT)
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP)
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_ZAN_UN_WAKEUP)
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_TRUE)
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_FEEDBACK_ERROR)
@@ -133,8 +136,8 @@ public class V2XPushEventDetailVH extends V2XBaseViewHolder {
});
}
public void initView(V2XPushMessageEntity v2XRoadEventEntity) {
mV2XRoadEventEntity = v2XRoadEventEntity;
public void initView(V2XEventShowEntity v2XEventShowEntity) {
mV2XRoadEventEntity = v2XEventShowEntity.getV2XPushMessageEntity();
mNoveltyInfo = new MarkerExploreWay();
mNoveltyInfo.setSn(mV2XRoadEventEntity.getSn());
mNoveltyInfo.setInfoId(mV2XRoadEventEntity.getSceneId());
@@ -143,16 +146,16 @@ public class V2XPushEventDetailVH extends V2XBaseViewHolder {
location.setLon(mV2XRoadEventEntity.getLon());
mNoveltyInfo.setLocation(location);
if (!TextUtils.isEmpty(v2XRoadEventEntity.getMsgImgUrl())) {
if (!TextUtils.isEmpty(mV2XRoadEventEntity.getMsgImgUrl())) {
V2XServiceManager.getImageLoader()
.displayImage(v2XRoadEventEntity.getMsgImgUrl(), ivImg);
.displayImage(mV2XRoadEventEntity.getMsgImgUrl(), ivImg);
}
if (!TextUtils.isEmpty(v2XRoadEventEntity.getHeadImgUrl())) {
if (!TextUtils.isEmpty(mV2XRoadEventEntity.getHeadImgUrl())) {
V2XServiceManager.getImageLoader()
.displayImage(v2XRoadEventEntity.getHeadImgUrl(), ivReportHead);
.displayImage(mV2XRoadEventEntity.getHeadImgUrl(), ivReportHead);
}
switch (v2XRoadEventEntity.getSceneId()) {
switch (mV2XRoadEventEntity.getSceneId()) {
case "100015"://取快递
case "100016"://顺风车
ivRoadEventNav.setVisibility(View.VISIBLE);

View File

@@ -50,7 +50,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* desc : 道路事件详情
* version: 1.0
*/
public class V2XRoadEventDetailVH extends V2XBaseViewHolder {
public class V2XRoadEventVH extends V2XBaseViewHolder {
private MogoImageView ivEventImg;
private MogoImageView ivReportHead;
private ImageView ivEventPlay;
@@ -125,7 +125,7 @@ public class V2XRoadEventDetailVH extends V2XBaseViewHolder {
ivEventReportErr = itemView.findViewById(R.id.ivEventReportErr);
}
public V2XRoadEventDetailVH(ViewGroup viewGroup) {
public V2XRoadEventVH(ViewGroup viewGroup) {
super(LayoutInflater.from(viewGroup.getContext()).inflate(R.layout.item_v2x_event_detail, viewGroup, false));
init(itemView);
// 设置视图状态监听
@@ -201,37 +201,28 @@ public class V2XRoadEventDetailVH extends V2XBaseViewHolder {
tvEventTime.setText(eventTime);
}
// 事件距离车辆小于50米的时候可以用户纠错
if (mV2XRoadEventEntity.getDistance() < 50) {
ivEventReportTrue.setVisibility(VISIBLE);
ivEventReportErr.setVisibility(VISIBLE);
ivEventLive.setVisibility(GONE);
ivEventZan.setVisibility(GONE);
if (!ArrayUtils.isEmpty(mV2XEventShowEntity.getV2XLiveCarList())) {
ivEventLive.setVisibility(VISIBLE);
V2XVoiceManager.INSTANCE
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_LIVE_ROAD,
v2XVoiceOpenLiveListener)
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_LIVE_UN_WAKEUP,
v2XVoiceOpenLiveListener);
ivEventLive.setOnClickListener(v -> {
showLiveCar(v2XEventShowEntity);
});
} else {
if (!ArrayUtils.isEmpty(mV2XEventShowEntity.getV2XLiveCarList())) {
ivEventLive.setVisibility(VISIBLE);
V2XVoiceManager.INSTANCE
.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_LIVE_ROAD,
v2XVoiceOpenLiveListener)
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_OPEN_LIVE_UN_WAKEUP,
v2XVoiceOpenLiveListener);
ivEventLive.setOnClickListener(v -> {
showLiveCar(v2XEventShowEntity);
});
} else {
ivEventLive.setVisibility(GONE);
}
ivEventLive.setVisibility(GONE);
}
ivEventReportTrue.setVisibility(GONE);
ivEventReportErr.setVisibility(GONE);
ivEventZan.setVisibility(VISIBLE);
ivEventReportTrue.setVisibility(GONE);
ivEventReportErr.setVisibility(GONE);
ivEventZan.setVisibility(VISIBLE);
// 用户上报的才会展示拨打电话
if (!TextUtils.isEmpty(mNoveltyInfo.getUploadType())
&& mNoveltyInfo.getUploadType().equals("1")) {
requestUserInfo(mNoveltyInfo);
}
// 用户上报的才会展示拨打电话
if (!TextUtils.isEmpty(mNoveltyInfo.getUploadType())
&& mNoveltyInfo.getUploadType().equals("1")) {
requestUserInfo(mNoveltyInfo);
}
ivEventReportTrue.setOnClickListener(v -> {

View File

@@ -35,6 +35,7 @@ import com.mogo.utils.network.utils.GsonUtil;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.concurrent.ConcurrentHashMap;
import java.util.concurrent.CopyOnWriteArrayList;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
@@ -51,8 +52,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
*/
public class V2XAlarmServer {
// 记录道路播报的事件
private static HashMap<V2XRoadEventEntity, String> mAlertRoadEventList = new HashMap<>();
private static HashSet<V2XRoadEventEntity> mAlertRoadEventCorrectionList = new HashSet<>();
public static ConcurrentHashMap<V2XRoadEventEntity, String> mAlertRoadEventList = new ConcurrentHashMap<>();
// 记录违章停车播报事件
private static HashMap<MarkerExploreWay, String> mAlertIllegalParkEventList = new HashMap<>();
@@ -112,13 +112,6 @@ public class V2XAlarmServer {
isAlreadyAlert = true;
}
}
// 判断是否是纠错,如果是纠错就忽略掉带有时间段的道路提醒
if (v2XRoadEventEntity.getDistance() <= 50) {
if (!mAlertRoadEventCorrectionList.contains(v2XRoadEventEntity)) {
mAlertRoadEventCorrectionList.add(v2XRoadEventEntity);
isAlreadyAlert = false;
}
}
// Logger.w(MODULE_NAME, "V2X预警--车辆与事件信息:" +
// "\n距离" + v2XRoadEventEntity.getDistance() + "米" +
// "\n是否已经提醒" + isAlreadyAlert +

View File

@@ -69,11 +69,9 @@ public class V2XLocationListener implements IMogoLocationListener, CarStatusList
@Override
public void onLocationChanged(MogoLocation location) {
try {
Logger.d(V2XConst.MODULE_NAME, "V2X预警--onLocationChanged: " + GsonUtil.jsonFromObject(location));
//Logger.d(V2XConst.MODULE_NAME, "V2X预警--onLocationChanged: " + GsonUtil.jsonFromObject(location));
// 刷新角度
getCurrentCarAngle(location);
// 只有车速大于 5 的时候进行计算
if (location.getSpeed() >= 5) {
refreshCurrentCarState(location);

View File

@@ -0,0 +1,83 @@
package com.mogo.module.v2x.listener;
import android.content.Intent;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.mogo.map.MogoLatLng;
import com.mogo.map.location.MogoLocation;
import com.mogo.module.common.entity.MarkerCardResult;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerLocation;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
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.TimeUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.connection.IMogoOnMessageListener;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/4/1 10:23 AM
* desc : 道路事件服务端下发触发
* version: 1.0
*/
public class V2XMessageListener_401012 implements IMogoOnMessageListener<MarkerCardResult> {
@Override
public Class<MarkerCardResult> target() {
return MarkerCardResult.class;
}
@Override
public void onMsgReceived(MarkerCardResult response) {
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);
// 记录播报过的道路事件
V2XAlarmServer.mAlertRoadEventList.put(v2XRoadEventEntity, TimeUtils.getNowString());
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);
}
} catch (Exception e) {
e.printStackTrace();
}
}
}

View File

@@ -27,11 +27,11 @@ import com.mogo.utils.logger.Logger;
*/
public abstract class AbsV2XScenario<T> implements IV2XScenario {
protected String TAG = "AbsV2XScenario";
protected IV2XWindow mV2XWindow;
protected IV2XButton mV2XButton;
protected IV2XMarker<T> mV2XMarker;
protected IMoGoV2XStatusManager mV2XStatusManager;
protected V2XMessageEntity<T> mV2XMessageEntity;
private IV2XWindow mV2XWindow;
private IV2XButton mV2XButton;
private IV2XMarker<T> mV2XMarker;
private IMoGoV2XStatusManager mV2XStatusManager;
private V2XMessageEntity<T> mV2XMessageEntity;
protected AbsV2XScenario() {
this.mV2XStatusManager = V2XServiceManager.getMoGoV2XStatusManager();
@@ -62,6 +62,14 @@ public abstract class AbsV2XScenario<T> implements IV2XScenario {
this.mV2XWindow = mV2XWindow;
}
public IV2XMarker<T> getV2XMarker() {
return mV2XMarker;
}
public IV2XButton getV2XButton() {
return mV2XButton;
}
public void setV2XButton(@Nullable IV2XButton mV2XButton) {
this.mV2XButton = mV2XButton;
}

View File

@@ -4,6 +4,7 @@ import android.content.Intent;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.mogo.module.common.entity.V2XHistoryScenarioData;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.scenario.IV2XScenarioManager;
@@ -15,10 +16,13 @@ import com.mogo.module.v2x.scenario.scene.park.V2XIllegalParkScenario;
import com.mogo.module.v2x.scenario.scene.push.V2XPushEventScenario;
import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventScenario;
import com.mogo.module.v2x.scenario.scene.seek.V2XSeekHelpScenario;
import com.mogo.module.v2x.utils.TimeUtils;
import com.mogo.module.v2x.utils.ToastUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.utils.logger.Logger;
import com.mogo.utils.network.utils.GsonUtil;
import com.mogo.utils.sqlite.BaseDaoFactory;
import com.mogo.utils.sqlite.IBaseDao;
import java.util.HashMap;
@@ -36,6 +40,11 @@ public class V2XScenarioManager implements IV2XScenarioManager {
private AbsV2XScenario mV2XScenario;
private HashMap<Integer, AbsV2XScenario> mV2XScenarioSet = new HashMap<>();
/**
* 场景数据管理
*/
private static IBaseDao<V2XHistoryScenarioData> mScenarioDao;
private V2XScenarioManager() {
}
@@ -44,6 +53,7 @@ public class V2XScenarioManager implements IV2XScenarioManager {
synchronized (V2XScenarioManager.class) {
if (mV2XScenarioManager == null) {
mV2XScenarioManager = new V2XScenarioManager();
mScenarioDao = BaseDaoFactory.Companion.getInstance().getBaseDao(V2XUtils.getApp(), V2XHistoryScenarioData.class);
}
}
}
@@ -52,12 +62,23 @@ public class V2XScenarioManager implements IV2XScenarioManager {
@Override
public void handlerMessage(V2XMessageEntity v2XMessageEntity) {
Logger.w(MODULE_NAME, "处理V2X场景" + GsonUtil.jsonFromObject(v2XMessageEntity));
Logger.d(MODULE_NAME, "处理V2X场景" + GsonUtil.jsonFromObject(v2XMessageEntity));
synchronized (V2XScenarioManager.class) {
// 展示
V2XUtils.runOnUiThread(() -> {
// 提取之前存储的场景
if (v2XMessageEntity != null) {
/*try {
// 进行数据库存储
V2XHistoryScenarioData v2XHistoryScenarioData = new V2XHistoryScenarioData();
v2XHistoryScenarioData.setScenarioType(v2XMessageEntity.getType());
v2XHistoryScenarioData.setTriggerTime(TimeUtils.getNowMills());
v2XHistoryScenarioData.setEventJsonData(GsonUtil.jsonFromObject(v2XMessageEntity.getContent()));
mScenarioDao.insert(v2XHistoryScenarioData);
} catch (Exception e) {
e.printStackTrace();
}*/
// 广播给应用内部其它模块
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);

View File

@@ -61,11 +61,11 @@ public class V2XAnimationScenario extends AbsV2XScenario<V2XPushMessageEntity> {
@Override
public void showWindow() {
if (mV2XWindow != null) {
mV2XWindow.setWindowStatusListener(new V2XWindowStatusListener() {
if (getV2XWindow() != null) {
getV2XWindow().setWindowStatusListener(new V2XWindowStatusListener() {
@Override
public void onViewShow() {
ADASUtils.broadcastToADAS(V2XServiceManager.getContext(), mV2XMessageEntity.getContent());
ADASUtils.broadcastToADAS(V2XServiceManager.getContext(), getV2XMessageEntity().getContent());
}
@Override
@@ -74,48 +74,48 @@ public class V2XAnimationScenario extends AbsV2XScenario<V2XPushMessageEntity> {
clearPOI();
}
});
mV2XWindow.show(mV2XMessageEntity.getContent());
getV2XWindow().show(getV2XMessageEntity().getContent());
V2XServiceManager
.getIMogoWindowManager()
.addView(mV2XWindow.getView(), 0, 0, false);
.addView(getV2XWindow().getView(), 0, 0, false);
V2XServiceManager.getMoGoV2XStatusManager().setV2XAnimationWindowShow(TAG, true);
}
}
@Override
public void closeWindow() {
if (mV2XWindow != null) {
mV2XWindow.close();
if (getV2XWindow() != null) {
getV2XWindow().close();
}
V2XServiceManager.getMoGoV2XStatusManager().setV2XAnimationWindowShow(TAG, false);
}
@Override
public void showButton() {
if (mV2XButton != null) {
mV2XButton.show();
if (getV2XButton() != null) {
getV2XButton().show();
}
}
@Override
public void closeButton() {
if (mV2XButton != null) {
mV2XButton.close();
if (getV2XButton() != null) {
getV2XButton().close();
}
}
@Override
public void drawPOI() {
if (mV2XMarker != null) {
mV2XMarker.drawPOI(mV2XMessageEntity.getContent());
if (getV2XMarker() != null) {
getV2XMarker().drawPOI(getV2XMessageEntity().getContent());
}
}
@Override
public void clearPOI() {
setV2XMessageEntity(null);
if (mV2XMarker != null) {
mV2XMarker.clearPOI();
if (getV2XMarker() != null) {
getV2XMarker().clearPOI();
}
}
}

View File

@@ -76,23 +76,23 @@ public class V2XFatigueDrivingScenario extends AbsV2XScenario<V2XPushMessageEnti
@Override
public void showWindow() {
if (mV2XWindow != null) {
if (getV2XWindow() != null) {
ViewGroup.LayoutParams layoutParams =
new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
(int) V2XUtils.getApp().getResources().getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground));
V2XServiceManager
.getMogoTopViewManager()
.addView(mV2XWindow.getView(), layoutParams, this);
mV2XWindow.show(mV2XMessageEntity.getContent());
.addView(getV2XWindow().getView(), layoutParams, this);
getV2XWindow().show(getV2XMessageEntity().getContent());
V2XServiceManager.getMoGoV2XStatusManager().setFatigueDrivingWindowShow(TAG, true);
}
}
@Override
public void closeWindow() {
if (mV2XWindow != null) {
mV2XWindow.close();
if (getV2XWindow() != null) {
getV2XWindow().close();
}
}
@@ -141,14 +141,15 @@ public class V2XFatigueDrivingScenario extends AbsV2XScenario<V2XPushMessageEnti
* 导航规划路线
*/
private void startNavi() {
if (mV2XMessageEntity.getContent() != null) {
if (getV2XMessageEntity().getContent() != null) {
// 反注册语音交互
V2XVoiceManager.INSTANCE
.unRegisterWakeCmd(
V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI)
.unRegisterUnWakeVoice(
V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP);
MogoLatLng endPoint = new MogoLatLng(mV2XMessageEntity.getContent().getLat(), mV2XMessageEntity.getContent().getLon());
MogoLatLng endPoint = new MogoLatLng(getV2XMessageEntity().getContent().getLat(),
getV2XMessageEntity().getContent().getLon());
V2XServiceManager.getNavi().naviTo(endPoint);
close();
}

View File

@@ -2,28 +2,29 @@ package com.mogo.module.v2x.scenario.scene.fatigue;
import android.content.Context;
import android.os.Handler;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.ImageView;
import android.widget.RelativeLayout;
import android.widget.TextView;
import com.mogo.map.MogoLatLng;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.map.navi.MogoTraffic;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView;
import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.common.entity.V2XWindowTypeEnum;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.adapter.V2XRoadEventAdapter;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.SpanUtils;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.utils.logger.Logger;
import java.util.ArrayList;
import java.util.List;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
@@ -34,10 +35,13 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* version: 1.0
*/
public class V2XFatigueDrivingWindow extends RelativeLayout
implements IV2XWindow<V2XPushMessageEntity>, IMogoNaviListener {
private TextView mTvAddress, mTvAddressDistance;
private ImageView mIvToNav;
implements IV2XWindow<V2XPushMessageEntity> {
// 展示列表
private RecyclerView mRecyclerView;
// 列表数据适配器
private V2XRoadEventAdapter mV2XRoadEventAdapter;
// 列表展示
private List<V2XEventShowEntity> mItemList = new ArrayList<>();
// 直播30秒自动关闭
private static Handler handlerV2XEvent = new Handler();
@@ -65,55 +69,54 @@ public class V2XFatigueDrivingWindow extends RelativeLayout
public void initView(Context context) {
Logger.w(MODULE_NAME, "V2X-初始化疲劳驾驶");
LayoutInflater.from(context).inflate(R.layout.window_fatigue_driving, this);
mTvAddress = findViewById(R.id.tvAddress);
mTvAddressDistance = findViewById(R.id.tvAddressDistance);
mIvToNav = findViewById(R.id.ivToNav);
V2XServiceManager.getMogoRegisterCenter().registerMogoNaviListener( "test", this );
mIvToNav.setOnClickListener(v -> startNavi());
LayoutInflater.from(context).inflate(R.layout.window_fault_help, this);
// 详情列表
mRecyclerView = findViewById(R.id.rvRoadEventList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList);
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
// 设置切换样式
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);
// 配置列表朝向
LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (recyclerView.getChildCount() > 0) {
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
// 用户处于交互的时候延后隐藏时间
countDownV2XEvent();
}
}
}
});
}
/**
* 导航规划路线
*/
private void startNavi() {
if (mV2XPushMessageEntity != null) {
MogoLatLng endPoint = new MogoLatLng(mV2XPushMessageEntity.getLat(), mV2XPushMessageEntity.getLon());
V2XServiceManager.getNavi().naviTo(endPoint);
close();
}
}
/**
* 展示道路事件详情Windows
*/
@Override
public void show(V2XPushMessageEntity entity) {
mV2XPushMessageEntity = entity;
if (entity != null) {
if (!TextUtils.isEmpty(entity.getAddress())) {
mTvAddress.setText(entity.getAddress());
} else {
mTvAddress.setText("");
}
SpanUtils.with(mTvAddressDistance)
.append("" + (int) entity.getDistance())
.setFontSize((int) getResources().getDimension(R.dimen.dp_80))
.append("M")
.setFontSize((int) getResources().getDimension(R.dimen.dp_30))
.create();
countDownV2XEvent(entity);
mV2XPushMessageEntity = entity;
// 清空数据
mItemList.clear();
//Logger.d(MODULE_NAME, "V2X===推送消息:" + v2XRoadEventEntity);
V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity();
v2XEventShowEntity.setV2XPushMessageEntity(mV2XPushMessageEntity);
v2XEventShowEntity.setViewType(V2XWindowTypeEnum.FATIGUE_DRIVING_WINDOW);
mItemList.add(v2XEventShowEntity);
// 刷新列表
mV2XRoadEventAdapter.notifyDataSetChanged();
countDownV2XEvent();
}
}
@Override
public void close() {
// 反注册语音交互
V2XVoiceManager.INSTANCE
.unRegisterWakeCmd(
V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI)
.unRegisterUnWakeVoice(
V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP);
// 停止倒计时
if (handlerV2XEvent != null && runnableV2XEvent != null) {
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
@@ -138,60 +141,21 @@ public class V2XFatigueDrivingWindow extends RelativeLayout
/**
* 窗体倒计时
*/
public void countDownV2XEvent(V2XPushMessageEntity v2XPushMessageEntity) {
// 倒计时
if (runnableV2XEvent == null) {
runnableV2XEvent = () -> {
Logger.d(MODULE_NAME, "V2X=== Window 30秒倒计时结束。。。");
// 移出Window详细信息
close();
};
} else {
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
public void countDownV2XEvent() {
if (mV2XPushMessageEntity != null) {
// 倒计时
if (runnableV2XEvent == null) {
runnableV2XEvent = () -> {
Logger.d(MODULE_NAME, "V2X=== Window 30秒倒计时结束。。。");
// 移出Window详细信息
close();
};
} else {
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
}
int expireTime = mV2XPushMessageEntity.getExpireTime();
Logger.d(MODULE_NAME, "V2X=== Window 展示开始倒计时:" + expireTime);
handlerV2XEvent.postDelayed(runnableV2XEvent, expireTime);
}
int expireTime = v2XPushMessageEntity.getExpireTime();
Logger.d(MODULE_NAME, "V2X=== Window 展示开始倒计时:" + expireTime);
handlerV2XEvent.postDelayed(runnableV2XEvent, expireTime);
}
@Override
public void onCalculateSuccess() {
V2XServiceManager.getNavi().startNavi(true);
}
@Override
public void onInitNaviFailure() {
}
@Override
public void onInitNaviSuccess() {
}
@Override
public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
}
@Override
public void onStartNavi() {
}
@Override
public void onStopNavi() {
}
@Override
public void onoCalculateFailed() {
}
@Override
public void onUpdateTraffic(MogoTraffic traffic) {
}
}

View File

@@ -6,9 +6,9 @@ import android.widget.TextView;
import androidx.annotation.Nullable;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
import com.mogo.module.v2x.scenario.scene.seek.V2XSeekHelpButton;
import com.mogo.module.v2x.scenario.scene.seek.V2XSeekHelpDialog;
@@ -64,8 +64,8 @@ public class V2XCarForHelpScenario extends AbsV2XScenario<Boolean> implements IM
if (v2XMessageEntity == null) {
return;
}
mV2XMessageEntity = v2XMessageEntity;
Boolean isShow = mV2XMessageEntity.getContent();
setV2XMessageEntity(v2XMessageEntity);
Boolean isShow = getV2XMessageEntity().getContent();
if (isShow) {
showButton();
mySeekHelpCountDownTimerCancel();
@@ -108,9 +108,9 @@ public class V2XCarForHelpScenario extends AbsV2XScenario<Boolean> implements IM
Logger.d(TAG, "打开自车求助按钮!");
// 设置Button的显示
V2XUtils.runOnUiThread(() -> {
if (mV2XButton != null) {
mV2XButton.setOnActionListener(this::showDialog);
mV2XButton.show();
if (getV2XButton() != null) {
getV2XButton().setOnActionListener(this::showDialog);
getV2XButton().show();
}
});
}
@@ -120,8 +120,8 @@ public class V2XCarForHelpScenario extends AbsV2XScenario<Boolean> implements IM
if (V2XServiceManager.getMoGoStatusManager().isSeekHelping()) {
Logger.d(TAG, "关闭自车求助按钮!");
V2XServiceManager.getMoGoStatusManager().setSeekHelping(TAG, false);
if (mV2XButton != null) {
mV2XButton.close();
if (getV2XButton() != null) {
getV2XButton().close();
SharedPrefsMgr.getInstance(V2XUtils.getApp()).putLong(V2XConst.SEEK_HELP_TIME, 0);
}

View File

@@ -6,11 +6,11 @@ import android.view.ViewGroup;
import androidx.annotation.Nullable;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
import com.mogo.module.v2x.utils.ADASUtils;
import com.mogo.module.v2x.utils.V2XUtils;
@@ -76,59 +76,59 @@ public class V2XPushLiveCarScenario extends AbsV2XScenario<V2XPushMessageEntity>
@Override
public void showWindow() {
if (mV2XWindow != null) {
if (getV2XWindow() != null) {
ViewGroup.LayoutParams layoutParams =
new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
(int) V2XUtils.getApp().getResources().getDimension(R.dimen.module_v2x_event_window_height));
V2XServiceManager
.getMogoTopViewManager()
.addView(mV2XWindow.getView(), layoutParams, this);
mV2XWindow.show(mV2XMessageEntity.getContent());
.addView(getV2XWindow().getView(), layoutParams, this);
getV2XWindow().show(getV2XMessageEntity().getContent());
V2XServiceManager.getMoGoV2XStatusManager().setLiveCarWindowShow(TAG, true);
}
}
@Override
public void closeWindow() {
if (mV2XWindow != null) {
mV2XWindow.close();
if (getV2XWindow() != null) {
getV2XWindow().close();
}
V2XServiceManager.getMoGoV2XStatusManager().setLiveCarWindowShow(TAG, false);
}
@Override
public void showButton() {
if (mV2XButton != null) {
mV2XButton.show();
if (getV2XButton() != null) {
getV2XButton().show();
}
}
@Override
public void closeButton() {
if (mV2XButton != null) {
mV2XButton.close();
if (getV2XButton() != null) {
getV2XButton().close();
}
}
@Override
public void drawPOI() {
if (mV2XMarker != null) {
mV2XMarker.drawPOI(mV2XMessageEntity.getContent());
if (getV2XMarker() != null) {
getV2XMarker().drawPOI(getV2XMessageEntity().getContent());
}
}
@Override
public void clearPOI() {
if (mV2XMarker != null) {
mV2XMarker.clearPOI();
if (getV2XMarker() != null) {
getV2XMarker().clearPOI();
}
}
@Override
public void onViewAdded(View view) {
Logger.d(MODULE_NAME, "展示 Window 动画结束");
ADASUtils.broadcastToADAS(V2XServiceManager.getContext(), mV2XMessageEntity.getContent());
ADASUtils.broadcastToADAS(V2XServiceManager.getContext(), getV2XMessageEntity().getContent());
}
@Override

View File

@@ -2,19 +2,21 @@ package com.mogo.module.v2x.scenario.scene.livecar;
import android.content.Context;
import android.os.Handler;
import android.text.TextUtils;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.RelativeLayout;
import com.mogo.module.common.entity.MarkerCarInfo;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.MarkerUtils;
import com.mogo.module.v2x.view.V2XLiveGSYVideoView;
import com.mogo.service.imageloader.MogoImageView;
import com.mogo.utils.logger.Logger;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
@@ -30,6 +32,7 @@ public class V2XPushLiveCarWindow extends RelativeLayout implements IV2XWindow<V
private Context mContext;
private V2XLiveGSYVideoView mV2XLiveGSYVideoView;
private MogoImageView mIvReportHead;
// 弹窗状态监听
private V2XWindowStatusListener mV2XWindowStatusListener;
@@ -60,6 +63,7 @@ public class V2XPushLiveCarWindow extends RelativeLayout implements IV2XWindow<V
LayoutInflater.from(context).inflate(R.layout.window_push_live_video, this);
// 详情列表
mV2XLiveGSYVideoView = findViewById(R.id.videoPlayer);
mIvReportHead = findViewById(R.id.ivReportHead);
}
/**
@@ -70,6 +74,11 @@ public class V2XPushLiveCarWindow extends RelativeLayout implements IV2XWindow<V
if (entity != null) {
Logger.w(MODULE_NAME, "更新直播信息。。。。。" + entity);
if (!TextUtils.isEmpty(entity.getHeadImgUrl())) {
mIvReportHead.setVisibility(VISIBLE);
V2XServiceManager.getImageLoader()
.displayImage(entity.getHeadImgUrl(), mIvReportHead);
}
// 启动播放
MarkerCarInfo.CarLiveInfo carLiveInfo = new MarkerCarInfo.CarLiveInfo();
carLiveInfo.setVideoChannel(entity.getVideoChannel());

View File

@@ -1,17 +1,14 @@
package com.mogo.module.v2x.scenario.scene.livecar;
import android.view.View;
import android.view.ViewGroup;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventScenario;
import com.mogo.module.v2x.scenario.scene.road.V2XRoadEventWindow;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.windowview.IMogoTopViewStatusListener;
import com.mogo.utils.logger.Logger;
@@ -70,55 +67,55 @@ public class V2XRoadLiveCarScenario extends AbsV2XScenario<List<V2XEventShowEnti
@Override
public void show() {
if (mV2XMessageEntity != null && mV2XMessageEntity.getContent() != null) {
if (getV2XMessageEntity() != null && getV2XMessageEntity().getContent() != null) {
showWindow();
}
}
@Override
public void showWindow() {
if (mV2XWindow != null) {
if (getV2XWindow() != null) {
V2XServiceManager
.getMogoTopViewManager()
.addSubView(mV2XWindow.getView(), this);
mV2XWindow.show(mV2XMessageEntity.getContent());
.addSubView(getV2XWindow().getView(), this);
getV2XWindow().show(getV2XMessageEntity().getContent());
V2XServiceManager.getMoGoV2XStatusManager().setRoadLiveCarWindowShow(TAG, true);
}
}
@Override
public void closeWindow() {
if (mV2XWindow != null) {
mV2XWindow.close();
if (getV2XWindow() != null) {
getV2XWindow().close();
}
V2XServiceManager.getMoGoV2XStatusManager().setRoadLiveCarWindowShow(TAG, false);
}
@Override
public void showButton() {
if (mV2XButton != null) {
mV2XButton.show();
if (getV2XButton() != null) {
getV2XButton().show();
}
}
@Override
public void closeButton() {
if (mV2XButton != null) {
mV2XButton.close();
if (getV2XButton() != null) {
getV2XButton().close();
}
}
@Override
public void drawPOI() {
if (mV2XMarker != null) {
mV2XMarker.drawPOI(mV2XMessageEntity.getContent());
if (getV2XMarker() != null) {
getV2XMarker().drawPOI(getV2XMessageEntity().getContent());
}
}
@Override
public void clearPOI() {
if (mV2XMarker != null) {
mV2XMarker.clearPOI();
if (getV2XMarker() != null) {
getV2XMarker().clearPOI();
}
}

View File

@@ -3,12 +3,14 @@ package com.mogo.module.v2x.scenario.scene.park;
import androidx.annotation.Nullable;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPoiTypeEnum;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.V2XStatusManager;
import com.mogo.module.v2x.alarm.V2XAlarmServer;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPoiTypeEnum;
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
import com.mogo.module.v2x.utils.ADASUtils;
import com.mogo.module.v2x.utils.TrackUtils;
import java.util.ArrayList;
@@ -57,30 +59,36 @@ public class V2XIllegalParkScenario extends AbsV2XScenario<List<MarkerExploreWay
@Override
public void showWindow() {
MarkerExploreWay markerExploreWay = null;
if (mV2XMessageEntity.getContent() != null) {
if (getV2XMessageEntity().getContent() != null) {
markerExploreWay = V2XAlarmServer
.getIllegalParkAlarmEvent(
(ArrayList<MarkerExploreWay>) mV2XMessageEntity.getContent(),
(ArrayList<MarkerExploreWay>) getV2XMessageEntity().getContent(),
V2XStatusManager.getInstance().getLocation());
}
if (markerExploreWay != null) {
//弹框
// 设置要展开的违章停车事件
//((V2XIllegalParkMarker) mV2XMarker).setOpenPoiId(markerExploreWay.getInfoId());
// 广播给ADAS
V2XRoadEventEntity v2XRoadEventEntity = new V2XRoadEventEntity();
v2XRoadEventEntity.setAlarmContent("违章停车");
v2XRoadEventEntity.setExpireTime(20000);
v2XRoadEventEntity.setPoiType(V2XPoiTypeEnum.ALERT_ILLEGAL_PARK);
if (V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) {
speakTTSVoice(markerExploreWay.getAddr() + "可能被罚违章停车,您可以说,有用或没用来帮助其它车友。", null);
((V2XIllegalParkWindow) mV2XWindow).show(markerExploreWay, true);
v2XRoadEventEntity.setTts(markerExploreWay.getAddr() + "可能被罚违章停车,您可以说,有用或没用来帮助其它车友。");
((V2XIllegalParkWindow) getV2XWindow()).show(markerExploreWay, true);
TrackUtils.trackV2xRoadShow(markerExploreWay.getInfoId(), V2XPoiTypeEnum.ALERT_ILLEGAL_PARK, "1");
} else {
speakTTSVoice(markerExploreWay.getAddr() + "可能被罚违章停车", null);
v2XRoadEventEntity.setTts(markerExploreWay.getAddr() + "可能被罚违章停车");
TrackUtils.trackV2xRoadShow(markerExploreWay.getInfoId(), V2XPoiTypeEnum.ALERT_ILLEGAL_PARK, "2");
}
ADASUtils.broadcastToADAS(V2XServiceManager.getContext(), v2XRoadEventEntity);
}
}
@Override
public void closeWindow() {
V2XServiceManager.getMogoTopViewManager().removeView(mV2XWindow.getView());
V2XServiceManager.getMogoTopViewManager().removeView(getV2XWindow().getView());
}
@Override
@@ -93,8 +101,8 @@ public class V2XIllegalParkScenario extends AbsV2XScenario<List<MarkerExploreWay
@Override
public void drawPOI() {
if (mV2XMessageEntity != null) {
mV2XMarker.drawPOI(mV2XMessageEntity.getContent());
if (getV2XMessageEntity() != null) {
getV2XMarker().drawPOI(getV2XMessageEntity().getContent());
}
}

View File

@@ -7,34 +7,39 @@ import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.RelativeLayout;
import android.widget.TextView;
import androidx.annotation.NonNull;
import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XWindowTypeEnum;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.adapter.V2XRoadEventAdapter;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.utils.RoadConditionUtils;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.module.v2x.view.HeartLikeView;
import com.mogo.module.v2x.view.HeartUnLikeView;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.utils.logger.Logger;
import java.util.ArrayList;
import java.util.List;
/**
* 违章停车
* 弹窗视图
*/
public class V2XIllegalParkWindow extends RelativeLayout implements IV2XWindow<MarkerExploreWay> {
private static final String TAG = "V2XLegalParkWindow";
private TextView mAddressTv;
private TextView mIllegalNumTv;
private HeartLikeView mIlIllegalParkingLike;
private HeartUnLikeView mIIllegalParkingUnLike;
private static final String TAG = "V2XIllegalParkWindow";
// 展示列表
private RecyclerView mRecyclerView;
// 列表数据适配器
private V2XRoadEventAdapter mV2XRoadEventAdapter;
// 列表展示
private List<V2XEventShowEntity> mItemList = new ArrayList<>();
// 处理道路事件20秒倒计时
private Handler handlerV2XEvent = new Handler();
@@ -44,10 +49,6 @@ public class V2XIllegalParkWindow extends RelativeLayout implements IV2XWindow<M
private MarkerExploreWay mExploreWay;
// 反馈按钮语音操控
private V2XVoiceCallbackListener v2XVoiceCallbackYouYongListener = (command, intent) -> roadReportTrue();
private V2XVoiceCallbackListener v2XVoiceCallbackMeiYongListener = (command, intent) -> roadReportErr();
public V2XIllegalParkWindow() {
this(V2XServiceManager.getContext(), null);
}
@@ -69,12 +70,28 @@ public class V2XIllegalParkWindow extends RelativeLayout implements IV2XWindow<M
* 初始化视图
*/
private void initView(Context context) {
LayoutInflater.from(context).inflate(R.layout.window_illegal_parking, this);
mAddressTv = findViewById(R.id.tvAddress);
mIllegalNumTv = findViewById(R.id.tvIllegalNum);
mIlIllegalParkingLike = findViewById(R.id.llIllegalParkingLike);
mIIllegalParkingUnLike = findViewById(R.id.llIllegalParkingUnLike);
LayoutInflater.from(context).inflate(R.layout.window_fault_help, this);
// 详情列表
mRecyclerView = findViewById(R.id.rvRoadEventList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList);
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
// 设置切换样式
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);
// 配置列表朝向
LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
mRecyclerView.setLayoutManager(layoutManager);
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (recyclerView.getChildCount() > 0) {
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
// 用户处于交互的时候延后隐藏时间
countDownV2XEvent();
}
}
}
});
}
public void show(MarkerExploreWay entity, boolean isAutoClose) {
@@ -89,23 +106,17 @@ public class V2XIllegalParkWindow extends RelativeLayout implements IV2XWindow<M
public void show(MarkerExploreWay entity) {
mExploreWay = entity;
//Logger.d(V2XConst.MODULE_NAME, "V2X===违章停车:展示 Window=\n" + entity);
mAddressTv.setText(entity.getAddr());
try {
mIllegalNumTv.setText("违章人数:" + (int) entity.getItems().get(0).getIllegalCount());
} catch (Exception e) {
e.printStackTrace();
// 清空数据
mItemList.clear();
if (mExploreWay != null) {
//Logger.d(MODULE_NAME, "V2X===推送消息:" + v2XRoadEventEntity);
V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity();
v2XEventShowEntity.setV2XIllegalPark(mExploreWay);
v2XEventShowEntity.setViewType(V2XWindowTypeEnum.ILLEGAL_PARK_WINDOW);
mItemList.add(v2XEventShowEntity);
}
mIlIllegalParkingLike.setOnClickCallListener(v -> {
Logger.d(V2XConst.MODULE_NAME, "反馈有用");
roadReportTrue();
});
mIIllegalParkingUnLike.setOnClickCallListener(v -> {
Logger.d(V2XConst.MODULE_NAME, "反馈无用");
roadReportErr();
});
// 刷新列表
mV2XRoadEventAdapter.notifyDataSetChanged();
// 倒计时
if (mIsAutoClose) {
countDownV2XEvent();
@@ -120,14 +131,6 @@ public class V2XIllegalParkWindow extends RelativeLayout implements IV2XWindow<M
// 添加弹窗
V2XServiceManager.getMogoTopViewManager().addView(this, layoutParams);
// 注册语音交互
V2XVoiceManager.INSTANCE
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_YOUYONG_UN_WAKEUP,
v2XVoiceCallbackYouYongListener)
.registerUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_MEIYONG_UN_WAKEUP,
v2XVoiceCallbackMeiYongListener);
}
/**
@@ -136,11 +139,6 @@ public class V2XIllegalParkWindow extends RelativeLayout implements IV2XWindow<M
@Override
public void close() {
mIsAutoClose = false;
V2XVoiceManager.INSTANCE
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_YOUYONG_UN_WAKEUP)
.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_ILLEGAL_PARKMARKER_FEEDBACK_MEIYONG_UN_WAKEUP);
// 停止倒计时
if (handlerV2XEvent != null && runnableV2XEvent != null) {
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
@@ -179,31 +177,4 @@ public class V2XIllegalParkWindow extends RelativeLayout implements IV2XWindow<M
Logger.d(V2XConst.MODULE_NAME, "V2X===违章停车 Window 展示开始倒计时:" + mExpireTime);
handlerV2XEvent.postDelayed(runnableV2XEvent, mExpireTime);
}
/**
* 反馈路况正确
*/
private void roadReportTrue() {
if (mExploreWay != null) {
RoadConditionUtils.sendDataErrorReceiverInfo(
mExploreWay.getPoiType(),
mExploreWay.getInfoId(),
"2");
}
close();
}
/**
* 反馈路况错误
*/
private void roadReportErr() {
if (mExploreWay != null) {
RoadConditionUtils.sendDataErrorReceiverInfo(
mExploreWay.getPoiType(),
mExploreWay.getInfoId(),
"1");
}
close();
}
}

View File

@@ -5,11 +5,11 @@ import android.view.ViewGroup;
import androidx.annotation.Nullable;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.scenario.impl.AbsV2XScenario;
import com.mogo.module.v2x.utils.V2XUtils;
import com.mogo.service.windowview.IMogoTopViewStatusListener;
@@ -62,8 +62,8 @@ public class V2XPushEventScenario extends AbsV2XScenario<V2XPushMessageEntity> i
@Override
public void show() {
if (mV2XMessageEntity != null && mV2XMessageEntity.getContent() != null) {
speakTTSVoice(mV2XMessageEntity.getContent().getTts(), null);
if (getV2XMessageEntity() != null && getV2XMessageEntity().getContent() != null) {
speakTTSVoice(getV2XMessageEntity().getContent().getTts(), null);
drawPOI();
showWindow();
}
@@ -71,15 +71,15 @@ public class V2XPushEventScenario extends AbsV2XScenario<V2XPushMessageEntity> i
@Override
public void showWindow() {
if (mV2XWindow != null) {
if (getV2XWindow() != null) {
ViewGroup.LayoutParams layoutParams =
new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
(int) V2XUtils.getApp().getResources().getDimension(R.dimen.module_v2x_event_window_height_ground));
V2XServiceManager
.getMogoTopViewManager()
.addView(mV2XWindow.getView(), layoutParams,this);
mV2XWindow.show(mV2XMessageEntity.getContent());
.addView(getV2XWindow().getView(), layoutParams, this);
getV2XWindow().show(getV2XMessageEntity().getContent());
V2XServiceManager.getMoGoV2XStatusManager().setPushWindowShow(TAG, true);
}
}
@@ -87,37 +87,37 @@ public class V2XPushEventScenario extends AbsV2XScenario<V2XPushMessageEntity> i
@Override
public void closeWindow() {
V2XServiceManager.getMoGoV2XStatusManager().setPushWindowShow(TAG, false);
if (mV2XWindow != null) {
mV2XWindow.close();
if (getV2XWindow() != null) {
getV2XWindow().close();
}
}
@Override
public void showButton() {
if (mV2XButton != null) {
mV2XButton.show();
if (getV2XButton() != null) {
getV2XButton().show();
}
}
@Override
public void closeButton() {
if (mV2XButton != null) {
mV2XButton.close();
if (getV2XButton() != null) {
getV2XButton().close();
}
}
@Override
public void drawPOI() {
if (mV2XMarker != null) {
mV2XMarker.drawPOI(mV2XMessageEntity.getContent());
if (getV2XMarker() != null) {
getV2XMarker().drawPOI(getV2XMessageEntity().getContent());
V2XServiceManager.getMoGoV2XStatusManager().setPushPOIShow(TAG, true);
}
}
@Override
public void clearPOI() {
if (mV2XMarker != null) {
mV2XMarker.clearPOI();
if (getV2XMarker() != null) {
getV2XMarker().clearPOI();
}
V2XServiceManager.getMoGoV2XStatusManager().setPushPOIShow(TAG, false);
}

View File

@@ -13,10 +13,12 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView;
import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.common.entity.V2XWindowTypeEnum;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.adapter.V2XPushEventAdapter;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.v2x.adapter.V2XRoadEventAdapter;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
@@ -42,9 +44,9 @@ public class V2XPushEventWindow extends RelativeLayout implements IV2XWindow<V2X
// 展示列表
private RecyclerView mRecyclerView;
// 列表数据适配器
private V2XPushEventAdapter mV2XRoadEventAdapter;
private V2XRoadEventAdapter mV2XRoadEventAdapter;
// 列表展示
private List<V2XPushMessageEntity> mItemList = new ArrayList<>();
private List<V2XEventShowEntity> mItemList = new ArrayList<>();
// 处理道路事件30秒倒计时
private Handler handlerV2XEvent = new Handler();
private Runnable runnableV2XEvent;
@@ -80,7 +82,7 @@ public class V2XPushEventWindow extends RelativeLayout implements IV2XWindow<V2X
LayoutInflater.from(context).inflate(R.layout.window_push_event_detail, this);
// 详情列表
mRecyclerView = findViewById(R.id.rvRoadEventList);
mV2XRoadEventAdapter = new V2XPushEventAdapter(mItemList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList);
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
// 设置切换样式
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);
@@ -110,7 +112,10 @@ public class V2XPushEventWindow extends RelativeLayout implements IV2XWindow<V2X
mItemList.clear();
if (v2XRoadEventEntity != null) {
//Logger.d(MODULE_NAME, "V2X===推送消息:" + v2XRoadEventEntity);
mItemList.add(v2XRoadEventEntity);
V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity();
v2XEventShowEntity.setV2XPushMessageEntity(v2XRoadEventEntity);
v2XEventShowEntity.setViewType(V2XWindowTypeEnum.PUSH_EVENT_WINDOW);
mItemList.add(v2XEventShowEntity);
}
// 刷新列表
mV2XRoadEventAdapter.notifyDataSetChanged();

View File

@@ -53,7 +53,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
@Override
public void init(V2XMessageEntity<V2XRoadEventEntity> v2XMessageEntity) {
try {
Logger.w(V2XConst.MODULE_NAME, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity));
Logger.d(V2XConst.MODULE_NAME, "v2XMessageEntity:" + GsonUtil.jsonFromObject(v2XMessageEntity));
V2XRoadEventEntity v2XRoadEventEntity = v2XMessageEntity.getContent();
if (v2XRoadEventEntity != null) {
@@ -78,28 +78,22 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
@Override
public void show() {
if (mV2XMessageEntity != null && mV2XMessageEntity.getContent() != null) {
// 如果道路事件小于50米的时候需要用户反馈
if (mV2XMessageEntity.getContent().getDistance() < 50) {
// 设置TTS
mV2XMessageEntity.getContent().getTtsWithFeedback();
} else {
// 设置TTS
mV2XMessageEntity.getContent().getTts(false);
}
if (getV2XMessageEntity() != null && getV2XMessageEntity().getContent() != null) {
// 设置TTS
getV2XMessageEntity().getContent().getTts(false);
// 广播给ADAS
ADASUtils.broadcastToADAS(
V2XServiceManager.getContext(),
mV2XMessageEntity.getContent());
getV2XMessageEntity().getContent());
if (V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) {
showWindow();
}
// 地图主动推送/触发消息 埋点
String poiType = mV2XMessageEntity.getContent().getPoiType();
String lat = String.valueOf(mV2XMessageEntity.getContent().getLocation().getLat());
String lon = String.valueOf(mV2XMessageEntity.getContent().getLocation().getLon());
String infoId = mV2XMessageEntity.getContent().getNoveltyInfo().getInfoId();
String poiType = getV2XMessageEntity().getContent().getPoiType();
String lat = String.valueOf(getV2XMessageEntity().getContent().getLocation().getLat());
String lon = String.valueOf(getV2XMessageEntity().getContent().getLocation().getLon());
String infoId = getV2XMessageEntity().getContent().getNoveltyInfo().getInfoId();
String style = V2XServiceManager.getMoGoStatusManager().isMainPageOnResume() ? "1" : "2";
Map<String, Object> properties = new HashMap<>();
properties.put("dbid", infoId);
@@ -113,7 +107,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
@Override
public void showWindow() {
if (mV2XWindow != null) {
if (getV2XWindow() != null) {
// 关闭直播弹窗
try {
IV2XWindow v2XWindow = V2XRoadLiveCarScenario.getInstance().getV2XWindow();
@@ -128,7 +122,7 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
// 关闭之前的事件弹窗
boolean isShowEventWindow = V2XServiceManager.getMoGoV2XStatusManager().isRoadEventWindowShow();
if (isShowEventWindow) {
((V2XRoadEventWindow) mV2XWindow).updateTopWindowInfo(mV2XMessageEntity.getContent());
((V2XRoadEventWindow) getV2XWindow()).updateTopWindowInfo(getV2XMessageEntity().getContent());
} else {
ViewGroup.LayoutParams layoutParams =
new ViewGroup.LayoutParams(
@@ -136,8 +130,8 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
(int) V2XUtils.getApp().getResources().getDimension(R.dimen.module_v2x_event_window_height));
V2XServiceManager
.getMogoTopViewManager()
.addView(mV2XWindow.getView(), layoutParams, this);
mV2XWindow.show(mV2XMessageEntity.getContent());
.addView(getV2XWindow().getView(), layoutParams, this);
getV2XWindow().show(getV2XMessageEntity().getContent());
}
V2XServiceManager.getMoGoV2XStatusManager().setRoadEventWindowShow(TAG, true);
}
@@ -147,42 +141,42 @@ public class V2XRoadEventScenario extends AbsV2XScenario<V2XRoadEventEntity> imp
@Override
public void closeWindow() {
if (mV2XWindow != null) {
mV2XWindow.close();
if (getV2XWindow() != null) {
getV2XWindow().close();
}
V2XServiceManager.getMoGoV2XStatusManager().setRoadEventWindowShow(TAG, false);
}
@Override
public void showButton() {
if (mV2XButton != null) {
mV2XButton.setOnActionListener(this::showWindow);
mV2XButton.show();
if (getV2XButton() != null) {
getV2XButton().setOnActionListener(this::showWindow);
getV2XButton().show();
V2XServiceManager.getMoGoV2XStatusManager().setRoadEventButtonShow(TAG, true);
}
}
@Override
public void closeButton() {
if (mV2XButton != null) {
mV2XButton.close();
if (getV2XButton() != null) {
getV2XButton().close();
}
V2XServiceManager.getMoGoV2XStatusManager().setRoadEventButtonShow(TAG, false);
}
@Override
public void drawPOI() {
if (mV2XMarker != null) {
if (getV2XMarker() != null) {
// 重置告警信息
V2XServiceManager.getV2XStatusManager().setAlarmInfo(mV2XMessageEntity.getContent());
mV2XMarker.drawPOI(mV2XMessageEntity.getContent());
V2XServiceManager.getV2XStatusManager().setAlarmInfo(getV2XMessageEntity().getContent());
getV2XMarker() .drawPOI(getV2XMessageEntity().getContent());
}
}
@Override
public void clearPOI() {
if (mV2XMarker != null) {
mV2XMarker.clearPOI();
if (getV2XMarker() != null) {
getV2XMarker().clearPOI();
}
}

View File

@@ -97,7 +97,7 @@ public class V2XRoadEventWindow extends RelativeLayout
* 初始化视图
*/
private void initView(Context context) {
Logger.w(MODULE_NAME, "V2X===初始化道路事件小窗口View。。。。。");
Logger.d(MODULE_NAME, "V2X===初始化道路事件小窗口View。。。。。");
// 填充布局
LayoutInflater.from(context).inflate(R.layout.window_road_event_detail, this);
// 详情列表

View File

@@ -1,6 +1,5 @@
package com.mogo.module.v2x.scenario.scene.seek;
import android.os.CountDownTimer;
import android.view.View;
import android.view.ViewGroup;
@@ -20,7 +19,6 @@ import com.mogo.service.windowview.IMogoTopViewStatusListener;
import com.mogo.utils.logger.Logger;
import java.util.List;
import java.util.concurrent.ArrayBlockingQueue;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
@@ -32,6 +30,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
* version: 1.0
*/
public class V2XSeekHelpScenario extends AbsV2XScenario<List<V2XMarkerEntity>> implements IMogoTopViewStatusListener {
private volatile static V2XSeekHelpScenario mV2XSeekHelpScenario;
private V2XSeekHelpScenario() {
@@ -42,6 +41,8 @@ public class V2XSeekHelpScenario extends AbsV2XScenario<List<V2XMarkerEntity>> i
synchronized (V2XSeekHelpScenario.class) {
if (mV2XSeekHelpScenario == null) {
mV2XSeekHelpScenario = new V2XSeekHelpScenario();
mV2XSeekHelpScenario.setV2XWindow(new V2XSeekHelpWindow());
mV2XSeekHelpScenario.setV2XMarker(new V2XSeekHelpMarker());
}
}
}
@@ -52,21 +53,8 @@ public class V2XSeekHelpScenario extends AbsV2XScenario<List<V2XMarkerEntity>> i
@Override
public void init(@Nullable V2XMessageEntity<List<V2XMarkerEntity>> v2XMessageEntity) {
mV2XMessageEntity = v2XMessageEntity;
if (V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) {
if (mV2XMessageEntity != null) {
mMarkerEntity = mV2XMessageEntity.getContent();
}
if (!isShown) {
setV2XWindow(new V2XSeekHelpWindow());
setV2XMarker(new V2XSeekHelpMarker());
} else {
countDownFaultHelpWindowCancel();
closeWindow();
clearPOI();
}
show();
}
setV2XMessageEntity(v2XMessageEntity);
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("发现其他车主的求助信息");
// 广播给ADAS和Launcher卡片
V2XRoadEventEntity eventEntity = new V2XRoadEventEntity();
@@ -74,6 +62,14 @@ public class V2XSeekHelpScenario extends AbsV2XScenario<List<V2XMarkerEntity>> i
eventEntity.setExpireTime(30000);
eventEntity.setAlarmContent("其他车主求助");
ADASUtils.broadcastToADAS(V2XServiceManager.getContext(), eventEntity);
if (V2XServiceManager.getMoGoStatusManager().isMainPageLaunched()) {
if (getV2XMessageEntity() != null &&
!V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpWindowShow()) {
mMarkerEntity = getV2XMessageEntity().getContent();
show();
}
}
}
@Override
@@ -81,90 +77,31 @@ public class V2XSeekHelpScenario extends AbsV2XScenario<List<V2XMarkerEntity>> i
showWindow();
}
@Override
public void close() {
countDownFaultHelpWindowCancel();
super.close();
mV2XWindow = null;
mV2XMarker = null;
mV2XButton = null;
}
private volatile boolean isShown = false;
private ArrayBlockingQueue<List<V2XMarkerEntity>> blockingQueue = new ArrayBlockingQueue<>(5);
private CountDownTimer faultHelpTimer;
private void countDownFaultHelpWindowCancel() {
if (faultHelpTimer != null) {
faultHelpTimer.cancel();
faultHelpTimer = null;
}
blockingQueue.clear();
isShown = false;
}
private void countDownFaultHelpWindowStart() {
if (faultHelpTimer == null) {
faultHelpTimer = new CountDownTimer(20_000, 20_000) {
@Override
public void onTick(long millisUntilFinished) {
// Logger.d(TAG, "故障求助倒计时: " + millisUntilFinished);
}
@Override
public void onFinish() {
Logger.d(TAG, "故障求助倒计时: onFinish");
isShown = false;
List<V2XMarkerEntity> result = blockingQueue.poll();
closeWindow();
clearPOI();
if (result != null) {
mMarkerEntity = result;
show();
}
}
};
}
faultHelpTimer.start();
}
@Override
public void showWindow() {
V2XServiceManager.getMoGoV2XStatusManager().setOtherSeekHelpWindowShow(TAG, true);
if (mV2XWindow != null && mMarkerEntity != null) {
if (!isShown) {
isShown = true;
countDownFaultHelpWindowStart();
View view = mV2XWindow.getView();
Logger.d(TAG, "添加window= " + view);
ViewGroup.LayoutParams layoutParams =
new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
(int) V2XUtils.getApp().getResources().getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground));
V2XServiceManager
.getMogoTopViewManager()
.addView(mV2XWindow.getView(), layoutParams, this);
mV2XWindow.show(mMarkerEntity);
} else {
blockingQueue.offer(mMarkerEntity);
}
if (getV2XWindow() != null && mMarkerEntity != null) {
View view = getV2XWindow().getView();
Logger.d(MODULE_NAME, "添加window= " + view);
ViewGroup.LayoutParams layoutParams =
new ViewGroup.LayoutParams(
ViewGroup.LayoutParams.MATCH_PARENT,
(int) V2XUtils.getApp().getResources().getDimension(R.dimen.module_v2x_fatigue_driving_window_height_ground));
V2XServiceManager
.getMogoTopViewManager()
.addView(getV2XWindow().getView(), layoutParams, this);
getV2XWindow().show(mMarkerEntity);
}
}
@Override
public void closeWindow() {
if (V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpWindowShow()) {
Logger.d(TAG, "关闭求助车辆的Window!");
Logger.d(MODULE_NAME, "关闭求助车辆的Window!");
V2XServiceManager.getMoGoV2XStatusManager().setOtherSeekHelpWindowShow(TAG, false);
if (mV2XWindow != null) {
View view = mV2XWindow.getView();
Logger.d(TAG, "移除window= " + view);
V2XServiceManager
.getMogoTopViewManager()
.removeView(view);
mV2XWindow.close();
if (getV2XWindow() != null) {
View view = getV2XWindow().getView();
Logger.d(MODULE_NAME, "移除window= " + view);
getV2XWindow().close();
}
}
}
@@ -181,21 +118,22 @@ public class V2XSeekHelpScenario extends AbsV2XScenario<List<V2XMarkerEntity>> i
@Override
public void drawPOI() {
if (mV2XMarker != null && mMarkerEntity != null) {
mV2XMarker.drawPOI(mMarkerEntity);
if (getV2XMarker() != null && mMarkerEntity != null) {
getV2XMarker().drawPOI(mMarkerEntity);
}
}
@Override
public void clearPOI() {
if (mV2XMarker != null) {
mV2XMarker.clearPOI();
if (getV2XMarker() != null) {
getV2XMarker().clearPOI();
}
}
@Override
public void onViewAdded(View view) {
Logger.d(MODULE_NAME, "展示 Window 动画结束");
V2XServiceManager.getMoGoV2XStatusManager().setOtherSeekHelpWindowShow(TAG, true);
drawPOI();
}

View File

@@ -1,9 +1,8 @@
package com.mogo.module.v2x.scenario.scene.seek;
import android.content.Context;
import android.content.Intent;
import android.os.Handler;
import android.util.AttributeSet;
import android.util.Log;
import android.view.LayoutInflater;
import android.view.View;
@@ -13,54 +12,50 @@ import androidx.recyclerview.widget.LinearLayoutManager;
import androidx.recyclerview.widget.PagerSnapHelper;
import androidx.recyclerview.widget.RecyclerView;
import com.mogo.map.MogoLatLng;
import com.mogo.map.navi.IMogoNaviListener;
import com.mogo.map.navi.MogoNaviInfo;
import com.mogo.map.navi.MogoTraffic;
import com.mogo.module.common.entity.V2XEventShowEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.common.entity.V2XWindowTypeEnum;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XServiceManager;
import com.mogo.module.v2x.adapter.V2XSeekHelpAdapter;
import com.mogo.module.v2x.adapter.V2XRoadEventAdapter;
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes.V2XMarkerEntity;
import com.mogo.module.v2x.listener.V2XWindowStatusListener;
import com.mogo.module.v2x.scenario.view.IV2XWindow;
import com.mogo.module.v2x.voice.V2XVoiceCallbackListener;
import com.mogo.module.v2x.voice.V2XVoiceConstants;
import com.mogo.module.v2x.voice.V2XVoiceManager;
import com.mogo.service.module.IMogoRegisterCenter;
import com.mogo.utils.logger.Logger;
import com.zhidao.carchattingprovider.CallChattingProviderConstant;
import java.util.HashMap;
import java.util.ArrayList;
import java.util.List;
import java.util.Map;
import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
/**
* @ProjectName: MoGoModulSafeDriving
* @Package: com.mogo.module.v2x.window
* @ClassName: V2XFaultHelpWindow
* @Description: 故障求助window
* @Author: fenghl
* @CreateDate: 2020/4/13 15:24
* @UpdateUser: 更新者:
* @UpdateDate: 2020/4/13 15:24
* @UpdateRemark: 更新说明:
* @Version: 1.0
* author : donghongyu
* e-mail : 1358506549@qq.com
* date : 2020/5/15 5:37 PM
* desc : 他人发起的故障求助
* version: 1.0
*/
public class V2XSeekHelpWindow extends ConstraintLayout implements V2XSeekHelpAdapter.OnViewClickListener, IMogoNaviListener, IV2XWindow<List<V2XMarkerEntity>> {
private static final String TAG = V2XSeekHelpWindow.class.getSimpleName();
public class V2XSeekHelpWindow extends ConstraintLayout implements IV2XWindow<List<V2XMarkerEntity>> {
private static final String TAG = "V2XSeekHelpWindow";
// 展示列表
private RecyclerView mRecyclerView;
private int mCurPosition;
private V2XSeekHelpAdapter mAdapter;
IMogoRegisterCenter mMogoRegisterCenter = null;
private V2XMarkerEntity mMarkerEntity;
// 弹窗状态监听
private V2XWindowStatusListener mV2XWindowStatusListener;
// 列表数据适配器
private V2XRoadEventAdapter mV2XRoadEventAdapter;
// 列表展示
private List<V2XEventShowEntity> mItemList = new ArrayList<>();
// 直播30秒自动关闭
private static Handler handlerV2XEvent = new Handler();
private static Runnable runnableV2XEvent;
// 推荐的停车场
private V2XPushMessageEntity mV2XPushMessageEntity;
public V2XSeekHelpWindow() {
this(V2XServiceManager.getContext(), null);
}
public V2XSeekHelpWindow(Context context) {
this(context, null);
}
@@ -71,197 +66,73 @@ public class V2XSeekHelpWindow extends ConstraintLayout implements V2XSeekHelpAd
public V2XSeekHelpWindow(Context context, AttributeSet attrs, int defStyleAttr) {
super(context, attrs, defStyleAttr);
init(context);
initView(context);
}
private void init(Context context) {
private void initView(Context context) {
Logger.w(MODULE_NAME, "初始化道路故障求助窗口View。。。。。");
LayoutInflater.from(context).inflate(R.layout.window_fault_help, this);
initRecyclerView(context);
initVoice();
mMogoRegisterCenter = V2XServiceManager.getMogoRegisterCenter();
}
private void initRecyclerView(Context context) {
mRecyclerView = findViewById(R.id.rvFaultHelp);
LinearLayoutManager layoutManager = new LinearLayoutManager(context, RecyclerView.VERTICAL, false);
// 详情列表
mRecyclerView = findViewById(R.id.rvRoadEventList);
mV2XRoadEventAdapter = new V2XRoadEventAdapter(mItemList);
mRecyclerView.setAdapter(mV2XRoadEventAdapter);
// 设置切换样式
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);
// 配置列表朝向
LinearLayoutManager layoutManager = new LinearLayoutManager(context, LinearLayoutManager.HORIZONTAL, false);
mRecyclerView.setLayoutManager(layoutManager);
mAdapter = new V2XSeekHelpAdapter(context);
mAdapter.setOnViewClickListener(this);
mRecyclerView.setAdapter(mAdapter);
mRecyclerView.addOnScrollListener(new RecyclerView.OnScrollListener() {
@Override
public void onScrollStateChanged(@NonNull RecyclerView recyclerView, int newState) {
super.onScrollStateChanged(recyclerView, newState);
if (recyclerView.getChildCount() > 0 && newState == RecyclerView.SCROLL_STATE_IDLE) {
mCurPosition = layoutManager.findFirstCompletelyVisibleItemPosition();
Logger.d(TAG, "v2x 故障求助 当前显示位置===" + mCurPosition);
if (recyclerView.getChildCount() > 0) {
if (newState == RecyclerView.SCROLL_STATE_IDLE) {
// 用户处于交互的时候延后隐藏时间
countDownV2XEvent();
}
}
}
});
new PagerSnapHelper().attachToRecyclerView(mRecyclerView);
}
private V2XVoiceCallbackListener mChatCb = new V2XVoiceCallbackListener() {
@Override
public void onCallback(String command, Intent intent) {
if (mMarkerEntity != null) {
callChatting(mMarkerEntity);
}
}
};
private V2XVoiceCallbackListener mNaviCb = new V2XVoiceCallbackListener() {
@Override
public void onCallback(String command, Intent intent) {
if (mMarkerEntity != null) {
startNavi(mMarkerEntity.getLat(), mMarkerEntity.getLon());
}
}
};
/**
* 注册语音
*/
private void initVoice() {
registerVoiceCmd();
}
private void registerVoiceCmd() {
V2XVoiceManager.INSTANCE.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING, mChatCb);
V2XVoiceManager.INSTANCE.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP, mChatCb);
V2XVoiceManager.INSTANCE.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI, mNaviCb);
V2XVoiceManager.INSTANCE.registerUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP, mNaviCb);
}
private void unregisterVoiceCmd() {
V2XVoiceManager.INSTANCE.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CALL_CHATTING);
V2XVoiceManager.INSTANCE.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_CHAT_MORE_UN_WAKEUP);
V2XVoiceManager.INSTANCE.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_NAVI);
V2XVoiceManager.INSTANCE.unRegisterUnWakeVoice(V2XVoiceConstants.COMMAND_V2X_TO_NAVI_UN_WAKEUP);
}
private void callChatting(V2XMarkerEntity entity) {
try {
Map<String, String> params = new HashMap<>(16);
params.put(CallChattingProviderConstant.CCPROVIDER_SN, entity.getSn());
V2XMarkerEntity.UserInfoBean infoBean = entity.getUserInfo();
if (infoBean != null) {
params.put(CallChattingProviderConstant.CCPROVIDER_USER_IMG, infoBean.getHeadImgUrl());
params.put(CallChattingProviderConstant.CCPROVIDER_USER_AGE, infoBean.getAge() + "");
params.put(CallChattingProviderConstant.CCPROVIDER_USER_SEX, infoBean.getSex() + "");
params.put(CallChattingProviderConstant.CCPROVIDER_NICK_NAME, infoBean.getDisplayName());
}
// params.put(CallChattingProviderConstant.CCPROVIDER_CAR_TYPE, );
//params.put(CallChattingProviderConstant.CCPROVIDER_ADDRESS, location.getAddress());
params.put(CallChattingProviderConstant.CCPROVIDER_LAT, entity.getLat() + "");
params.put(CallChattingProviderConstant.CCPROVIDER_LON, entity.getLon() + "");
Logger.d(TAG, "调用车聊聊传入参数==$params===" + params);
V2XServiceManager.getCarsChattingProvider().call(params);
} catch (Exception e) {
e.printStackTrace();
}
}
@Override
public void onViewChatClick(V2XMarkerEntity entity) {
Log.d(TAG, "点击:调用车聊聊通话!");
callChatting(entity);
}
@Override
public void onViewNaviClick(double lat, double lng) {
startNavi(lat, lng);
}
private void startNavi(double lat, double lng) {
Log.d(TAG, "去导航!");
MogoLatLng endPoint = new MogoLatLng(lat, lng);
V2XServiceManager.getNavi().naviTo(endPoint);
synchronized (V2XSeekHelpWindow.class) {
mMogoRegisterCenter.unregisterMogoNaviListener(MODULE_NAME);
mMogoRegisterCenter.registerMogoNaviListener(MODULE_NAME, this);
}
}
@Override
protected void onDetachedFromWindow() {
super.onDetachedFromWindow();
unregisterVoiceCmd();
mAdapter.clearData();
mAdapter.setOnViewClickListener(null);
synchronized (V2XSeekHelpWindow.class) {
mMogoRegisterCenter.unregisterMogoNaviListener(MODULE_NAME);
}
mMarkerEntity = null;
}
@Override
public void onInitNaviFailure() {
}
@Override
public void onInitNaviSuccess() {
}
@Override
public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
}
@Override
public void onStartNavi() {
}
@Override
public void onStopNavi() {
}
@Override
public void onCalculateSuccess() {
V2XServiceManager.getNavi().startNavi(true);
}
@Override
public void onoCalculateFailed() {
}
@Override
public void onUpdateTraffic(MogoTraffic traffic) {
}
@Override
public void show(List<V2XMarkerEntity> entityList) {
// TODO: 2020/4/13 根据需求仅展示一个,默认显示第一个
if (entityList != null && !entityList.isEmpty()) {
V2XMarkerEntity entity = entityList.get(0);
mAdapter.addData(entityList.get(0));
mAdapter.notifyDataSetChanged();
mMarkerEntity = entity;
V2XMarkerEntity markerEntity = entityList.get(0);
mV2XPushMessageEntity = new V2XPushMessageEntity();
mV2XPushMessageEntity.setLon(markerEntity.getLon());
mV2XPushMessageEntity.setLat(markerEntity.getLat());
mV2XPushMessageEntity.setDisplayName(markerEntity.getUserInfo().getDisplayName());
mV2XPushMessageEntity.setHeadImgUrl(markerEntity.getUserInfo().getHeadImgUrl());
mV2XPushMessageEntity.setSex(markerEntity.getUserInfo().getSex());
mV2XPushMessageEntity.setSn(markerEntity.getUserInfo().getSn());
mV2XPushMessageEntity.setCreateTime(markerEntity.getCreateTime());
mV2XPushMessageEntity.setDistance(markerEntity.getDistance());
mV2XPushMessageEntity.setExpireTime(20000);
// 清空数据
mItemList.clear();
//Logger.d(MODULE_NAME, "V2X===推送消息:" + v2XRoadEventEntity);
V2XEventShowEntity v2XEventShowEntity = new V2XEventShowEntity();
v2XEventShowEntity.setV2XPushMessageEntity(mV2XPushMessageEntity);
v2XEventShowEntity.setViewType(V2XWindowTypeEnum.SEEK_HELP_WINDOW);
mItemList.add(v2XEventShowEntity);
// 刷新列表
mV2XRoadEventAdapter.notifyDataSetChanged();
countDownV2XEvent();
}
//mAdapter.addDataList(entityList);
}
@Override
public void close() {
/* Logger.d(TAG,"移除window= "+this);
Logger.d(TAG, "移除window= " + this);
//移除窗体
V2XServiceManager
.getIMogoWindowManager()
.removeView(this);*/
.getMogoTopViewManager()
.removeView(this);
}
@Override
@@ -271,6 +142,26 @@ public class V2XSeekHelpWindow extends ConstraintLayout implements V2XSeekHelpAd
@Override
public void setWindowStatusListener(V2XWindowStatusListener listener) {
mV2XWindowStatusListener = listener;
}
/**
* 窗体倒计时
*/
public void countDownV2XEvent() {
if (mV2XPushMessageEntity != null) {
// 倒计时
if (runnableV2XEvent == null) {
runnableV2XEvent = () -> {
Logger.d(MODULE_NAME, "V2X=== Window 30秒倒计时结束。。。");
// 移出Window详细信息
close();
};
} else {
handlerV2XEvent.removeCallbacks(runnableV2XEvent);
}
int expireTime = mV2XPushMessageEntity.getExpireTime();
Logger.d(MODULE_NAME, "V2X=== Window 展示开始倒计时:" + expireTime);
handlerV2XEvent.postDelayed(runnableV2XEvent, expireTime);
}
}
}

View File

@@ -4,20 +4,22 @@ import android.content.Context;
import android.content.Intent;
import android.util.AttributeSet;
import android.view.LayoutInflater;
import android.view.View;
import android.widget.Button;
import androidx.constraintlayout.widget.ConstraintLayout;
import androidx.localbroadcastmanager.content.LocalBroadcastManager;
import com.google.android.flexbox.FlexboxLayout;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.V2XConst;
import com.mogo.module.v2x.alarm.V2XAlarmServer;
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes;
import com.mogo.module.v2x.utils.TestOnLineCarUtils;
import com.mogo.module.v2x.utils.ToastUtils;
import java.util.List;
@@ -29,8 +31,10 @@ import java.util.List;
* version: 1.0
*/
public class V2XTestConsoleWindow extends ConstraintLayout {
private FlexboxLayout mFlTestPanel;
private Button mBtnTriggerOpen;
private Button mBtnTriggerRoadEvent;
private Button mBtnClearRoadEvent;
private Button mBtnTriggerPushEvent;
private Button mBtnTriggerPushLiveCarEvent;
private Button mBtnTriggerAnimationEvent;
@@ -54,6 +58,9 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
private void initView(Context context) {
LayoutInflater.from(context).inflate(R.layout.window_test_console, this);
mFlTestPanel = findViewById(R.id.flTestPanel);
mBtnTriggerOpen = findViewById(R.id.btnTriggerOpen);
mBtnClearRoadEvent = findViewById(R.id.btnClearRoadEvent);
mBtnTriggerRoadEvent = findViewById(R.id.btnTriggerRoadEvent);
mBtnTriggerPushEvent = findViewById(R.id.btnTriggerPushEvent);
mBtnTriggerPushLiveCarEvent = findViewById(R.id.btnTriggerPushLiveCarEvent);
@@ -62,6 +69,13 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
mBtnTriggerSeekHelpEvent = findViewById(R.id.btnTriggerSeekHelpEvent);
mBtnTriggerParkEvent = findViewById(R.id.btnTriggerParkEvent);
mBtnTriggerOpen.setOnClickListener(v -> mFlTestPanel.setVisibility(GONE));
mBtnClearRoadEvent.setOnClickListener(v -> {
V2XAlarmServer.mAlertRoadEventList.clear();
ToastUtils.showShort("缓存已清除");
});
mBtnTriggerRoadEvent.setOnClickListener(v -> {
V2XMessageEntity<V2XRoadEventEntity> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioRoadEventData();
@@ -82,7 +96,7 @@ public class V2XTestConsoleWindow extends ConstraintLayout {
mBtnTriggerPushLiveCarEvent.setOnClickListener(v -> {
V2XMessageEntity<V2XPushMessageEntity> v2XMessageEntity =
TestOnLineCarUtils.getV2XScenarioPushEventData();
TestOnLineCarUtils.getV2XScenarioPushLiveEventData();
Intent intent = new Intent(V2XConst.BROADCAST_SCENE_HANDLER_ACTION);
intent.putExtra(V2XConst.BROADCAST_SCENE_EXTRA_KEY, v2XMessageEntity);

View File

@@ -2,11 +2,11 @@ package com.mogo.module.v2x.utils;
import com.mogo.module.common.entity.MarkerExploreWay;
import com.mogo.module.common.entity.MarkerResponse;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes;
import com.mogo.module.common.entity.V2XMessageEntity;
import com.mogo.module.common.entity.V2XPushMessageEntity;
import com.mogo.module.common.entity.V2XRoadEventEntity;
import com.mogo.module.v2x.R;
import com.mogo.module.v2x.entity.net.V2XSpecialCarRes;
import com.mogo.utils.network.utils.GsonUtil;
import java.io.ByteArrayOutputStream;
@@ -122,6 +122,40 @@ public class TestOnLineCarUtils {
return null;
}
/**
* 模拟H5推送直播数据
*/
public static V2XMessageEntity<V2XPushMessageEntity> getV2XScenarioPushLiveEventData() {
try {
InputStream inputStream = V2XUtils.getApp()
.getResources()
.openRawResource(R.raw.scenario_push_live_event_data);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
int len = -1;
byte[] buffer = new byte[1024];
while ((len = inputStream.read(buffer)) != -1) {
baos.write(buffer, 0, len);
}
inputStream.close();
// 加载数据源
V2XPushMessageEntity v2xRoadEventEntity = GsonUtil.objectFromJson(baos.toString(), V2XPushMessageEntity.class);
V2XMessageEntity<V2XPushMessageEntity> v2xMessageEntity = new V2XMessageEntity<>();
// 控制类型
v2xMessageEntity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_PUSH_LIVE_CAR_WARNING);
// 设置数据
v2xMessageEntity.setContent(v2xRoadEventEntity);
// 控制展示状态
v2xMessageEntity.setShowState(true);
return v2xMessageEntity;
} catch (Exception e) {
e.printStackTrace();
}
return null;
}
/**
* 模拟H5推送场景动画数据
*/

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.9 KiB

After

Width:  |  Height:  |  Size: 8.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 6.0 KiB

After

Width:  |  Height:  |  Size: 5.2 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 2.2 KiB

After

Width:  |  Height:  |  Size: 3.9 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 20 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 16 KiB

After

Width:  |  Height:  |  Size: 12 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 4.9 KiB

After

Width:  |  Height:  |  Size: 9.2 KiB

View File

@@ -5,6 +5,7 @@
android:layout_width="match_parent"
android:layout_height="@dimen/module_v2x_fatigue_driving_window_height_ground"
android:background="@drawable/v2x_fault_help_bg"
android:paddingStart="@dimen/dp_40"
android:paddingEnd="@dimen/dp_40"
app:roundLayoutRadius="@dimen/dp_40">
@@ -13,15 +14,14 @@
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center"
android:layout_marginStart="@dimen/dp_13"
android:layout_marginTop="@dimen/dp_16"
android:layout_marginStart="@dimen/dp_10"
android:layout_marginTop="@dimen/dp_40"
android:layout_marginEnd="@dimen/dp_7"
android:layout_marginBottom="@dimen/dp_6"
android:background="@drawable/bg_v2x_event_type_orange"
android:gravity="center_vertical"
android:paddingStart="@dimen/dp_13"
android:paddingStart="@dimen/dp_23"
android:paddingTop="@dimen/dp_5"
android:paddingEnd="@dimen/dp_13"
android:paddingEnd="@dimen/dp_23"
android:paddingBottom="@dimen/dp_5"
android:text="求助信息"
android:textColor="@android:color/white"
@@ -32,16 +32,15 @@
<com.mogo.service.imageloader.MogoImageView
android:id="@+id/ivFaultHelpHead"
android:layout_width="@dimen/dp_108"
android:layout_height="@dimen/dp_108"
android:layout_width="@dimen/dp_75"
android:layout_height="@dimen/dp_75"
android:layout_alignParentEnd="true"
android:layout_alignParentBottom="true"
android:layout_marginStart="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_21"
android:layout_marginEnd="@dimen/dp_31"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintEnd_toEndOf="@+id/rlRoadEventList"
app:layout_constraintStart_toEndOf="@+id/tvImgTextContent"
app:layout_constraintTop_toTopOf="parent"
app:layout_constraintStart_toStartOf="@+id/tvImgTextContent"
app:layout_constraintTop_toBottomOf="@+id/tvImgTextContent"
app:miv_borderColor="#4cffffff"
app:miv_failureHolder="@drawable/icon_default_user_head"
app:miv_overlayImageId="@drawable/icon_default_user_head"
@@ -53,10 +52,10 @@
android:id="@+id/tvFaultHelpName"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_22"
android:layout_marginStart="@dimen/dp_10"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_34"
app:layout_constraintBottom_toTopOf="@id/tvFaultHelpEventTime"
android:textSize="@dimen/dp_28"
android:textStyle="bold"
app:layout_constraintStart_toEndOf="@id/ivFaultHelpHead"
app:layout_constraintTop_toTopOf="@+id/ivFaultHelpHead"
app:layout_constraintVertical_chainStyle="packed"
@@ -67,13 +66,10 @@
android:id="@+id/tvFaultHelpEventTime"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_22"
android:layout_marginTop="@dimen/dp_20"
android:alpha="0.59"
android:textColor="@android:color/white"
android:textSize="@dimen/dp_26"
app:layout_constraintBottom_toBottomOf="@+id/ivFaultHelpHead"
app:layout_constraintStart_toEndOf="@id/ivFaultHelpHead"
app:layout_constraintStart_toStartOf="@id/tvFaultHelpName"
app:layout_constraintTop_toBottomOf="@id/tvFaultHelpName"
tools:text="15:30发布求助信息" />

View File

@@ -6,6 +6,7 @@
android:layout_width="match_parent"
android:layout_height="@dimen/module_v2x_fatigue_driving_window_height_ground"
android:background="@color/live_video_background_color"
android:paddingStart="@dimen/dp_40"
android:paddingEnd="@dimen/dp_40"
app:roundLayoutRadius="@dimen/dp_40">
@@ -13,7 +14,6 @@
android:id="@+id/ivIconP"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_20"
android:src="@drawable/icon_parking_p"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent"
@@ -23,7 +23,7 @@
android:id="@+id/ivIconPIcon"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginStart="@dimen/dp_20"
android:layout_marginStart="@dimen/dp_30"
android:layout_marginTop="@dimen/dp_20"
android:src="@drawable/icon_parting_icon"
app:layout_constraintBottom_toTopOf="@+id/tvAddress"
@@ -57,7 +57,7 @@
app:layout_constraintBottom_toBottomOf="@+id/ivToNav"
app:layout_constraintEnd_toStartOf="@+id/ivToNav"
app:layout_constraintTop_toTopOf="@+id/ivToNav"
tools:text="300M" />
tools:text="300m" />
<ImageView
android:id="@+id/ivToNav"

View File

@@ -2,7 +2,7 @@
<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/rvFaultHelp"
android:id="@+id/rvRoadEventList"
android:layout_width="match_parent"
android:layout_height="@dimen/module_v2x_fatigue_driving_window_height_ground"
android:orientation="vertical"

View File

@@ -7,17 +7,43 @@
android:paddingStart="@dimen/module_main_v2x_animation_width">
<com.google.android.flexbox.FlexboxLayout
android:id="@+id/flTestPanel"
android:layout_width="match_parent"
android:layout_height="wrap_content"
android:layout_alignParentBottom="true"
android:orientation="horizontal"
android:paddingStart="@dimen/dp_150"
android:paddingEnd="@dimen/dp_100"
app:alignContent="flex_start"
app:alignItems="center"
app:flexDirection="row"
android:paddingStart="@dimen/dp_150"
app:flexWrap="wrap"
app:justifyContent="flex_start">
<Button
android:id="@+id/btnTriggerOpen"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:padding="@dimen/dp_10"
android:text="隐藏测试按钮面板"
android:background="#FFF"
android:textColor="#000"
android:textSize="@dimen/dp_22"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/btnClearRoadEvent"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:background="#6BCF23"
android:padding="@dimen/dp_10"
android:text="清除缓存播报"
android:textColor="#FFFFFF"
android:textSize="@dimen/dp_22"
app:layout_constraintBottom_toBottomOf="parent"
app:layout_constraintStart_toStartOf="parent" />
<Button
android:id="@+id/btnTriggerRoadEvent"
android:layout_width="wrap_content"

View File

@@ -14,11 +14,11 @@
"zoom": true,
"zoomScale": 15,
"location": {
"lat": 39.951326,
"lon": 116.343487
"lat": 39.968678,
"lon": 116.405467
},
"lat": 39.951326,
"lon": 116.343487,
"lat": 39.968678,
"lon": 116.405467,
"userHead": "https://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/defaultUserHeadImg/5.png",
"msgImgUrl": "https://upload.jianshu.io/users/upload_avatars/7663825/7c28763e-002b-4e89-8dea-5b8da210ef2c.jpg"
}

View File

@@ -16,6 +16,8 @@
"lat": 39.971417,
"lon": 116.415853
},
"lat": 39.968678,
"lon": 116.405467,
"userHead": "https://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/defaultUserHeadImg/5.png",
"msgImgUrl": "https://upload.jianshu.io/users/upload_avatars/7663825/7c28763e-002b-4e89-8dea-5b8da210ef2c.jpg"
}

View File

@@ -0,0 +1,23 @@
{
"sceneId": "100016",
"alarmContent": "顺风车提醒",
"expireTime": 30000,
"sceneCategory": 0,
"sceneDescription": "周围有路人发起顺风车",
"sceneName": "顺风车提醒",
"sceneLevel": 0,
"videoUrl": "rtmp://58.200.131.2:1935/livetv/hunantv",
"videoChannel": "C_1",
"videoSn": "XTCBA90740400625",
"tts": "附近直播车辆",
"zoom": true,
"zoomScale": 15,
"location": {
"lat": 39.971417,
"lon": 116.415853
},
"lat": 39.968678,
"lon": 116.405467,
"headImgUrl": "https://yycp-static-1255510688.cos.ap-beijing.myqcloud.com/defaultUserHeadImg/5.png",
"msgImgUrl": "https://upload.jianshu.io/users/upload_avatars/7663825/7c28763e-002b-4e89-8dea-5b8da210ef2c.jpg"
}

View File

@@ -8,11 +8,11 @@
<dimen name="module_v2x_event_window_height_ground">450px</dimen>
<dimen name="module_v2x_push_img_height">390px</dimen>
<dimen name="module_v2x_fatigue_driving_window_height_ground">230px</dimen>
<dimen name="module_v2x_fatigue_driving_window_height_ground">220px</dimen>
<dimen name="module_v2x_event_icon_size">160px</dimen>
<dimen name="module_v2x_event_icon_size">147px</dimen>
<dimen name="module_v2x_event_button_size">118px</dimen>
<dimen name="module_v2x_event_button_size">98px</dimen>
<dimen name="module_v2x_event_button_size_detail">130px</dimen>
<dimen name="module_v2x_event_image_height">320px</dimen>