[6.2.0]
[nav] [高德导航声音放入single线程]
This commit is contained in:
@@ -45,7 +45,7 @@ public class AmapNaviToDestinationModel implements AMapNaviListener {
|
||||
protected final List<NaviLatLng> sList = new ArrayList<NaviLatLng>();
|
||||
protected final List<NaviLatLng> eList = new ArrayList<NaviLatLng>();
|
||||
protected List<NaviLatLng> mWayPointList = new ArrayList<NaviLatLng>();
|
||||
private ICommonNaviChangedCallback mNaviChangedCallback;
|
||||
private volatile ICommonNaviChangedCallback mNaviChangedCallback;
|
||||
private AtomicInteger errorCount = new AtomicInteger(0);
|
||||
private boolean isPlay;
|
||||
|
||||
@@ -76,13 +76,15 @@ public class AmapNaviToDestinationModel implements AMapNaviListener {
|
||||
}
|
||||
|
||||
public void setVoiceIsMute(boolean isPlay) {
|
||||
if (mAMapNavi == null) return;
|
||||
this.isPlay = isPlay;
|
||||
if (isPlay) {
|
||||
mAMapNavi.startSpeak();
|
||||
} else {
|
||||
mAMapNavi.stopSpeak();
|
||||
}
|
||||
ThreadUtils.getSinglePool().execute(() -> {
|
||||
if (mAMapNavi == null) return;
|
||||
this.isPlay = isPlay;
|
||||
if (isPlay) {
|
||||
mAMapNavi.startSpeak();
|
||||
} else {
|
||||
mAMapNavi.stopSpeak();
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public AMapNavi getmAMapNavi() {
|
||||
@@ -90,9 +92,9 @@ public class AmapNaviToDestinationModel implements AMapNaviListener {
|
||||
}
|
||||
|
||||
public void destroyAmaNavi() {
|
||||
if (mAMapNavi != null) {
|
||||
ThreadUtils.getSinglePool().execute(() -> {
|
||||
CallerLogger.i( TAG, "destroyAmaNavi()");
|
||||
ThreadUtils.getSinglePool().execute(() -> {
|
||||
CallerLogger.i(TAG, "destroyAmaNavi()");
|
||||
if (mAMapNavi != null) {
|
||||
isPlay = false;
|
||||
sList.clear();
|
||||
eList.clear();
|
||||
@@ -100,8 +102,8 @@ public class AmapNaviToDestinationModel implements AMapNaviListener {
|
||||
mAMapNavi.destroy();
|
||||
mAMapNavi = null;
|
||||
mNaviChangedCallback = null;
|
||||
});
|
||||
}
|
||||
}
|
||||
});
|
||||
}
|
||||
|
||||
public void setTaxiNaviChangedCallback(ICommonNaviChangedCallback callback) {
|
||||
@@ -149,7 +151,7 @@ public class AmapNaviToDestinationModel implements AMapNaviListener {
|
||||
@Override
|
||||
public void onNaviInfoUpdate(NaviInfo naviinfo) {
|
||||
//导航过程中的信息更新,请看NaviInfo的具体说明
|
||||
CallerLogger.i( TAG, "距离=" + naviinfo.getPathRetainDistance() + ", 剩余时间 " + naviinfo.getPathRetainTime());
|
||||
CallerLogger.i(TAG, "距离=" + naviinfo.getPathRetainDistance() + ", 剩余时间 " + naviinfo.getPathRetainTime());
|
||||
if (null != mNaviChangedCallback) {
|
||||
mNaviChangedCallback.onCurrentNaviDistAndTimeChanged(naviinfo.getPathRetainDistance(), naviinfo.getPathRetainTime());// 米、秒
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user