优化显示逻辑
This commit is contained in:
@@ -43,6 +43,11 @@ class DialogImpl implements IWindowManagerView {
|
||||
public void update(WindowManagerView.WMViewParams params) {
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
/*
|
||||
|
||||
@@ -2,7 +2,7 @@ package com.mogo.module.common.wm;
|
||||
|
||||
import android.view.View;
|
||||
|
||||
interface IWindowManagerView {
|
||||
public interface IWindowManagerView {
|
||||
/**
|
||||
* 初始化
|
||||
*
|
||||
@@ -33,12 +33,17 @@ interface IWindowManagerView {
|
||||
*/
|
||||
void update(WindowManagerView.WMViewParams params);
|
||||
|
||||
/**
|
||||
* 刷新
|
||||
*/
|
||||
void update();
|
||||
|
||||
/**
|
||||
* 隐藏
|
||||
*/
|
||||
void hide();
|
||||
|
||||
interface OnViewClickListener {
|
||||
public interface OnViewClickListener {
|
||||
void onClick( View view, float xPos, float yPos );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -101,6 +101,13 @@ class WindowManagerImpl implements IWindowManagerView {
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void update() {
|
||||
if ( isShowing ) {
|
||||
mWindowManager.updateViewLayout(rootView,mLayoutParams);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void hide() {
|
||||
if ( isShowing && mParams != null ) {
|
||||
|
||||
@@ -127,4 +127,10 @@ public class WindowManagerView {
|
||||
}
|
||||
}
|
||||
|
||||
public void update(){
|
||||
if ( mManagerView != null) {
|
||||
mManagerView.update();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import com.mogo.module.common.drawer.AdasRecognizedResultDrawer;
|
||||
import com.mogo.module.common.drawer.SnapshotSetDataDrawer;
|
||||
import com.mogo.module.service.MarkerServiceHandler;
|
||||
import com.mogo.module.service.R;
|
||||
import com.mogo.module.service.status.EnvStatusManager;
|
||||
import com.mogo.module.service.uploadintime.SnapshotLocationController;
|
||||
import com.mogo.realtime.entity.ADASRecognizedResult;
|
||||
import com.mogo.realtime.entity.CloudRoadData;
|
||||
@@ -623,6 +624,9 @@ public class MockIntentHandler implements IntentHandler {
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 100, 0L );
|
||||
mLocationMockHandler.sendEmptyMessageDelayed( 101, 1000L );
|
||||
break;
|
||||
case 52:
|
||||
EnvStatusManager.getInstance().showPanel( context );
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -138,11 +138,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
MoGoAiCloudRealTime.registerOnMsgListener(new IMogoCloudOnMsgListener() {
|
||||
@Override
|
||||
public void onMsgSend(long id) {
|
||||
|
||||
DebugConfig.setStatus( DebugConfig.sDownloadLink, true );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMsgReceived(MogoSnapshotSetData mogoSnapshotSetData) {
|
||||
DebugConfig.setStatus( DebugConfig.sDownloadSnapshot, true );
|
||||
SnapshotSetDataDrawer.getInstance().renderSnapshotData(mogoSnapshotSetData);
|
||||
}
|
||||
});
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
package com.mogo.module.service.status;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Color;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.view.Gravity;
|
||||
import android.view.ViewGroup;
|
||||
import android.widget.TextView;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.MogoApisHandler;
|
||||
import com.mogo.module.common.wm.WindowManagerView;
|
||||
import com.mogo.module.service.R;
|
||||
|
||||
public
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2021/3/17
|
||||
*
|
||||
* 环境状态
|
||||
*/
|
||||
class EnvStatusManager {
|
||||
|
||||
private static volatile EnvStatusManager sInstance;
|
||||
|
||||
private EnvStatusManager() {
|
||||
}
|
||||
|
||||
public static EnvStatusManager getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( EnvStatusManager.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new EnvStatusManager();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
private WindowManagerView mPanelView;
|
||||
private TextView mStatusTv;
|
||||
private Handler mMainHandler = new Handler( Looper.getMainLooper() ) {
|
||||
@Override
|
||||
public void handleMessage( Message msg ) {
|
||||
super.handleMessage( msg );
|
||||
if ( mPanelView.isShowing() ) {
|
||||
renderStatus();
|
||||
mMainHandler.sendEmptyMessageDelayed( MSG, 5_000L );
|
||||
}
|
||||
}
|
||||
};
|
||||
public static final int MSG = 10000;
|
||||
|
||||
private void renderStatus() {
|
||||
String[] sStatusName = {
|
||||
"定位",
|
||||
"近景",
|
||||
"下发",
|
||||
"AUTO",
|
||||
"长链"
|
||||
};
|
||||
StringBuilder stringBuilder = new StringBuilder();
|
||||
for ( int i = 0; i < sStatusName.length; i++ ) {
|
||||
stringBuilder.append( sStatusName[i] ).append( ":" );
|
||||
if ( i != 3 ) {
|
||||
stringBuilder.append( "true".equals( DebugConfig.getStatus( i, true ) ) ? "正常" : "异常" ).append( "\n" );
|
||||
} else {
|
||||
stringBuilder.append( DebugConfig.getAutoPilotStatus() ).append( "\n" );
|
||||
}
|
||||
}
|
||||
mStatusTv.setText( stringBuilder );
|
||||
if ( MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode() ) {
|
||||
mStatusTv.setTextColor( Color.WHITE );
|
||||
} else {
|
||||
if ( MogoApisHandler.getInstance().getApis().getAdasControllerApi()
|
||||
.getCurrentSkinMode() == EnumMapUI.Type_Light ) {
|
||||
mStatusTv.setTextColor( Color.BLACK );
|
||||
} else {
|
||||
mStatusTv.setTextColor( Color.WHITE );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void showPanel( Context context ) {
|
||||
if ( mPanelView == null ) {
|
||||
mPanelView = new WindowManagerView.Builder( context )
|
||||
.contentView( R.layout.module_services_status_panel )
|
||||
.position( 0, 100 )
|
||||
.size( ViewGroup.LayoutParams.WRAP_CONTENT, ViewGroup.LayoutParams.WRAP_CONTENT )
|
||||
.gravity( Gravity.TOP )
|
||||
.showInWindowManager();
|
||||
mPanelView.attachTouchEvent( ( ( view, xPos, yPos ) -> {
|
||||
closePanel();
|
||||
} ) );
|
||||
mPanelView.findViewById( R.id.module_services_status_iv ).setOnClickListener( view -> {
|
||||
closePanel();
|
||||
} );
|
||||
mStatusTv = mPanelView.findViewById( R.id.module_services_status_tv );
|
||||
mMainHandler.sendEmptyMessageDelayed( MSG, 0L );
|
||||
}
|
||||
mPanelView.show();
|
||||
}
|
||||
|
||||
public void closePanel() {
|
||||
if ( mPanelView != null ) {
|
||||
mPanelView.dismiss();
|
||||
mMainHandler.removeMessages( MSG );
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.module.service.uploadintime;
|
||||
|
||||
import com.mogo.commons.debug.DebugConfig;
|
||||
import com.mogo.realtime.entity.CloudLocationInfo;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -74,6 +75,7 @@ class SnapshotLocationController {
|
||||
if ( data == null ) {
|
||||
return;
|
||||
}
|
||||
DebugConfig.setStatus( DebugConfig.sLocation, true );
|
||||
Logger.d( TAG, "同步到rtk数据" );
|
||||
double lon = data.optDouble( "lon", -1 );
|
||||
double lat = data.optDouble( "lat", -1 );
|
||||
|
||||
@@ -0,0 +1,23 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:tools="http://schemas.android.com/tools"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="90px"
|
||||
android:orientation="vertical">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/module_services_status_tv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:layout_marginRight="90px"
|
||||
android:textColor="#000"
|
||||
android:textSize="40px" />
|
||||
|
||||
<ImageView
|
||||
android:id="@+id/module_services_status_iv"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="right|center_vertical"
|
||||
android:src="@drawable/module_common_icon_close_vr" />
|
||||
</FrameLayout>
|
||||
Reference in New Issue
Block a user