Fix auto follow in viewing mode. Introduce special settings to manipulate with it.

This commit is contained in:
Victor Shcherb 2011-10-08 13:12:10 +02:00
parent 7ba33b4d0a
commit 5c6bceb9ba
5 changed files with 13 additions and 4 deletions

View file

@ -1,5 +1,7 @@
<?xml version="1.0" encoding="utf-8" standalone="no"?> <?xml version="1.0" encoding="utf-8" standalone="no"?>
<resources> <resources>
<string name="auto_follow_route_navigation_descr">Enable auto follow position only in navigation mode.</string>
<string name="auto_follow_route_navigation">Auto follow navigation</string>
<string name="auto_follow_location_enabled">Auto follow settings are enabled.</string> <string name="auto_follow_location_enabled">Auto follow settings are enabled.</string>
<string name="animate_route_off">Animate off</string> <string name="animate_route_off">Animate off</string>
<string name="animate_route">Animate on</string> <string name="animate_route">Animate on</string>

View file

@ -59,6 +59,9 @@
<ListPreference android:title="@string/voice_provider" android:key="voice_provider" android:summary="@string/voice_provider_descr"></ListPreference> <ListPreference android:title="@string/voice_provider" android:key="voice_provider" android:summary="@string/voice_provider_descr"></ListPreference>
<ListPreference android:key="auto_follow_route" android:title="@string/choose_auto_follow_route" <ListPreference android:key="auto_follow_route" android:title="@string/choose_auto_follow_route"
android:summary="@string/choose_auto_follow_route_descr"></ListPreference> android:summary="@string/choose_auto_follow_route_descr"></ListPreference>
<CheckBoxPreference android:summary="@string/auto_follow_route_navigation_descr" android:title="@string/auto_follow_route_navigation"
android:key="auto_follow_route_navigation"></CheckBoxPreference>
<ListPreference android:key="audio_stream" android:title="@string/choose_audio_stream" <ListPreference android:key="audio_stream" android:title="@string/choose_audio_stream"
android:summary="@string/choose_audio_stream_descr"></ListPreference> android:summary="@string/choose_audio_stream_descr"></ListPreference>
<CheckBoxPreference android:summary="@string/use_osmand_routing_service_descr" android:title="@string/use_osmand_routing_service" <CheckBoxPreference android:summary="@string/use_osmand_routing_service_descr" android:title="@string/use_osmand_routing_service"

View file

@ -508,10 +508,13 @@ public class OsmandSettings {
// seconds to auto_follow // seconds to auto_follow
public final CommonPreference<Integer> AUTO_FOLLOW_ROUTE = new IntPreference("auto_follow_route", 0, false); public final CommonPreference<Integer> AUTO_FOLLOW_ROUTE = new IntPreference("auto_follow_route", 0, false);
{ {
AUTO_FOLLOW_ROUTE.setModeDefaultValue(ApplicationMode.CAR, 10); AUTO_FOLLOW_ROUTE.setModeDefaultValue(ApplicationMode.CAR, 7);
AUTO_FOLLOW_ROUTE.setModeDefaultValue(ApplicationMode.BICYCLE, 15); AUTO_FOLLOW_ROUTE.setModeDefaultValue(ApplicationMode.BICYCLE, 10);
AUTO_FOLLOW_ROUTE.setModeDefaultValue(ApplicationMode.PEDESTRIAN, 20); AUTO_FOLLOW_ROUTE.setModeDefaultValue(ApplicationMode.PEDESTRIAN, 15);
} }
// this value string is synchronized with settings_pref.xml preference name
public final CommonPreference<Boolean> AUTO_FOLLOW_ROUTE_NAV = new BooleanPreference("auto_follow_route_navigation", true, false);
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
public static final int ROTATE_MAP_NONE = 0; public static final int ROTATE_MAP_NONE = 0;

View file

@ -1238,7 +1238,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
public void setMapLinkedToLocation(boolean isMapLinkedToLocation) { public void setMapLinkedToLocation(boolean isMapLinkedToLocation) {
if(!isMapLinkedToLocation){ if(!isMapLinkedToLocation){
int autoFollow = settings.AUTO_FOLLOW_ROUTE.get(); int autoFollow = settings.AUTO_FOLLOW_ROUTE.get();
if(autoFollow > 0){ if(autoFollow > 0 && (!settings.AUTO_FOLLOW_ROUTE_NAV.get() || routingHelper.isFollowingMode())){
uiHandler.removeMessages(AUTO_FOLLOW_MSG_ID); uiHandler.removeMessages(AUTO_FOLLOW_MSG_ID);
Message msg = Message.obtain(uiHandler, new Runnable() { Message msg = Message.obtain(uiHandler, new Runnable() {
@Override @Override

View file

@ -162,6 +162,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
registerBooleanPreference(osmandSettings.USE_ENGLISH_NAMES,screen); registerBooleanPreference(osmandSettings.USE_ENGLISH_NAMES,screen);
registerBooleanPreference(osmandSettings.SHOW_MORE_MAP_DETAIL,screen); registerBooleanPreference(osmandSettings.SHOW_MORE_MAP_DETAIL,screen);
registerBooleanPreference(osmandSettings.AUTO_ZOOM_MAP,screen); registerBooleanPreference(osmandSettings.AUTO_ZOOM_MAP,screen);
registerBooleanPreference(osmandSettings.AUTO_FOLLOW_ROUTE_NAV,screen);
registerBooleanPreference(osmandSettings.SAVE_TRACK_TO_GPX,screen); registerBooleanPreference(osmandSettings.SAVE_TRACK_TO_GPX,screen);
registerBooleanPreference(osmandSettings.DEBUG_RENDERING_INFO,screen); registerBooleanPreference(osmandSettings.DEBUG_RENDERING_INFO,screen);
registerBooleanPreference(osmandSettings.USE_STEP_BY_STEP_RENDERING,screen); registerBooleanPreference(osmandSettings.USE_STEP_BY_STEP_RENDERING,screen);