Merge pull request #5812 from osmandapp/js_voice_routing
Improved listener
This commit is contained in:
commit
192f0f28c1
1 changed files with 10 additions and 9 deletions
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue