merge
This commit is contained in:
@@ -1,48 +0,0 @@
|
||||
package com.mogo.map.navi;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-25
|
||||
* <p>
|
||||
* 导航监听
|
||||
*/
|
||||
public interface IMogoNaviListener {
|
||||
|
||||
/**
|
||||
* 导航初始化失败
|
||||
*/
|
||||
default void onInitNaviFailure(){}
|
||||
|
||||
/**
|
||||
* 导航初始化成功
|
||||
*/
|
||||
default void onInitNaviSuccess(){}
|
||||
|
||||
/**
|
||||
* 导航引导信息
|
||||
*
|
||||
* @param naviinfo
|
||||
*/
|
||||
default void onNaviInfoUpdate( MogoNaviInfo naviinfo ){}
|
||||
|
||||
/**
|
||||
* 导航开始回调
|
||||
*/
|
||||
default void onStartNavi(){}
|
||||
|
||||
/**
|
||||
* 导航停止:包括到达目的地和主动停止导航
|
||||
*/
|
||||
default void onStopNavi(){}
|
||||
|
||||
/**
|
||||
* 路径规划成功
|
||||
*/
|
||||
default void onCalculateSuccess(){}
|
||||
|
||||
/**
|
||||
* 路径规划失败
|
||||
*/
|
||||
default void onoCalculateFailed(){}
|
||||
|
||||
}
|
||||
@@ -1,210 +0,0 @@
|
||||
package com.mogo.map.navi;
|
||||
|
||||
import android.os.Parcel;
|
||||
import android.os.Parcelable;
|
||||
|
||||
import androidx.annotation.DrawableRes;
|
||||
|
||||
/**
|
||||
* @author congtaowang
|
||||
* @since 2019-12-25
|
||||
* <p>
|
||||
* 导航引导信息
|
||||
*/
|
||||
public class MogoNaviInfo implements Parcelable {
|
||||
|
||||
/**
|
||||
* 当前路线名称
|
||||
*/
|
||||
private String currentRoadName;
|
||||
|
||||
/**
|
||||
* 导航过程中当前的车速
|
||||
*/
|
||||
private int currentSpeed;
|
||||
|
||||
/**
|
||||
* 当前路段剩余距离
|
||||
*/
|
||||
private int curStepRetainDistance;
|
||||
|
||||
/**
|
||||
* 当前路段剩余时间
|
||||
*/
|
||||
private int curStepRetainTime;
|
||||
|
||||
/**
|
||||
* 导航转向图标资源ID
|
||||
*/
|
||||
@DrawableRes
|
||||
private int iconResId;
|
||||
|
||||
/**
|
||||
* 下条路名
|
||||
*/
|
||||
private String nextRoadName;
|
||||
|
||||
/**
|
||||
* 剩余时间(秒)
|
||||
*/
|
||||
private int pathRetainTime;
|
||||
|
||||
/**
|
||||
* 剩余距离
|
||||
*/
|
||||
private int pathRetainDistance;
|
||||
|
||||
/**
|
||||
* 当前限速
|
||||
*/
|
||||
private float currentLimitSpeed;
|
||||
|
||||
public String getCurrentRoadName() {
|
||||
return currentRoadName;
|
||||
}
|
||||
|
||||
public void setCurrentRoadName(String currentRoadName) {
|
||||
this.currentRoadName = currentRoadName;
|
||||
}
|
||||
|
||||
public int getCurrentSpeed() {
|
||||
return currentSpeed;
|
||||
}
|
||||
|
||||
public void setCurrentSpeed(int currentSpeed) {
|
||||
this.currentSpeed = currentSpeed;
|
||||
}
|
||||
|
||||
public int getCurStepRetainDistance() {
|
||||
return curStepRetainDistance;
|
||||
}
|
||||
|
||||
public void setCurStepRetainDistance(int curStepRetainDistance) {
|
||||
this.curStepRetainDistance = curStepRetainDistance;
|
||||
}
|
||||
|
||||
public int getCurStepRetainTime() {
|
||||
return curStepRetainTime;
|
||||
}
|
||||
|
||||
public void setCurStepRetainTime(int curStepRetainTime) {
|
||||
this.curStepRetainTime = curStepRetainTime;
|
||||
}
|
||||
|
||||
public int getIconResId() {
|
||||
return iconResId;
|
||||
}
|
||||
|
||||
public void setIconResId(int iconResId) {
|
||||
this.iconResId = iconResId;
|
||||
}
|
||||
|
||||
public String getNextRoadName() {
|
||||
return nextRoadName;
|
||||
}
|
||||
|
||||
public void setNextRoadName(String nextRoadName) {
|
||||
this.nextRoadName = nextRoadName;
|
||||
}
|
||||
|
||||
public int getPathRetainTime() {
|
||||
return pathRetainTime;
|
||||
}
|
||||
|
||||
public void setPathRetainTime(int pathRetainTime) {
|
||||
this.pathRetainTime = pathRetainTime;
|
||||
}
|
||||
|
||||
public int getPathRetainDistance() {
|
||||
return pathRetainDistance;
|
||||
}
|
||||
|
||||
public String getVoiceRetainDistance() {
|
||||
|
||||
StringBuilder builder = new StringBuilder();
|
||||
if (pathRetainDistance >= 1000) {
|
||||
builder.append(String.format("%.1f公里", pathRetainDistance / 1000f));
|
||||
} else {
|
||||
builder.append(pathRetainDistance).append("米");
|
||||
}
|
||||
|
||||
return builder.toString();
|
||||
}
|
||||
|
||||
public String getVoiceRetainTime() {
|
||||
StringBuilder builder = new StringBuilder();
|
||||
int seconds = pathRetainTime;
|
||||
int days = seconds / (24 * 60 * 60);
|
||||
if (days > 0) {
|
||||
builder.append(days).append("天");
|
||||
}
|
||||
seconds -= days * 24 * 60 * 60;
|
||||
int hours = seconds / (60 * 60);
|
||||
if (hours > 0) {
|
||||
builder.append(hours).append("小时");
|
||||
}
|
||||
seconds -= hours * 60 * 60;
|
||||
int min = seconds / 60;
|
||||
builder.append(min > 1 ? min : 1).append("分钟");
|
||||
return builder.toString();
|
||||
|
||||
}
|
||||
|
||||
public void setPathRetainDistance(int pathRetainDistance) {
|
||||
this.pathRetainDistance = pathRetainDistance;
|
||||
}
|
||||
|
||||
public float getCurrentLimitSpeed() {
|
||||
return currentLimitSpeed;
|
||||
}
|
||||
|
||||
public void setCurrentLimitSpeed(float currentLimitSpeed) {
|
||||
this.currentLimitSpeed = currentLimitSpeed;
|
||||
}
|
||||
|
||||
@Override
|
||||
public int describeContents() {
|
||||
return 0;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void writeToParcel(Parcel dest, int flags) {
|
||||
dest.writeString(this.currentRoadName);
|
||||
dest.writeInt(this.currentSpeed);
|
||||
dest.writeInt(this.curStepRetainDistance);
|
||||
dest.writeInt(this.curStepRetainTime);
|
||||
dest.writeInt(this.iconResId);
|
||||
dest.writeString(this.nextRoadName);
|
||||
dest.writeInt(this.pathRetainTime);
|
||||
dest.writeInt(this.pathRetainDistance);
|
||||
dest.writeFloat(this.currentLimitSpeed);
|
||||
}
|
||||
|
||||
public MogoNaviInfo() {
|
||||
}
|
||||
|
||||
protected MogoNaviInfo(Parcel in) {
|
||||
this.currentRoadName = in.readString();
|
||||
this.currentSpeed = in.readInt();
|
||||
this.curStepRetainDistance = in.readInt();
|
||||
this.curStepRetainTime = in.readInt();
|
||||
this.iconResId = in.readInt();
|
||||
this.nextRoadName = in.readString();
|
||||
this.pathRetainTime = in.readInt();
|
||||
this.pathRetainDistance = in.readInt();
|
||||
this.currentLimitSpeed = in.readFloat();
|
||||
}
|
||||
|
||||
public static final Creator<MogoNaviInfo> CREATOR = new Creator<MogoNaviInfo>() {
|
||||
@Override
|
||||
public MogoNaviInfo createFromParcel(Parcel source) {
|
||||
return new MogoNaviInfo(source);
|
||||
}
|
||||
|
||||
@Override
|
||||
public MogoNaviInfo[] newArray(int size) {
|
||||
return new MogoNaviInfo[size];
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user