[add] 前车碰撞预警 UI + 测试数据
This commit is contained in:
@@ -19,6 +19,7 @@ import com.mogo.och.IMogoOCH;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.statusmanager.IMogoStatusChangedListener;
|
||||
import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
import com.mogo.service.v2x.IWarningChangeListener;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
@@ -26,13 +27,14 @@ import com.mogo.utils.logger.Logger;
|
||||
*
|
||||
* @author tongchenfei
|
||||
*/
|
||||
public class MainLauncherActivity extends MainActivity implements IMogoIntentListener, IMogoStatusChangedListener {
|
||||
public class MainLauncherActivity extends MainActivity implements IMogoIntentListener, IMogoStatusChangedListener, IWarningChangeListener {
|
||||
private static final String TAG = "MainLauncherActivity";
|
||||
protected boolean mIsHomeKeyDown = false;
|
||||
|
||||
@Override
|
||||
protected void onCreate( @Nullable Bundle savedInstanceState ) {
|
||||
super.onCreate( savedInstanceState );
|
||||
DebugConfig.setNeedRequestUserInfo( true );
|
||||
protected void onCreate(@Nullable Bundle savedInstanceState) {
|
||||
super.onCreate(savedInstanceState);
|
||||
DebugConfig.setNeedRequestUserInfo(true);
|
||||
mServiceApis.getStatusManagerApi().registerStatusChangedListener(TAG,
|
||||
StatusDescriptor.VR_MODE, this);
|
||||
}
|
||||
@@ -43,10 +45,10 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
// 显示左边遮罩
|
||||
if (MogoApisHandler.getInstance().getApis().getStatusManagerApi().isVrMode()) {
|
||||
mLeftShadowFrame.setVisibility(View.GONE);
|
||||
}else {
|
||||
} else {
|
||||
mLeftShadowFrame.setVisibility(View.VISIBLE);
|
||||
}
|
||||
MogoModulesManager.getInstance().loadAppsListModule( com.mogo.module.main.R.id.module_main_id_apps_fragment_container );
|
||||
MogoModulesManager.getInstance().loadAppsListModule(com.mogo.module.main.R.id.module_main_id_apps_fragment_container);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -57,21 +59,21 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
@Override
|
||||
protected void hideLayout() {
|
||||
super.hideLayout();
|
||||
mApps.setVisibility( View.GONE );
|
||||
mLeftShadowFrame.setVisibility( View.GONE );
|
||||
mApps.setVisibility(View.GONE);
|
||||
mLeftShadowFrame.setVisibility(View.GONE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void showLayout() {
|
||||
super.showLayout();
|
||||
mApps.setVisibility( View.VISIBLE );
|
||||
mLeftShadowFrame.setVisibility( View.VISIBLE );
|
||||
mApps.setVisibility(View.VISIBLE);
|
||||
mLeftShadowFrame.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
protected void onStart() {
|
||||
super.onStart();
|
||||
getApis().getIntentManagerApi().registerIntentListener( Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this );
|
||||
getApis().getIntentManagerApi().registerIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -83,13 +85,13 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
@Override
|
||||
protected void onStop() {
|
||||
super.onStop();
|
||||
getApis().getIntentManagerApi().unregisterIntentListener( Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this );
|
||||
getApis().getIntentManagerApi().unregisterIntentListener(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, this);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIntentReceived( String intentStr, Intent intent ) {
|
||||
if ( TextUtils.equals( Intent.ACTION_CLOSE_SYSTEM_DIALOGS, intentStr ) ) {
|
||||
mIsHomeKeyDown = intent.getBooleanExtra( "isHomeKeyDown", true );
|
||||
public void onIntentReceived(String intentStr, Intent intent) {
|
||||
if (TextUtils.equals(Intent.ACTION_CLOSE_SYSTEM_DIALOGS, intentStr)) {
|
||||
mIsHomeKeyDown = intent.getBooleanExtra("isHomeKeyDown", true);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -107,10 +109,10 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
/**
|
||||
* 加载网约车模块
|
||||
*/
|
||||
private void loadOCHModule(){
|
||||
IMogoOCH och = ARouter.getInstance().navigation( IMogoOCH.class );
|
||||
if ( och != null ) {
|
||||
och.init( this, R.id.module_main_id_och_fragment );
|
||||
private void loadOCHModule() {
|
||||
IMogoOCH och = ARouter.getInstance().navigation(IMogoOCH.class);
|
||||
if (och != null) {
|
||||
och.init(this, R.id.module_main_id_och_fragment);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -121,38 +123,53 @@ public class MainLauncherActivity extends MainActivity implements IMogoIntentLis
|
||||
StatusDescriptor.VR_MODE, this);
|
||||
try {
|
||||
// acc off 之后会出现进程还在,但是页面被杀的情况,这个直接杀掉进程,然后让整个进程重启
|
||||
Process.killProcess( Process.myPid() );
|
||||
} catch ( Exception e ) {
|
||||
Process.killProcess(Process.myPid());
|
||||
} catch (Exception e) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapUiModeChanged( EnumMapUI mapUI ) {
|
||||
super.onMapUiModeChanged( mapUI );
|
||||
Intent intent = new Intent( "com.mogo.style.SKIN_CHANGED" );
|
||||
intent.putExtra( "type", -1 );
|
||||
if ( mapUI == EnumMapUI.Type_Light ) {
|
||||
intent.putExtra( "type", 1 );
|
||||
} else if( mapUI == EnumMapUI.Type_Night ){
|
||||
intent.putExtra( "type", 0 );
|
||||
public void onMapUiModeChanged(EnumMapUI mapUI) {
|
||||
super.onMapUiModeChanged(mapUI);
|
||||
Intent intent = new Intent("com.mogo.style.SKIN_CHANGED");
|
||||
intent.putExtra("type", -1);
|
||||
if (mapUI == EnumMapUI.Type_Light) {
|
||||
intent.putExtra("type", 1);
|
||||
} else if (mapUI == EnumMapUI.Type_Night) {
|
||||
intent.putExtra("type", 0);
|
||||
}
|
||||
sendBroadcast( intent );
|
||||
Logger.d( TAG, "send msg to AI Voice" );
|
||||
sendBroadcast(intent);
|
||||
Logger.d(TAG, "send msg to AI Voice");
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged(StatusDescriptor descriptor, boolean isTrue) {
|
||||
FrameLayout.LayoutParams entranceParams = ( ( FrameLayout.LayoutParams ) mEntrance.getLayoutParams() );
|
||||
FrameLayout.LayoutParams entranceParams = ((FrameLayout.LayoutParams) mEntrance.getLayoutParams());
|
||||
if (isTrue) {
|
||||
entranceParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_entrance_fragment_container_marginLeft_in_vr_mode );
|
||||
entranceParams.leftMargin = getResources().getDimensionPixelSize(R.dimen.module_main_entrance_fragment_container_marginLeft_in_vr_mode);
|
||||
mLeftShadowFrame.setVisibility(View.GONE);
|
||||
mApps.setVisibility(View.GONE);
|
||||
}else{
|
||||
entranceParams.leftMargin = getResources().getDimensionPixelSize( R.dimen.module_main_id_entrance_fragment_container_marginLeft );
|
||||
} else {
|
||||
entranceParams.leftMargin = getResources().getDimensionPixelSize(R.dimen.module_main_id_entrance_fragment_container_marginLeft);
|
||||
mLeftShadowFrame.setVisibility(View.VISIBLE);
|
||||
mApps.setVisibility(View.VISIBLE);
|
||||
}
|
||||
mEntrance.setLayoutParams( entranceParams );
|
||||
mEntrance.setLayoutParams(entranceParams);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void warningChangedWithType(String type) {
|
||||
switch (type) {
|
||||
case "top":
|
||||
mWarningTop.setVisibility(View.VISIBLE);
|
||||
case "left":
|
||||
mWarningLeft.setVisibility(View.VISIBLE);
|
||||
case "right":
|
||||
mWarningRight.setVisibility(View.VISIBLE);
|
||||
case "bottom":
|
||||
mWarningBottom.setVisibility(View.VISIBLE);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user