Merge pull request #5812 from osmandapp/js_voice_routing

Improved listener
This commit is contained in:
Alexey 2018-08-09 12:22:00 +03:00 committed by GitHub
commit 192f0f28c1
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -31,8 +31,9 @@ import java.util.Set;
//import net.osmand.plus.development.OsmandDevelopmentPlugin;
public class SettingsDevelopmentActivity extends SettingsBaseActivity implements StateChangedListener<Boolean> {
public class SettingsDevelopmentActivity extends SettingsBaseActivity {
private StateChangedListener<Boolean> useJSVoiceGuidanceListener;
@SuppressLint("SimpleDateFormat")
@Override
@ -63,10 +64,15 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity implements
cat.addPreference(createCheckBoxPreference(settings.ANIMATE_MY_LOCATION,
R.string.animate_my_location,
R.string.animate_my_location_desc));
useJSVoiceGuidanceListener = new StateChangedListener<Boolean>() {
@Override
public void stateChanged(Boolean change) {
getMyApplication().getDownloadThread().runReloadIndexFilesSilent();
}
};
cat.addPreference(createCheckBoxPreference(settings.USE_JS_VOICE_GUIDANCE, "Use JS voice guidance",
"Use new voice guidance logic based on JavaScript"));
settings.USE_JS_VOICE_GUIDANCE.addListener(this);
settings.USE_JS_VOICE_GUIDANCE.addListener(useJSVoiceGuidanceListener);
final Preference firstRunPreference = new Preference(this);
firstRunPreference.setTitle(R.string.simulate_initial_startup);
@ -257,11 +263,6 @@ public class SettingsDevelopmentActivity extends SettingsBaseActivity implements
@Override
public void onDestroy() {
super.onDestroy();
settings.USE_JS_VOICE_GUIDANCE.removeListener(this);
}
@Override
public void stateChanged(Boolean change) {
getMyApplication().getDownloadThread().runReloadIndexFilesSilent();
settings.USE_JS_VOICE_GUIDANCE.removeListener(useJSVoiceGuidanceListener);
}
}