opt: main page, add polyline api, add back to launcher logic; bugfix: map resume when back to mainactivity
This commit is contained in:
@@ -7,6 +7,7 @@ import android.graphics.Point;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Bundle;
|
||||
import android.os.SystemClock;
|
||||
import android.os.Trace;
|
||||
import android.view.MotionEvent;
|
||||
import android.view.View;
|
||||
import android.view.animation.Interpolator;
|
||||
@@ -319,7 +320,9 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
@Override
|
||||
public void onLockMap( boolean isLock ) {
|
||||
Logger.d( TAG, "lock status = %s", isLock );
|
||||
Trace.beginSection( "timer.onCameraChangeFinish" );
|
||||
MogoMapListenerHandler.getInstance().onLockMap( isLock );
|
||||
Trace.endSection();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -418,7 +421,6 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
}
|
||||
|
||||
|
||||
|
||||
private boolean checkAMapView() {
|
||||
if ( mMapView == null ) {
|
||||
Logger.e( TAG, "高德mapView实例为空,请检查" );
|
||||
@@ -549,17 +551,19 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
@Override
|
||||
public void onCameraChangeFinish( CameraPosition cameraPosition ) {
|
||||
if ( cameraPosition != null ) {
|
||||
MogoMapListenerHandler.getInstance()
|
||||
.onMapChanged( ObjectUtils.fromAMap( cameraPosition.target ), cameraPosition.zoom,
|
||||
cameraPosition.tilt, cameraPosition.bearing );
|
||||
Trace.beginSection( "timer.onCameraChangeFinish" );
|
||||
MogoMapListenerHandler.getInstance().onMapChanged( ObjectUtils.fromAMap( cameraPosition.target ),
|
||||
cameraPosition.zoom,
|
||||
cameraPosition.tilt,
|
||||
cameraPosition.bearing );
|
||||
Trace.endSection();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoLatLng getCameraNorthEastPosition() {
|
||||
try {
|
||||
return ObjectUtils.fromAMap(
|
||||
mMapView.getMap().getProjection().getVisibleRegion().latLngBounds.northeast );
|
||||
return ObjectUtils.fromAMap( mMapView.getMap().getProjection().getVisibleRegion().latLngBounds.northeast );
|
||||
} catch ( Exception e ) {
|
||||
|
||||
}
|
||||
@@ -569,8 +573,7 @@ public class AMapNaviViewWrapper implements IMogoMapView,
|
||||
@Override
|
||||
public MogoLatLng getCameraSouthWestPosition() {
|
||||
try {
|
||||
return ObjectUtils.fromAMap(
|
||||
mMapView.getMap().getProjection().getVisibleRegion().latLngBounds.southwest );
|
||||
return ObjectUtils.fromAMap( mMapView.getMap().getProjection().getVisibleRegion().latLngBounds.southwest );
|
||||
} catch ( Exception e ) {
|
||||
|
||||
}
|
||||
|
||||
@@ -6,16 +6,21 @@ import com.amap.api.maps.AMap;
|
||||
import com.amap.api.maps.CameraUpdateFactory;
|
||||
import com.amap.api.maps.model.Marker;
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
import com.amap.api.maps.model.Polyline;
|
||||
import com.amap.api.maps.model.PolylineOptions;
|
||||
import com.amap.api.navi.AMapNaviView;
|
||||
import com.mogo.map.IMogoMap;
|
||||
import com.mogo.map.IMogoUiSettings;
|
||||
import com.mogo.map.impl.amap.marker.AMapInfoWindowAdapter;
|
||||
import com.mogo.map.impl.amap.marker.AMapMarkerWrapper;
|
||||
import com.mogo.map.impl.amap.overlay.AMapPolylineWrapper;
|
||||
import com.mogo.map.impl.amap.uicontroller.AMapUIController;
|
||||
import com.mogo.map.impl.amap.utils.ObjectUtils;
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.marker.MogoMarkersHandler;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
@@ -219,6 +224,19 @@ public class AMapWrapper implements IMogoMap {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoPolyline addPolyline( MogoPolylineOptions options ) {
|
||||
if ( checkAMap() ) {
|
||||
PolylineOptions polylineOptions = ObjectUtils.fromMogo( options );
|
||||
if ( polylineOptions == null ) {
|
||||
return null;
|
||||
}
|
||||
Polyline polyline = mAMap.addPolyline( polylineOptions );
|
||||
return new AMapPolylineWrapper( polyline, options );
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
private boolean checkAMap() {
|
||||
if ( mAMap == null ) {
|
||||
Logger.e( TAG, "高德map实例为空,请检查" );
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
package com.mogo.map.impl.amap.location;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Trace;
|
||||
|
||||
import com.amap.api.location.AMapLocation;
|
||||
import com.amap.api.location.AMapLocationClient;
|
||||
@@ -139,6 +140,7 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
aMapLocation.getLongitude() == 0.0D ) {
|
||||
return;
|
||||
}
|
||||
Trace.beginSection("timer.onLocationChanged");
|
||||
mLastLocation = ObjectUtils.fromAMap( aMapLocation );
|
||||
synchronized ( sListeners ) {
|
||||
Iterator< IMogoLocationListener > listenerIterator = sListeners.iterator();
|
||||
@@ -146,6 +148,7 @@ public class ALocationClient implements IMogoLocationClient {
|
||||
listenerIterator.next().onLocationChanged( mLastLocation.clone() );
|
||||
}
|
||||
}
|
||||
Trace.endSection();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -2,6 +2,7 @@ package com.mogo.map.impl.amap.navi;
|
||||
|
||||
import android.content.Context;
|
||||
import android.graphics.Rect;
|
||||
import android.os.Trace;
|
||||
|
||||
import com.amap.api.maps.model.Polyline;
|
||||
import com.amap.api.navi.AMapNavi;
|
||||
@@ -178,8 +179,10 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate( NaviInfo naviInfo ) {
|
||||
Trace.beginSection( "NaviListenerAdapter.onNaviInfoUpdate" );
|
||||
MogoNaviListenerHandler.getInstance().onNaviInfoUpdate( ObjectUtils.fromAMap( mContext, naviInfo ) );
|
||||
mNaviOverlayHelper.handleNaviInfoUpdate( naviInfo );
|
||||
Trace.endSection();
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -201,8 +204,10 @@ public class NaviListenerAdapter extends AMapNaviListenerAdapter {
|
||||
|
||||
@Override
|
||||
public void onLocationChange( AMapNaviLocation aMapNaviLocation ) {
|
||||
Trace.beginSection( "NaviListenerAdapter.onLocationChange" );
|
||||
super.onLocationChange( aMapNaviLocation );
|
||||
mNaviOverlayHelper.handlePassedLocation( aMapNaviLocation );
|
||||
Trace.endSection();
|
||||
}
|
||||
|
||||
public void stopNavi() {
|
||||
|
||||
@@ -0,0 +1,196 @@
|
||||
package com.mogo.map.impl.amap.overlay;
|
||||
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.maps.model.Polyline;
|
||||
import com.amap.api.maps.model.PolylineOptions;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.impl.amap.utils.ObjectUtils;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-10
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class AMapPolylineWrapper implements IMogoPolyline {
|
||||
|
||||
private Polyline mPolyline;
|
||||
private MogoPolylineOptions mOptions;
|
||||
private boolean mIsDestroyed = false;
|
||||
|
||||
public AMapPolylineWrapper( Polyline mPolyline,
|
||||
MogoPolylineOptions mOptions ) {
|
||||
this.mPolyline = mPolyline;
|
||||
this.mOptions = mOptions;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void destroy() {
|
||||
remove();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void remove() {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.remove();
|
||||
}
|
||||
mIsDestroyed = true;
|
||||
}
|
||||
|
||||
@Override
|
||||
public String getId() {
|
||||
if ( mPolyline != null ) {
|
||||
return mPolyline.getId();
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setPoints( List< MogoLatLng > lonLats ) {
|
||||
if ( lonLats == null || lonLats.isEmpty() ) {
|
||||
mPolyline.setPoints( new ArrayList< LatLng >() );
|
||||
return;
|
||||
}
|
||||
ArrayList< LatLng > points = new ArrayList<>();
|
||||
for ( MogoLatLng lonLat : lonLats ) {
|
||||
LatLng latLng = ObjectUtils.fromMogo2( lonLat );
|
||||
if ( latLng == null ) {
|
||||
continue;
|
||||
}
|
||||
points.add( latLng );
|
||||
}
|
||||
mPolyline.setPoints( points );
|
||||
}
|
||||
|
||||
@Override
|
||||
public List< MogoLatLng > getPoints() {
|
||||
if ( mPolyline == null ) {
|
||||
return null;
|
||||
}
|
||||
ArrayList< MogoLatLng > lonLats = new ArrayList<>();
|
||||
List< LatLng > points = mPolyline.getPoints();
|
||||
if ( points != null ) {
|
||||
for ( LatLng latLng : points ) {
|
||||
MogoLatLng lonLat = ObjectUtils.fromAMap( latLng );
|
||||
if ( lonLat == null ) {
|
||||
continue;
|
||||
}
|
||||
lonLats.add( lonLat );
|
||||
}
|
||||
}
|
||||
return lonLats;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setGeodesic( boolean draw ) {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setGeodesic( draw );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isGeodesic() {
|
||||
return mPolyline == null ? false : mPolyline.isGeodesic();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setDottedLine( boolean dottedLine ) {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setDottedLine( dottedLine );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDottedLine() {
|
||||
return mPolyline == null ? false : mPolyline.isDottedLine();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setWidth( float width ) {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setWidth( width );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getWidth() {
|
||||
if ( mPolyline != null ) {
|
||||
return mPolyline.getWidth();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setColor( int color ) {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setColor( color );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public int getColor() {
|
||||
if ( mPolyline != null ) {
|
||||
return mPolyline.getColor();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setZIndex( float zIndex ) {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setZIndex( zIndex );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public float getZIndex() {
|
||||
if ( mPolyline != null ) {
|
||||
return mPolyline.getZIndex();
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setVisible( boolean visible ) {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setVisible( visible );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isVisible() {
|
||||
if ( mPolyline != null ) {
|
||||
return mPolyline.isVisible();
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setTransparency( float transparency ) {
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setTransparency( transparency );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void setOption( MogoPolylineOptions option ) {
|
||||
PolylineOptions target = ObjectUtils.fromMogo( option );
|
||||
if ( target == null ) {
|
||||
return;
|
||||
}
|
||||
mOptions = option;
|
||||
if ( mPolyline != null ) {
|
||||
mPolyline.setOptions( target );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public boolean isDestroyed() {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
@@ -10,6 +10,7 @@ import com.amap.api.maps.model.BitmapDescriptorFactory;
|
||||
import com.amap.api.maps.model.LatLng;
|
||||
import com.amap.api.maps.model.MarkerOptions;
|
||||
import com.amap.api.maps.model.Poi;
|
||||
import com.amap.api.maps.model.PolylineOptions;
|
||||
import com.amap.api.navi.model.AMapCongestionLink;
|
||||
import com.amap.api.navi.model.AMapNaviTrafficFacilityInfo;
|
||||
import com.amap.api.navi.model.AimLessModeCongestionInfo;
|
||||
@@ -46,6 +47,7 @@ import com.mogo.map.navi.MogoCongestionLink;
|
||||
import com.mogo.map.navi.MogoNaviInfo;
|
||||
import com.mogo.map.navi.MogoNaviListenerHandler;
|
||||
import com.mogo.map.navi.MogoTraffic;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.map.search.geo.MogoAoiItem;
|
||||
import com.mogo.map.search.geo.MogoBusinessArea;
|
||||
import com.mogo.map.search.geo.MogoCrossroad;
|
||||
@@ -704,4 +706,31 @@ public class ObjectUtils {
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
public static PolylineOptions fromMogo( MogoPolylineOptions options ) {
|
||||
if ( options == null ) {
|
||||
return null;
|
||||
}
|
||||
PolylineOptions target = new PolylineOptions();
|
||||
if ( options.getPoints() != null ) {
|
||||
List< LatLng > points = new ArrayList<>();
|
||||
for ( MogoLatLng point : options.getPoints() ) {
|
||||
points.add( fromMogo2( point ) );
|
||||
}
|
||||
target.addAll( points );
|
||||
}
|
||||
target.width( options.getWidth() );
|
||||
target.color( options.getColor() );
|
||||
target.zIndex( options.getWidth() );
|
||||
target.visible( options.isVisible() );
|
||||
target.geodesic( options.isGeodesic() );
|
||||
target.setDottedLine( options.isDottedLine() );
|
||||
target.useGradient( options.isGradient() );
|
||||
target.transparency( options.getTransparency() );
|
||||
target.aboveMaskLayer( options.isAboveMaskLayer() );
|
||||
target.lineCapType( PolylineOptions.LineCapType.LineCapRound );
|
||||
target.lineJoinType( PolylineOptions.LineJoinType.LineJoinRound );
|
||||
target.setDottedLineType( PolylineOptions.DOTTEDLINE_TYPE_CIRCLE );
|
||||
return target;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -2,6 +2,8 @@ package com.mogo.map;
|
||||
|
||||
import com.mogo.map.marker.IMogoMarker;
|
||||
import com.mogo.map.marker.MogoMarkerOptions;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
import com.mogo.map.uicontroller.IMogoMapUIController;
|
||||
|
||||
import java.util.ArrayList;
|
||||
@@ -127,4 +129,12 @@ public interface IMogoMap {
|
||||
* @return
|
||||
*/
|
||||
float getZoomLevel();
|
||||
|
||||
/**
|
||||
* 添加线段
|
||||
*
|
||||
* @param options
|
||||
* @return
|
||||
*/
|
||||
IMogoPolyline addPolyline( MogoPolylineOptions options );
|
||||
}
|
||||
|
||||
@@ -54,63 +54,49 @@ public class MogoMapListenerHandler implements IMogoMapListener, IMogoMapListene
|
||||
@Override
|
||||
public void onMapLoaded() {
|
||||
if ( mDelegateListener != null ) {
|
||||
synchronized ( mDelegateListener ) {
|
||||
mDelegateListener.onMapLoaded();
|
||||
}
|
||||
mDelegateListener.onMapLoaded();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTouch( MotionEvent motionEvent ) {
|
||||
if ( mDelegateListener != null ) {
|
||||
synchronized ( mDelegateListener ) {
|
||||
mDelegateListener.onTouch( motionEvent );
|
||||
}
|
||||
mDelegateListener.onTouch( motionEvent );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPOIClick( MogoPoi poi ) {
|
||||
if ( mDelegateListener != null ) {
|
||||
synchronized ( mDelegateListener ) {
|
||||
mDelegateListener.onPOIClick( poi );
|
||||
}
|
||||
mDelegateListener.onPOIClick( poi );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapClick( MogoLatLng latLng ) {
|
||||
if ( mDelegateListener != null ) {
|
||||
synchronized ( mDelegateListener ) {
|
||||
mDelegateListener.onMapClick( latLng );
|
||||
}
|
||||
mDelegateListener.onMapClick( latLng );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLockMap( boolean isLock ) {
|
||||
if ( mDelegateListener != null ) {
|
||||
synchronized ( mDelegateListener ) {
|
||||
mDelegateListener.onLockMap( isLock );
|
||||
}
|
||||
mDelegateListener.onLockMap( isLock );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapModeChanged( EnumMapUI ui ) {
|
||||
if ( mDelegateListener != null ) {
|
||||
synchronized ( mDelegateListener ) {
|
||||
mDelegateListener.onMapModeChanged( ui );
|
||||
}
|
||||
mDelegateListener.onMapModeChanged( ui );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapChanged( MogoLatLng location, float zoom, float tilt, float bearing ) {
|
||||
if ( mDelegateListener != null ) {
|
||||
synchronized ( mDelegateListener ) {
|
||||
mDelegateListener.onMapChanged( location, zoom, tilt, bearing );
|
||||
}
|
||||
mDelegateListener.onMapChanged( location, zoom, tilt, bearing );
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -0,0 +1,18 @@
|
||||
package com.mogo.map.overlay;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-10
|
||||
* <p>
|
||||
* 覆盖物
|
||||
*/
|
||||
public interface IMogoOverlayManager {
|
||||
|
||||
/**
|
||||
* 绘制线段
|
||||
*
|
||||
* @param options
|
||||
* @return
|
||||
*/
|
||||
IMogoPolyline addPolyline( MogoPolylineOptions options );
|
||||
}
|
||||
@@ -0,0 +1,144 @@
|
||||
package com.mogo.map.overlay;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
|
||||
import com.mogo.map.IDestroyable;
|
||||
import com.mogo.map.MogoLatLng;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-10
|
||||
* <p>
|
||||
* 线段
|
||||
*/
|
||||
public interface IMogoPolyline extends IDestroyable {
|
||||
|
||||
|
||||
/**
|
||||
* 是否已经销毁
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isDestroyed();
|
||||
|
||||
/**
|
||||
* 移除
|
||||
*/
|
||||
void remove();
|
||||
|
||||
/**
|
||||
* 获取ID
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
String getId();
|
||||
|
||||
/**
|
||||
* 设置绘制点数据
|
||||
*
|
||||
* @param lonLats
|
||||
*/
|
||||
void setPoints( List< MogoLatLng > lonLats );
|
||||
|
||||
/**
|
||||
* 获取点
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
List< MogoLatLng > getPoints();
|
||||
|
||||
/**
|
||||
* 测地线
|
||||
*
|
||||
* @param draw
|
||||
*/
|
||||
void setGeodesic( boolean draw );
|
||||
|
||||
/**
|
||||
* 是否设置了测地线
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isGeodesic();
|
||||
|
||||
/**
|
||||
* 虚线
|
||||
*
|
||||
* @param dottedLine
|
||||
*/
|
||||
void setDottedLine( boolean dottedLine );
|
||||
|
||||
/**
|
||||
* 是否是虚线
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isDottedLine();
|
||||
|
||||
/**
|
||||
* 设置线宽
|
||||
*
|
||||
* @param width
|
||||
*/
|
||||
void setWidth( float width );
|
||||
|
||||
/**
|
||||
* 获取线宽
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
float getWidth();
|
||||
|
||||
/**
|
||||
* 设置线条颜色
|
||||
*
|
||||
* @param color
|
||||
*/
|
||||
void setColor( @ColorInt int color );
|
||||
|
||||
/**
|
||||
* 获取线条颜色
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
@ColorInt
|
||||
int getColor();
|
||||
|
||||
/**
|
||||
* 设置Z轴
|
||||
*/
|
||||
void setZIndex( float zIndex );
|
||||
|
||||
/**
|
||||
* 获取Z轴
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
float getZIndex();
|
||||
|
||||
/**
|
||||
* 设置显示/隐藏
|
||||
*/
|
||||
void setVisible( boolean visible );
|
||||
|
||||
/**
|
||||
* 是否可见
|
||||
*
|
||||
* @return
|
||||
*/
|
||||
boolean isVisible();
|
||||
|
||||
/**
|
||||
* 设置透明度
|
||||
*
|
||||
* @param transparency
|
||||
*/
|
||||
void setTransparency( float transparency );
|
||||
|
||||
/**
|
||||
* 设置配置项
|
||||
*/
|
||||
void setOption( MogoPolylineOptions option );
|
||||
}
|
||||
@@ -0,0 +1,214 @@
|
||||
package com.mogo.map.overlay;
|
||||
|
||||
import android.graphics.Color;
|
||||
|
||||
import androidx.annotation.ColorInt;
|
||||
|
||||
import com.mogo.map.MogoLatLng;
|
||||
import com.mogo.map.location.MogoLocation;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.List;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-10
|
||||
* <p>
|
||||
* 线段属性
|
||||
*/
|
||||
public class MogoPolylineOptions {
|
||||
|
||||
private List< MogoLatLng > mPoints;
|
||||
private float mWidth = 10.0F;
|
||||
private int mColor = Color.BLACK;
|
||||
private float mZIndex = 0.0F;
|
||||
private boolean mIsVisible = true;
|
||||
private boolean mIsGeodesic = false;
|
||||
private boolean mIsDottedLine = false;
|
||||
private boolean mIsGradient = false;
|
||||
private float mTransparency = 1.0F;
|
||||
private boolean mIsAboveMaskLayer = false;
|
||||
private boolean mIsPointsUpdated = false;
|
||||
|
||||
public MogoPolylineOptions() {
|
||||
this.mPoints = new ArrayList<>();
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置顶点
|
||||
*
|
||||
* @param points
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions points( List< MogoLatLng > points ) {
|
||||
this.mPoints.clear();
|
||||
this.mPoints.addAll( points );
|
||||
this.mIsPointsUpdated = true;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 添加顶点到集合最后
|
||||
*
|
||||
* @param points
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions add( MogoLatLng... points ) {
|
||||
if ( points != null ) {
|
||||
this.mPoints.addAll( Arrays.asList( points ) );
|
||||
this.mIsPointsUpdated = true;
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoPolylineOptions add( double lon, double lat ) {
|
||||
this.mPoints.add( new MogoLatLng( lat, lon ) );
|
||||
return this;
|
||||
}
|
||||
|
||||
public MogoPolylineOptions add( MogoLocation location ) {
|
||||
if ( location != null ) {
|
||||
this.mPoints.add( new MogoLatLng( location.getLatitude(), location.getLongitude() ) );
|
||||
}
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置线宽
|
||||
*/
|
||||
public MogoPolylineOptions width( float width ) {
|
||||
this.mWidth = width;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置线的颜色
|
||||
*
|
||||
* @param color
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions color( @ColorInt int color ) {
|
||||
this.mColor = color;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置Z轴的值
|
||||
*
|
||||
* @param zIndex
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions zIndex( float zIndex ) {
|
||||
this.mZIndex = zIndex;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否可见
|
||||
*
|
||||
* @param isVisible
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions visible( boolean isVisible ) {
|
||||
this.mIsVisible = isVisible;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置是否绘制测地线
|
||||
*
|
||||
* @param isGeodesic
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions geodesic( boolean isGeodesic ) {
|
||||
this.mIsGeodesic = isGeodesic;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否是虚线
|
||||
*
|
||||
* @param isDottedLine
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions dottedLine( boolean isDottedLine ) {
|
||||
this.mIsDottedLine = isDottedLine;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 是否使用渐变色
|
||||
*
|
||||
* @param isGradient
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions useGradient( boolean isGradient ) {
|
||||
this.mIsGradient = isGradient;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* 设置透明度
|
||||
*
|
||||
* @param transparency
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions transparency( float transparency ) {
|
||||
this.mTransparency = transparency;
|
||||
return this;
|
||||
}
|
||||
|
||||
/**
|
||||
* @param isAboveMaskLayer
|
||||
* @return
|
||||
*/
|
||||
public MogoPolylineOptions aboveMaskLayer( boolean isAboveMaskLayer ) {
|
||||
this.mIsAboveMaskLayer = isAboveMaskLayer;
|
||||
return this;
|
||||
}
|
||||
|
||||
public List< MogoLatLng > getPoints() {
|
||||
return mPoints;
|
||||
}
|
||||
|
||||
public float getWidth() {
|
||||
return mWidth;
|
||||
}
|
||||
|
||||
public int getColor() {
|
||||
return mColor;
|
||||
}
|
||||
|
||||
public float getZIndex() {
|
||||
return mZIndex;
|
||||
}
|
||||
|
||||
public boolean isVisible() {
|
||||
return mIsVisible;
|
||||
}
|
||||
|
||||
public boolean isGeodesic() {
|
||||
return mIsGeodesic;
|
||||
}
|
||||
|
||||
public boolean isDottedLine() {
|
||||
return mIsDottedLine;
|
||||
}
|
||||
|
||||
public boolean isGradient() {
|
||||
return mIsGradient;
|
||||
}
|
||||
|
||||
public float getTransparency() {
|
||||
return mTransparency;
|
||||
}
|
||||
|
||||
public boolean isAboveMaskLayer() {
|
||||
return mIsAboveMaskLayer;
|
||||
}
|
||||
|
||||
public boolean isPointsUpdated() {
|
||||
return mIsPointsUpdated;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
package com.mogo.map;
|
||||
|
||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
import com.mogo.map.overlay.IMogoPolyline;
|
||||
import com.mogo.map.overlay.MogoPolylineOptions;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-03-10
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class MogoOverlayManager implements IMogoOverlayManager {
|
||||
|
||||
private MogoOverlayManager() {
|
||||
// private constructor
|
||||
}
|
||||
|
||||
private static final class InstanceHolder {
|
||||
private static final MogoOverlayManager INSTANCE = new MogoOverlayManager();
|
||||
}
|
||||
|
||||
public static MogoOverlayManager getInstance() {
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
private Object readResolve() {
|
||||
// 阻止反序列化,必须实现 Serializable 接口
|
||||
return InstanceHolder.INSTANCE;
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoPolyline addPolyline( MogoPolylineOptions options ) {
|
||||
try {
|
||||
return MogoMap.getInstance().getMogoMap().addPolyline( options );
|
||||
} catch ( Exception e ) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -47,13 +47,21 @@ dependencies {
|
||||
implementation rootProject.ext.dependencies.rxandroid
|
||||
|
||||
if (Boolean.valueOf(RELEASE)) {
|
||||
implementation rootProject.ext.dependencies.mogomap
|
||||
implementation rootProject.ext.dependencies.mogomapapi
|
||||
implementation rootProject.ext.dependencies.mogoutils
|
||||
implementation rootProject.ext.dependencies.mogocommons
|
||||
implementation rootProject.ext.dependencies.mogoserviceapi
|
||||
implementation rootProject.ext.dependencies.modulecommon
|
||||
implementation rootProject.ext.dependencies.moduleshare
|
||||
} else {
|
||||
implementation project(":libraries:mogo-map")
|
||||
implementation project(":libraries:mogo-map-api")
|
||||
implementation project(":foudations:mogo-utils")
|
||||
api project(":foudations:mogo-commons")
|
||||
implementation project(":foudations:mogo-commons")
|
||||
implementation project(':services:mogo-service-api')
|
||||
implementation project(':modules:mogo-module-common')
|
||||
implementation project(':modules:mogo-module-share')
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -1,33 +1,31 @@
|
||||
package com.mogo.module.back;
|
||||
|
||||
import android.app.Activity;
|
||||
import android.content.Context;
|
||||
import android.os.Build;
|
||||
import android.content.Intent;
|
||||
import android.os.Bundle;
|
||||
import android.text.TextUtils;
|
||||
import android.util.ArrayMap;
|
||||
import android.util.Log;
|
||||
import android.view.View;
|
||||
|
||||
import androidx.annotation.NonNull;
|
||||
import androidx.fragment.app.Fragment;
|
||||
import androidx.fragment.app.FragmentActivity;
|
||||
import androidx.fragment.app.FragmentManager;
|
||||
|
||||
import com.alibaba.android.arouter.facade.annotation.Route;
|
||||
import com.alibaba.android.arouter.launcher.ARouter;
|
||||
import com.alibaba.idst.nls.internal.utils.L;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
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.IMogoServiceApis;
|
||||
import com.mogo.service.MogoServicePaths;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.service.intent.IMogoIntentListener;
|
||||
import com.mogo.service.intent.IMogoIntentManager;
|
||||
import com.mogo.service.module.IMogoModuleLifecycle;
|
||||
import com.mogo.service.module.IMogoModuleProvider;
|
||||
import com.mogo.service.module.ModuleType;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2020-02-26
|
||||
@@ -35,7 +33,12 @@ import java.util.Map;
|
||||
* 描述
|
||||
*/
|
||||
@Route( path = BackToLauncherConst.MODULE_PATH )
|
||||
public class BackToLauncherModuleProvider implements IMogoModuleProvider {
|
||||
public class BackToLauncherModuleProvider implements IMogoModuleProvider, IMogoIntentListener {
|
||||
|
||||
private IMogoServiceApis mServiceApis;
|
||||
private IMogoIntentManager mIntentManager;
|
||||
|
||||
public static final String COMMAND_BACK = "com.ileja.launcher.back";
|
||||
|
||||
private static final String TAG = "BackToLauncherModuleProvider";
|
||||
|
||||
@@ -98,54 +101,17 @@ public class BackToLauncherModuleProvider implements IMogoModuleProvider {
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
BackToMainHomeManager.addMainHomeView();
|
||||
// final Activity activity = getTopActivity(context.getPackageName());
|
||||
// if ( activity instanceof FragmentActivity ) {
|
||||
// Logger.d( TAG, "init." );
|
||||
// FragmentManager fragmentManager = ( ( FragmentActivity ) activity ).getSupportFragmentManager();
|
||||
// fragmentManager.beginTransaction()
|
||||
// .add( new Back2LauncherFragment(), BackToLauncherConst.MODULE_NAME )
|
||||
// .commitAllowingStateLoss();
|
||||
// fragmentManager.executePendingTransactions();
|
||||
// }
|
||||
mServiceApis = ( IMogoServiceApis ) ARouter.getInstance().build( MogoServicePaths.PATH_SERVICE_APIS ).navigation();
|
||||
mIntentManager = mServiceApis.getIntentManagerApi();
|
||||
mIntentManager.registerIntentListener( COMMAND_BACK, this );
|
||||
BackToMainHomeManager.init( mServiceApis.getFragmentManagerApi() );
|
||||
}
|
||||
|
||||
// /**
|
||||
// * 获取当前运行的activity
|
||||
// */
|
||||
// private Activity getTopActivity(String process) {
|
||||
// Log.i("activity", "[getTopActivity]");
|
||||
// try {
|
||||
// Class activityThreadClass = Class.forName("android.app.ActivityThread");
|
||||
// Object activityThread = activityThreadClass.getMethod("currentActivityThread").invoke(null);
|
||||
// Field activitiesField = activityThreadClass.getDeclaredField("mActivities");
|
||||
// activitiesField.setAccessible(true);
|
||||
// //16~18 HashMap
|
||||
// //19~27 ArrayMap
|
||||
// Map<Object, Object> activities;
|
||||
// if ( Build.VERSION.SDK_INT < Build.VERSION_CODES.KITKAT) {
|
||||
// activities = ( HashMap<Object, Object> ) activitiesField.get(activityThread);
|
||||
// } else {
|
||||
// activities = ( ArrayMap<Object, Object> ) activitiesField.get(activityThread);
|
||||
// }
|
||||
// if (activities.size() < 1) {
|
||||
// return null;
|
||||
// }
|
||||
// for (Object activityRecord : activities.values()) {
|
||||
// Class activityRecordClass = activityRecord.getClass();
|
||||
// Field pausedField = activityRecordClass.getDeclaredField("paused");
|
||||
// pausedField.setAccessible(true);
|
||||
// if (!pausedField.getBoolean(activityRecord)) {
|
||||
// Field activityField = activityRecordClass.getDeclaredField("activity");
|
||||
// activityField.setAccessible(true);
|
||||
// Activity activity = (Activity) activityField.get(activityRecord);
|
||||
// if ( TextUtils.equals( process, activity.getPackageName() ) ) {
|
||||
// return activity;
|
||||
// }
|
||||
// }
|
||||
// }
|
||||
// } catch (Exception e) {
|
||||
// e.printStackTrace();
|
||||
// }
|
||||
// return null;
|
||||
// }
|
||||
@Override
|
||||
public void onIntentReceived( String intentStr, Intent intent ) {
|
||||
if ( COMMAND_BACK.equals( intentStr ) ) {
|
||||
Logger.d( TAG, "received back to home command." );
|
||||
BackToMainHomeManager.backToLauncher();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,15 +14,35 @@ import android.view.WindowManager;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
import com.mogo.module.back.utils.Utils;
|
||||
import com.mogo.module.back.utils.WindowManagerViewHelper;
|
||||
import com.mogo.service.fragmentmanager.IMogoFragmentManager;
|
||||
import com.mogo.utils.logger.Logger;
|
||||
|
||||
public class BackToMainHomeManager {
|
||||
|
||||
private static View mBackView;
|
||||
public static void addMainHomeView(){
|
||||
Logger.d("BackToMainHomeManager","addMainHomeView");
|
||||
if (mBackView != null)WindowManagerViewHelper.removeView(mBackView);
|
||||
mBackView = LayoutInflater.from(AbsMogoApplication.getApp()).inflate(R.layout.mogo_module_back_home_back_layout, null);
|
||||
|
||||
private static IMogoFragmentManager mFragmentManager;
|
||||
|
||||
public static void init( IMogoFragmentManager manager ) {
|
||||
mFragmentManager = manager;
|
||||
}
|
||||
|
||||
public static void backToLauncher(){
|
||||
Intent intent = new Intent();
|
||||
intent.setAction( Intent.ACTION_MAIN );
|
||||
intent.addCategory( Intent.CATEGORY_HOME );
|
||||
intent.addFlags( Intent.FLAG_ACTIVITY_NEW_TASK );
|
||||
AbsMogoApplication.getApp().startActivity( intent );
|
||||
|
||||
if ( mFragmentManager != null ) {
|
||||
mFragmentManager.clearAll();
|
||||
}
|
||||
}
|
||||
|
||||
public static void addMainHomeView() {
|
||||
Logger.d( "BackToMainHomeManager", "addMainHomeView" );
|
||||
if ( mBackView != null ) WindowManagerViewHelper.removeView( mBackView );
|
||||
mBackView = LayoutInflater.from( AbsMogoApplication.getApp() ).inflate( R.layout.mogo_module_back_home_back_layout, null );
|
||||
final Context context = mBackView.getContext();
|
||||
if ( context == null || context.getApplicationContext() == null ) {
|
||||
return;
|
||||
@@ -31,32 +51,24 @@ public class BackToMainHomeManager {
|
||||
if ( windowManager == null ) {
|
||||
return;
|
||||
}
|
||||
mBackView.setOnClickListener(view -> {
|
||||
if (Utils.isActivityExits("com.mogo.launcher","com.mogo.module.main.MainActivity")){
|
||||
ComponentName cn = new ComponentName("com.mogo.launcher", "com.mogo.module.main.MainActivity") ;
|
||||
Intent intent = new Intent() ;
|
||||
intent.setComponent(cn) ;
|
||||
if (!(AbsMogoApplication.getApp().getApplicationContext() instanceof Activity)) {
|
||||
intent.addFlags(Intent.FLAG_ACTIVITY_NEW_TASK);
|
||||
}
|
||||
AbsMogoApplication.getApp().startActivity(intent);
|
||||
}
|
||||
});
|
||||
mBackView.setOnClickListener( view -> {
|
||||
backToLauncher();
|
||||
} );
|
||||
WindowManager.LayoutParams params = new WindowManager.LayoutParams();
|
||||
params.height = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
params.width = WindowManager.LayoutParams.WRAP_CONTENT;
|
||||
params.x = AbsMogoApplication.getApp().getResources().getDimensionPixelOffset(R.dimen.module_back_main_home_icon_left);
|
||||
params.y = AbsMogoApplication.getApp().getResources().getDimensionPixelOffset(R.dimen.module_back_main_home_icon_top);
|
||||
params.x = AbsMogoApplication.getApp().getResources().getDimensionPixelOffset( R.dimen.module_back_main_home_icon_left );
|
||||
params.y = AbsMogoApplication.getApp().getResources().getDimensionPixelOffset( R.dimen.module_back_main_home_icon_top );
|
||||
params.gravity = Gravity.LEFT | Gravity.CENTER;
|
||||
params.type = getFitWindowParamsType();
|
||||
params.format = PixelFormat.RGBA_8888;
|
||||
params.flags = WindowManager.LayoutParams.FLAG_NOT_FOCUSABLE | WindowManager.LayoutParams.FLAG_KEEP_SCREEN_ON;
|
||||
windowManager.addView( mBackView, params );
|
||||
WindowManagerViewHelper.attachMovementEvent(mBackView,params);
|
||||
WindowManagerViewHelper.attachMovementEvent( mBackView, params );
|
||||
}
|
||||
|
||||
public static void removeMainHomeView(){
|
||||
WindowManagerViewHelper.removeView(mBackView);
|
||||
public static void removeMainHomeView() {
|
||||
WindowManagerViewHelper.removeView( mBackView );
|
||||
}
|
||||
|
||||
private static int getFitWindowParamsType() {
|
||||
|
||||
@@ -7,13 +7,13 @@ import android.content.pm.ResolveInfo;
|
||||
import com.mogo.commons.AbsMogoApplication;
|
||||
|
||||
public class Utils {
|
||||
public static boolean isActivityExits(String packageName,String classStr){
|
||||
public static boolean isActivityExits( String packageName, String classStr ) {
|
||||
Intent intent = new Intent();
|
||||
intent.setClassName(packageName, classStr);
|
||||
ResolveInfo resolveInfo = AbsMogoApplication.getApp().getPackageManager().resolveActivity(intent, PackageManager.MATCH_DEFAULT_ONLY);
|
||||
if(resolveInfo != null) {
|
||||
intent.setClassName( packageName, classStr );
|
||||
ResolveInfo resolveInfo = AbsMogoApplication.getApp().getPackageManager().resolveActivity( intent, PackageManager.MATCH_DEFAULT_ONLY );
|
||||
if ( resolveInfo != null ) {
|
||||
return true;
|
||||
}else{
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -50,9 +50,9 @@ import java.util.Map;
|
||||
* <p>
|
||||
* 描述
|
||||
*/
|
||||
public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresenter>
|
||||
implements EntranceView,
|
||||
IMogoNaviListener, IMogoMapListener {
|
||||
public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresenter >
|
||||
implements EntranceView,
|
||||
IMogoNaviListener, IMogoMapListener {
|
||||
|
||||
private static final String TAG = "EntranceFragment";
|
||||
|
||||
@@ -100,37 +100,37 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
|
||||
@Override
|
||||
protected void initViews() {
|
||||
mMogoFragmentManager = (IMogoFragmentManager) ARouter.getInstance()
|
||||
.build(MogoServicePaths.PATH_FRAGMENT_MANAGER)
|
||||
.navigation();
|
||||
mMogoAddressManager = (IMogoAddressManager) ARouter.getInstance()
|
||||
.build(MogoServicePaths.PATH_ADDRESS_MANAGER)
|
||||
.navigation();
|
||||
|
||||
mCommonAddress = findViewById(R.id.module_entrance_id_common_address);
|
||||
|
||||
mSearch = findViewById(R.id.module_entrance_id_search);
|
||||
|
||||
mSearch.setOnClickListener(view -> {
|
||||
mSearchProvider = (IMogoModuleProvider) ARouter.getInstance()
|
||||
.build(MogoModulePaths.PATH_MODULE_SEARCH)
|
||||
mMogoFragmentManager = ( IMogoFragmentManager ) ARouter.getInstance()
|
||||
.build( MogoServicePaths.PATH_FRAGMENT_MANAGER )
|
||||
.navigation();
|
||||
mMogoAddressManager = ( IMogoAddressManager ) ARouter.getInstance()
|
||||
.build( MogoServicePaths.PATH_ADDRESS_MANAGER )
|
||||
.navigation();
|
||||
final Fragment fragment = mSearchProvider.createFragment(getContext(), null);
|
||||
mMogoFragmentManager.push(new FragmentDescriptor.Builder().fragment(fragment)
|
||||
.tag(MogoModulePaths.PATH_FRAGMENT_SEARCH)
|
||||
.notifyMainModule(true)
|
||||
.build());
|
||||
});
|
||||
|
||||
mHome = findViewById(R.id.module_entrance_id_home);
|
||||
mHome.setOnClickListener(view -> {
|
||||
mCommonAddress = findViewById( R.id.module_entrance_id_common_address );
|
||||
|
||||
mSearch = findViewById( R.id.module_entrance_id_search );
|
||||
|
||||
mSearch.setOnClickListener( view -> {
|
||||
mSearchProvider = ( IMogoModuleProvider ) ARouter.getInstance()
|
||||
.build( MogoModulePaths.PATH_MODULE_SEARCH )
|
||||
.navigation();
|
||||
final Fragment fragment = mSearchProvider.createFragment( getContext(), null );
|
||||
mMogoFragmentManager.push( new FragmentDescriptor.Builder().fragment( fragment )
|
||||
.tag( MogoModulePaths.PATH_FRAGMENT_SEARCH )
|
||||
.notifyMainModule( true )
|
||||
.build() );
|
||||
} );
|
||||
|
||||
mHome = findViewById( R.id.module_entrance_id_home );
|
||||
mHome.setOnClickListener( view -> {
|
||||
mMogoAddressManager.goHome();
|
||||
});
|
||||
} );
|
||||
|
||||
mCompany = findViewById(R.id.module_entrance_id_company);
|
||||
mCompany.setOnClickListener(view -> {
|
||||
mCompany = findViewById( R.id.module_entrance_id_company );
|
||||
mCompany.setOnClickListener( view -> {
|
||||
mMogoAddressManager.goCompany();
|
||||
});
|
||||
} );
|
||||
|
||||
mUploadRoadCondition = findViewById( R.id.module_entrance_id_upload_road_condition );
|
||||
mUploadRoadCondition.setOnClickListener( view -> {
|
||||
@@ -141,78 +141,79 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
mVRMode.setOnClickListener( view -> {
|
||||
} );
|
||||
|
||||
mMove2CurrentLocation = findViewById(R.id.module_entrance_id_move2_current_location);
|
||||
mMove2CurrentLocation.setOnClickListener(view -> {
|
||||
mMove2CurrentLocation = findViewById( R.id.module_entrance_id_move2_current_location );
|
||||
mMove2CurrentLocation.setOnClickListener( view -> {
|
||||
final MogoLocation location = mMogoLocationClient.getLastKnowLocation();
|
||||
if (location != null) {
|
||||
mMogoStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||
mMApUIController.changeZoom(16.0f);
|
||||
mMogoStatusManager.setUserInteractionStatus(TAG, true, false);
|
||||
if ( location != null ) {
|
||||
mMogoStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mMApUIController.changeZoom( 16.0f );
|
||||
mMogoStatusManager.setUserInteractionStatus( TAG, true, false );
|
||||
mMApUIController.recoverLockMode();
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
mNaviInfo = findViewById(R.id.module_entrance_id_navi_info_panel);
|
||||
mExitNavi = findViewById(R.id.module_entrance_id_exit_navi);
|
||||
mExitNavi.setOnClickListener(view -> {
|
||||
if (mMogoNavi != null) {
|
||||
mNaviInfo = findViewById( R.id.module_entrance_id_navi_info_panel );
|
||||
mExitNavi = findViewById( R.id.module_entrance_id_exit_navi );
|
||||
mExitNavi.setOnClickListener( view -> {
|
||||
if ( mMogoNavi != null ) {
|
||||
//if ( mIsLock ) {
|
||||
NaviNoticeDialog naviNoticeDialog = new NaviNoticeDialog(getContext());
|
||||
NaviNoticeDialog naviNoticeDialog = new NaviNoticeDialog( getContext() );
|
||||
naviNoticeDialog.show();
|
||||
//} else {
|
||||
// mMApUIController.recoverLockMode();
|
||||
//}
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
ivMode = findViewById(R.id.module_ext_id_north);
|
||||
ivMode.setOnClickListener(new View.OnClickListener() {
|
||||
@Override public void onClick(View v) {
|
||||
if (ivMode.isSelected()) {
|
||||
mMApUIController.changeMapMode(EnumMapUI.CarUp_2D);
|
||||
ivMode = findViewById( R.id.module_ext_id_north );
|
||||
ivMode.setOnClickListener( new View.OnClickListener() {
|
||||
@Override
|
||||
public void onClick( View v ) {
|
||||
if ( ivMode.isSelected() ) {
|
||||
mMApUIController.changeMapMode( EnumMapUI.CarUp_2D );
|
||||
} else {
|
||||
mMApUIController.changeMapMode(EnumMapUI.NorthUP_2D);
|
||||
mMApUIController.changeMapMode( EnumMapUI.NorthUP_2D );
|
||||
}
|
||||
ivMode.setSelected(!ivMode.isSelected());
|
||||
ivMode.setSelected( !ivMode.isSelected() );
|
||||
ivMode.setText(
|
||||
getString(ivMode.isSelected() ? R.string.mode_car_up : R.string.mode_north_up));
|
||||
getString( ivMode.isSelected() ? R.string.mode_car_up : R.string.mode_north_up ) );
|
||||
}
|
||||
});
|
||||
} );
|
||||
|
||||
mSpeedLimit = findViewById(R.id.module_entrance_id_speed_limit_container);
|
||||
mSpeedLimitValue = findViewById(R.id.module_entrance_id_speed_limit_value);
|
||||
mSpeedLimitUnit = findViewById(R.id.module_entrance_id_speed_limit_unit);
|
||||
mSpeedLimit = findViewById( R.id.module_entrance_id_speed_limit_container );
|
||||
mSpeedLimitValue = findViewById( R.id.module_entrance_id_speed_limit_value );
|
||||
mSpeedLimitUnit = findViewById( R.id.module_entrance_id_speed_limit_unit );
|
||||
}
|
||||
|
||||
@NonNull
|
||||
@Override
|
||||
protected EntrancePresenter createPresenter() {
|
||||
return new EntrancePresenter(getContext(), this);
|
||||
return new EntrancePresenter( getContext(), this );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onActivityCreated(@Nullable Bundle savedInstanceState) {
|
||||
super.onActivityCreated(savedInstanceState);
|
||||
mService = (IMogoMapService) ARouter.getInstance()
|
||||
.build(MogoServicePaths.PATH_SERVICES_MAP)
|
||||
.navigation(getContext());
|
||||
mMogoRegisterCenter = (IMogoRegisterCenter) ARouter.getInstance()
|
||||
.build(MogoServicePaths.PATH_REGISTER_CENTER)
|
||||
.navigation(getContext());
|
||||
public void onActivityCreated( @Nullable Bundle savedInstanceState ) {
|
||||
super.onActivityCreated( savedInstanceState );
|
||||
mService = ( IMogoMapService ) ARouter.getInstance()
|
||||
.build( MogoServicePaths.PATH_SERVICES_MAP )
|
||||
.navigation( getContext() );
|
||||
mMogoRegisterCenter = ( IMogoRegisterCenter ) ARouter.getInstance()
|
||||
.build( MogoServicePaths.PATH_REGISTER_CENTER )
|
||||
.navigation( getContext() );
|
||||
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());
|
||||
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() );
|
||||
|
||||
mMogoRegisterCenter.registerMogoNaviListener(ExtensionsModuleConst.TYPE_ENTRANCE, this);
|
||||
mMogoRegisterCenter.registerMogoMapListener(ExtensionsModuleConst.TYPE_ENTRANCE, this);
|
||||
mMogoRegisterCenter.registerMogoNaviListener( ExtensionsModuleConst.TYPE_ENTRANCE, this );
|
||||
mMogoRegisterCenter.registerMogoMapListener( ExtensionsModuleConst.TYPE_ENTRANCE, this );
|
||||
|
||||
mMogoMarkerManager = mService.getMarkerManager(getContext());
|
||||
mMogoMarkerManager = mService.getMarkerManager( getContext() );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -224,30 +225,30 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onNaviInfoUpdate(MogoNaviInfo naviinfo) {
|
||||
if (naviinfo == null) {
|
||||
public void onNaviInfoUpdate( MogoNaviInfo naviinfo ) {
|
||||
if ( naviinfo == null ) {
|
||||
return;
|
||||
}
|
||||
mNaviInfo.notifyChanged(naviinfo);
|
||||
mNaviInfo.notifyChanged( naviinfo );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStartNavi() {
|
||||
mCommonAddress.setVisibility(View.GONE);
|
||||
mNaviInfo.setVisibility(View.VISIBLE);
|
||||
ivMode.setVisibility(View.VISIBLE);
|
||||
mExitNavi.setVisibility(View.VISIBLE);
|
||||
mMApUIController.setPointToCenter(0.675926, 0.77552);
|
||||
mCommonAddress.setVisibility( View.GONE );
|
||||
mNaviInfo.setVisibility( View.VISIBLE );
|
||||
ivMode.setVisibility( View.VISIBLE );
|
||||
mExitNavi.setVisibility( View.VISIBLE );
|
||||
mMApUIController.setPointToCenter( 0.675926, 0.77552 );
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStopNavi() {
|
||||
mCommonAddress.setVisibility(View.VISIBLE);
|
||||
mNaviInfo.setVisibility(View.GONE);
|
||||
ivMode.setVisibility(View.GONE);
|
||||
mExitNavi.setVisibility(View.GONE);
|
||||
mSpeedLimit.setVisibility(View.GONE);
|
||||
mMApUIController.setPointToCenter(0.66145, 0.590688);
|
||||
mCommonAddress.setVisibility( View.VISIBLE );
|
||||
mNaviInfo.setVisibility( View.GONE );
|
||||
ivMode.setVisibility( View.GONE );
|
||||
mExitNavi.setVisibility( View.GONE );
|
||||
mSpeedLimit.setVisibility( View.GONE );
|
||||
mMApUIController.setPointToCenter( 0.66145, 0.590688 );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -259,16 +260,16 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onUpdateTraffic(MogoTraffic traffic) {
|
||||
if (traffic == null) {
|
||||
public void onUpdateTraffic( MogoTraffic traffic ) {
|
||||
if ( traffic == null ) {
|
||||
return;
|
||||
}
|
||||
if (traffic.getSpeedLimit() <= 0) {
|
||||
mSpeedLimit.setVisibility(View.INVISIBLE);
|
||||
mSpeedLimitValue.setText("--");
|
||||
if ( traffic.getSpeedLimit() <= 0 ) {
|
||||
mSpeedLimit.setVisibility( View.INVISIBLE );
|
||||
mSpeedLimitValue.setText( "--" );
|
||||
} else {
|
||||
mSpeedLimit.setVisibility(View.VISIBLE);
|
||||
mSpeedLimitValue.setText(String.valueOf(traffic.getSpeedLimit()));
|
||||
mSpeedLimit.setVisibility( View.VISIBLE );
|
||||
mSpeedLimitValue.setText( String.valueOf( traffic.getSpeedLimit() ) );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -278,43 +279,43 @@ public class EntranceFragment extends MvpFragment<EntranceView, EntrancePresente
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onTouch(MotionEvent motionEvent) {
|
||||
public void onTouch( MotionEvent motionEvent ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onPOIClick(MogoPoi poi) {
|
||||
public void onPOIClick( MogoPoi poi ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapClick(MogoLatLng latLng) {
|
||||
public void onMapClick( MogoLatLng latLng ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onLockMap(boolean isLock) {
|
||||
public void onLockMap( boolean isLock ) {
|
||||
mIsLock = isLock;
|
||||
if (isLock) {
|
||||
mExitNavi.setText(R.string.module_ext_str_exit_navi);
|
||||
if ( isLock ) {
|
||||
mExitNavi.setText( R.string.module_ext_str_exit_navi );
|
||||
} else {
|
||||
mExitNavi.setText(R.string.module_ext_str_exit_navi);
|
||||
mExitNavi.setText( R.string.module_ext_str_exit_navi );
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapModeChanged(EnumMapUI ui) {
|
||||
public void onMapModeChanged( EnumMapUI ui ) {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onMapChanged(MogoLatLng latLng, float zoom, float tilt, float bearing) {
|
||||
public void onMapChanged( MogoLatLng latLng, float zoom, float tilt, float bearing ) {
|
||||
|
||||
}
|
||||
|
||||
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 );
|
||||
}
|
||||
}
|
||||
|
||||
@@ -1,6 +1,5 @@
|
||||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<FrameLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
xmlns:app="http://schemas.android.com/apk/res-auto"
|
||||
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
@@ -9,9 +8,7 @@
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_map_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintLeft_toRightOf="@+id/module_main_id_apps_fragment_container"
|
||||
app:layout_constraintRight_toRightOf="parent" />
|
||||
android:layout_height="match_parent" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_map_top_shadow_frame"
|
||||
@@ -27,68 +24,56 @@
|
||||
android:background="@drawable/module_main_dw_left_frame_bkg"
|
||||
android:visibility="invisible" />
|
||||
|
||||
<LinearLayout
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_header_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/module_ext_height" />
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_card_container_frame"
|
||||
android:layout_width="@dimen/module_main_card_container_width"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_below="@+id/module_main_id_header_fragment_container"
|
||||
android:layout_marginLeft="@dimen/module_main_card_container_marginLeft"
|
||||
android:layout_marginTop="@dimen/module_main_card_container_marginTop">
|
||||
|
||||
<com.mogo.module.main.cards.OrientedViewPager
|
||||
android:id="@+id/module_main_id_cards_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/module_main_card_container_height"
|
||||
android:layout_marginBottom="@dimen/module_main_card_container_marginBottom"
|
||||
android:clipToPadding="false"
|
||||
android:overScrollMode="never"
|
||||
android:paddingBottom="@dimen/module_main_card_container_paddingBottom" />
|
||||
|
||||
<!-- 应用入口-->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_apps_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent">
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_card_cover_up_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20px"
|
||||
android:layout_marginLeft="15px"
|
||||
android:layout_marginTop="@dimen/module_main_card_cover_up_margin"
|
||||
android:layout_marginRight="15px"
|
||||
android:background="@drawable/module_main_card_cover_up_bottom"
|
||||
android:visibility="gone" />
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<!--快捷操作浮层-->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_entrance_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical">
|
||||
|
||||
<!-- 小智语音-->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_header_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent" />
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
android:layout_marginTop="@dimen/module_main_card_container_marginTop"
|
||||
android:layout_height="match_parent">
|
||||
<!-- 卡片-->
|
||||
<FrameLayout
|
||||
android:layout_width="@dimen/module_main_card_container_width"
|
||||
android:layout_height="match_parent"
|
||||
android:layout_marginLeft="@dimen/module_main_card_container_marginLeft">
|
||||
|
||||
<com.mogo.module.main.cards.OrientedViewPager
|
||||
android:id="@+id/module_main_id_cards_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="@dimen/module_main_card_container_height"
|
||||
android:layout_marginBottom="@dimen/module_main_card_container_marginBottom"
|
||||
android:clipToPadding="false"
|
||||
android:overScrollMode="never"
|
||||
android:paddingBottom="@dimen/module_main_card_container_paddingBottom" />
|
||||
|
||||
<!-- 应用入口-->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_apps_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
app:layout_constraintLeft_toLeftOf="parent"
|
||||
app:layout_constraintTop_toTopOf="parent">
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_card_cover_up_bottom"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="20px"
|
||||
android:visibility="gone"
|
||||
android:layout_marginTop="@dimen/module_main_card_cover_up_margin"
|
||||
android:layout_marginLeft="15px"
|
||||
android:layout_marginRight="15px"
|
||||
android:background="@drawable/module_main_card_cover_up_bottom"/>
|
||||
|
||||
</FrameLayout>
|
||||
|
||||
<!--快捷操作浮层-->
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_entrance_fragment_container"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent" />
|
||||
</LinearLayout>
|
||||
|
||||
</LinearLayout>
|
||||
android:layout_below="@+id/module_main_id_header_fragment_container"
|
||||
android:layout_marginTop="@dimen/module_main_card_container_marginTop"
|
||||
android:layout_toRightOf="@+id/module_main_card_container_frame" />
|
||||
|
||||
<!-- 浮层-->
|
||||
<FrameLayout
|
||||
@@ -104,6 +89,6 @@
|
||||
<FrameLayout
|
||||
android:id="@+id/module_main_id_cover_up"
|
||||
android:layout_width="match_parent"
|
||||
android:background="@drawable/module_main_launcher_bg"
|
||||
android:layout_height="match_parent"/>
|
||||
</FrameLayout>
|
||||
android:layout_height="match_parent"
|
||||
android:background="@drawable/module_main_launcher_bg" />
|
||||
</RelativeLayout>
|
||||
@@ -22,13 +22,12 @@ import com.mogo.service.statusmanager.StatusDescriptor;
|
||||
* <p>
|
||||
* 地图图层,地图操作都在这个图层完成
|
||||
*/
|
||||
public class MapFragment extends MvpFragment< MapView, MapPresenter > implements MapView, IMogoStatusChangedListener {
|
||||
public class MapFragment extends MvpFragment< MapView, MapPresenter > implements MapView {
|
||||
|
||||
private static final String TAG = "MapFragment";
|
||||
|
||||
private MogoMapView mMogoMapView;
|
||||
private IMogoMap mMogoMap;
|
||||
private IMogoStatusManager mMogoStatusManager;
|
||||
|
||||
private boolean mIsControllerByOthersStatus = false;
|
||||
|
||||
@@ -67,8 +66,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
// mMogoMapView.onCreate( savedInstanceState );
|
||||
//}
|
||||
initMapView();
|
||||
mMogoStatusManager = ( IMogoStatusManager ) ARouter.getInstance().build( MogoServicePaths.PATH_STATUS_MANAGER ).navigation( getContext() );
|
||||
mMogoStatusManager.registerStatusChangedListener( TAG, StatusDescriptor.APP_LIST_UI, this );
|
||||
}
|
||||
|
||||
@Override
|
||||
@@ -134,18 +131,6 @@ public class MapFragment extends MvpFragment< MapView, MapPresenter > implements
|
||||
return mMogoMap.getUIController();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onStatusChanged( StatusDescriptor descriptor, boolean isTrue ) {
|
||||
if ( descriptor == StatusDescriptor.APP_LIST_UI ) {
|
||||
mIsControllerByOthersStatus = isTrue;
|
||||
if ( isTrue ) {
|
||||
mMogoMapView.onPause();
|
||||
} else {
|
||||
mMogoMapView.onResume();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void onDestroyView() {
|
||||
super.onDestroyView();
|
||||
|
||||
@@ -7,6 +7,7 @@ import android.content.IntentFilter;
|
||||
import android.os.Handler;
|
||||
import android.os.Looper;
|
||||
import android.os.Message;
|
||||
import android.os.Trace;
|
||||
import android.text.TextUtils;
|
||||
import android.view.MotionEvent;
|
||||
|
||||
@@ -461,6 +462,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
*/
|
||||
private boolean invokeRefreshWhenTranslationByUser( MogoLatLng latLng ) {
|
||||
try {
|
||||
Trace.beginSection( "timer.invokeRefreshWhenTranslationByUser" );
|
||||
float factor = 0.0f;
|
||||
if ( mIsVertical ) {
|
||||
factor = getMapCameraFactWidth();
|
||||
@@ -472,6 +474,7 @@ public class MogoServices implements IMogoMapListener,
|
||||
}
|
||||
Logger.d( TAG, "invokeRefreshWhenTranslationByUser,mLastCustomRefreshCenterLocation = %s, latLng = %s", mLastCustomRefreshCenterLocation, latLng );
|
||||
float distance = Utils.calculateLineDistance( latLng, mLastCustomRefreshCenterLocation );
|
||||
Trace.endSection();
|
||||
return distance > factor;
|
||||
} catch ( Exception e ) {
|
||||
Logger.e( TAG, e, "warming. " );
|
||||
|
||||
@@ -425,9 +425,12 @@ public class MapMarkerManager implements IMogoMarkerClickListener,
|
||||
* @param onlineCarList
|
||||
*/
|
||||
private void drawOnlineCarMarkers( List< MarkerOnlineCar > onlineCarList ) {
|
||||
// 将数据同步给在线车辆,避免每次 perform 的时候去拉取,造成消耗
|
||||
if ( onlineCarList == null || onlineCarList.isEmpty() ) {
|
||||
MogoDataHandler.getInstance().invoke( ServiceConst.CARD_TYPE_USER_DATA, new ArrayList<>( ) );
|
||||
return;
|
||||
}
|
||||
MogoDataHandler.getInstance().invoke( ServiceConst.CARD_TYPE_USER_DATA, onlineCarList );
|
||||
double nearlyDistance = Float.MAX_VALUE;
|
||||
for ( MarkerOnlineCar markerOnlineCar : onlineCarList ) {
|
||||
MarkerLocation markerLocation = markerOnlineCar.getLocation();
|
||||
|
||||
@@ -12,6 +12,8 @@ public interface IMogoCardManager extends IProvider {
|
||||
|
||||
/**
|
||||
* 切换卡片
|
||||
* <p>
|
||||
* 实际调用 switch2(cardType, false)
|
||||
*
|
||||
* @param cardType
|
||||
*/
|
||||
|
||||
@@ -11,6 +11,7 @@ import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.navi.IMogoNaviListener;
|
||||
import com.mogo.map.navi.IMogoNaviListenerRegister;
|
||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
import com.mogo.map.search.geo.IMogoGeoSearch;
|
||||
import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
|
||||
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
|
||||
@@ -68,7 +69,8 @@ public interface IMogoMapService extends IProvider {
|
||||
*/
|
||||
IMogoPoiSearch getPoiSearch( Context context, MogoPoiSearchQuery query );
|
||||
|
||||
/**f
|
||||
/**
|
||||
* f
|
||||
* 获取导航操作实例
|
||||
*
|
||||
* @param context
|
||||
@@ -96,4 +98,12 @@ public interface IMogoMapService extends IProvider {
|
||||
* @return
|
||||
*/
|
||||
IMogoHosListenerRegister getHostListenerRegister();
|
||||
|
||||
/**
|
||||
* 覆盖物操作
|
||||
*
|
||||
* @param context
|
||||
* @return
|
||||
*/
|
||||
IMogoOverlayManager getOverlayManager( Context context );
|
||||
}
|
||||
|
||||
@@ -10,12 +10,14 @@ import com.mogo.map.MogoLocationClient;
|
||||
import com.mogo.map.MogoMapUIController;
|
||||
import com.mogo.map.MogoMarkerManager;
|
||||
import com.mogo.map.MogoNavi;
|
||||
import com.mogo.map.MogoOverlayManager;
|
||||
import com.mogo.map.MogoPoiSearch;
|
||||
import com.mogo.map.listener.IMogoHosListenerRegister;
|
||||
import com.mogo.map.listener.MogoHosListenerRegister;
|
||||
import com.mogo.map.location.IMogoLocationClient;
|
||||
import com.mogo.map.marker.IMogoMarkerManager;
|
||||
import com.mogo.map.navi.IMogoNavi;
|
||||
import com.mogo.map.overlay.IMogoOverlayManager;
|
||||
import com.mogo.map.search.geo.IMogoGeoSearch;
|
||||
import com.mogo.map.search.inputtips.IMogoInputtipsSearch;
|
||||
import com.mogo.map.search.inputtips.query.MogoInputtipsQuery;
|
||||
@@ -79,6 +81,11 @@ public class MogoMapService implements IMogoMapService {
|
||||
return MogoHosListenerRegister.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public IMogoOverlayManager getOverlayManager( Context context ) {
|
||||
return MogoOverlayManager.getInstance();
|
||||
}
|
||||
|
||||
@Override
|
||||
public void init( Context context ) {
|
||||
MogoInitor.init( context );
|
||||
|
||||
Reference in New Issue
Block a user