Add left side navigation option and let user be aware of offline navigation turned off

This commit is contained in:
Victor Shcherb 2012-05-29 19:44:18 +02:00
parent f0ce38200b
commit 04ad989938
5 changed files with 25 additions and 6 deletions

View file

@ -8,6 +8,9 @@
If you are making/correcting english translations make sure :
1. All your modified/created strings are in the top of the file (to make easier find what's translated).
-->
<string name="offline_navigation_not_available">Osmand offline navigation is temporarily not available.</string>
<string name="left_side_navigation">Left Side Navigation</string>
<string name="left_side_navigation_descr">Turn on if you navigate in left side countries</string>
<string name="download_link_and_local_description">Download or update offline data. \nTo see more details click on the item, to deactivate or delete offline data press and hold. \nCurrent data on device (%1$s free):</string>
<string name="unknown_from_location">Starting location is not yet determined</string>
<string name="unknown_location">Position not yet known</string>

View file

@ -27,9 +27,12 @@
<!-- try without AUTO_FOLLOW_ROUTE_NAV (see forum discussion 'Simplify our navigation preference menu')
<CheckBoxPreference android:summary="@string/auto_follow_route_navigation_descr" android:title="@string/auto_follow_route_navigation"
android:key="auto_follow_route_navigation"></CheckBoxPreference>
-->
<CheckBoxPreference android:summary="@string/use_osmand_routing_service_descr" android:title="@string/use_osmand_routing_service"
android:key="use_osmand_routing_service"></CheckBoxPreference>
android:key="use_osmand_routing_service"></CheckBoxPreference>
-->
<CheckBoxPreference android:summary="@string/left_side_navigation_descr" android:title="@string/left_side_navigation"
android:key="left_side_navigation"></CheckBoxPreference>
</PreferenceScreen>
</PreferenceCategory>

View file

@ -565,6 +565,8 @@ public class OsmandSettings {
// make cloudmade by default why osmand is not stable enough
public final OsmandPreference<RouteService> ROUTER_SERVICE =
new EnumIntPreference<RouteService>("router_service", RouteService.CLOUDMADE, false, RouteService.values());
public final CommonPreference<Boolean> LEFT_SIDE_NAVIGATION = new BooleanPreference("left_side_navigation", false, true);
// this value string is synchronized with settings_pref.xml preference name

View file

@ -235,7 +235,8 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
registerBooleanPreference(osmandSettings.USE_ENGLISH_NAMES,screen);
registerBooleanPreference(osmandSettings.AUTO_ZOOM_MAP,screen);
registerBooleanPreference(osmandSettings.FAST_ROUTE_MODE,screen);
registerBooleanPreference(osmandSettings.USE_OSMAND_ROUTING_SERVICE_ALWAYS,screen);
registerBooleanPreference(osmandSettings.USE_OSMAND_ROUTING_SERVICE_ALWAYS,screen);
registerBooleanPreference(osmandSettings.LEFT_SIDE_NAVIGATION,screen);
registerBooleanPreference(osmandSettings.SHOW_ALTITUDE_INFO,screen);
@ -509,6 +510,11 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
} else {
getMyApplication().showDialogInitializingCommandPlayer(this, false);
}
} else if (listPref.getId().equals(osmandSettings.ROUTER_SERVICE.getId())) {
// TO Delete when it will be available
if (osmandSettings.ROUTER_SERVICE.get() == RouteService.OSMAND) {
AccessibleToast.makeText(this, R.string.offline_navigation_not_available, Toast.LENGTH_LONG).show();
}
} else if (listPref.getId().equals(osmandSettings.APPLICATION_MODE.getId())) {
updateAllSettings();
} else if (listPref.getId().equals(osmandSettings.PREFERRED_LOCALE.getId())) {

View file

@ -25,6 +25,7 @@ import net.osmand.GPXUtilities.TrkSegment;
import net.osmand.GPXUtilities.WptPt;
import net.osmand.LogUtil;
import net.osmand.OsmAndFormatter;
import net.osmand.access.AccessibleToast;
import net.osmand.binary.BinaryMapIndexReader;
import net.osmand.osm.LatLon;
import net.osmand.osm.MapUtils;
@ -50,6 +51,7 @@ import org.xml.sax.SAXException;
import android.content.Context;
import android.location.Location;
import android.widget.Toast;
public class RouteProvider {
private static final org.apache.commons.logging.Log log = LogUtil.getLog(RouteProvider.class);
@ -268,10 +270,13 @@ public class RouteProvider {
} else if (type == RouteService.ORS) {
res = findORSRoute(start, end, mode, fast);
addMissingTurnsToRoute(res, start, end, mode, ctx);
} else if (type == RouteService.OSMAND) {
res = findVectorMapsRoute(start, end, mode, fast, (OsmandApplication)ctx.getApplicationContext());
addMissingTurnsToRoute(res, start, end, mode, ctx);
// } else if (type == RouteService.OSMAND) {
// res = findVectorMapsRoute(start, end, mode, fast, (OsmandApplication)ctx.getApplicationContext());
// addMissingTurnsToRoute(res, start, end, mode, ctx);
} else {
if (type == RouteService.OSMAND) {
AccessibleToast.makeText(ctx, R.string.offline_navigation_not_available, Toast.LENGTH_LONG).show();
}
res = findCloudMadeRoute(start, end, mode, ctx, fast);
// for test purpose
addMissingTurnsToRoute(res, start, end, mode, ctx);