Merge branch 'qa_byd' into dev

This commit is contained in:
wangcongtao
2020-07-23 17:53:41 +08:00
2 changed files with 13 additions and 32 deletions

View File

@@ -99,25 +99,25 @@ public class MogoApplication extends AbsMogoApplication {
@Override
protected void init() {
super.init();
prepareBaseService();
prepareBaseService(2_000L);
}
/**
* 基础服务passport、location、socket
*/
private void prepareBaseService(){
UiThreadHandler.postDelayed( ()->{
private void prepareBaseService(long delay) {
UiThreadHandler.postDelayed( () -> {
final IMogoServiceApis apis = ARouter.getInstance().navigation( IMogoServiceApis.class );
// 第三方平台的sn是服务端生成的所以必须在返回后才能开启
if ( TextUtils.isEmpty( Utils.getSn() ) ) {
preparePassportEnvironment( apis, ()->{
preparePassportEnvironment( apis, () -> {
prepareSocketAndLocationServices( apis );
} );
} else {
preparePassportEnvironment( apis, null );
prepareSocketAndLocationServices( apis );
}
}, 2_000L );
}, delay );
}
private void preparePassportEnvironment( IMogoServiceApis apis, Runnable after ) {
@@ -138,12 +138,14 @@ public class MogoApplication extends AbsMogoApplication {
if ( after != null ) {
after.run();
}
} else {
prepareBaseService(1_000L);
}
}
} );
}
private void prepareSocketAndLocationServices(IMogoServiceApis apis){
private void prepareSocketAndLocationServices( IMogoServiceApis apis ) {
apis.getSocketManagerApi( getApplicationContext() ).init( getApplicationContext(), DebugConfig.getSocketAppId() );
apis.getLocationInfoApi().start();
apis.getMapServiceApi().getSingletonLocationClient( getApplicationContext() ).addLocationListener( location -> {

View File

@@ -2,24 +2,20 @@ package com.mogo.module.v2x.scenario.scene.seek;
import android.content.Context;
import android.content.Intent;
import android.graphics.PixelFormat;
import android.os.Build;
import android.util.AttributeSet;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.WindowManager;
import android.widget.TextView;
import androidx.constraintlayout.widget.ConstraintLayout;
import com.mogo.commons.voice.AIAssist;
import com.mogo.module.common.wm.WindowManagerView;
import com.mogo.module.v2x.R;
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.WindowUtils;
import com.mogo.utils.logger.Logger;
/**
@@ -82,30 +78,13 @@ public class V2XSeekHelpDialog extends ConstraintLayout implements View.OnClickL
}
boolean isShown;
WindowManager windowManager;
WindowManagerView windowManager;
public void show() {
Logger.d(TAG, "使用windowManager实现");
if (!isShown) {
windowManager = (WindowManager) mContext.getApplicationContext().getSystemService(Context.WINDOW_SERVICE);
WindowManager.LayoutParams layoutParams = new WindowManager.LayoutParams();
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.O) {
layoutParams.type = WindowManager.LayoutParams.TYPE_APPLICATION_OVERLAY;
} else {
layoutParams.type = WindowManager.LayoutParams.TYPE_SYSTEM_ALERT;
}
layoutParams.format = PixelFormat.TRANSLUCENT;
layoutParams.gravity = Gravity.START | Gravity.TOP;
// mWindowLayoutParams.flags = WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
// FLAG_LAYOUT_IN_SCREEN将window放置在整个屏幕之内,无视其他的装饰(比如状态栏) FLAG_NOT_TOUCH_MODAL不阻塞事件传递到后面的窗口
layoutParams.flags = WindowManager.LayoutParams.FLAG_LAYOUT_IN_SCREEN | WindowManager.LayoutParams.FLAG_NOT_TOUCH_MODAL | WindowManager.LayoutParams.FLAG_WATCH_OUTSIDE_TOUCH | WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE;
layoutParams.width = WindowUtils.getScreenWidth(mContext);
layoutParams.height = WindowUtils.getScreenHeight(mContext);
//后面变暗区域透明...
layoutParams.dimAmount = 0;
layoutParams.x = 0;
layoutParams.y = 0;
windowManager.addView(this, layoutParams);
windowManager = new WindowManagerView.Builder(getContext()).contentView(R.layout.module_commons_layout_wm_dialog).build();
windowManager.show();
isShown = true;
AIAssist.getInstance(V2XUtils.getApp()).speakTTSVoice("确定要解除求助状态吗");
unRegisterVoiceCmd();
@@ -125,7 +104,7 @@ public class V2XSeekHelpDialog extends ConstraintLayout implements View.OnClickL
public void dismiss() {
if (isShown && windowManager != null) {
windowManager.removeViewImmediate(this);
windowManager.dismiss();
windowManager = null;
isShown = false;
}