Merge remote-tracking branch 'origin/feature/v1.0.0' into feature/v1.0.0
# Conflicts: # .idea/misc.xml
@@ -28,7 +28,7 @@ public class MogoApplication extends AbsMogoApplication {
|
||||
DebugConfig.setNetMode( DebugConfig.NET_MODE_QA );
|
||||
MogoModulePaths.addModule(new MogoModule(OnLineCarConstants.TAG, "CARD_TYPE_ROAD_ONLINECAR"));
|
||||
MogoModulePaths.addModule( new MogoModule( TanluConstants.TAG, "CARD_TYPE_ROAD_CODITION" ) );
|
||||
MogoModulePaths.addModule(new MogoModule( CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME));
|
||||
// MogoModulePaths.addModule(new MogoModule( CallChatConstant.PROVIDER, CallChatConstant.MODULE_NAME));
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
package com.mogo.map.listener;
|
||||
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListenerRegister;
|
||||
import com.mogo.map.navi.IMogoNaviListenerRegister;
|
||||
|
||||
|
||||
@@ -10,6 +10,8 @@ import androidx.annotation.NonNull;
|
||||
import androidx.annotation.Nullable;
|
||||
|
||||
import com.mogo.commons.mvp.MvpFragment;
|
||||
import com.mogo.module.extensions.anim.AnimRes;
|
||||
import com.mogo.module.extensions.anim.JSurfaceView;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
@@ -19,7 +21,7 @@ import com.mogo.commons.mvp.MvpFragment;
|
||||
*/
|
||||
public class ExtensionsFragment extends MvpFragment< ExtensionsView, ExtensionsPresenter > implements ExtensionsView {
|
||||
|
||||
private View mVoiceIcon;
|
||||
private JSurfaceView mVoiceIcon;
|
||||
private View mVoiceMsg;
|
||||
|
||||
private TextView mTime;
|
||||
@@ -66,6 +68,8 @@ public class ExtensionsFragment extends MvpFragment< ExtensionsView, ExtensionsP
|
||||
|
||||
mMsgContainer = findViewById( R.id.module_ext_id_msg );
|
||||
mMsgCounter = findViewById( R.id.module_ext_id_msg_counter );
|
||||
|
||||
mVoiceIcon.setFrames( AnimRes.sRes );
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@@ -77,7 +81,18 @@ public class ExtensionsFragment extends MvpFragment< ExtensionsView, ExtensionsP
|
||||
@Override
|
||||
public void onActivityCreated( @Nullable Bundle savedInstanceState ) {
|
||||
super.onActivityCreated( savedInstanceState );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onResume() {
|
||||
super.onResume();
|
||||
mVoiceIcon.startAnim();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStop() {
|
||||
super.onStop();
|
||||
mVoiceIcon.stop();
|
||||
}
|
||||
|
||||
@Override
|
||||
|
||||
@@ -0,0 +1,83 @@
|
||||
package com.mogo.module.extensions.anim;
|
||||
|
||||
import com.mogo.module.extensions.R;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-09
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class AnimRes {
|
||||
|
||||
public static final int sRes[] = {
|
||||
R.drawable.mogo_tts_icon_00000,
|
||||
R.drawable.mogo_tts_icon_00001,
|
||||
R.drawable.mogo_tts_icon_00002,
|
||||
R.drawable.mogo_tts_icon_00003,
|
||||
R.drawable.mogo_tts_icon_00004,
|
||||
R.drawable.mogo_tts_icon_00005,
|
||||
R.drawable.mogo_tts_icon_00006,
|
||||
R.drawable.mogo_tts_icon_00007,
|
||||
R.drawable.mogo_tts_icon_00008,
|
||||
R.drawable.mogo_tts_icon_00009,
|
||||
R.drawable.mogo_tts_icon_00010,
|
||||
R.drawable.mogo_tts_icon_00011,
|
||||
R.drawable.mogo_tts_icon_00012,
|
||||
R.drawable.mogo_tts_icon_00013,
|
||||
R.drawable.mogo_tts_icon_00014,
|
||||
R.drawable.mogo_tts_icon_00015,
|
||||
R.drawable.mogo_tts_icon_00016,
|
||||
R.drawable.mogo_tts_icon_00017,
|
||||
R.drawable.mogo_tts_icon_00018,
|
||||
R.drawable.mogo_tts_icon_00019,
|
||||
R.drawable.mogo_tts_icon_00020,
|
||||
R.drawable.mogo_tts_icon_00021,
|
||||
R.drawable.mogo_tts_icon_00022,
|
||||
R.drawable.mogo_tts_icon_00023,
|
||||
R.drawable.mogo_tts_icon_00024,
|
||||
R.drawable.mogo_tts_icon_00025,
|
||||
R.drawable.mogo_tts_icon_00026,
|
||||
R.drawable.mogo_tts_icon_00027,
|
||||
R.drawable.mogo_tts_icon_00028,
|
||||
R.drawable.mogo_tts_icon_00029,
|
||||
R.drawable.mogo_tts_icon_00030,
|
||||
R.drawable.mogo_tts_icon_00031,
|
||||
R.drawable.mogo_tts_icon_00032,
|
||||
R.drawable.mogo_tts_icon_00033,
|
||||
R.drawable.mogo_tts_icon_00034,
|
||||
R.drawable.mogo_tts_icon_00035,
|
||||
R.drawable.mogo_tts_icon_00036,
|
||||
R.drawable.mogo_tts_icon_00037,
|
||||
R.drawable.mogo_tts_icon_00038,
|
||||
R.drawable.mogo_tts_icon_00039,
|
||||
R.drawable.mogo_tts_icon_00040,
|
||||
R.drawable.mogo_tts_icon_00041,
|
||||
R.drawable.mogo_tts_icon_00042,
|
||||
R.drawable.mogo_tts_icon_00043,
|
||||
R.drawable.mogo_tts_icon_00044,
|
||||
R.drawable.mogo_tts_icon_00045,
|
||||
R.drawable.mogo_tts_icon_00046,
|
||||
R.drawable.mogo_tts_icon_00047,
|
||||
R.drawable.mogo_tts_icon_00048,
|
||||
R.drawable.mogo_tts_icon_00049,
|
||||
R.drawable.mogo_tts_icon_00050,
|
||||
R.drawable.mogo_tts_icon_00051,
|
||||
R.drawable.mogo_tts_icon_00052,
|
||||
R.drawable.mogo_tts_icon_00053,
|
||||
R.drawable.mogo_tts_icon_00054,
|
||||
R.drawable.mogo_tts_icon_00055,
|
||||
R.drawable.mogo_tts_icon_00056,
|
||||
R.drawable.mogo_tts_icon_00057,
|
||||
R.drawable.mogo_tts_icon_00058,
|
||||
R.drawable.mogo_tts_icon_00059,
|
||||
R.drawable.mogo_tts_icon_00060,
|
||||
R.drawable.mogo_tts_icon_00061,
|
||||
R.drawable.mogo_tts_icon_00062,
|
||||
R.drawable.mogo_tts_icon_00063,
|
||||
R.drawable.mogo_tts_icon_00064,
|
||||
R.drawable.mogo_tts_icon_00065,
|
||||
R.drawable.mogo_tts_icon_00066,
|
||||
R.drawable.mogo_tts_icon_00067
|
||||
};
|
||||
}
|
||||
@@ -0,0 +1,127 @@
|
||||
package com.mogo.module.extensions.anim;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Bitmap;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Canvas;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Paint;
|
||||
import android.graphics.PixelFormat;
|
||||
import android.graphics.PorterDuff;
|
||||
import android.graphics.Rect;
|
||||
import android.util.AttributeSet;
|
||||
import android.view.SurfaceHolder;
|
||||
import android.view.SurfaceView;
|
||||
|
||||
import com.mogo.utils.ThreadPoolService;
|
||||
|
||||
public class JSurfaceView extends SurfaceView implements Runnable, SurfaceHolder.Callback {
|
||||
|
||||
private SurfaceHolder mHolder;
|
||||
|
||||
/**
|
||||
* 动画是否执行中
|
||||
*/
|
||||
private boolean bRunning = false;
|
||||
/**
|
||||
* 当前执行的第几帧
|
||||
*/
|
||||
private int mCurrentPos;
|
||||
/**
|
||||
* 动画集合
|
||||
*/
|
||||
private int[] mFrames;
|
||||
|
||||
public JSurfaceView( Context context ) {
|
||||
super( context );
|
||||
init();
|
||||
}
|
||||
|
||||
public JSurfaceView( Context context, AttributeSet attrs ) {
|
||||
super( context, attrs );
|
||||
init();
|
||||
}
|
||||
|
||||
public JSurfaceView( Context context, AttributeSet attrs, int defStyleAttr ) {
|
||||
super( context, attrs, defStyleAttr );
|
||||
init();
|
||||
}
|
||||
|
||||
private void init() {
|
||||
mHolder = getHolder();
|
||||
mHolder.addCallback( this );
|
||||
setZOrderOnTop( false );
|
||||
mHolder.setFormat( PixelFormat.TRANSLUCENT );
|
||||
}
|
||||
|
||||
public void setFrames( int[] frames ) {
|
||||
mFrames = frames;
|
||||
}
|
||||
|
||||
public void startAnim() {
|
||||
if ( bRunning ) {
|
||||
return;
|
||||
}
|
||||
ThreadPoolService.execute( this );
|
||||
bRunning = true;
|
||||
}
|
||||
|
||||
public void stop() {
|
||||
bRunning = false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void run() {
|
||||
while ( bRunning ) {
|
||||
drawBitmap();
|
||||
mCurrentPos++;
|
||||
try {
|
||||
Thread.sleep( 100 );
|
||||
} catch ( InterruptedException e ) {
|
||||
e.printStackTrace();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
private void drawBitmap() {
|
||||
//获取画布并锁定
|
||||
Canvas mCanvas = mHolder.lockCanvas();
|
||||
if ( mCanvas == null ) {
|
||||
return;
|
||||
}
|
||||
//绘制透明色
|
||||
mCanvas.drawColor( Color.TRANSPARENT, PorterDuff.Mode.CLEAR );
|
||||
Bitmap mBitmap = BitmapFactory.decodeResource( getResources(), mFrames[mCurrentPos % mFrames.length] );
|
||||
|
||||
Paint paint = new Paint();
|
||||
Rect mSrcRect = new Rect( 0,
|
||||
0,
|
||||
mBitmap.getWidth(),
|
||||
mBitmap.getHeight() ); // 图片绘制
|
||||
Rect mDestRect = new Rect( 0,
|
||||
0,
|
||||
getWidth(),
|
||||
getHeight() );// 图片绘制位置
|
||||
|
||||
mCanvas.drawBitmap( mBitmap, mSrcRect, mDestRect, paint );
|
||||
//解锁画布,并展示bitmap到surface
|
||||
mHolder.unlockCanvasAndPost( mCanvas );
|
||||
mBitmap.recycle();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceCreated( SurfaceHolder holder ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceChanged( SurfaceHolder holder, int format, int width, int height ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void surfaceDestroyed( SurfaceHolder holder ) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -13,8 +13,6 @@ import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.extensions.R;
|
||||
@@ -31,7 +29,7 @@ import com.mogo.service.module.IMogoModuleProvider;
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresenter > implements EntranceView, IMogoNaviListener {
|
||||
public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresenter > implements EntranceView {
|
||||
|
||||
|
||||
private View mSearch;
|
||||
@@ -126,64 +124,4 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
mMogoLocationClient = mService.getLocationClient( getContext() );
|
||||
mMogoNavi = mService.getNavi( getContext() );
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onInitNaviFailure() {
|
||||
if ( mSearchProvider != null && mSearchProvider.getNaviListener() != null ) {
|
||||
mSearchProvider.getNaviListener().onInitNaviFailure();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitNaviSuccess() {
|
||||
if ( mSearchProvider != null && mSearchProvider.getNaviListener() != null ) {
|
||||
mSearchProvider.getNaviListener().onInitNaviSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate( MogoNaviInfo naviinfo ) {
|
||||
if ( naviinfo == null ) {
|
||||
return;
|
||||
}
|
||||
mNaviInfo.notifyChanged( naviinfo );
|
||||
if ( mSearchProvider != null && mSearchProvider.getNaviListener() != null ) {
|
||||
mSearchProvider.getNaviListener().onNaviInfoUpdate( naviinfo );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
mCommonAddress.setVisibility( View.GONE );
|
||||
mNaviInfo.setVisibility( View.VISIBLE );
|
||||
mExitNavi.setVisibility( View.VISIBLE );
|
||||
if ( mSearchProvider != null && mSearchProvider.getNaviListener() != null ) {
|
||||
mSearchProvider.getNaviListener().onStartNavi();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
mCommonAddress.setVisibility( View.VISIBLE );
|
||||
mNaviInfo.setVisibility( View.GONE );
|
||||
mExitNavi.setVisibility( View.GONE );
|
||||
if ( mSearchProvider != null && mSearchProvider.getNaviListener() != null ) {
|
||||
mSearchProvider.getNaviListener().onStopNavi();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onCalculateSuccess() {
|
||||
if ( mSearchProvider != null && mSearchProvider.getNaviListener() != null ) {
|
||||
mSearchProvider.getNaviListener().onCalculateSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onoCalculateFailed() {
|
||||
if ( mSearchProvider != null && mSearchProvider.getNaviListener() != null ) {
|
||||
mSearchProvider.getNaviListener().onoCalculateFailed();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 12 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
|
After Width: | Height: | Size: 11 KiB |
@@ -1,4 +0,0 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<animation-list xmlns:android="http://schemas.android.com/apk/res/android">
|
||||
|
||||
</animation-list>
|
||||
@@ -9,10 +9,10 @@
|
||||
android:paddingLeft="@dimen/dp_70"
|
||||
android:paddingRight="@dimen/dp_70">
|
||||
|
||||
<ImageView
|
||||
<com.mogo.module.extensions.anim.JSurfaceView
|
||||
android:id="@+id/module_ext_id_voice"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_width="@dimen/dp_120"
|
||||
android:layout_height="@dimen/dp_120"
|
||||
android:src="@drawable/module_ext_ic_voice"
|
||||
app:layout_constraintBottom_toBottomOf="parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
|
||||
@@ -199,7 +199,9 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
@Override
|
||||
public boolean onMarkerClicked( IMogoMarker marker ) {
|
||||
switch2( marker.getOwner() );
|
||||
mMogoModuleHandler.onMarkerReceive(marker.getOwner(),marker);
|
||||
if (mMogoModuleHandler != null) {
|
||||
mMogoModuleHandler.onMarkerReceive(marker);
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
|
||||
@@ -77,8 +77,7 @@ public interface MogoModulesHandler extends IMogoMapListener,
|
||||
|
||||
/**
|
||||
* 卡片接收到Marker传入数据
|
||||
* @param cardType
|
||||
* @param marker
|
||||
* @param marker marker
|
||||
*/
|
||||
void onMarkerReceive(String cardType, IMogoMarker marker);
|
||||
void onMarkerReceive(IMogoMarker marker);
|
||||
}
|
||||
|
||||
@@ -15,6 +15,7 @@ import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.model.MogoPoi;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
@@ -22,6 +23,7 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.main.MainActivity;
|
||||
import com.mogo.module.main.registercenter.MogoRegisterCenterHandler;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.module.ModuleType;
|
||||
@@ -30,6 +32,7 @@ import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.List;
|
||||
import java.util.Map;
|
||||
import java.util.Set;
|
||||
@@ -157,6 +160,7 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
@Override
|
||||
public void setEnable( String module ) {
|
||||
mEnableModuleName = module;
|
||||
|
||||
final Set< Map.Entry< MogoModule, IMogoModuleProvider > > entries = mModuleProviders.entrySet();
|
||||
if ( !entries.isEmpty() ) {
|
||||
for ( Map.Entry< MogoModule, IMogoModuleProvider > entry : entries ) {
|
||||
@@ -166,7 +170,7 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
// 仅卡片需要生命周期
|
||||
continue;
|
||||
}
|
||||
final IMogoModuleLifecycle lifecycle = provider.getCardLifecycle();
|
||||
final IMogoModuleLifecycle lifecycle = MogoRegisterCenterHandler.getInstance().getLifecycleListener( key.getName() );
|
||||
if ( lifecycle != null ) {
|
||||
if ( TextUtils.equals( key.getName(), mEnableModuleName ) ) {
|
||||
lifecycle.onPerform();
|
||||
@@ -185,249 +189,122 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
mMapLoadedCallback.run();
|
||||
mMapLoadedCallback = null;
|
||||
}
|
||||
for ( IMogoModuleProvider value : mModuleProviders.values() ) {
|
||||
if ( value.getMapListener() != null ) {
|
||||
value.getMapListener().onMapLoaded();
|
||||
}
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
while ( iterator.hasNext() ) {
|
||||
iterator.next().onMapLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTouch( MotionEvent motionEvent ) {
|
||||
for ( IMogoModuleProvider value : mModuleProviders.values() ) {
|
||||
if ( value.getType() == ModuleType.TYPE_CARD_FRAGMENT ) {
|
||||
if ( mEnableModuleName != null && TextUtils.equals( value.getModuleName(), mEnableModuleName ) ) {
|
||||
if ( value.getMapListener() != null ) {
|
||||
value.getMapListener().onTouch( motionEvent );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( value.getMapListener() != null ) {
|
||||
value.getMapListener().onTouch( motionEvent );
|
||||
}
|
||||
}
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
while ( iterator.hasNext() ) {
|
||||
iterator.next().onTouch( motionEvent );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPOIClick( MogoPoi poi ) {
|
||||
for ( IMogoModuleProvider value : mModuleProviders.values() ) {
|
||||
if ( value.getType() == ModuleType.TYPE_CARD_FRAGMENT ) {
|
||||
if ( mEnableModuleName != null && TextUtils.equals( value.getModuleName(), mEnableModuleName ) ) {
|
||||
if ( value.getMapListener() != null ) {
|
||||
value.getMapListener().onPOIClick( poi );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( value.getMapListener() != null ) {
|
||||
value.getMapListener().onPOIClick( poi );
|
||||
}
|
||||
}
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
while ( iterator.hasNext() ) {
|
||||
iterator.next().onPOIClick( poi );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapClick( MogoLatLng latLng ) {
|
||||
for ( IMogoModuleProvider value : mModuleProviders.values() ) {
|
||||
if ( value.getType() == ModuleType.TYPE_CARD_FRAGMENT ) {
|
||||
if ( mEnableModuleName != null && TextUtils.equals( value.getModuleName(), mEnableModuleName ) ) {
|
||||
if ( value.getMapListener() != null ) {
|
||||
value.getMapListener().onMapClick( latLng );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( value.getMapListener() != null ) {
|
||||
value.getMapListener().onMapClick( latLng );
|
||||
}
|
||||
}
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
while ( iterator.hasNext() ) {
|
||||
iterator.next().onMapClick( latLng );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLockMap( boolean isLock ) {
|
||||
for ( IMogoModuleProvider value : mModuleProviders.values() ) {
|
||||
if ( value.getType() == ModuleType.TYPE_CARD_FRAGMENT ) {
|
||||
if ( mEnableModuleName != null && TextUtils.equals( value.getModuleName(), mEnableModuleName ) ) {
|
||||
if ( value.getMapListener() != null ) {
|
||||
value.getMapListener().onLockMap( isLock );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( value.getMapListener() != null ) {
|
||||
value.getMapListener().onLockMap( isLock );
|
||||
}
|
||||
}
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
while ( iterator.hasNext() ) {
|
||||
iterator.next().onLockMap( isLock );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapModeChanged( EnumMapUI ui ) {
|
||||
for ( IMogoModuleProvider value : mModuleProviders.values() ) {
|
||||
if ( value.getType() == ModuleType.TYPE_CARD_FRAGMENT ) {
|
||||
if ( mEnableModuleName != null && TextUtils.equals( value.getModuleName(), mEnableModuleName ) ) {
|
||||
if ( value.getMapListener() != null ) {
|
||||
value.getMapListener().onMapModeChanged( ui );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( value.getMapListener() != null ) {
|
||||
value.getMapListener().onMapModeChanged( ui );
|
||||
}
|
||||
}
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
while ( iterator.hasNext() ) {
|
||||
iterator.next().onMapModeChanged( ui );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapChanged( MogoLatLng location, float zoom, float tilt, float bearing ) {
|
||||
for ( IMogoModuleProvider value : mModuleProviders.values() ) {
|
||||
if ( value.getType() == ModuleType.TYPE_CARD_FRAGMENT ) {
|
||||
if ( mEnableModuleName != null && TextUtils.equals( value.getModuleName(), mEnableModuleName ) ) {
|
||||
if ( value.getMapListener() != null ) {
|
||||
value.getMapListener().onMapChanged( location, zoom, tilt, bearing );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( value.getMapListener() != null ) {
|
||||
value.getMapListener().onMapChanged( location, zoom, tilt, bearing );
|
||||
}
|
||||
}
|
||||
Iterator< IMogoMapListener > iterator = MogoRegisterCenterHandler.getInstance().getMapListeners();
|
||||
while ( iterator.hasNext() ) {
|
||||
iterator.next().onMapChanged( location, zoom, tilt, bearing );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitNaviFailure() {
|
||||
for ( IMogoModuleProvider value : mModuleProviders.values() ) {
|
||||
if ( value.getType() == ModuleType.TYPE_CARD_FRAGMENT ) {
|
||||
if ( mEnableModuleName != null && TextUtils.equals( value.getModuleName(), mEnableModuleName ) ) {
|
||||
if ( value.getNaviListener() != null ) {
|
||||
value.getNaviListener().onInitNaviFailure();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( value.getNaviListener() != null ) {
|
||||
value.getNaviListener().onInitNaviFailure();
|
||||
}
|
||||
}
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
while ( iterator.hasNext() ) {
|
||||
iterator.next().onInitNaviFailure();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitNaviSuccess() {
|
||||
for ( IMogoModuleProvider value : mModuleProviders.values() ) {
|
||||
if ( value.getType() == ModuleType.TYPE_CARD_FRAGMENT ) {
|
||||
if ( mEnableModuleName != null && TextUtils.equals( value.getModuleName(), mEnableModuleName ) ) {
|
||||
if ( value.getNaviListener() != null ) {
|
||||
value.getNaviListener().onInitNaviSuccess();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( value.getNaviListener() != null ) {
|
||||
value.getNaviListener().onInitNaviSuccess();
|
||||
}
|
||||
}
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
while ( iterator.hasNext() ) {
|
||||
iterator.next().onInitNaviSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate( MogoNaviInfo naviinfo ) {
|
||||
for ( IMogoModuleProvider value : mModuleProviders.values() ) {
|
||||
if ( value.getType() == ModuleType.TYPE_CARD_FRAGMENT ) {
|
||||
if ( mEnableModuleName != null && TextUtils.equals( value.getModuleName(), mEnableModuleName ) ) {
|
||||
if ( value.getNaviListener() != null ) {
|
||||
value.getNaviListener().onNaviInfoUpdate( naviinfo );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( value.getNaviListener() != null ) {
|
||||
value.getNaviListener().onNaviInfoUpdate( naviinfo );
|
||||
}
|
||||
}
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
while ( iterator.hasNext() ) {
|
||||
iterator.next().onNaviInfoUpdate( naviinfo );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
for ( IMogoModuleProvider value : mModuleProviders.values() ) {
|
||||
if ( value.getType() == ModuleType.TYPE_CARD_FRAGMENT ) {
|
||||
if ( mEnableModuleName != null && TextUtils.equals( value.getModuleName(), mEnableModuleName ) ) {
|
||||
if ( value.getNaviListener() != null ) {
|
||||
value.getNaviListener().onStartNavi();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( value.getNaviListener() != null ) {
|
||||
value.getNaviListener().onStartNavi();
|
||||
}
|
||||
}
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
while ( iterator.hasNext() ) {
|
||||
iterator.next().onStartNavi();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
for ( IMogoModuleProvider value : mModuleProviders.values() ) {
|
||||
if ( value.getType() == ModuleType.TYPE_CARD_FRAGMENT ) {
|
||||
if ( mEnableModuleName != null && TextUtils.equals( value.getModuleName(), mEnableModuleName ) ) {
|
||||
if ( value.getNaviListener() != null ) {
|
||||
value.getNaviListener().onStopNavi();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( value.getNaviListener() != null ) {
|
||||
value.getNaviListener().onStopNavi();
|
||||
}
|
||||
}
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
while ( iterator.hasNext() ) {
|
||||
iterator.next().onStopNavi();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onCalculateSuccess() {
|
||||
for ( IMogoModuleProvider value : mModuleProviders.values() ) {
|
||||
if ( value.getType() == ModuleType.TYPE_CARD_FRAGMENT ) {
|
||||
if ( mEnableModuleName != null && TextUtils.equals( value.getModuleName(), mEnableModuleName ) ) {
|
||||
if ( value.getNaviListener() != null ) {
|
||||
value.getNaviListener().onCalculateSuccess();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( value.getNaviListener() != null ) {
|
||||
value.getNaviListener().onCalculateSuccess();
|
||||
}
|
||||
}
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
while ( iterator.hasNext() ) {
|
||||
iterator.next().onCalculateSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onoCalculateFailed() {
|
||||
for ( IMogoModuleProvider value : mModuleProviders.values() ) {
|
||||
if ( value.getType() == ModuleType.TYPE_CARD_FRAGMENT ) {
|
||||
if ( mEnableModuleName != null && TextUtils.equals( value.getModuleName(), mEnableModuleName ) ) {
|
||||
if ( value.getNaviListener() != null ) {
|
||||
value.getNaviListener().onoCalculateFailed();
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( value.getNaviListener() != null ) {
|
||||
value.getNaviListener().onoCalculateFailed();
|
||||
}
|
||||
}
|
||||
Iterator< IMogoNaviListener > iterator = MogoRegisterCenterHandler.getInstance().getNaviListeners();
|
||||
while ( iterator.hasNext() ) {
|
||||
iterator.next().onoCalculateFailed();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged( MogoLocation location ) {
|
||||
for ( IMogoModuleProvider value : mModuleProviders.values() ) {
|
||||
if ( value.getType() == ModuleType.TYPE_CARD_FRAGMENT ) {
|
||||
if ( mEnableModuleName != null && TextUtils.equals( value.getModuleName(), mEnableModuleName ) ) {
|
||||
if ( value.getLocationListener() != null ) {
|
||||
value.getLocationListener().onLocationChanged( location );
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if ( value.getLocationListener() != null ) {
|
||||
value.getLocationListener().onLocationChanged( location );
|
||||
}
|
||||
}
|
||||
Iterator< IMogoLocationListener > iterator = MogoRegisterCenterHandler.getInstance().getLocationListeners();
|
||||
while ( iterator.hasNext() ) {
|
||||
iterator.next().onLocationChanged( location );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -437,10 +314,9 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
public void onReceive( Context context, Intent intent ) {
|
||||
final String action = intent.getAction();
|
||||
if ( TextUtils.equals( action, Intent.ACTION_POWER_CONNECTED ) ) {
|
||||
for ( IMogoModuleProvider value : mModuleProviders.values() ) {
|
||||
if ( value.getCardLifecycle() != null ) {
|
||||
value.getCardLifecycle().accOn();
|
||||
}
|
||||
Iterator< IMogoModuleLifecycle > iterator = MogoRegisterCenterHandler.getInstance().getLifecycleListeners();
|
||||
if ( iterator.hasNext() ) {
|
||||
iterator.next().accOn();
|
||||
}
|
||||
}
|
||||
if ( TextUtils.equals( action, Intent.ACTION_POWER_DISCONNECTED ) ) {
|
||||
@@ -473,13 +349,10 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMarkerReceive( String cardType, IMogoMarker marker ) {
|
||||
for ( IMogoModuleProvider value : mModuleProviders.values() ) {
|
||||
if ( value.getModuleName().equals( cardType ) ) {
|
||||
if ( value.getMarkerClickListener() != null ) {
|
||||
value.getMarkerClickListener().onMarkerClicked( marker );
|
||||
}
|
||||
}
|
||||
public void onMarkerReceive( IMogoMarker marker ) {
|
||||
IMogoMarkerClickListener listener = MogoRegisterCenterHandler.getInstance().getMarkerListener( marker.getOwner() );
|
||||
if ( listener != null ) {
|
||||
listener.onMarkerClicked( marker );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,77 @@
|
||||
package com.mogo.module.main.registercenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-09
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = MogoServicePaths.PATH_REGISTER_CENTER )
|
||||
public class MogoRegisterCenter implements IMogoRegisterCenter {
|
||||
|
||||
@Override
|
||||
public void registerMogoModuleLifecycle( String moduleName, IMogoModuleLifecycle lifecycle ) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoModuleLifecycle( moduleName, lifecycle );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoModuleLifecycle( String moduleName ) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoModuleLifecycle( moduleName );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoMapListener( String moduleName, IMogoMapListener listener ) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoMapListener( moduleName, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoMapListener( String moduleName ) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoMapListener( moduleName );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoNaviListener( String moduleName, IMogoNaviListener listener ) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoNaviListener( moduleName, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoNaviListener( String moduleName ) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoNaviListener( moduleName );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoLocationListener( String moduleName, IMogoLocationListener listener ) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoLocationListener( moduleName, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoLocationListener( String moduleName ) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoLocationListener( moduleName );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoMarkerClickListener( String moduleName, IMogoMarkerClickListener listener ) {
|
||||
MogoRegisterCenterHandler.getInstance().registerMogoMarkerClickListener( moduleName, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoMarkerClickListener( String moduleName ) {
|
||||
MogoRegisterCenterHandler.getInstance().unregisterMogoMarkerClickListener( moduleName );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,148 @@
|
||||
package com.mogo.module.main.registercenter;
|
||||
|
||||
import android.content.Context;
|
||||
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
|
||||
import java.util.HashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-09
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MogoRegisterCenterHandler implements IMogoRegisterCenter {
|
||||
|
||||
private static volatile MogoRegisterCenterHandler sInstance;
|
||||
private Context mContext;
|
||||
|
||||
private Map< String, IMogoModuleLifecycle > mLifecycle = new HashMap<>();
|
||||
private Map< String, IMogoMapListener > mMap = new HashMap<>();
|
||||
private Map< String, IMogoNaviListener > mNavi = new HashMap<>();
|
||||
private Map< String, IMogoLocationListener > mLocation = new HashMap<>();
|
||||
private Map< String, IMogoMarkerClickListener > mMarker = new HashMap<>();
|
||||
|
||||
private MogoRegisterCenterHandler() {
|
||||
}
|
||||
|
||||
public static MogoRegisterCenterHandler getInstance() {
|
||||
if ( sInstance == null ) {
|
||||
synchronized ( MogoRegisterCenterHandler.class ) {
|
||||
if ( sInstance == null ) {
|
||||
sInstance = new MogoRegisterCenterHandler();
|
||||
}
|
||||
}
|
||||
}
|
||||
return sInstance;
|
||||
}
|
||||
|
||||
public synchronized void release() {
|
||||
sInstance = null;
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void registerMogoModuleLifecycle( String tag, IMogoModuleLifecycle lifecycle ) {
|
||||
mLifecycle.put( tag, lifecycle );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoModuleLifecycle( String tag ) {
|
||||
mLifecycle.remove( tag );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoMapListener( String tag, IMogoMapListener listener ) {
|
||||
mMap.put( tag, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoMapListener( String tag ) {
|
||||
mMap.remove( tag );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoNaviListener( String tag, IMogoNaviListener listener ) {
|
||||
mNavi.put( tag, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoNaviListener( String tag ) {
|
||||
mNavi.remove( tag );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoLocationListener( String tag, IMogoLocationListener listener ) {
|
||||
mLocation.put( tag, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoLocationListener( String tag ) {
|
||||
mLocation.remove( tag );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void registerMogoMarkerClickListener( String tag, IMogoMarkerClickListener listener ) {
|
||||
mMarker.put( tag, listener );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void unregisterMogoMarkerClickListener( String tag ) {
|
||||
mMarker.remove( tag );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
if ( mContext == null && context != null ) {
|
||||
mContext = context.getApplicationContext();
|
||||
}
|
||||
}
|
||||
|
||||
public IMogoModuleLifecycle getLifecycleListener( String tag ) {
|
||||
return mLifecycle.get( tag );
|
||||
}
|
||||
|
||||
public IMogoMapListener getMapListener( String tag ) {
|
||||
return mMap.get( tag );
|
||||
}
|
||||
|
||||
public IMogoNaviListener getNaviListener( String tag ) {
|
||||
return mNavi.get( tag );
|
||||
}
|
||||
|
||||
public IMogoLocationListener getLocationListener( String tag ) {
|
||||
return mLocation.get( tag );
|
||||
}
|
||||
|
||||
public IMogoMarkerClickListener getMarkerListener( String tag ) {
|
||||
return mMarker.get( tag );
|
||||
}
|
||||
|
||||
public Iterator< IMogoModuleLifecycle > getLifecycleListeners() {
|
||||
return mLifecycle.values().iterator();
|
||||
}
|
||||
|
||||
public Iterator< IMogoMapListener > getMapListeners() {
|
||||
return mMap.values().iterator();
|
||||
}
|
||||
|
||||
public Iterator< IMogoNaviListener > getNaviListeners() {
|
||||
return mNavi.values().iterator();
|
||||
}
|
||||
|
||||
public Iterator< IMogoLocationListener > getLocationListeners() {
|
||||
return mLocation.values().iterator();
|
||||
}
|
||||
|
||||
public Iterator< IMogoMarkerClickListener > getMarkerListeners() {
|
||||
return mMarker.values().iterator();
|
||||
}
|
||||
}
|
||||
@@ -16,6 +16,7 @@ import com.mogo.module.service.entity.MarkerLocation;
|
||||
import com.mogo.module.service.entity.MarkerOnlineCar;
|
||||
import com.mogo.module.service.entity.MarkerResponse;
|
||||
import com.mogo.module.service.entity.MarkerShareMusic;
|
||||
import com.mogo.module.service.marker.MapMarkerInfoView;
|
||||
import com.mogo.module.service.marker.MapMarkerView;
|
||||
import com.mogo.module.service.marker.MarkerInfoWindowAdapter;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
@@ -26,7 +27,6 @@ import com.mogo.service.map.IMogoMapService;
|
||||
import com.mogo.utils.TipToast;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import java.util.Random;
|
||||
|
||||
@@ -76,55 +76,7 @@ public class MarkerServiceHandler {
|
||||
@Override
|
||||
public void onMsgReceived(MarkerResponse response) {
|
||||
Logger.e(TAG, "===" + response);
|
||||
|
||||
getMarkerManager().removeMarkers();
|
||||
|
||||
// 解析不同的Marker类型,然后对应的进行绘制
|
||||
if (response != null && response.getResult() != null) {
|
||||
MarkerCardResult markerCardResult = response.getResult();
|
||||
|
||||
List<MarkerCarChat> carChat = markerCardResult.getCarChat();
|
||||
List<MarkerOnlineCar> onlineCar = markerCardResult.getOnlineCar();
|
||||
List<MarkerExploreWay> exploreWay = markerCardResult.getExploreWay();
|
||||
List<MarkerShareMusic> shareMusic = markerCardResult.getShareMusic();
|
||||
|
||||
ArrayList<MogoMarkerOptions> optionsList = new ArrayList<>();
|
||||
|
||||
if (carChat != null) {
|
||||
for (MarkerCarChat markerCarChat : carChat) {
|
||||
MarkerLocation markerLocation = markerCarChat.getLocation();
|
||||
drawMapMarker(markerCarChat.getType(), markerLocation, optionsList);
|
||||
}
|
||||
}
|
||||
|
||||
if (onlineCar != null) {
|
||||
for (MarkerOnlineCar markerOnlineCar : onlineCar) {
|
||||
MarkerLocation markerLocation = markerOnlineCar.getLocation();
|
||||
drawMapMarker(markerOnlineCar.getType(), markerLocation, optionsList);
|
||||
}
|
||||
}
|
||||
|
||||
if (exploreWay != null) {
|
||||
for (MarkerExploreWay markerExploreWay : exploreWay) {
|
||||
MarkerLocation markerLocation = markerExploreWay.getLocation();
|
||||
drawMapMarker(markerExploreWay.getType(), markerLocation, optionsList);
|
||||
}
|
||||
}
|
||||
|
||||
if (shareMusic != null) {
|
||||
for (MarkerShareMusic markerShareMusic : shareMusic) {
|
||||
MarkerLocation markerLocation = markerShareMusic.getLocation();
|
||||
drawMapMarker(markerShareMusic.getType(), markerLocation, optionsList);
|
||||
}
|
||||
}
|
||||
|
||||
List<IMogoMarker> iMogoMarkers = getMarkerManager().addMarkers(TAG, optionsList, true);
|
||||
for (IMogoMarker iMogoMarker : iMogoMarkers) {
|
||||
iMogoMarker.setInfoWindowAdapter(markerInfoWindowAdapter);
|
||||
iMogoMarker.setOnMarkerClickListener(mogoMarkerClickListener);
|
||||
}
|
||||
}
|
||||
|
||||
drawMapMarker(response);
|
||||
}
|
||||
});
|
||||
}
|
||||
@@ -168,27 +120,107 @@ public class MarkerServiceHandler {
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* 绘制Marker
|
||||
*/
|
||||
public static void drawMapMarker(MarkerResponse response) {
|
||||
getMarkerManager().removeMarkers();
|
||||
|
||||
// 解析不同的Marker类型,然后对应的进行绘制
|
||||
if (response != null && response.getResult() != null) {
|
||||
MarkerCardResult markerCardResult = response.getResult();
|
||||
|
||||
List<MarkerCarChat> carChat = markerCardResult.getCarChat();
|
||||
List<MarkerOnlineCar> onlineCar = markerCardResult.getOnlineCar();
|
||||
List<MarkerExploreWay> exploreWay = markerCardResult.getExploreWay();
|
||||
List<MarkerShareMusic> shareMusic = markerCardResult.getShareMusic();
|
||||
|
||||
if (carChat != null) {
|
||||
for (MarkerCarChat markerCarChat : carChat) {
|
||||
MarkerLocation markerLocation = markerCarChat.getLocation();
|
||||
drawMapMarker(
|
||||
markerCarChat.getType(),
|
||||
markerCarChat,
|
||||
markerLocation);
|
||||
}
|
||||
}
|
||||
|
||||
if (onlineCar != null) {
|
||||
for (MarkerOnlineCar markerOnlineCar : onlineCar) {
|
||||
MarkerLocation markerLocation = markerOnlineCar.getLocation();
|
||||
drawMapMarker(
|
||||
markerOnlineCar.getType(),
|
||||
markerOnlineCar,
|
||||
markerLocation);
|
||||
}
|
||||
}
|
||||
|
||||
if (exploreWay != null) {
|
||||
for (MarkerExploreWay markerExploreWay : exploreWay) {
|
||||
MarkerLocation markerLocation = markerExploreWay.getLocation();
|
||||
drawMapMarker(
|
||||
markerExploreWay.getType(),
|
||||
markerExploreWay,
|
||||
markerLocation);
|
||||
}
|
||||
}
|
||||
|
||||
if (shareMusic != null) {
|
||||
for (MarkerShareMusic markerShareMusic : shareMusic) {
|
||||
MarkerLocation markerLocation = markerShareMusic.getLocation();
|
||||
drawMapMarker(
|
||||
markerShareMusic.getType(),
|
||||
markerShareMusic,
|
||||
markerLocation);
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
getMapUIController().changeZoom(10);
|
||||
}
|
||||
|
||||
/**
|
||||
* 绘制Marker
|
||||
*
|
||||
* @param markerTag Marker类型
|
||||
* http://gitlab.zhidaoauto.com/ecos/yycp-service/CarLauncher-Docs/blob/master/%E5%8D%A1%E7%89%87%E7%B1%BB%E5%9E%8B%E5%AE%9A%E4%B9%89.md
|
||||
* @param markerLocation 要绘制Marker的位置信息
|
||||
* @param optionsList 要加入的Marker集合
|
||||
*/
|
||||
public static void drawMapMarker(String markerTag, MarkerLocation markerLocation,
|
||||
ArrayList<MogoMarkerOptions> optionsList) {
|
||||
Logger.e(markerTag, "绘制Marker====markerTag:" + markerTag);
|
||||
public static void drawMapMarker(String markerTag,
|
||||
Object bindObject,
|
||||
MarkerLocation markerLocation) {
|
||||
Logger.e(TAG, "绘制Marker====markerTag:" + markerTag);
|
||||
|
||||
MapMarkerView mapMarkerView = new MapMarkerView(mContext);
|
||||
MapMarkerInfoView mapMarkerInfoView = new MapMarkerInfoView(mContext);
|
||||
|
||||
MogoMarkerOptions options = new MogoMarkerOptions()
|
||||
.icon(mapMarkerView)
|
||||
.owner(markerTag)
|
||||
.latitude(markerLocation.getLat())
|
||||
.longitude(markerLocation.getLon());
|
||||
|
||||
optionsList.add(options);
|
||||
switch (markerTag) {
|
||||
case ServiceConst.CARD_TYPE_CARS_CHATTING:
|
||||
options.icon(mapMarkerView);
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_ROAD_CODITION:
|
||||
options.icon(mapMarkerView);
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_SHARE_MUSIC:
|
||||
options.icon(mapMarkerView);
|
||||
break;
|
||||
case ServiceConst.CARD_TYPE_USER_DATA:
|
||||
options.icon(mapMarkerInfoView);
|
||||
break;
|
||||
default:
|
||||
options.icon(mapMarkerView);
|
||||
break;
|
||||
}
|
||||
|
||||
IMogoMarker marker = getMarkerManager().addMarker(markerTag, options);
|
||||
marker.setInfoWindowAdapter(markerInfoWindowAdapter);
|
||||
marker.setOnMarkerClickListener(mogoMarkerClickListener);
|
||||
marker.setObject(bindObject);
|
||||
}
|
||||
|
||||
|
||||
@@ -203,13 +235,11 @@ public class MarkerServiceHandler {
|
||||
.owner("CARD_TYPE_USER_DATA")
|
||||
.latitude(39.574525d + new Random().nextDouble())
|
||||
.longitude(116.21733d + new Random().nextDouble());
|
||||
IMogoMarker marker = getMarkerManager().addMarker(TAG, options);
|
||||
IMogoMarker marker = getMarkerManager().addMarker("CARD_TYPE_USER_DATA", options);
|
||||
marker.setInfoWindowAdapter(markerInfoWindowAdapter);
|
||||
marker.setOnMarkerClickListener(mogoMarkerClickListener);
|
||||
|
||||
getMapUIController().changeZoom(false);
|
||||
marker.setObject("我是Marker上面绑定的数据");
|
||||
|
||||
getMapUIController().changeZoom(10);
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
@@ -26,4 +26,26 @@ public class ServiceConst {
|
||||
* 倒计时间隔
|
||||
*/
|
||||
public static final int DECREASE_INTERVAL = 1_000;
|
||||
|
||||
|
||||
/**
|
||||
* 卡片 车聊聊
|
||||
*/
|
||||
public static final String CARD_TYPE_CARS_CHATTING = "CARD_TYPE_CARS_CHATTING";
|
||||
|
||||
/**
|
||||
* 卡片 探路数据
|
||||
*/
|
||||
public static final String CARD_TYPE_ROAD_CODITION = "CARD_TYPE_ROAD_CODITION";
|
||||
|
||||
/**
|
||||
* 卡片 分享音乐
|
||||
*/
|
||||
public static final String CARD_TYPE_SHARE_MUSIC = "CARD_TYPE_SHARE_MUSIC";
|
||||
|
||||
/**
|
||||
* 卡片 用户数据
|
||||
*/
|
||||
public static final String CARD_TYPE_USER_DATA = "CARD_TYPE_USER_DATA";
|
||||
|
||||
}
|
||||
|
||||
@@ -76,5 +76,10 @@ public class MogoServicePaths {
|
||||
*/
|
||||
public static final String PATH_VOICE_MANAGER = "/voicemanager/api";
|
||||
|
||||
/**
|
||||
* 基础功能监听回调注册
|
||||
*/
|
||||
public static final String PATH_REGISTER_CENTER = "/registercenter/api";
|
||||
|
||||
|
||||
}
|
||||
|
||||
@@ -47,6 +47,7 @@ public interface IMogoModuleProvider extends IProvider {
|
||||
|
||||
/**
|
||||
* 生命周期控制方法
|
||||
* use {@link IMogoRegisterCenter#registerMogoModuleLifecycle(String, IMogoModuleLifecycle)} instead.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -54,6 +55,7 @@ public interface IMogoModuleProvider extends IProvider {
|
||||
|
||||
/**
|
||||
* 地图监听对象
|
||||
* use {@link IMogoRegisterCenter#registerMogoMapListener(String, IMogoMapListener)} instead.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@@ -70,22 +72,28 @@ public interface IMogoModuleProvider extends IProvider {
|
||||
|
||||
/**
|
||||
* 导航监听
|
||||
* use {@link IMogoRegisterCenter#registerMogoNaviListener(String, IMogoNaviListener)} instead.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
IMogoNaviListener getNaviListener();
|
||||
|
||||
/**
|
||||
* 定位变化监听:此接口接受地图定位信息
|
||||
* use {@link IMogoRegisterCenter#registerMogoLocationListener(String, IMogoLocationListener)} instead.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
IMogoLocationListener getLocationListener();
|
||||
|
||||
/**
|
||||
* marker 点击回调
|
||||
* use {@link IMogoRegisterCenter#registerMogoMarkerClickListener(String, IMogoMarkerClickListener)} instead.
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@Deprecated
|
||||
IMogoMarkerClickListener getMarkerClickListener();
|
||||
}
|
||||
|
||||
@@ -0,0 +1,96 @@
|
||||
package com.mogo.service.module;
|
||||
|
||||
import com.alibaba.android.arouter.facade.template.IProvider;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.marker.IMogoMarkerClickListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-09
|
||||
* <p>
|
||||
* 监听注册中心
|
||||
*/
|
||||
public interface IMogoRegisterCenter extends IProvider {
|
||||
|
||||
/**
|
||||
* 注册模块生命周期函数
|
||||
*
|
||||
* @param tag
|
||||
* @param lifecycle
|
||||
*/
|
||||
void registerMogoModuleLifecycle( String tag, IMogoModuleLifecycle lifecycle );
|
||||
|
||||
/**
|
||||
* 注销模块生命周期函数
|
||||
*
|
||||
* @param tag
|
||||
*/
|
||||
void unregisterMogoModuleLifecycle( String tag );
|
||||
|
||||
/**
|
||||
* 注册地图监听函数
|
||||
*
|
||||
* @param tag
|
||||
* @param listener
|
||||
* @return
|
||||
*/
|
||||
void registerMogoMapListener( String tag, IMogoMapListener listener );
|
||||
|
||||
/**
|
||||
* 注销地图监听函数
|
||||
*
|
||||
* @param tag
|
||||
*/
|
||||
void unregisterMogoMapListener( String tag );
|
||||
|
||||
/**
|
||||
* 注册导航监听函数
|
||||
*
|
||||
* @param tag
|
||||
* @param listener
|
||||
* @return
|
||||
*/
|
||||
void registerMogoNaviListener( String tag, IMogoNaviListener listener );
|
||||
|
||||
/**
|
||||
* 注销导航监听函数
|
||||
*
|
||||
* @param tag
|
||||
*/
|
||||
void unregisterMogoNaviListener( String tag );
|
||||
|
||||
/**
|
||||
* 注册定位监听函数
|
||||
*
|
||||
* @param tag
|
||||
* @param listener
|
||||
* @return
|
||||
*/
|
||||
void registerMogoLocationListener( String tag, IMogoLocationListener listener );
|
||||
|
||||
/**
|
||||
* 注销定位监听函数
|
||||
*
|
||||
* @param tag
|
||||
*/
|
||||
void unregisterMogoLocationListener( String tag );
|
||||
|
||||
/**
|
||||
* 注册marker点击监听函数
|
||||
*
|
||||
* @param tag
|
||||
* @param listener
|
||||
* @return
|
||||
*/
|
||||
void registerMogoMarkerClickListener( String tag, IMogoMarkerClickListener listener );
|
||||
|
||||
/**
|
||||
* 注销定位监听函数
|
||||
*
|
||||
* @param tag
|
||||
*/
|
||||
void unregisterMogoMarkerClickListener( String tag );
|
||||
|
||||
}
|
||||