diff --git a/gradle.properties b/gradle.properties index 3d9c247180..3275b61624 100644 --- a/gradle.properties +++ b/gradle.properties @@ -145,7 +145,7 @@ MOGO_OCH_TAXI_VERSION=1.0.0 ######## 外部依赖引用 # 车聊聊 -CARCHATTING_VERSION=2.2.311 +CARCHATTING_VERSION=2.2.318 # 车聊聊接口 CARCHATTINGPROVIDER_VERSION=1.1.11 # websocket diff --git a/modules/mogo-module-service/src/main/java/com/mogo/module/service/strategy/CarIconDisplayStrategy.java b/modules/mogo-module-service/src/main/java/com/mogo/module/service/strategy/CarIconDisplayStrategy.java index 8513281d10..3c9ba2bab3 100644 --- a/modules/mogo-module-service/src/main/java/com/mogo/module/service/strategy/CarIconDisplayStrategy.java +++ b/modules/mogo-module-service/src/main/java/com/mogo/module/service/strategy/CarIconDisplayStrategy.java @@ -198,7 +198,7 @@ public class CarIconDisplayStrategy { new MogoMarkerOptions() .icons(mBitmapFrames) .period(1) - .zIndex(1000) + .zIndex(0) .autoManager(false) .anchor(0.5f, 0.5f) .position(MarkerServiceHandler.getMapService().getNavi(AbsMogoApplication.getApp()).getCarLocation2())); diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpScenario.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpScenario.java index 09fa98f8ee..52a0802733 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpScenario.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpScenario.java @@ -47,10 +47,10 @@ public class V2XCarForHelpScenario extends AbsV2XScenario implements IM private V2XSeekHelpButton mV2XSeekHelpButton; public V2XCarForHelpScenario() { - setV2XWindow(new V2XCarForHelpWindow(V2XServiceManager.getContext())); mV2XSeekHelpButton = new V2XSeekHelpButton(); setV2XButton(mV2XSeekHelpButton); V2XServiceManager.getMoGoStatusManager().registerStatusChangedListener(TAG, StatusDescriptor.SEEK_HELPING, this); + V2XServiceManager.getMoGoStatusManager().registerStatusChangedListener(TAG, StatusDescriptor.VR_MODE, this); } @Override @@ -61,14 +61,6 @@ public class V2XCarForHelpScenario extends AbsV2XScenario implements IM } setV2XMessageEntity(v2XMessageEntity); Boolean isShow = getV2XMessageEntity().getContent(); - if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { - if (isShow) { - showWindow(); - } else { - closeWindow(); - } - return; - } if (isShow) { showButton(); mySeekHelpCountDownTimerCancel(); @@ -96,20 +88,10 @@ public class V2XCarForHelpScenario extends AbsV2XScenario implements IM @Override public void showWindow() { - if (getV2XWindow() != null) { - ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams( - ViewGroup.LayoutParams.MATCH_PARENT, - (int) V2XUtils.getApp().getResources().getDimension(R.dimen.dp_140)); - V2XServiceManager.getMogoTopViewManager().addView(getV2XWindow().getView(), layoutParams); - getV2XWindow().show(getV2XMessageEntity().getContent()); - } } @Override public void closeWindow() { -// if (getV2XWindow() != null) { -// getV2XWindow().close(); -// } } private V2XVoiceCallbackListener cancelCb = null; @@ -122,7 +104,7 @@ public class V2XCarForHelpScenario extends AbsV2XScenario implements IM if (getV2XButton() != null) { getV2XButton().setOnActionListener(this::showDialog); getV2XButton().show(); - V2XServiceManager.getMogoEntranceButtonController().showLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP, R.drawable.module_v2x_left_notice_seek_help, "正在发起求助..."); + // V2XServiceManager.getMogoEntranceButtonController().showLeftNoticeByType(IMogoEntranceButtonController.NOTICE_TYPE_SEEK_HELP, R.drawable.module_v2x_left_notice_seek_help, "正在发起求助..."); } }); } @@ -241,6 +223,18 @@ public class V2XCarForHelpScenario extends AbsV2XScenario implements IM entity.setType(V2XMessageEntity.V2XTypeEnum.ALERT_CAR_FOR_HELP); entity.setContent(isTrue); init(entity); + } else if (descriptor == StatusDescriptor.VR_MODE) { + if (V2XServiceManager.getMoGoStatusManager().isSeekHelping()) { + if (isTrue) { + ((V2XSeekHelpButton) getV2XButton()).showTopView(); + V2XServiceManager.getMogoEntranceButtonController() + .getButton(ButtonIndex.BUTTON2).setVisibility(View.GONE); + } else { + ((V2XSeekHelpButton) getV2XButton()).closeTopView(); + V2XServiceManager.getMogoEntranceButtonController() + .getButton(ButtonIndex.BUTTON2).setVisibility(View.VISIBLE); + } + } } } } diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpWindow.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpWindow.java deleted file mode 100644 index 00ecfd0077..0000000000 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpWindow.java +++ /dev/null @@ -1,114 +0,0 @@ -package com.mogo.module.v2x.scenario.scene.help; - -import android.content.Context; -import android.content.Intent; -import android.util.AttributeSet; -import android.view.LayoutInflater; -import android.view.View; -import android.widget.TextView; -import android.widget.Toast; - -import com.mogo.commons.data.BaseData; -import com.mogo.commons.voice.AIAssist; -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.v2x.listener.V2XWindowStatusListener; -import com.mogo.module.v2x.network.V2XRefreshCallback; -import com.mogo.module.v2x.scenario.scene.V2XBasWindow; -import com.mogo.module.v2x.scenario.view.IV2XWindow; -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.utils.storage.SharedPrefsMgr; - -import static com.mogo.module.v2x.V2XConst.MODULE_NAME; - -/** - * created by wujifei on 2021/4/1 16:04 - * describe: - */ -public class V2XCarForHelpWindow extends V2XBasWindow implements IV2XWindow { - private static final String TAG = MODULE_NAME + "_" + V2XCarForHelpScenario.class.getSimpleName(); - private TextView tvCancel; - private V2XVoiceCallbackListener cancelCb = (String command, Intent intent) -> { - close(); - }; - - - public V2XCarForHelpWindow(Context context) { - this(context, null); - } - - public V2XCarForHelpWindow(Context context, AttributeSet attrs) { - this(context, attrs, 0); - } - - public V2XCarForHelpWindow(Context context, AttributeSet attrs, int defStyleAttr) { - super(context, attrs, defStyleAttr); - initView(context); - } - - private void initView(Context context) { - LayoutInflater.from(context).inflate(R.layout.window_carforhelp_detail, this); - tvCancel = (TextView) findViewById(R.id.tv_cancel); - tvCancel.setOnClickListener(new OnClickListener() { - @Override - public void onClick(View v) { - close(); - } - }); - } - - @Override - public void show(Boolean entity) { - V2XVoiceManager.INSTANCE.registerWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CANCEL_HELP, cancelCb); - } - - @Override - public void close() { - if (V2XServiceManager.getMoGoStatusManager().isSeekHelping()) { - V2XServiceManager.getMoGoStatusManager().setSeekHelping(TAG, false); - SharedPrefsMgr.getInstance(V2XUtils.getApp()).putLong(V2XConst.SEEK_HELP_TIME, 0); - V2XServiceManager.getV2XRefreshModel().cancelHelpSignal(new V2XRefreshCallback() { - @Override - public void onSuccess(BaseData result) { - //移除窗体 - V2XServiceManager.getMogoTopViewManager().removeView(V2XCarForHelpWindow.this); - } - - @Override - public void onFail(String msg) { - Toast.makeText(V2XServiceManager.getContext(), msg, Toast.LENGTH_SHORT).show(); - } - }); - - } - AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("已取消", null); - //移除窗体 - V2XServiceManager.getMogoTopViewManager().removeView(V2XCarForHelpWindow.this); - V2XVoiceManager.INSTANCE.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CANCEL_HELP); - - if (V2XServiceManager.getMoGoV2XStatusManager().isOtherSeekHelpPOIShow()) { - // 移除线 - V2XServiceManager.getMoGoV2XPolylineManager().clearLine(); - // 移除事件POI - V2XServiceManager.getMoGoV2XMarkerManager().clearSpecialCarPOI(); - // 绘制上次的数据 - V2XServiceManager.getMoGoV2XMarkerManager().drawableLastAllPOI(); - } - - } - - @Override - public View getView() { - return this; - } - - @Override - public void setWindowStatusListener(V2XWindowStatusListener listener) { - - } -} diff --git a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XSeekHelpButton.java b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XSeekHelpButton.java index 7f8854db08..ac18174fed 100644 --- a/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XSeekHelpButton.java +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XSeekHelpButton.java @@ -1,7 +1,9 @@ package com.mogo.module.v2x.scenario.scene.help; import android.content.Intent; +import android.view.LayoutInflater; import android.view.View; +import android.view.ViewGroup; import android.widget.TextView; import com.mogo.commons.data.BaseData; @@ -35,6 +37,8 @@ public class V2XSeekHelpButton implements IV2XButton { private V2XVoiceCallbackListener cancelCb = (String command, Intent intent) -> { doAction(); }; + private View topView; + private void doAction() { if (mListener != null) { @@ -53,31 +57,57 @@ public class V2XSeekHelpButton implements IV2XButton { try { tv = V2XServiceManager.getMogoEntranceButtonController().getButton(ButtonIndex.BUTTON2); tv.setText("取消\n求助"); - tv.setVisibility(View.VISIBLE); tv.setOnClickListener(v -> { //调用取消求助接口 // TODO: 2020/5/18 回调,显示对话框 doAction(); }); + + if (V2XServiceManager.getMoGoStatusManager().isVrMode()) { + showTopView(); + tv.setVisibility(View.GONE); + } else { + closeTopView(); + tv.setVisibility(View.VISIBLE); + } + } catch (Exception e) { e.printStackTrace(); } } + public void showTopView() { + topView = View.inflate(V2XServiceManager.getContext(), R.layout.window_carforhelp_detail, null); + TextView tvCancel = topView.findViewById(R.id.tv_cancel); + tvCancel.setOnClickListener(v -> { + doAction(); + }); + ViewGroup.LayoutParams layoutParams = new ViewGroup.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, + (int) V2XUtils.getApp().getResources().getDimension(R.dimen.dp_140)); + V2XServiceManager.getMogoTopViewManager().addView(topView, layoutParams); + } + + public void closeTopView() { + V2XServiceManager.getMogoTopViewManager().removeView(topView); + } + @Override public void close() { if (tv != null) { AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("已取消", null); tv.setVisibility(View.GONE); + closeTopView(); V2XServiceManager.getV2XRefreshModel().cancelHelpSignal(new V2XRefreshCallback() { @Override public void onSuccess(BaseData result) { tv.setVisibility(View.GONE); + closeTopView(); } @Override public void onFail(String msg) { tv.setVisibility(View.VISIBLE); + showTopView(); } }); mListener = null; diff --git a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml index ae2ab6d8bb..2d0db2ebb2 100644 --- a/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml +++ b/modules/mogo-module-v2x/src/main/res/layout/item_v2x_event_detail_vr.xml @@ -262,9 +262,10 @@ android:id="@+id/iv_play" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:paddingLeft="@dimen/dp_40" - android:visibility="gone" - android:src="@drawable/icon_play" /> + android:layout_marginTop="@dimen/dp_6" + android:paddingLeft="@dimen/dp_42" + android:src="@drawable/icon_play" + android:visibility="gone" />