merge
This commit is contained in:
@@ -454,6 +454,8 @@ public class AMapNaviViewWrapper implements IMogoMapView, IMogoMapUIController,
|
||||
|
||||
@Override
|
||||
public void onCameraChangeFinish( CameraPosition cameraPosition ) {
|
||||
|
||||
if ( cameraPosition != null ) {
|
||||
MogoMapListenerHandler.getInstance().onMapChanged( ObjectUtils.fromAMap( cameraPosition.target ), cameraPosition.zoom, cameraPosition.tilt, cameraPosition.bearing );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -46,4 +46,12 @@ public class MogoLatLng implements Parcelable {
|
||||
return new MogoLatLng[size];
|
||||
}
|
||||
};
|
||||
|
||||
@Override
|
||||
public String toString() {
|
||||
return "MogoLatLng{" +
|
||||
"lat=" + lat +
|
||||
", lng=" + lng +
|
||||
'}';
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.map.listener;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.model.MogoPoi;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
|
||||
@@ -53,4 +54,12 @@ public interface IMogoMapListener {
|
||||
* @param ui
|
||||
*/
|
||||
void onMapModeChanged( EnumMapUI ui );
|
||||
|
||||
/**
|
||||
* @param latLng 中点的经纬度
|
||||
* @param zoom 缩放大小
|
||||
* @param tilt 倾斜度
|
||||
* @param bearing 旋转角度
|
||||
*/
|
||||
void onMapChanged( MogoLatLng latLng, float zoom, float tilt, float bearing );
|
||||
}
|
||||
|
||||
@@ -3,6 +3,7 @@ package com.mogo.map.listener;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.model.MogoPoi;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
@@ -103,4 +104,13 @@ public class MogoMapListenerHandler implements IMogoMapListener, IMogoMapListene
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapChanged( MogoLatLng location, float zoom, float tilt, float bearing ) {
|
||||
if ( mDelegateListener != null ) {
|
||||
synchronized ( mDelegateListener ) {
|
||||
mDelegateListener.onMapChanged( location, zoom, tilt, bearing );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,6 +42,7 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.modulemap
|
||||
implementation rootProject.ext.dependencies.mogoserviceapi
|
||||
implementation rootProject.ext.dependencies.mogoservice
|
||||
implementation rootProject.ext.dependencies.moduleservice
|
||||
implementation rootProject.ext.dependencies.moduleapps
|
||||
implementation rootProject.ext.dependencies.mogoconnection
|
||||
} else {
|
||||
@@ -49,6 +50,7 @@ dependencies {
|
||||
implementation project(":foudations:mogo-commons")
|
||||
implementation project(':modules:mogo-module-common')
|
||||
implementation project(':modules:mogo-module-map')
|
||||
implementation project(':modules:mogo-module-service')
|
||||
implementation project(':services:mogo-service-api')
|
||||
implementation project(':services:mogo-service')
|
||||
implementation project(':modules:mogo-module-apps')
|
||||
|
||||
@@ -125,7 +125,7 @@ public class MainActivity extends MvpActivity< MainView, MainPresenter > impleme
|
||||
mLocationClient.addLocationListener( this );
|
||||
mLocationClient.start();
|
||||
|
||||
mMogoModuleHandler.loadPushService();
|
||||
mMogoModuleHandler.loadService();
|
||||
|
||||
mMogoModuleHandler.loadAppsList( R.id.module_main_id_fragment_container );
|
||||
}
|
||||
|
||||
@@ -67,9 +67,9 @@ public interface MogoModulesHandler extends IMogoMapListener,
|
||||
void setEnable( String module );
|
||||
|
||||
/**
|
||||
* 加载 push 服务
|
||||
* 加载服务
|
||||
*/
|
||||
void loadPushService();
|
||||
void loadService();
|
||||
|
||||
/**
|
||||
* 销毁
|
||||
|
||||
@@ -22,6 +22,7 @@ import com.mogo.module.common.MogoModule;
|
||||
import com.mogo.module.common.MogoModulePaths;
|
||||
import com.mogo.module.main.MainActivity;
|
||||
import com.mogo.module.main.receiver.MogoReceiver;
|
||||
import com.mogo.module.service.ServiceConst;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.utils.ResourcesHelper;
|
||||
@@ -47,9 +48,13 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
private static final String TAG = "MogoModulesManager";
|
||||
|
||||
private MainActivity mActivity;
|
||||
|
||||
private final Map< String, IMogoModuleProvider > mCardProviders = new HashMap<>();
|
||||
private IMogoModuleProvider mMapProvider;
|
||||
private IMogoModuleProvider mAppsListProvider;
|
||||
private IMogoModuleProvider mPushProvider;
|
||||
private IMogoModuleProvider mRefreshStrategyProvider;
|
||||
|
||||
private String mEnableModuleName = null;
|
||||
private Runnable mMapLoadedCallback;
|
||||
|
||||
@@ -136,13 +141,9 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void loadPushService() {
|
||||
IMogoModuleProvider provider = ( IMogoModuleProvider ) ARouter.getInstance().build( "/push/ui" ).navigation( mActivity.getApplicationContext() );
|
||||
if ( provider != null ) {
|
||||
if ( provider.getType() == IMogoModuleProvider.TYPE_SERVICE ) {
|
||||
|
||||
}
|
||||
}
|
||||
public void loadService() {
|
||||
mPushProvider = ( IMogoModuleProvider ) ARouter.getInstance().build( "/push/ui" ).navigation( mActivity.getApplicationContext() );
|
||||
mRefreshStrategyProvider = ( IMogoModuleProvider ) ARouter.getInstance().build( ServiceConst.PATH_REFRESH_STRATEGY ).navigation( mActivity.getApplicationContext() );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -180,6 +181,12 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
provider.getMapListener().onMapLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
if ( mRefreshStrategyProvider != null ) {
|
||||
if ( mRefreshStrategyProvider.getMapListener() != null ) {
|
||||
mRefreshStrategyProvider.getMapListener().onMapLoaded();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -190,6 +197,11 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
provider.getMapListener().onTouch( motionEvent );
|
||||
}
|
||||
}
|
||||
if ( mRefreshStrategyProvider != null ) {
|
||||
if ( mRefreshStrategyProvider.getMapListener() != null ) {
|
||||
mRefreshStrategyProvider.getMapListener().onTouch( motionEvent );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -200,6 +212,12 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
provider.getMapListener().onPOIClick( poi );
|
||||
}
|
||||
}
|
||||
|
||||
if ( mRefreshStrategyProvider != null ) {
|
||||
if ( mRefreshStrategyProvider.getMapListener() != null ) {
|
||||
mRefreshStrategyProvider.getMapListener().onPOIClick( poi );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -210,6 +228,12 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
provider.getMapListener().onMapClick( latLng );
|
||||
}
|
||||
}
|
||||
|
||||
if ( mRefreshStrategyProvider != null ) {
|
||||
if ( mRefreshStrategyProvider.getMapListener() != null ) {
|
||||
mRefreshStrategyProvider.getMapListener().onMapClick( latLng );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -220,6 +244,12 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
provider.getMapListener().onLockMap( isLock );
|
||||
}
|
||||
}
|
||||
|
||||
if ( mRefreshStrategyProvider != null ) {
|
||||
if ( mRefreshStrategyProvider.getMapListener() != null ) {
|
||||
mRefreshStrategyProvider.getMapListener().onLockMap( isLock );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -230,6 +260,21 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
provider.getMapListener().onMapModeChanged( ui );
|
||||
}
|
||||
}
|
||||
|
||||
if ( mRefreshStrategyProvider != null ) {
|
||||
if ( mRefreshStrategyProvider.getMapListener() != null ) {
|
||||
mRefreshStrategyProvider.getMapListener().onMapModeChanged( ui );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapChanged( MogoLatLng location, float zoom, float tilt, float bearing ) {
|
||||
if ( mRefreshStrategyProvider != null ) {
|
||||
if ( mRefreshStrategyProvider.getMapListener() != null ) {
|
||||
mRefreshStrategyProvider.getMapListener().onMapChanged( location, zoom, tilt, bearing );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -240,6 +285,12 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
provider.getNaviListener().onInitNaviFailure();
|
||||
}
|
||||
}
|
||||
|
||||
if ( mRefreshStrategyProvider != null ) {
|
||||
if ( mRefreshStrategyProvider.getNaviListener() != null ) {
|
||||
mRefreshStrategyProvider.getNaviListener().onInitNaviFailure();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -250,6 +301,12 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
provider.getNaviListener().onInitNaviSuccess();
|
||||
}
|
||||
}
|
||||
|
||||
if ( mRefreshStrategyProvider != null ) {
|
||||
if ( mRefreshStrategyProvider.getNaviListener() != null ) {
|
||||
mRefreshStrategyProvider.getNaviListener().onInitNaviSuccess();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -260,6 +317,12 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
provider.getNaviListener().onNaviInfoUpdate( naviinfo );
|
||||
}
|
||||
}
|
||||
|
||||
if ( mRefreshStrategyProvider != null ) {
|
||||
if ( mRefreshStrategyProvider.getNaviListener() != null ) {
|
||||
mRefreshStrategyProvider.getNaviListener().onNaviInfoUpdate( naviinfo );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -271,6 +334,12 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
provider.getNaviListener().onStartNavi();
|
||||
}
|
||||
}
|
||||
|
||||
if ( mRefreshStrategyProvider != null ) {
|
||||
if ( mRefreshStrategyProvider.getNaviListener() != null ) {
|
||||
mRefreshStrategyProvider.getNaviListener().onStartNavi();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -282,6 +351,12 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
provider.getNaviListener().onStopNavi();
|
||||
}
|
||||
}
|
||||
|
||||
if ( mRefreshStrategyProvider != null ) {
|
||||
if ( mRefreshStrategyProvider.getNaviListener() != null ) {
|
||||
mRefreshStrategyProvider.getNaviListener().onStopNavi();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -292,6 +367,12 @@ public class MogoModulesManager implements MogoModulesHandler,
|
||||
provider.getLocationListener().onLocationChanged( location );
|
||||
}
|
||||
}
|
||||
|
||||
if ( mRefreshStrategyProvider != null ) {
|
||||
if ( mRefreshStrategyProvider.getLocationListener() != null ) {
|
||||
mRefreshStrategyProvider.getLocationListener().onLocationChanged( location );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public void registerReceiver() {
|
||||
|
||||
@@ -12,6 +12,13 @@ android {
|
||||
|
||||
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
||||
consumerProguardFiles 'consumer-rules.pro'
|
||||
|
||||
javaCompileOptions {
|
||||
annotationProcessorOptions {
|
||||
arguments = [AROUTER_MODULE_NAME: project.getName()]
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
buildTypes {
|
||||
|
||||
@@ -0,0 +1,148 @@
|
||||
package com.mogo.module.service;
|
||||
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
import com.mogo.map.model.MogoPoi;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-03
|
||||
* <p>
|
||||
* 数据刷新策略
|
||||
*/
|
||||
@Route( path = ServiceConst.PATH_REFRESH_STRATEGY )
|
||||
public class MogoRefreshStrategyProvider implements IMogoModuleProvider, IMogoMapListener, IMogoLocationListener, IMogoNaviListener {
|
||||
|
||||
private static final String TAG = "MogoRefreshStrategyProvider";
|
||||
|
||||
@Override
|
||||
public final Fragment createFragment( Context context, Bundle data ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final View createView( Context context ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final IMogoModuleLifecycle getCardLifecycle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapListener getMapListener() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return TYPE_SERVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoNaviListener getNaviListener() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoLocationListener getLocationListener() {
|
||||
return this;
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
public String getModuleName() {
|
||||
return ServiceConst.PATH_REFRESH_STRATEGY;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void onMapLoaded() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTouch( MotionEvent motionEvent ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPOIClick( MogoPoi poi ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapClick( MogoLatLng latLng ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLockMap( boolean isLock ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapModeChanged( EnumMapUI ui ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapChanged( MogoLatLng latLng, float zoom, float tilt, float bearing ) {
|
||||
Logger.d( TAG, "current map status: %s, zoom = %f, tilt = %f, bearing = %f", latLng, zoom, tilt, bearing );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLocationChanged( MogoLocation location ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitNaviFailure() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onInitNaviSuccess() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate( MogoNaviInfo naviinfo ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -1,59 +0,0 @@
|
||||
package com.mogo.module.service;
|
||||
|
||||
|
||||
import android.app.Service;
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.fragment.app.Fragment;
|
||||
|
||||
import com.mogo.map.listener.IMogoMapListener;
|
||||
import com.mogo.map.location.IMogoLocationListener;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-03
|
||||
* <p>
|
||||
* service 服务:负责数据上传策略
|
||||
*/
|
||||
public abstract class MogoServiceProvider extends Service implements IMogoModuleProvider {
|
||||
|
||||
@Override
|
||||
public final Fragment createFragment( Context context, Bundle data ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final View createView( Context context ) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public final IMogoModuleLifecycle getCardLifecycle() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoMapListener getMapListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getType() {
|
||||
return TYPE_SERVICE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoNaviListener getNaviListener() {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoLocationListener getLocationListener() {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,15 @@
|
||||
package com.mogo.module.service;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-01-03
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class ServiceConst {
|
||||
|
||||
/**
|
||||
* 刷新策略模块地址
|
||||
*/
|
||||
public static final String PATH_REFRESH_STRATEGY = "/strategy/refresh";
|
||||
}
|
||||
@@ -278,6 +278,11 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
Logger.d(TAG, ui.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapChanged( MogoLatLng location, float zoom, float tilt, float bearing ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
Logger.w(TAG, "onDestroyView position=" + position);
|
||||
|
||||
@@ -59,8 +59,6 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
private Bitmap mClickedMarkerIcon;
|
||||
private TextView mLocInfo;
|
||||
private TextView mLoc;
|
||||
private Button m2D3D;
|
||||
private CheckBox mNaviMode;
|
||||
|
||||
private IMogoMarker mLastClickedMarker;
|
||||
private TanluInfoWindowAdapter mDemoInfoWindowAdapter;
|
||||
@@ -142,16 +140,6 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
}
|
||||
});
|
||||
|
||||
m2D3D.setOnClickListener(new View.OnClickListener() {
|
||||
private EnumMapUI ui = EnumMapUI.NorthUP_2D;
|
||||
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
TanluServiceHandler.getMapUIController().changeMapMode(ui = ui.next());
|
||||
m2D3D.setText(ui.toString());
|
||||
}
|
||||
});
|
||||
|
||||
findViewById(R.id.demo_module_id_current).setOnClickListener(new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick(View v) {
|
||||
@@ -283,6 +271,11 @@ public class TanluCardViewFragment extends MvpFragment<IView, Presenter<IView>>
|
||||
Logger.d(TAG, ui.name());
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapChanged( MogoLatLng location, float zoom, float tilt, float bearing ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
Logger.w(TAG, "onDestroyView position=" + position);
|
||||
|
||||
Reference in New Issue
Block a user