diff --git a/gradle.properties b/gradle.properties index 73f8f9dadb..2172a6f8a0 100644 --- a/gradle.properties +++ b/gradle.properties @@ -145,7 +145,7 @@ MOGO_OCH_TAXI_VERSION=1.0.0 ######## 外部依赖引用 # 车聊聊 -CARCHATTING_VERSION=2.2.77 +CARCHATTING_VERSION=2.2.311 # 车聊聊接口 CARCHATTINGPROVIDER_VERSION=1.1.11 # websocket diff --git a/modules/mogo-module-share/src/main/java/com/mogo/module/share/ShareControl.java b/modules/mogo-module-share/src/main/java/com/mogo/module/share/ShareControl.java index c9a7816550..5c04289638 100644 --- a/modules/mogo-module-share/src/main/java/com/mogo/module/share/ShareControl.java +++ b/modules/mogo-module-share/src/main/java/com/mogo/module/share/ShareControl.java @@ -301,9 +301,9 @@ public class ShareControl implements IMogoShareManager, Handler.Callback { } break; case VOICE_CMD_PUB_TROUBLE_HELP: - if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { - return; - } +// if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) { +// return; +// } if (needAuth()) { goAuth(STEP_AFTER_AUTH_TYPE_SEEK_HELP, TYPE_DENSE_FOG, false); } else { 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 b558ffa800..e1f35a4d4c 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 @@ -2,6 +2,8 @@ package com.mogo.module.v2x.scenario.scene.help; import android.content.Intent; import android.os.CountDownTimer; +import android.view.View; +import android.view.ViewGroup; import android.widget.TextView; import androidx.annotation.Nullable; @@ -11,6 +13,7 @@ import com.mogo.module.v2x.R; 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.seek.V2XSeekHelpWindow; import com.mogo.module.v2x.utils.V2XUtils; import com.mogo.module.v2x.voice.V2XVoiceCallbackListener; import com.mogo.module.v2x.voice.V2XVoiceConstants; @@ -44,6 +47,7 @@ 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); @@ -57,6 +61,14 @@ 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(); @@ -84,12 +96,20 @@ public class V2XCarForHelpScenario extends AbsV2XScenario implements IM @Override public void showWindow() { - //无window + 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() { - //无window + if (getV2XWindow() != null) { + getV2XWindow().close(); + } } private V2XVoiceCallbackListener cancelCb = null; 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 new file mode 100644 index 0000000000..84b1c8081d --- /dev/null +++ b/modules/mogo-module-v2x/src/main/java/com/mogo/module/v2x/scenario/scene/help/V2XCarForHelpWindow.java @@ -0,0 +1,102 @@ +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) { + AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("已取消", null); + //移除窗体 + V2XServiceManager.getMogoTopViewManager().removeView(V2XCarForHelpWindow.this); + V2XVoiceManager.INSTANCE.unRegisterWakeCmd(V2XVoiceConstants.COMMAND_ZHIDAO_V2X_CANCEL_HELP); + } + + @Override + public void onFail(String msg) { + Toast.makeText(V2XServiceManager.getContext(), msg, Toast.LENGTH_SHORT).show(); + } + }); + } + + } + + @Override + public View getView() { + return this; + } + + @Override + public void setWindowStatusListener(V2XWindowStatusListener listener) { + + } +} diff --git a/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_car_for_help.png b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_car_for_help.png new file mode 100644 index 0000000000..6244ee2b2f Binary files /dev/null and b/modules/mogo-module-v2x/src/main/res/drawable-xhdpi/icon_car_for_help.png differ diff --git a/modules/mogo-module-v2x/src/main/res/layout/window_carforhelp_detail.xml b/modules/mogo-module-v2x/src/main/res/layout/window_carforhelp_detail.xml new file mode 100644 index 0000000000..267d6b20fe --- /dev/null +++ b/modules/mogo-module-v2x/src/main/res/layout/window_carforhelp_detail.xml @@ -0,0 +1,55 @@ + + + + + + + + + + + \ No newline at end of file diff --git a/modules/mogo-module-v2x/src/main/res/values/colors.xml b/modules/mogo-module-v2x/src/main/res/values/colors.xml index cb5b32ca4c..f3c8c733f3 100644 --- a/modules/mogo-module-v2x/src/main/res/values/colors.xml +++ b/modules/mogo-module-v2x/src/main/res/values/colors.xml @@ -20,4 +20,6 @@ #4C83FF #FF3036 + + #F63A35 \ No newline at end of file