From 3f4afca30313cdfde3ee51828a81ce4b5b67d106 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Wed, 24 Sep 2014 22:32:37 +0200 Subject: [PATCH] Add text size setting for the map --- .../src/net/osmand/router/GeneralRouter.java | 2 +- .../osmand/router/RoutePlannerFrontEnd.java | 2 +- .../osmand/router/RouteResultPreparation.java | 10 ++++-- OsmAnd/res/values/strings.xml | 2 ++ .../access/SettingsAccessibilityActivity.java | 33 +++++++++++++++---- 5 files changed, 39 insertions(+), 10 deletions(-) diff --git a/OsmAnd-java/src/net/osmand/router/GeneralRouter.java b/OsmAnd-java/src/net/osmand/router/GeneralRouter.java index b1bb749950..6f5cc4ce94 100644 --- a/OsmAnd-java/src/net/osmand/router/GeneralRouter.java +++ b/OsmAnd-java/src/net/osmand/router/GeneralRouter.java @@ -324,7 +324,7 @@ public class GeneralRouter implements VehicleRouter { RouteTypeRule r = reg.quickGetEncodingRule(pt[i]); if ("highway".equals(r.getTag()) && "traffic_signals".equals(r.getValue())) { // traffic signals don't add turn info - return 0; +// return 0; } } } diff --git a/OsmAnd-java/src/net/osmand/router/RoutePlannerFrontEnd.java b/OsmAnd-java/src/net/osmand/router/RoutePlannerFrontEnd.java index f6fac8e79a..e61ad49676 100644 --- a/OsmAnd-java/src/net/osmand/router/RoutePlannerFrontEnd.java +++ b/OsmAnd-java/src/net/osmand/router/RoutePlannerFrontEnd.java @@ -314,7 +314,7 @@ public class RoutePlannerFrontEnd { long time = System.currentTimeMillis(); RouteSegmentResult[] res = ctx.nativeLib.runNativeRouting(ctx.startX, ctx.startY, ctx.targetX, ctx.targetY, ctx.config, regions, ctx.calculationProgress, ctx.precalculatedRouteDirection, ctx.calculationMode == RouteCalculationMode.BASE); - System.out.println("Native routing took " + (System.currentTimeMillis() - time) / 1000f + " seconds"); + log.info("Native routing took " + (System.currentTimeMillis() - time) / 1000f + " seconds"); ArrayList result = new ArrayList(Arrays.asList(res)); ctx.routingTime = ctx.calculationProgress.routingCalculatedTime; ctx.visitedSegments = ctx.calculationProgress.visitedSegments; diff --git a/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java b/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java index 4b8249743f..1fa0b3afad 100644 --- a/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java +++ b/OsmAnd-java/src/net/osmand/router/RouteResultPreparation.java @@ -8,6 +8,9 @@ import java.util.Collections; import java.util.Iterator; import java.util.List; +import org.apache.commons.logging.Log; + +import net.osmand.PlatformUtil; import net.osmand.binary.BinaryMapIndexReader; import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule; import net.osmand.binary.RouteDataObject; @@ -21,6 +24,7 @@ public class RouteResultPreparation { public static boolean PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST = false; private static final float TURN_DEGREE_MIN = 45; + private Log log = PlatformUtil.getLog(RouteResultPreparation.class); /** * Helper method to prepare final result */ @@ -258,12 +262,14 @@ public class RouteResultPreparation { double startLon = start.getLongitude(); double endLat = end.getLatitude(); double endLon = end.getLongitude(); - println(MessageFormat.format("", startLat + "", startLon + "", endLat + "", endLon + "", ctx.config.routerName, "loadedTiles = \"" + ctx.loadedTiles + "\" " + "visitedSegments = \"" + ctx.visitedSegments + "\" " + "complete_distance = \"" + completeDistance + "\" " + "complete_time = \"" + completeTime + "\" " + - "routing_time = \"" + ctx.routingTime + "\" ")); + "routing_time = \"" + ctx.routingTime + "\" "); + log.info(msg); + println(msg); if (PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST) { for (RouteSegmentResult res : result) { String name = res.getObject().getName(); diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 0eda56ca63..e036582800 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,8 @@ 3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy --> + Set the text size on the map. + Text size Speed limit Border control Toll booth diff --git a/OsmAnd/src/net/osmand/access/SettingsAccessibilityActivity.java b/OsmAnd/src/net/osmand/access/SettingsAccessibilityActivity.java index 2c60fd6800..b3be541fe9 100644 --- a/OsmAnd/src/net/osmand/access/SettingsAccessibilityActivity.java +++ b/OsmAnd/src/net/osmand/access/SettingsAccessibilityActivity.java @@ -9,6 +9,7 @@ import android.os.Build; import android.os.Bundle; import android.preference.ListPreference; import android.preference.Preference; +import android.preference.PreferenceGroup; import android.preference.Preference.OnPreferenceChangeListener; import android.preference.PreferenceCategory; import android.preference.PreferenceScreen; @@ -41,6 +42,8 @@ public class SettingsAccessibilityActivity extends SettingsBaseActivity { return true; } }); + addTextScale(grp); + addSpeechRateSetting(grp); grp.addPreference(accessibilityModePreference); PreferenceCategory cat = new PreferenceCategory(this); @@ -69,15 +72,11 @@ public class SettingsAccessibilityActivity extends SettingsBaseActivity { cat.addPreference(createCheckBoxPreference(settings.ZOOM_BY_TRACKBALL, R.string.zoom_by_trackball, R.string.zoom_by_trackball_descr)); + cat.addPreference(createCheckBoxPreference(settings.USE_SHORT_OBJECT_NAMES, R.string.use_short_object_names, R.string.use_short_object_names_descr)); - Float[] sprValues = new Float[] {0.5f, 0.75f, 1f, 1.25f, 1.5f, 2f} ; - String[] sprNames = new String[sprValues.length]; - for(int i = 0; i < sprNames.length; i++) { - sprNames[i] = (int)(sprValues[i] * 100) + " %"; - } - cat.addPreference(createListPreference(settings.SPEECH_RATE, sprNames, sprValues, R.string.speech_rate, R.string.speech_rate_descr)); + if (Build.VERSION.SDK_INT < 14) { // Build.VERSION_CODES.ICE_CREAM_SANDWICH cat.addPreference(createCheckBoxPreference(settings.SCROLL_MAP_BY_GESTURES, R.string.scroll_map_by_gestures, R.string.scroll_map_by_gestures_descr)); @@ -88,6 +87,28 @@ public class SettingsAccessibilityActivity extends SettingsBaseActivity { + protected void addTextScale(PreferenceGroup grp) { + Float[] txtValues = new Float[] {0.75f, 1f, 1.25f, 1.5f, 2f, 3f} ; + String[] txtNames = new String[txtValues.length]; + for(int i = 0; i < txtNames.length; i++) { + txtNames[i] = (int)(txtValues[i] * 100) + " %"; + } + grp.addPreference(createListPreference(settings.TEXT_SCALE, txtNames, txtValues, R.string.text_size, R.string.text_size_descr)); + } + + + + protected void addSpeechRateSetting(PreferenceGroup grp) { + Float[] sprValues = new Float[] {0.5f, 0.75f, 1f, 1.25f, 1.5f, 2f} ; + String[] sprNames = new String[sprValues.length]; + for(int i = 0; i < sprNames.length; i++) { + sprNames[i] = (int)(sprValues[i] * 100) + " %"; + } + grp.addPreference(createListPreference(settings.SPEECH_RATE, sprNames, sprValues, R.string.speech_rate, R.string.speech_rate_descr)); + } + + + public void updateAllSettings() { super.updateAllSettings(); PreferenceCategory accessibilityOptions = ((PreferenceCategory)(getPreferenceScreen().findPreference("accessibility_options")));