add voice next and previous
This commit is contained in:
@@ -13,6 +13,8 @@ public class TanluConstants {
|
||||
public static final String MODEL_NAME = "CARD_TYPE_ROAD_CONDITION";
|
||||
|
||||
public static final String[] CMD_PLAY_ROAD_CONDITION = {"播放路况"};
|
||||
public static final String[] CMD_THE_PREVIOUS = {"上一条"};
|
||||
public static final String[] CMD_THE_NEXT = {"下一条"};
|
||||
|
||||
//上报路况
|
||||
public static final String UPLOAD_ROAD_CONDITION = "command_upload_roadcondition";
|
||||
@@ -21,6 +23,11 @@ public class TanluConstants {
|
||||
//播放
|
||||
public static final String PLAY_VIDEO = "com.zhidao.tanlu.play";
|
||||
|
||||
//上一条
|
||||
public static final String THE_PREVIOUS = "com.zhidao.tanlu.previous";
|
||||
//下一条
|
||||
public static final String THE_NEXT = "com.zhidao.tanlu.next";
|
||||
|
||||
//分享封路
|
||||
public static final String SHARE_ROAD_CLOSURE = "com.zhidao.share.road.closure";
|
||||
//分享交通检查
|
||||
|
||||
@@ -495,6 +495,10 @@ import static com.mogo.module.tanlu.video.VideoInitKt.initVideo;
|
||||
.build(simpleCoverVideoPlayer);
|
||||
simpleCoverVideoPlayer.getStartButton().performClick();
|
||||
traceVideoPlayStatusData();
|
||||
} else if (cmd.equals(TanluConstants.THE_PREVIOUS)) { //上一条
|
||||
handlePrevious();
|
||||
} else if (cmd.equals(TanluConstants.THE_NEXT)) { //下一条
|
||||
handleNext();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -584,35 +588,48 @@ import static com.mogo.module.tanlu.video.VideoInitKt.initVideo;
|
||||
public void onClick(View view) {
|
||||
int id = view.getId();
|
||||
if (id == R.id.tv_previous_res) { //上一个
|
||||
//判断是图片还是视频,第一个时,上一个不可点击
|
||||
Log.e(TAG, " tv_previous_res --1-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size());
|
||||
if (currentPosition < 0) {
|
||||
currentPosition = markerExploreWayList.size();
|
||||
}
|
||||
currentPosition--;
|
||||
Log.d(TAG, " tv_previous_res --2-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size());
|
||||
if (markerExploreWayList.size() > currentPosition && currentPosition >= 0) {
|
||||
handleMarkerExploreWay(markerExploreWayList.get(currentPosition));
|
||||
moveToMarcker(markerExploreWayList.get(currentPosition).getLocation().getLat(), markerExploreWayList.get(currentPosition).getLocation().getLon());
|
||||
}
|
||||
handlePrevious();
|
||||
} else if (id == R.id.tv_next_res) { //下一个
|
||||
//判断是图片还是视频,最后一个时,下一个不可点击
|
||||
Log.e(TAG, " tv_next_res --1-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size());
|
||||
if (currentPosition >= markerExploreWayList.size()) {
|
||||
currentPosition = 0;
|
||||
}
|
||||
currentPosition++;
|
||||
Log.d(TAG, " tv_next_res --2-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size());
|
||||
if (markerExploreWayList.size() > currentPosition) {
|
||||
handleMarkerExploreWay(markerExploreWayList.get(currentPosition));
|
||||
moveToMarcker(markerExploreWayList.get(currentPosition).getLocation().getLat(), markerExploreWayList.get(currentPosition).getLocation().getLon());
|
||||
}
|
||||
handleNext();
|
||||
|
||||
} else if (id == R.id.tv_main_empty) { //上报路况
|
||||
sendShareReceiver("1");
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 上一条逻辑
|
||||
*/
|
||||
private void handlePrevious() {
|
||||
//判断是图片还是视频,第一个时,上一个不可点击
|
||||
Log.e(TAG, " tv_previous_res --1-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size());
|
||||
if (currentPosition < 0) {
|
||||
currentPosition = markerExploreWayList.size();
|
||||
}
|
||||
currentPosition--;
|
||||
Log.d(TAG, " tv_previous_res --2-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size());
|
||||
if (markerExploreWayList.size() > currentPosition && currentPosition >= 0) {
|
||||
handleMarkerExploreWay(markerExploreWayList.get(currentPosition));
|
||||
moveToMarcker(markerExploreWayList.get(currentPosition).getLocation().getLat(), markerExploreWayList.get(currentPosition).getLocation().getLon());
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* 下一条逻辑
|
||||
*/
|
||||
private void handleNext() {
|
||||
//判断是图片还是视频,最后一个时,下一个不可点击
|
||||
Log.d(TAG, " tv_next_res --1-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size());
|
||||
if (currentPosition >= markerExploreWayList.size()) {
|
||||
currentPosition = 0;
|
||||
}
|
||||
currentPosition++;
|
||||
Log.d(TAG, " tv_next_res --2-> currentPosition = " + currentPosition + " >> size= " + markerExploreWayList.size());
|
||||
if (markerExploreWayList.size() > currentPosition) {
|
||||
handleMarkerExploreWay(markerExploreWayList.get(currentPosition));
|
||||
moveToMarcker(markerExploreWayList.get(currentPosition).getLocation().getLat(), markerExploreWayList.get(currentPosition).getLocation().getLon());
|
||||
}
|
||||
}
|
||||
|
||||
private void moveToMarcker(double lat, double lon) {
|
||||
MogoLatLng latLng = new MogoLatLng(lat, lon);
|
||||
@@ -763,6 +780,10 @@ import static com.mogo.module.tanlu.video.VideoInitKt.initVideo;
|
||||
//免唤醒
|
||||
AIAssist.getInstance(getActivity()).registerUnWakeupCommand(TanluConstants.PLAY_VIDEO,
|
||||
TanluConstants.CMD_PLAY_ROAD_CONDITION, mogoVoiceListener);
|
||||
AIAssist.getInstance(getActivity()).registerUnWakeupCommand(TanluConstants.THE_PREVIOUS,
|
||||
TanluConstants.CMD_THE_PREVIOUS, mogoVoiceListener);
|
||||
AIAssist.getInstance(getActivity()).registerUnWakeupCommand(TanluConstants.THE_NEXT,
|
||||
TanluConstants.CMD_THE_NEXT, mogoVoiceListener);
|
||||
|
||||
isCurrentPage = true;
|
||||
Logger.d(TAG, "tanlu卡片 onPerform 有效 ---->");
|
||||
@@ -873,6 +894,8 @@ import static com.mogo.module.tanlu.video.VideoInitKt.initVideo;
|
||||
}
|
||||
|
||||
AIAssist.getInstance(getActivity()).unregisterUnWakeupCommand(TanluConstants.PLAY_VIDEO);
|
||||
AIAssist.getInstance(getActivity()).unregisterUnWakeupCommand(TanluConstants.THE_PREVIOUS);
|
||||
AIAssist.getInstance(getActivity()).unregisterUnWakeupCommand(TanluConstants.THE_NEXT);
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
Reference in New Issue
Block a user