完成了UGC场景基础显示以及TTS
This commit is contained in:
@@ -1,11 +1,19 @@
|
||||
package com.mogo.module.v2x.adapter.holder;
|
||||
|
||||
import android.view.LayoutInflater;
|
||||
import android.view.View;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.ImageView;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.commons.voice.AIAssist;
|
||||
import com.mogo.module.common.entity.MarkerExploreWay;
|
||||
import com.mogo.module.common.entity.V2XEventShowEntity;
|
||||
import com.mogo.module.common.entity.V2XRoadEventEntity;
|
||||
import com.mogo.module.v2x.R;
|
||||
import com.mogo.module.v2x.scenario.scene.fatigue.V2XFatigueDrivingScenario;
|
||||
import com.mogo.module.v2x.utils.EventTypeUtils;
|
||||
import com.mogo.module.v2x.utils.V2XUtils;
|
||||
|
||||
/**
|
||||
* e-mail : 1358506549@qq.com
|
||||
@@ -13,19 +21,72 @@ import com.mogo.module.v2x.scenario.scene.fatigue.V2XFatigueDrivingScenario;
|
||||
* desc : 道路事件UGC
|
||||
* 需求地址
|
||||
* http://wiki.zhidaohulian.com/pages/viewpage.action?pageId=42321443
|
||||
*
|
||||
* @author donghongyu
|
||||
*/
|
||||
public class V2XEventUgcVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
|
||||
private ImageView ivEventTypeIcon;
|
||||
private TextView tvEventUgcTitle;
|
||||
private ImageView ivEventReportTrue;
|
||||
private ImageView ivEventReportErr;
|
||||
|
||||
// 当前的新鲜事儿信息
|
||||
private MarkerExploreWay mNoveltyInfo;
|
||||
private V2XRoadEventEntity mV2XRoadEventEntity;
|
||||
private V2XEventShowEntity mV2XEventShowEntity;
|
||||
|
||||
public V2XEventUgcVH(ViewGroup viewGroup) {
|
||||
super(LayoutInflater.from(viewGroup.getContext())
|
||||
.inflate(R.layout.item_v2x_event_ugc, viewGroup, false));
|
||||
|
||||
ivEventTypeIcon = itemView.findViewById(R.id.ivEventTypeIcon);
|
||||
tvEventUgcTitle = itemView.findViewById(R.id.tvEventUgcTitle);
|
||||
ivEventReportTrue = itemView.findViewById(R.id.ivEventReportTrue);
|
||||
ivEventReportErr = itemView.findViewById(R.id.ivEventReportErr);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initView(V2XEventShowEntity v2XEventShowEntity) {
|
||||
try {
|
||||
if (v2XEventShowEntity == null) {
|
||||
return;
|
||||
}
|
||||
mV2XEventShowEntity = v2XEventShowEntity;
|
||||
mV2XRoadEventEntity = v2XEventShowEntity.getV2XRoadEventEntity();
|
||||
|
||||
if (mV2XRoadEventEntity == null) {
|
||||
return;
|
||||
}
|
||||
mNoveltyInfo = mV2XRoadEventEntity.getNoveltyInfo();
|
||||
|
||||
if (mNoveltyInfo != null) {
|
||||
|
||||
Object[] ugcTitleStr = EventTypeUtils.getUgcTitleStr(mNoveltyInfo.getPoiType());
|
||||
|
||||
if (ugcTitleStr != null) {
|
||||
tvEventUgcTitle.setText(((String) ugcTitleStr[0]).replace("####", mNoveltyInfo.getAddr()));
|
||||
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice((String) ugcTitleStr[1], null);
|
||||
ivEventTypeIcon.setImageResource((Integer) ugcTitleStr[2]);
|
||||
}
|
||||
|
||||
|
||||
ivEventReportTrue.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
});
|
||||
ivEventReportErr.setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -78,7 +78,6 @@ public class V2XRoadEventVH extends V2XBaseViewHolder<V2XEventShowEntity> {
|
||||
private MarkerExploreWay mNoveltyInfo;
|
||||
private V2XRoadEventEntity mV2XRoadEventEntity;
|
||||
private V2XEventShowEntity mV2XEventShowEntity;
|
||||
private V2XRoadVideoCarScenario mV2XRoadVideoCarScenario;
|
||||
|
||||
// 拨打车聊聊语音回调
|
||||
private V2XVoiceCallbackListener v2XVoiceCallbackCallListener = new V2XVoiceCallbackListener() {
|
||||
|
||||
@@ -154,4 +154,10 @@ public interface V2XApiService {
|
||||
@FormUrlEncoded
|
||||
@POST("/deva/poiInfoFabulous/car/poi/no/RespondingToHelp/v1")
|
||||
Observable<BaseData> respondingToHelp(@FieldMap Map<String, Object> params);
|
||||
/**
|
||||
* 响应求助
|
||||
*/
|
||||
@FormUrlEncoded
|
||||
@POST("/deva/car/poi/no/manualMarkingTrafficJam")
|
||||
Observable<BaseData> manualMarkingTrafficJam(@FieldMap Map<String, Object> params);
|
||||
}
|
||||
|
||||
@@ -132,4 +132,44 @@ public class EventTypeUtils {
|
||||
}
|
||||
return isRoadEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 获取 UGC 问答使用的 Title 和 TTS 以及展示图表
|
||||
*
|
||||
* @param poiType 事件类型
|
||||
* @return UGC 文案
|
||||
*/
|
||||
public static Object[] getUgcTitleStr(String poiType) {
|
||||
Object[] str = new Object[3];
|
||||
switch (poiType) {
|
||||
// 封路
|
||||
case V2XPoiTypeEnum.ROAD_CLOSED:
|
||||
str[0] = "你刚经过 #### 封路吗?";
|
||||
str[1] = "你刚路过的路段封路吗?您可以直接对我说封路、或者不封路。";
|
||||
str[2] = R.drawable.v_to_x_event_ugc_fenglu;
|
||||
break;
|
||||
// 施工
|
||||
case V2XPoiTypeEnum.FOURS_ROAD_WORK:
|
||||
str[0] = "你刚经过 #### 有道路施工吗?";
|
||||
str[1] = "你刚路过的路段道路施工吗?您可以直接对我说有施工、或者没有施工。";
|
||||
str[2] = R.drawable.v_to_x_event_ugc_shigong;
|
||||
break;
|
||||
// 拥堵
|
||||
case V2XPoiTypeEnum.FOURS_BLOCK_UP:
|
||||
str[0] = "你刚路过 #### 堵不堵?";
|
||||
str[1] = "你刚路过的路段堵不堵?您可以直接对我说拥赌、或者不堵。";
|
||||
str[2] = R.drawable.v_to_x_event_ugc_yongdu;
|
||||
break;
|
||||
// 事故
|
||||
case V2XPoiTypeEnum.FOURS_ACCIDENT:
|
||||
str[0] = "你刚经过 #### 有事故发生吗?";
|
||||
str[1] = "你刚路过的路段有交通事故吗?您可以直接对我说有事故、或者没有事故。";
|
||||
str[2] = R.drawable.v_to_x_event_ugc_shigu;
|
||||
break;
|
||||
default:
|
||||
return null;
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@
|
||||
android:paddingEnd="@dimen/dp_62">
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/ivFaultHelpHead"
|
||||
android:id="@+id/ivEventTypeIcon"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_alignParentEnd="true"
|
||||
@@ -20,7 +20,7 @@
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvFaultHelpName"
|
||||
android:id="@+id/tvEventUgcTitle"
|
||||
android:layout_width="0dp"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginStart="@dimen/dp_10"
|
||||
@@ -28,10 +28,10 @@
|
||||
android:textColor="@color/v2x_FFF_333"
|
||||
android:textSize="@dimen/module_v2x_event_help_title_text_size"
|
||||
android:textStyle="bold"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/ivFaultHelpHead"
|
||||
app:layout_constraintBottom_toBottomOf="@+id/ivEventTypeIcon"
|
||||
app:layout_constraintEnd_toStartOf="@+id/ivEventReportTrue"
|
||||
app:layout_constraintStart_toEndOf="@id/ivFaultHelpHead"
|
||||
app:layout_constraintTop_toTopOf="@+id/ivFaultHelpHead"
|
||||
app:layout_constraintStart_toEndOf="@id/ivEventTypeIcon"
|
||||
app:layout_constraintTop_toTopOf="@+id/ivEventTypeIcon"
|
||||
app:layout_constraintVertical_chainStyle="packed"
|
||||
tools:text="你刚路过的路段堵不堵?您可以直接对我说拥赌、或者不堵。" />
|
||||
|
||||
|
||||
@@ -3,13 +3,13 @@
|
||||
"expireTime":20000,
|
||||
"isShowEventButton":false,
|
||||
"location":{
|
||||
"address":"北五环(测试位置不准确)",
|
||||
"address":"北三环环球贸易中心",
|
||||
"angle":270,
|
||||
"lat":39.966668,
|
||||
"lon":116.411211
|
||||
},
|
||||
"noveltyInfo":{
|
||||
"addr":"北五环(测试位置不准确)",
|
||||
"addr":"北三环环球贸易中心",
|
||||
"canLive":false,
|
||||
"cityName":"",
|
||||
"direction":0,
|
||||
@@ -25,12 +25,12 @@
|
||||
}
|
||||
],
|
||||
"location":{
|
||||
"address":"北五环(测试位置不准确)",
|
||||
"address":"北三环环球贸易中心",
|
||||
"angle":270,
|
||||
"lat":39.966668,
|
||||
"lon":116.411211
|
||||
},
|
||||
"poiType":"10002",
|
||||
"poiType":"10006",
|
||||
"type":"CARD_TYPE_ROAD_CONDITION",
|
||||
"uploadType":"2",
|
||||
"userInfo":{
|
||||
@@ -41,5 +41,5 @@
|
||||
"userName":"零下的雨"
|
||||
}
|
||||
},
|
||||
"poiType":"10002"
|
||||
"poiType":"10006"
|
||||
}
|
||||
Reference in New Issue
Block a user