剩余的语音指令

This commit is contained in:
zhangyuanzhen
2020-02-04 16:37:20 +08:00
parent 7cfd34e22c
commit 2cd99d98c8
6 changed files with 92 additions and 27 deletions

View File

@@ -63,7 +63,7 @@ public class MogoNaviInfo implements Parcelable {
return currentRoadName;
}
public void setCurrentRoadName( String currentRoadName ) {
public void setCurrentRoadName(String currentRoadName) {
this.currentRoadName = currentRoadName;
}
@@ -71,7 +71,7 @@ public class MogoNaviInfo implements Parcelable {
return currentSpeed;
}
public void setCurrentSpeed( int currentSpeed ) {
public void setCurrentSpeed(int currentSpeed) {
this.currentSpeed = currentSpeed;
}
@@ -79,7 +79,7 @@ public class MogoNaviInfo implements Parcelable {
return curStepRetainDistance;
}
public void setCurStepRetainDistance( int curStepRetainDistance ) {
public void setCurStepRetainDistance(int curStepRetainDistance) {
this.curStepRetainDistance = curStepRetainDistance;
}
@@ -87,7 +87,7 @@ public class MogoNaviInfo implements Parcelable {
return curStepRetainTime;
}
public void setCurStepRetainTime( int curStepRetainTime ) {
public void setCurStepRetainTime(int curStepRetainTime) {
this.curStepRetainTime = curStepRetainTime;
}
@@ -95,7 +95,7 @@ public class MogoNaviInfo implements Parcelable {
return iconResId;
}
public void setIconResId( int iconResId ) {
public void setIconResId(int iconResId) {
this.iconResId = iconResId;
}
@@ -103,7 +103,7 @@ public class MogoNaviInfo implements Parcelable {
return nextRoadName;
}
public void setNextRoadName( String nextRoadName ) {
public void setNextRoadName(String nextRoadName) {
this.nextRoadName = nextRoadName;
}
@@ -111,7 +111,7 @@ public class MogoNaviInfo implements Parcelable {
return pathRetainTime;
}
public void setPathRetainTime( int pathRetainTime ) {
public void setPathRetainTime(int pathRetainTime) {
this.pathRetainTime = pathRetainTime;
}
@@ -119,7 +119,38 @@ public class MogoNaviInfo implements Parcelable {
return pathRetainDistance;
}
public void setPathRetainDistance( int 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;
}
@@ -127,7 +158,7 @@ public class MogoNaviInfo implements Parcelable {
return currentLimitSpeed;
}
public void setCurrentLimitSpeed( float currentLimitSpeed ) {
public void setCurrentLimitSpeed(float currentLimitSpeed) {
this.currentLimitSpeed = currentLimitSpeed;
}
@@ -137,22 +168,22 @@ public class MogoNaviInfo implements Parcelable {
}
@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 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 ) {
protected MogoNaviInfo(Parcel in) {
this.currentRoadName = in.readString();
this.currentSpeed = in.readInt();
this.curStepRetainDistance = in.readInt();
@@ -164,14 +195,14 @@ public class MogoNaviInfo implements Parcelable {
this.currentLimitSpeed = in.readFloat();
}
public static final Creator< MogoNaviInfo > CREATOR = new Creator< MogoNaviInfo >() {
public static final Creator<MogoNaviInfo> CREATOR = new Creator<MogoNaviInfo>() {
@Override
public MogoNaviInfo createFromParcel( Parcel source ) {
return new MogoNaviInfo( source );
public MogoNaviInfo createFromParcel(Parcel source) {
return new MogoNaviInfo(source);
}
@Override
public MogoNaviInfo[] newArray( int size ) {
public MogoNaviInfo[] newArray(int size) {
return new MogoNaviInfo[size];
}
};