优化显示逻辑
This commit is contained in:
@@ -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 );
|
||||
|
||||
Reference in New Issue
Block a user