- * 描述 - */ -public class AMapCalcRouteResultWrapper implements Parcelable { - - private final int errorCode; - private final int[] routeId; - private final int calcRouteType; - private final String errorDetail; - - public AMapCalcRouteResultWrapper( AMapCalcRouteResult result ) { - errorCode = result.getErrorCode(); - routeId = result.getRouteid(); - calcRouteType = result.getCalcRouteType(); - errorDetail = result.getErrorDetail(); - } - - public AMapCalcRouteResult parse() { - final AMapCalcRouteResult inst = new AMapCalcRouteResult(); - inst.setErrorCode( getErrorCode() ); - inst.setRouteid( getRouteId() ); - inst.setCalcRouteType( getCalcRouteType() ); - inst.setErrorDetail( getErrorDetail() ); - return inst; - } - - public int getErrorCode() { - return errorCode; - } - - public int[] getRouteId() { - return routeId; - } - - public int getCalcRouteType() { - return calcRouteType; - } - - public String getErrorDetail() { - return errorDetail; - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel( Parcel dest, int flags ) { - dest.writeInt( this.errorCode ); - dest.writeIntArray( this.routeId ); - dest.writeInt( this.calcRouteType ); - dest.writeString( this.errorDetail ); - } - - protected AMapCalcRouteResultWrapper( Parcel in ) { - this.errorCode = in.readInt(); - this.routeId = in.createIntArray(); - this.calcRouteType = in.readInt(); - this.errorDetail = in.readString(); - } - - public static final Creator< AMapCalcRouteResultWrapper > CREATOR = new Creator< AMapCalcRouteResultWrapper >() { - @Override - public AMapCalcRouteResultWrapper createFromParcel( Parcel source ) { - return new AMapCalcRouteResultWrapper( source ); - } - - @Override - public AMapCalcRouteResultWrapper[] newArray( int size ) { - return new AMapCalcRouteResultWrapper[size]; - } - }; -} diff --git a/modules/mogo-module-navi/src/main/java/com/mogo/module/navi/wrapper/AMapNaviCameraInfoWrapper.java b/modules/mogo-module-navi/src/main/java/com/mogo/module/navi/wrapper/AMapNaviCameraInfoWrapper.java deleted file mode 100644 index 9463cdc52a..0000000000 --- a/modules/mogo-module-navi/src/main/java/com/mogo/module/navi/wrapper/AMapNaviCameraInfoWrapper.java +++ /dev/null @@ -1,99 +0,0 @@ -package com.mogo.module.navi.wrapper; - -import com.amap.api.navi.model.AMapNaviCameraInfo; - -/** - * @author congtaowang - * @since 2019-10-10 - *
- * 描述 - */ -public class AMapNaviCameraInfoWrapper { - - private int cameraDistance; - private double x; - private double y; - /** - * {@link AMapNaviCameraInfo#getCameraType()} - * {@link com.amap.api.navi.enums.CameraType#SPEED} 测速摄像 - * {@link com.amap.api.navi.enums.CameraType#SURVEILLANCE}监控摄像 - * {@link com.amap.api.navi.enums.CameraType#TRAFFICLIGHT} 闯红灯拍照 - * {@link com.amap.api.navi.enums.CameraType#BREAKRULE} 违章拍照 - * {@link com.amap.api.navi.enums.CameraType#BUSWAY} 公交专用道摄像头 - * {@link com.amap.api.navi.enums.CameraType#EMERGENCY}应急车道拍照 - * {@link com.amap.api.navi.enums.CameraType#BICYCLE}非机动车道(暂未使用) - * {@link com.amap.api.navi.enums.CameraType#INTERVALVELOCITYSTART}区间测速起始 - * {@link com.amap.api.navi.enums.CameraType#INTERVALVELOCITYEND}区间测速解除 - */ - private int cameraType; - private int cameraSpeed; - private int averageSpeed; - private int reasonableSpeedInRemainDist; - private int distance; - private int[] speed; - - public AMapNaviCameraInfoWrapper( AMapNaviCameraInfo info ) { - if ( info != null ) { - cameraDistance = info.getCameraDistance(); - x = info.getX(); - y = info.getY(); - cameraType = info.getCameraType(); - cameraSpeed = info.getCameraSpeed(); - averageSpeed = info.getAverageSpeed(); - reasonableSpeedInRemainDist = info.getReasonableSpeedInRemainDist(); - distance = info.getDistance(); - speed = info.getSpeed(); - } - } - - @Override - public String toString() { - StringBuilder builder = new StringBuilder(); - builder.append( "cameraDistance" ).append( "=" ).append( cameraDistance ).append( "\n" ); - builder.append( "cameraType" ).append( "=" ).append( cameraType ).append( "\n" ); - builder.append( "cameraSpeed" ).append( "=" ).append( cameraSpeed ).append( "\n" ); - builder.append( "averageSpeed" ).append( "=" ).append( averageSpeed ).append( "\n" ); - builder.append( "reasonableSpeedInRemainDist" ).append( "=" ).append( reasonableSpeedInRemainDist ).append( "\n" ); - builder.append( "distance" ).append( "=" ).append( distance ).append( "\n" ); - if ( speed != null ) { - builder.append( "speed" ).append( "=" ).append( speed ).append( "\n" ); - } - return builder.toString(); - } - - public int getCameraDistance() { - return cameraDistance; - } - - public double getX() { - return x; - } - - public double getY() { - return y; - } - - public int getCameraType() { - return cameraType; - } - - public int getCameraSpeed() { - return cameraSpeed; - } - - public int getAverageSpeed() { - return averageSpeed; - } - - public int getReasonableSpeedInRemainDist() { - return reasonableSpeedInRemainDist; - } - - public int getDistance() { - return distance; - } - - public int[] getSpeed() { - return speed; - } -} diff --git a/modules/mogo-module-navi/src/main/java/com/mogo/module/navi/wrapper/AMapNaviLocationWrapper.java b/modules/mogo-module-navi/src/main/java/com/mogo/module/navi/wrapper/AMapNaviLocationWrapper.java deleted file mode 100644 index 0bba71fdd9..0000000000 --- a/modules/mogo-module-navi/src/main/java/com/mogo/module/navi/wrapper/AMapNaviLocationWrapper.java +++ /dev/null @@ -1,148 +0,0 @@ -package com.mogo.module.navi.wrapper; - -import android.os.Parcel; -import android.os.Parcelable; -import com.amap.api.navi.model.AMapNaviLocation; -import com.amap.api.navi.model.NaviLatLng; - -/** - * @author congtaowang - * @since 2019-09-26 - *
- * 描述 - */ -public class AMapNaviLocationWrapper implements Parcelable { - - private final float accuracy; - private final double altitude; - private final float bearing; - private final float speed; - private final long time; - private final int matchStatus; - private final NaviLatLng coord; - private final int curStepIndex; - private final int curLinkIndex; - private final int curPointIndex; - private final int type; - - public AMapNaviLocationWrapper( AMapNaviLocation aMapNaviLocation ) { - this.accuracy = aMapNaviLocation.getAccuracy(); - this.altitude = aMapNaviLocation.getAltitude(); - this.bearing = aMapNaviLocation.getBearing(); - this.speed = aMapNaviLocation.getSpeed(); - this.time = aMapNaviLocation.getTime(); - this.matchStatus = aMapNaviLocation.getMatchStatus(); - this.coord = aMapNaviLocation.getCoord(); - this.curStepIndex = aMapNaviLocation.getCurStepIndex(); - this.curLinkIndex = aMapNaviLocation.getCurLinkIndex(); - this.curPointIndex = aMapNaviLocation.getCurPointIndex(); - this.type = aMapNaviLocation.getType(); - } - - public AMapNaviLocation parse() { - final AMapNaviLocation inst = new AMapNaviLocation(); - inst.setAccuracy( getAccuracy() ); - inst.setAltitude( getAltitude() ); - inst.setBearing( getBearing() ); - inst.setSpeed( getSpeed() ); - inst.setTime( getTime() ); - inst.setMatchStatus( getMatchStatus() ); - inst.setCoord( getCoord() ); - inst.setCurStepIndex( getCurStepIndex() ); - inst.setCurLinkIndex( getCurLinkIndex() ); - inst.setCurPointIndex( getCurPointIndex() ); - inst.setType( getType() ); - return inst; - } - - public float getAccuracy() { - return accuracy; - } - - public double getAltitude() { - return altitude; - } - - public float getBearing() { - return bearing; - } - - public float getSpeed() { - return speed; - } - - public long getTime() { - return time; - } - - public int getMatchStatus() { - return matchStatus; - } - - public NaviLatLng getCoord() { - return coord; - } - - public int getCurStepIndex() { - return curStepIndex; - } - - public int getCurLinkIndex() { - return curLinkIndex; - } - - public int getCurPointIndex() { - return curPointIndex; - } - - public int getType() { - return type; - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel( Parcel dest, int flags ) { - dest.writeFloat( this.accuracy ); - dest.writeDouble( this.altitude ); - dest.writeFloat( this.bearing ); - dest.writeFloat( this.speed ); - dest.writeLong( this.time ); - dest.writeInt( this.matchStatus ); - dest.writeParcelable( this.coord, flags ); - dest.writeInt( this.curStepIndex ); - dest.writeInt( this.curLinkIndex ); - dest.writeInt( this.curPointIndex ); - dest.writeInt( this.type ); - } - - protected AMapNaviLocationWrapper( Parcel in ) { - this.accuracy = in.readFloat(); - this.altitude = in.readDouble(); - this.bearing = in.readFloat(); - this.speed = in.readFloat(); - this.time = in.readLong(); - this.matchStatus = in.readInt(); - this.coord = in.readParcelable( NaviLatLng.class.getClassLoader() ); - this.curStepIndex = in.readInt(); - this.curLinkIndex = in.readInt(); - this.curPointIndex = in.readInt(); - this.type = in.readInt(); - } - - public static final Creator< AMapNaviLocationWrapper > - CREATOR = new Parcelable.Creator< AMapNaviLocationWrapper >() { - @Override - public AMapNaviLocationWrapper createFromParcel( Parcel source ) { - return new AMapNaviLocationWrapper( source ); - } - - @Override - public AMapNaviLocationWrapper[] newArray( int size ) { - return new AMapNaviLocationWrapper[size]; - } - }; -} diff --git a/modules/mogo-module-navi/src/main/java/com/mogo/module/navi/wrapper/LatLngWrapper.java b/modules/mogo-module-navi/src/main/java/com/mogo/module/navi/wrapper/LatLngWrapper.java deleted file mode 100644 index e8dedf1ef8..0000000000 --- a/modules/mogo-module-navi/src/main/java/com/mogo/module/navi/wrapper/LatLngWrapper.java +++ /dev/null @@ -1,104 +0,0 @@ -package com.mogo.module.navi.wrapper; - -import android.location.Location; -import android.os.Parcel; -import android.os.Parcelable; -import com.amap.api.maps.model.LatLng; -import com.amap.api.navi.model.AMapNaviLocation; -import com.amap.api.navi.model.NaviLatLng; - -/** - * @author congtaowang - * @since 2019-09-26 - *
- * 经纬度 - */ -public class LatLngWrapper implements Parcelable { - - private final double lat; - private final double lng; - - public LatLngWrapper( double lat, double lng ) { - this.lat = lat; - this.lng = lng; - } - - public double getLat() { - return lat; - } - - public double getLng() { - return lng; - } - - @Override - public int describeContents() { - return 0; - } - - @Override - public void writeToParcel( Parcel dest, int flags ) { - dest.writeDouble( this.lat ); - dest.writeDouble( this.lng ); - } - - protected LatLngWrapper( Parcel in ) { - this.lat = in.readDouble(); - this.lng = in.readDouble(); - } - - public static final Creator< LatLngWrapper > CREATOR = new Creator< LatLngWrapper >() { - @Override - public LatLngWrapper createFromParcel( Parcel source ) { - return new LatLngWrapper( source ); - } - - @Override - public LatLngWrapper[] newArray( int size ) { - return new LatLngWrapper[size]; - } - }; - - public static LatLngWrapper from( LatLng latlng ) { - return new LatLngWrapper( latlng.latitude, latlng.longitude ); - } - - public static LatLngWrapper from( NaviLatLng latlng ) { - return new LatLngWrapper( latlng.getLatitude(), latlng.getLongitude() ); - } - - public static LatLngWrapper from( AMapNaviLocation latlng ) { - return from( latlng.getCoord() ); - } - - public LatLng parseLatLngInst() { - return new LatLng( getLat(), getLng() ); - } - - public static LatLng parse( NaviLatLng latLng ) { - if ( latLng == null ) { - return null; - } - return new LatLng( latLng.getLatitude(), latLng.getLongitude() ); - } - - public static LatLng parse( Location location ) { - if ( location == null ) { - return null; - } - return new LatLng( location.getLatitude(), location.getLongitude() ); - } - - public static LatLng parse( double lat, double lng ) { - if ( isRightLatLng( lat, lng ) ) { - return new LatLng( lat, lng ); - } - return null; - } - - public static boolean isRightLatLng( double lat, double lng ) { - return lat > 0 && lat < 90 && lng > 0 && lng < 180; - } - - -} diff --git a/modules/mogo-module-navi/src/main/java/com/mogo/module/navi/wrapper/NaviInfoWrapper.java b/modules/mogo-module-navi/src/main/java/com/mogo/module/navi/wrapper/NaviInfoWrapper.java deleted file mode 100644 index 7ec2849867..0000000000 --- a/modules/mogo-module-navi/src/main/java/com/mogo/module/navi/wrapper/NaviInfoWrapper.java +++ /dev/null @@ -1,116 +0,0 @@ -package com.mogo.module.navi.wrapper; - -import android.os.Parcel; -import android.os.Parcelable; -import com.amap.api.navi.model.NaviInfo; - -/** - * @author congtaowang - * @since 2019-09-29 - *
- * 导航信息对象
- */
-public class NaviInfoWrapper implements Parcelable {
-
- private static final NaviInfoWrapper INST = new NaviInfoWrapper();
-
- private int nextIconType;
- private int nextDistance;
- private String nextRoad;
- private int surplusDistance;
- private int surplusTime;
- private int currentSpeed;
-
- private NaviInfoWrapper() {
-
- }
-
- public static NaviInfoWrapper getInst() {
- return INST;
- }
-
- public synchronized NaviInfoWrapper fillWith( NaviInfo naviInfo ) {
- INST.nextIconType = naviInfo.getIconType();
- INST.nextDistance = naviInfo.getCurStepRetainDistance();
- INST.nextRoad = naviInfo.getNextRoadName();
- INST.surplusDistance = naviInfo.getPathRetainDistance();
- INST.surplusTime = naviInfo.getPathRetainTime();
- INST.currentSpeed = naviInfo.getCurrentSpeed();
- return INST;
- }
-
- public NaviInfoWrapper( NaviInfo naviInfo ) {
- this.nextIconType = naviInfo.getIconType();
- this.nextDistance = naviInfo.getCurStepRetainDistance();
- this.nextRoad = naviInfo.getNextRoadName();
- this.surplusDistance = naviInfo.getPathRetainDistance();
- this.surplusTime = naviInfo.getPathRetainTime();
- this.currentSpeed = naviInfo.getCurrentSpeed();
- }
-
- public synchronized int getNextIconType() {
- return nextIconType;
- }
-
- public synchronized int getNextDistance() {
- return nextDistance;
- }
-
- public synchronized String getNextRoad() {
- return nextRoad;
- }
-
- public synchronized int getSurplusDistance() {
- return surplusDistance;
- }
-
- public synchronized int getSurplusTime() {
- return surplusTime;
- }
-
- public synchronized int getCurrentSpeed() {
- return currentSpeed;
- }
-
- @Override
- public int describeContents() {
- return 0;
- }
-
- @Override
- public void writeToParcel( Parcel dest, int flags ) {
- dest.writeInt( getNextIconType() );
- dest.writeInt( getNextDistance() );
- dest.writeString( getNextRoad() );
- dest.writeInt( getSurplusDistance() );
- dest.writeInt( getSurplusTime() );
- dest.writeInt( getCurrentSpeed() );
- }
-
- protected NaviInfoWrapper( Parcel in ) {
- this.nextIconType = in.readInt();
- this.nextDistance = in.readInt();
- this.nextRoad = in.readString();
- this.surplusDistance = in.readInt();
- this.surplusTime = in.readInt();
- this.currentSpeed = in.readInt();
- }
-
- public static final Creator< NaviInfoWrapper > CREATOR = new Parcelable.Creator< NaviInfoWrapper >() {
- @Override
- public NaviInfoWrapper createFromParcel( Parcel source ) {
- return new NaviInfoWrapper( source );
- }
-
- @Override
- public NaviInfoWrapper[] newArray( int size ) {
- return new NaviInfoWrapper[size];
- }
- };
-
- @Override
- public String toString() {
- StringBuilder builder = new StringBuilder();
- return builder.toString();
- }
-}
diff --git a/modules/mogo-module-navi/src/main/res/layout/activity_navi.xml b/modules/mogo-module-navi/src/main/res/layout/activity_navi.xml
new file mode 100644
index 0000000000..dbec94d82e
--- /dev/null
+++ b/modules/mogo-module-navi/src/main/res/layout/activity_navi.xml
@@ -0,0 +1,15 @@
+
+