add showBounds interface
This commit is contained in:
2
.idea/misc.xml
generated
2
.idea/misc.xml
generated
@@ -1,6 +1,6 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<project version="4">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="1.8" project-jdk-type="JavaSDK">
|
||||
<component name="ProjectRootManager" version="2" languageLevel="JDK_1_8" project-jdk-name="JDK" project-jdk-type="JavaSDK">
|
||||
<output url="file://$PROJECT_DIR$/build/classes" />
|
||||
</component>
|
||||
</project>
|
||||
@@ -8,9 +8,6 @@ buildscript {
|
||||
maven {
|
||||
url 'http://maven.aliyun.com/nexus/content/groups/public/'
|
||||
}
|
||||
maven {
|
||||
url 'http://nexus.zhidaoauto.com/repository/maven-snapshots/'
|
||||
}
|
||||
maven {
|
||||
url 'http://nexus.zhidaoauto.com/repository/maven-releases/'
|
||||
}
|
||||
@@ -34,9 +31,6 @@ allprojects {
|
||||
maven {
|
||||
url 'http://maven.aliyun.com/nexus/content/groups/public/'
|
||||
}
|
||||
maven {
|
||||
url 'http://nexus.zhidaoauto.com/repository/maven-snapshots/'
|
||||
}
|
||||
maven {
|
||||
url 'http://nexus.zhidaoauto.com/repository/maven-releases/'
|
||||
}
|
||||
|
||||
@@ -4,6 +4,7 @@ import android.content.Context;
|
||||
import android.graphics.BitmapFactory;
|
||||
import android.graphics.Color;
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.view.MotionEvent;
|
||||
@@ -15,6 +16,8 @@ import com.amap.api.maps.CameraUpdateFactory;
|
||||
import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
import com.amap.api.maps.model.CameraPosition;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.maps.model.LatLngBounds;
|
||||
import com.amap.api.maps.model.LatLngBoundsCreator;
|
||||
import com.amap.api.maps.model.Marker;
|
||||
import com.amap.api.maps.model.MyLocationStyle;
|
||||
import com.amap.api.maps.model.Poi;
|
||||
@@ -42,6 +45,8 @@ import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.utils.WindowUtils;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import retrofit2.http.HEAD;
|
||||
|
||||
/**
|
||||
@@ -465,10 +470,10 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setLockZoom(int var1) {
|
||||
public void setLockZoom( int var1 ) {
|
||||
if ( checkAMapView() ) {
|
||||
Logger.d( TAG, "锁定锁车比例尺" );
|
||||
mMapView.setLockZoom(var1);
|
||||
mMapView.setLockZoom( var1 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -624,14 +629,14 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
/**
|
||||
* 模拟点击事件,达到锁车->普通事件
|
||||
*/
|
||||
private void mockTouchEvent(){
|
||||
private void mockTouchEvent() {
|
||||
long downTime = SystemClock.uptimeMillis();
|
||||
long eventTime = SystemClock.uptimeMillis() + 100;
|
||||
int metaState = 0;
|
||||
MotionEvent motionEvent = MotionEvent.obtain(downTime, eventTime, MotionEvent.ACTION_DOWN, 0, 0, metaState);
|
||||
mMapView.dispatchTouchEvent(motionEvent);
|
||||
MotionEvent upEvent = MotionEvent.obtain(downTime + 100, eventTime + 100, MotionEvent.ACTION_UP, 0,0, metaState);
|
||||
mMapView.dispatchTouchEvent(upEvent);
|
||||
MotionEvent motionEvent = MotionEvent.obtain( downTime, eventTime, MotionEvent.ACTION_DOWN, 0, 0, metaState );
|
||||
mMapView.dispatchTouchEvent( motionEvent );
|
||||
MotionEvent upEvent = MotionEvent.obtain( downTime + 100, eventTime + 100, MotionEvent.ACTION_UP, 0, 0, metaState );
|
||||
mMapView.dispatchTouchEvent( upEvent );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -643,4 +648,26 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showBounds( List< MogoLatLng > lonLats, Rect bound ) {
|
||||
if ( checkAMapView() ) {
|
||||
if ( lonLats == null ) {
|
||||
return;
|
||||
}
|
||||
try {
|
||||
LatLngBounds.Builder builder = new LatLngBounds.Builder();
|
||||
for ( MogoLatLng lonLat : lonLats ) {
|
||||
builder.include( ObjectUtils.fromMogo2( lonLat ) );
|
||||
}
|
||||
if ( bound == null ) {
|
||||
bound = new Rect();
|
||||
}
|
||||
LatLngBounds latLngBounds = builder.build();
|
||||
mMapView.getMap().moveCamera( CameraUpdateFactory.newLatLngBoundsRect( latLngBounds, bound.left, bound.right, bound.top, bound.bottom ) );
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "error." );
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.map.impl.amap.uicontroller;
|
||||
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
@@ -10,6 +11,8 @@ import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-26
|
||||
@@ -184,4 +187,11 @@ public class AMapUIController implements IMogoMapUIController {
|
||||
mClient.setRenderFps( fps );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showBounds( List< MogoLatLng > lonLats, Rect bound ) {
|
||||
if ( mClient != null ) {
|
||||
mClient.showBounds( lonLats, bound );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,11 +1,14 @@
|
||||
package com.mogo.map.uicontroller;
|
||||
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-26
|
||||
@@ -146,4 +149,10 @@ public interface IMogoMapUIController {
|
||||
* @param fps
|
||||
*/
|
||||
void setRenderFps( int fps );
|
||||
|
||||
/**
|
||||
* @param lonLats 经纬度围成的范围
|
||||
* @param bound 地图上可显示的范围
|
||||
*/
|
||||
void showBounds( List< MogoLatLng > lonLats, Rect bound );
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.view.animation.Interpolator;
|
||||
|
||||
import com.mogo.map.impl.amap.uicontroller.AMapUIController;
|
||||
@@ -8,6 +9,8 @@ import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.uicontroller.EnumMapUI;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-26
|
||||
@@ -177,4 +180,11 @@ public class MogoMapUIController implements IMogoMapUIController {
|
||||
mDelegate.setRenderFps( fps );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void showBounds( List< MogoLatLng > lonLats, Rect bound ) {
|
||||
if ( mDelegate != null ) {
|
||||
mDelegate.showBounds( lonLats, bound );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package com.mogo.module.extensions.entrance;
|
||||
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
@@ -39,6 +40,7 @@ import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.module.IMogoRegisterCenter;
|
||||
import com.mogo.service.statusmanager.IMogoStatusManager;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -50,7 +52,7 @@ import java.util.Map;
|
||||
*/
|
||||
public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresenter > implements EntranceView,
|
||||
IMogoNaviListener, IMogoMapListener {
|
||||
|
||||
|
||||
private static final String TAG = "EntranceFragment";
|
||||
|
||||
|
||||
@@ -122,8 +124,8 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
|
||||
mUploadRoadCondition = findViewById( R.id.module_entrance_id_upload_road_condition );
|
||||
mUploadRoadCondition.setOnClickListener( view -> {
|
||||
ShareControl.getInstance(getActivity()).showDialog();
|
||||
traceData("1");
|
||||
ShareControl.getInstance( getActivity() ).showDialog();
|
||||
traceData( "1" );
|
||||
} );
|
||||
|
||||
mVRMode = findViewById( R.id.module_entrance_id_vr_mode );
|
||||
@@ -138,7 +140,6 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
mMApUIController.changeZoom( 16.0f );
|
||||
mMogoStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mMApUIController.recoverLockMode();
|
||||
// mMApUIController.moveToCenter( new MogoLatLng( location.getLatitude(), location.getLongitude() ) );
|
||||
}
|
||||
} );
|
||||
|
||||
@@ -147,8 +148,8 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
mExitNavi.setOnClickListener( view -> {
|
||||
if ( mMogoNavi != null ) {
|
||||
//if ( mIsLock ) {
|
||||
NaviNoticeDialog naviNoticeDialog = new NaviNoticeDialog( getContext() );
|
||||
naviNoticeDialog.show();
|
||||
NaviNoticeDialog naviNoticeDialog = new NaviNoticeDialog( getContext() );
|
||||
naviNoticeDialog.show();
|
||||
//} else {
|
||||
// mMApUIController.recoverLockMode();
|
||||
//}
|
||||
@@ -163,7 +164,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
@NonNull
|
||||
@Override
|
||||
protected EntrancePresenter createPresenter() {
|
||||
return new EntrancePresenter(getContext(), this );
|
||||
return new EntrancePresenter( getContext(), this );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -174,8 +175,8 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
mMApUIController = mService.getMapUIController();
|
||||
mMogoLocationClient = mService.getSingletonLocationClient( getContext() );
|
||||
mMogoNavi = mService.getNavi( getContext() );
|
||||
mAnalytics = (IMogoAnalytics) ARouter.getInstance().build(MogoServicePaths.PATH_UTILS_ANALYTICS).navigation(getContext());
|
||||
mMogoStatusManager = (IMogoStatusManager )ARouter.getInstance().build( MogoServicePaths.PATH_STATUS_MANAGER ).navigation( getContext() );
|
||||
mAnalytics = ( IMogoAnalytics ) ARouter.getInstance().build( MogoServicePaths.PATH_UTILS_ANALYTICS ).navigation( getContext() );
|
||||
mMogoStatusManager = ( IMogoStatusManager ) ARouter.getInstance().build( MogoServicePaths.PATH_STATUS_MANAGER ).navigation( getContext() );
|
||||
|
||||
mMogoRegisterCenter.registerMogoNaviListener( ExtensionsModuleConst.TYPE_ENTRANCE, this );
|
||||
mMogoRegisterCenter.registerMogoMapListener( ExtensionsModuleConst.TYPE_ENTRANCE, this );
|
||||
@@ -280,10 +281,10 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
|
||||
}
|
||||
|
||||
|
||||
private void traceData(String from) {
|
||||
Map<String, Object> properties = new HashMap<>();
|
||||
properties.put("from", from);
|
||||
mAnalytics.track("Launcher_Share_Click", properties);
|
||||
private void traceData( String from ) {
|
||||
Map< String, Object > properties = new HashMap<>();
|
||||
properties.put( "from", from );
|
||||
mAnalytics.track( "Launcher_Share_Click", properties );
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user