simplify initVoiceCommandPlayer calling

This commit is contained in:
sonora 2016-07-17 10:38:29 +02:00
parent 82e382d7c6
commit a3877d3fde
5 changed files with 5 additions and 13 deletions

View file

@ -362,14 +362,6 @@ public class OsmandApplication extends MultiDexApplication {
return player;
}
public void initVoiceCommandPlayer(final Activity uiContext) {
initVoiceCommandPlayer(uiContext, true, null, false, false);
}
public void initVoiceCommandPlayer(final Activity uiContext, boolean warningNoneProvider) {
initVoiceCommandPlayer(uiContext, warningNoneProvider, null, true, false);
}
public void initVoiceCommandPlayer(final Activity uiContext, boolean warningNoneProvider, Runnable run, boolean showDialog, boolean force) {
String voiceProvider = osmandSettings.VOICE_PROVIDER.get();
if (voiceProvider == null || OsmandSettings.VOICE_PROVIDER_NOT_USE.equals(voiceProvider)) {

View file

@ -418,7 +418,7 @@ public class MapActivityActions implements DialogProvider {
ApplicationMode mode = getRouteMode(from);
//app.getSettings().APPLICATION_MODE.set(mode);
app.getRoutingHelper().setAppMode(mode);
app.initVoiceCommandPlayer(mapActivity);
app.initVoiceCommandPlayer(mapActivity, true, null, false, false);
// save application mode controls
settings.FOLLOW_THE_ROUTE.set(false);
app.getRoutingHelper().setFollowingMode(false);
@ -448,7 +448,7 @@ public class MapActivityActions implements DialogProvider {
ApplicationMode mode = getRouteMode(null);
//app.getSettings().APPLICATION_MODE.set(mode);
app.getRoutingHelper().setAppMode(mode);
app.initVoiceCommandPlayer(mapActivity);
app.initVoiceCommandPlayer(mapActivity, true, null, false, false);
// save application mode controls
settings.FOLLOW_THE_ROUTE.set(false);
app.getRoutingHelper().setFollowingMode(false);

View file

@ -456,7 +456,7 @@ public class SettingsGeneralActivity extends SettingsBaseActivity implements OnR
startActivity(intent);
} else {
super.onPreferenceChange(preference, newValue);
getMyApplication().initVoiceCommandPlayer(this, false);
getMyApplication().initVoiceCommandPlayer(this, false, null, true, false);
}
return true;
}

View file

@ -173,7 +173,7 @@ public class FailSafeFuntions {
app.getSettings().FOLLOW_THE_ROUTE.set(true);
routingHelper.setFollowingMode(true);
app.getTargetPointsHelper().updateRouteAndRefresh(true);
app.initVoiceCommandPlayer(ma);
app.initVoiceCommandPlayer(ma, true, null, false, false);
if(ma.getDashboard().isVisible()) {
ma.getDashboard().hideDashboard();
}

View file

@ -269,7 +269,7 @@ public class RoutePreferencesMenu {
public static void applyVoiceProvider(MapActivity mapActivity, String provider) {
mapActivity.getMyApplication().getSettings().VOICE_PROVIDER.set(provider);
mapActivity.getMyApplication().initVoiceCommandPlayer(mapActivity, false);
mapActivity.getMyApplication().initVoiceCommandPlayer(mapActivity, false, null, true, false);
}
private static Set<String> getVoiceFiles(MapActivity mapActivity) {