opt
This commit is contained in:
@@ -1,6 +1,5 @@
|
||||
package com.mogo.module.main;
|
||||
|
||||
import android.content.Intent;
|
||||
import android.location.Location;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
@@ -21,11 +20,6 @@ import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.main.registercenter.MogoRegisterCenterHandler;
|
||||
import com.mogo.module.service.receiver.AccStatusReceiver;
|
||||
import com.mogo.module.service.receiver.MogoReceiver;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.Iterator;
|
||||
@@ -43,8 +37,7 @@ public class EventDispatchCenter implements
|
||||
IMogoCarLocationChangedListener2,
|
||||
IMogoMapListener,
|
||||
IMogoNaviListener2,
|
||||
IMogoLocationListener,
|
||||
IMogoIntentListener {
|
||||
IMogoLocationListener {
|
||||
|
||||
|
||||
private static volatile EventDispatchCenter sInstance;
|
||||
@@ -66,12 +59,6 @@ public class EventDispatchCenter implements
|
||||
|
||||
private static final String TAG = "DispatchCenter";
|
||||
|
||||
public void registerReceiver( IMogoIntentManager intentManager ) {
|
||||
intentManager.registerIntentListener( Intent.ACTION_POWER_CONNECTED, this );
|
||||
intentManager.registerIntentListener( Intent.ACTION_POWER_DISCONNECTED, this );
|
||||
intentManager.registerIntentListener( AccStatusReceiver.ACTION_NWD_ACC, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean onMarkerClicked( IMogoMarker marker ) {
|
||||
IMogoMarkerClickListener listener = MogoRegisterCenterHandler.getInstance().getMarkerListener( marker.getOwner() );
|
||||
@@ -437,32 +424,6 @@ public class EventDispatchCenter implements
|
||||
Logger.i( TAG, "onLocationChanged event cost " + ( System.currentTimeMillis() - start ) + "ms" );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onIntentReceived( String intentStr, Intent intent ) {
|
||||
|
||||
Iterator< IMogoModuleLifecycle > iterator = MogoRegisterCenterHandler.getInstance().getLifecycleListeners();
|
||||
if ( Intent.ACTION_POWER_CONNECTED.equals( intentStr ) ) {
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoModuleLifecycle lifecycle = iterator.next();
|
||||
if ( lifecycle != null ) {
|
||||
lifecycle.accOn();
|
||||
}
|
||||
}
|
||||
} else if ( Intent.ACTION_POWER_DISCONNECTED.equals( intentStr ) ) {
|
||||
} else if ( AccStatusReceiver.ACTION_NWD_ACC.equals( intentStr ) ) {
|
||||
int state = intent.getByteExtra( AccStatusReceiver.PARAM_ACC_STATUS, ( byte ) 0 );
|
||||
if ( state == 1 ) {
|
||||
while ( iterator.hasNext() ) {
|
||||
IMogoModuleLifecycle lifecycle = iterator.next();
|
||||
if ( lifecycle != null ) {
|
||||
lifecycle.accOn();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onArriveDestination() {
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
|
||||
@@ -60,7 +60,6 @@ public class MogoModulesManager implements MogoModulesHandler {
|
||||
throw new NullPointerException( "activity can't be null." );
|
||||
}
|
||||
this.mActivity = activity;
|
||||
EventDispatchCenter.getInstance().registerReceiver( apis.getIntentManagerApi() );
|
||||
}
|
||||
|
||||
private Context getContext() {
|
||||
|
||||
Reference in New Issue
Block a user