重命名视图名称
This commit is contained in:
@@ -7,11 +7,12 @@ import androidx.recyclerview.widget.RecyclerView;
|
||||
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XWindowTypeEnum;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XFatigueDrivingDetailVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XIllegalParkDetailVH;
|
||||
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.V2XPushEventDetailVH;
|
||||
import com.mogo.module.v2x.adapter.holder.V2XRoadEventDetailVH;
|
||||
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;
|
||||
|
||||
@@ -41,22 +42,26 @@ public class V2XRoadEventAdapter extends RecyclerView.Adapter<RecyclerView.ViewH
|
||||
break;
|
||||
//道路事件详情
|
||||
case V2XWindowTypeEnum.ROAD_EVENT_WINDOW:
|
||||
holder = new V2XRoadEventDetailVH(parent);
|
||||
holder = new V2XRoadEventVH(parent);
|
||||
break;
|
||||
//违章停车
|
||||
case V2XWindowTypeEnum.ILLEGAL_PARK_WINDOW:
|
||||
holder = new V2XIllegalParkDetailVH(parent);
|
||||
holder = new V2XIllegalParkVH(parent);
|
||||
break;
|
||||
//推送展示
|
||||
case V2XWindowTypeEnum.PUSH_EVENT_WINDOW:
|
||||
holder = new V2XPushEventDetailVH(parent);
|
||||
holder = new V2XPushEventVH(parent);
|
||||
break;
|
||||
//疲劳驾驶
|
||||
case V2XWindowTypeEnum.FATIGUE_DRIVING_WINDOW:
|
||||
holder = new V2XFatigueDrivingDetailVH(parent);
|
||||
holder = new V2XFatigueDrivingVH(parent);
|
||||
break;
|
||||
//他人故障求助
|
||||
case V2XWindowTypeEnum.SEEK_HELP_WINDOW:
|
||||
holder = new V2XOtherSeekHelpVH(parent);
|
||||
break;
|
||||
default:
|
||||
holder = new V2XPushEventDetailVH(parent);
|
||||
holder = new V2XPushEventVH(parent);
|
||||
}
|
||||
return holder;
|
||||
}
|
||||
@@ -66,17 +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 V2XIllegalParkDetailVH) {
|
||||
((V2XIllegalParkDetailVH) holder).initView(itemList.get(position));
|
||||
if (holder instanceof V2XIllegalParkVH) {
|
||||
((V2XIllegalParkVH) holder).initView(itemList.get(position));
|
||||
}
|
||||
if (holder instanceof V2XPushEventDetailVH) {
|
||||
((V2XPushEventDetailVH) holder).initView(itemList.get(position));
|
||||
if (holder instanceof V2XPushEventVH) {
|
||||
((V2XPushEventVH) holder).initView(itemList.get(position));
|
||||
}
|
||||
if (holder instanceof V2XFatigueDrivingDetailVH) {
|
||||
((V2XFatigueDrivingDetailVH) 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));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -26,7 +26,7 @@ import com.mogo.module.v2x.voice.V2XVoiceManager;
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XFatigueDrivingDetailVH extends V2XBaseViewHolder {
|
||||
public class V2XFatigueDrivingVH extends V2XBaseViewHolder {
|
||||
|
||||
private TextView mTvAddress, mTvAddressDistance;
|
||||
private ImageView mIvToNav;
|
||||
@@ -36,7 +36,7 @@ public class V2XFatigueDrivingDetailVH extends V2XBaseViewHolder {
|
||||
// 语音控制导航
|
||||
private V2XVoiceCallbackListener mNaviCb = (command, intent) -> triggerStartNavi(mNoveltyInfo);
|
||||
|
||||
public V2XFatigueDrivingDetailVH(ViewGroup viewGroup) {
|
||||
public V2XFatigueDrivingVH(ViewGroup viewGroup) {
|
||||
super(LayoutInflater.from(viewGroup.getContext())
|
||||
.inflate(R.layout.window_fatigue_driving, viewGroup, false));
|
||||
mTvAddress = itemView.findViewById(R.id.tvAddress);
|
||||
@@ -29,7 +29,7 @@ import static com.mogo.module.v2x.V2XConst.MODULE_NAME;
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XIllegalParkDetailVH extends V2XBaseViewHolder {
|
||||
public class V2XIllegalParkVH extends V2XBaseViewHolder {
|
||||
private TextView mAddressTv;
|
||||
private TextView mIllegalNumTv;
|
||||
private HeartLikeView mIlIllegalParkingLike;
|
||||
@@ -41,7 +41,7 @@ public class V2XIllegalParkDetailVH extends V2XBaseViewHolder {
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackYouYongListener = (command, intent) -> roadReportTrue();
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackMeiYongListener = (command, intent) -> roadReportErr();
|
||||
|
||||
public V2XIllegalParkDetailVH(ViewGroup viewGroup) {
|
||||
public V2XIllegalParkVH(ViewGroup viewGroup) {
|
||||
super(LayoutInflater.from(viewGroup.getContext())
|
||||
.inflate(R.layout.window_illegal_parking, viewGroup, false));
|
||||
|
||||
@@ -0,0 +1,194 @@
|
||||
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.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.window_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("" + 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(() -> V2XFatigueDrivingScenario.getInstance().close(), 1000);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -14,12 +14,10 @@ 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;
|
||||
|
||||
@@ -30,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;
|
||||
|
||||
@@ -57,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();
|
||||
@@ -65,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);
|
||||
@@ -86,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();
|
||||
@@ -125,9 +125,9 @@ public class V2XPushEventDetailVH extends V2XBaseViewHolder {
|
||||
.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)
|
||||
@@ -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);
|
||||
// 设置视图状态监听
|
||||
Reference in New Issue
Block a user