剩余的语音指令

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

View File

@@ -263,7 +263,7 @@ public class EntranceFragment extends MvpFragment< EntranceView, EntrancePresent
if ( isLock ) { if ( isLock ) {
mExitNavi.setText( R.string.module_ext_str_exit_navi ); mExitNavi.setText( R.string.module_ext_str_exit_navi );
} else { } else {
mExitNavi.setText( R.string.module_ext_str_continue_navi ); mExitNavi.setText( R.string.module_ext_str_exit_path );
} }
} }

View File

@@ -19,4 +19,5 @@
<string name="module_map_str_upload_road_condition">分享</string> <string name="module_map_str_upload_road_condition">分享</string>
<string name="module_ext_str_exit_navi">退出导航</string> <string name="module_ext_str_exit_navi">退出导航</string>
<string name="module_ext_str_continue_navi">继续导航</string> <string name="module_ext_str_continue_navi">继续导航</string>
<string name="module_ext_str_exit_path">退出全览</string>
</resources> </resources>

View File

@@ -38,8 +38,8 @@ public class MapBroadCastHelper {
Intent intent = new Intent(ACTION_NAV_SEND); Intent intent = new Intent(ACTION_NAV_SEND);
intent.putExtra("KEY_TYPE", 10001); intent.putExtra("KEY_TYPE", 10001);
intent.putExtra("NEXT_ROAD_NAME", naviinfo.getNextRoadName()); intent.putExtra("NEXT_ROAD_NAME", naviinfo.getNextRoadName());
intent.putExtra("ROUTE_REMAIN_TIME", naviinfo.getPathRetainTime()); intent.putExtra("ROUTE_REMAIN_TIME_AUTO", naviinfo.getVoiceRetainTime());
intent.putExtra("ROUTE_REMAIN_DIS", naviinfo.getPathRetainDistance()); intent.putExtra("ROUTE_REMAIN_DIS_AUTO", naviinfo.getVoiceRetainDistance());
intent.putExtra("ICON", naviinfo.getIconResId()); intent.putExtra("ICON", naviinfo.getIconResId());
context.sendBroadcast(intent); context.sendBroadcast(intent);
Log.v("MapBroadCastHelper","action="+ACTION_NAV_SEND+"NaviInfo"); Log.v("MapBroadCastHelper","action="+ACTION_NAV_SEND+"NaviInfo");

View File

@@ -101,7 +101,38 @@ public class MapPresenter extends Presenter<MapView> implements
if (extra_endurance_data) { if (extra_endurance_data) {
mView.getUIController().recoverLockMode(); mView.getUIController().recoverLockMode();
} }
} else if (key_type == 10006) {
int extra_is_show = intent.getIntExtra("EXTRA_IS_SHOW", 0);
if (extra_is_show == 0) {
mView.getUIController().displayOverview();
} else {
mView.getUIController().recoverLockMode();
}
}else if (key_type == 10005){
int navi_route_prefer = intent.getIntExtra("NAVI_ROUTE_PREFER", type);
} }
///**
// * 仅在导航场景下,⽀持第三⽅进⾏路线偏好的重新选择。
// * `避免收费` |`1` `多策略算路` |`2` `不走高速` |`3` ` 躲避拥堵` |`4` `不走高速且避免收费` |`5` `不走高速且躲避拥堵` |`6`
// * `躲避收费和拥堵` |`7` `不走高速躲避收费和拥堵` |`8` `高速优先` |`20` `躲避拥堵且高速优先` |`24`
// *
// * @param context
// * @param type
// */
//public static void setUserPreference(Context context, int type) {
// Intent intent = new Intent();
// intent.setAction("AUTONAVI_STANDARD_BROADCAST_RECV");
// intent.putExtra("KEY_TYPE", 10005);
// intent.putExtra("NAVI_ROUTE_PREFER", type);
// context.sendBroadcast(intent);
//}
//
} }
} }
}; };

View File

@@ -1,5 +1,6 @@
package com.mogo.module.navi.ui.search package com.mogo.module.navi.ui.search
import android.app.Service
import android.os.Bundle import android.os.Bundle
import android.view.View import android.view.View
import androidx.fragment.app.Fragment import androidx.fragment.app.Fragment
@@ -103,6 +104,7 @@ class ChoosePathFragment : BaseFragment(), IMogoNaviListener {
tv_navi_navi.setOnClickListener { tv_navi_navi.setOnClickListener {
SearchServiceHolder.getNavi() SearchServiceHolder.getNavi()
.startNavi(false) .startNavi(false)
SearchServiceHolder.getMapUIController().recoverLockMode()
isStartedNavi = true isStartedNavi = true
SearchServiceHolder.fragmentManager.clearAll() SearchServiceHolder.fragmentManager.clearAll()
} }