From e78a5f72de39371d5658c72a9965ad00e62cf974 Mon Sep 17 00:00:00 2001 From: sonora Date: Tue, 26 Jul 2016 00:20:38 +0200 Subject: [PATCH] do not re-init player when recalculating route --- OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java | 3 ++- .../src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java | 2 +- OsmAnd/src/net/osmand/plus/voice/MediaCommandPlayerImpl.java | 2 +- OsmAnd/src/net/osmand/plus/voice/TTSCommandPlayerImpl.java | 2 +- 4 files changed, 5 insertions(+), 4 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index 77813855df..b82cbbe357 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -448,7 +448,8 @@ public class MapActivityActions implements DialogProvider { ApplicationMode mode = getRouteMode(null); //app.getSettings().APPLICATION_MODE.set(mode); app.getRoutingHelper().setAppMode(mode); - app.initVoiceCommandPlayer(mapActivity, true, null, false, false); + //Test for #2810: No need to init player here? + //app.initVoiceCommandPlayer(mapActivity, true, null, false, false); // save application mode controls settings.FOLLOW_THE_ROUTE.set(false); app.getRoutingHelper().setFollowingMode(false); diff --git a/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java b/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java index b3c5f1037a..f466e19675 100644 --- a/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java +++ b/OsmAnd/src/net/osmand/plus/voice/AbstractPrologCommandPlayer.java @@ -60,7 +60,7 @@ public abstract class AbstractPrologCommandPlayer implements CommandPlayer, Stat private static final String WEAR_ALERT = "WEAR_ALERT"; /** Must be sorted array! */ private final int[] sortedVoiceVersions; - private AudioFocusHelper mAudioFocusHelper; + private static AudioFocusHelper mAudioFocusHelper; protected String language = ""; protected int streamType; private int currentVersion; diff --git a/OsmAnd/src/net/osmand/plus/voice/MediaCommandPlayerImpl.java b/OsmAnd/src/net/osmand/plus/voice/MediaCommandPlayerImpl.java index 0f021b546d..789bb25e45 100644 --- a/OsmAnd/src/net/osmand/plus/voice/MediaCommandPlayerImpl.java +++ b/OsmAnd/src/net/osmand/plus/voice/MediaCommandPlayerImpl.java @@ -28,7 +28,7 @@ public class MediaCommandPlayerImpl extends AbstractPrologCommandPlayer implemen private static final Log log = PlatformUtil.getLog(MediaCommandPlayerImpl.class); // playing media - private MediaPlayer mediaPlayer; + private static MediaPlayer mediaPlayer; // indicates that player is ready to play first file private List filesToPlay = Collections.synchronizedList(new ArrayList()); private VoiceRouter vrt; diff --git a/OsmAnd/src/net/osmand/plus/voice/TTSCommandPlayerImpl.java b/OsmAnd/src/net/osmand/plus/voice/TTSCommandPlayerImpl.java index 74a2d80570..4a228b80ec 100644 --- a/OsmAnd/src/net/osmand/plus/voice/TTSCommandPlayerImpl.java +++ b/OsmAnd/src/net/osmand/plus/voice/TTSCommandPlayerImpl.java @@ -62,7 +62,7 @@ public class TTSCommandPlayerImpl extends AbstractPrologCommandPlayer { private static final int[] TTS_VOICE_VERSION = new int[] { 102, 103 }; // !! MUST BE SORTED // TTS any more 101 because of to much changes private static final Log log = PlatformUtil.getLog(TTSCommandPlayerImpl.class); - private TextToSpeech mTts; + private static TextToSpeech mTts; private Context mTtsContext; private HashMap params = new HashMap(); private VoiceRouter vrt;