Add text size setting for the map

This commit is contained in:
Victor Shcherb 2014-09-24 22:32:37 +02:00
parent 327ff96ba6
commit 3f4afca303
5 changed files with 39 additions and 10 deletions

View file

@ -324,7 +324,7 @@ public class GeneralRouter implements VehicleRouter {
RouteTypeRule r = reg.quickGetEncodingRule(pt[i]); RouteTypeRule r = reg.quickGetEncodingRule(pt[i]);
if ("highway".equals(r.getTag()) && "traffic_signals".equals(r.getValue())) { if ("highway".equals(r.getTag()) && "traffic_signals".equals(r.getValue())) {
// traffic signals don't add turn info // traffic signals don't add turn info
return 0; // return 0;
} }
} }
} }

View file

@ -314,7 +314,7 @@ public class RoutePlannerFrontEnd {
long time = System.currentTimeMillis(); long time = System.currentTimeMillis();
RouteSegmentResult[] res = ctx.nativeLib.runNativeRouting(ctx.startX, ctx.startY, ctx.targetX, ctx.targetY, RouteSegmentResult[] res = ctx.nativeLib.runNativeRouting(ctx.startX, ctx.startY, ctx.targetX, ctx.targetY,
ctx.config, regions, ctx.calculationProgress, ctx.precalculatedRouteDirection, ctx.calculationMode == RouteCalculationMode.BASE); 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<RouteSegmentResult> result = new ArrayList<RouteSegmentResult>(Arrays.asList(res)); ArrayList<RouteSegmentResult> result = new ArrayList<RouteSegmentResult>(Arrays.asList(res));
ctx.routingTime = ctx.calculationProgress.routingCalculatedTime; ctx.routingTime = ctx.calculationProgress.routingCalculatedTime;
ctx.visitedSegments = ctx.calculationProgress.visitedSegments; ctx.visitedSegments = ctx.calculationProgress.visitedSegments;

View file

@ -8,6 +8,9 @@ import java.util.Collections;
import java.util.Iterator; import java.util.Iterator;
import java.util.List; import java.util.List;
import org.apache.commons.logging.Log;
import net.osmand.PlatformUtil;
import net.osmand.binary.BinaryMapIndexReader; import net.osmand.binary.BinaryMapIndexReader;
import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule; import net.osmand.binary.BinaryMapRouteReaderAdapter.RouteTypeRule;
import net.osmand.binary.RouteDataObject; import net.osmand.binary.RouteDataObject;
@ -21,6 +24,7 @@ public class RouteResultPreparation {
public static boolean PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST = false; public static boolean PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST = false;
private static final float TURN_DEGREE_MIN = 45; private static final float TURN_DEGREE_MIN = 45;
private Log log = PlatformUtil.getLog(RouteResultPreparation.class);
/** /**
* Helper method to prepare final result * Helper method to prepare final result
*/ */
@ -258,12 +262,14 @@ public class RouteResultPreparation {
double startLon = start.getLongitude(); double startLon = start.getLongitude();
double endLat = end.getLatitude(); double endLat = end.getLatitude();
double endLon = end.getLongitude(); double endLon = end.getLongitude();
println(MessageFormat.format("<test regions=\"\" description=\"\" best_percent=\"\" vehicle=\"{4}\" \n" String msg = MessageFormat.format("<test regions=\"\" description=\"\" best_percent=\"\" vehicle=\"{4}\" \n"
+ " start_lat=\"{0}\" start_lon=\"{1}\" target_lat=\"{2}\" target_lon=\"{3}\" {5} >", + " start_lat=\"{0}\" start_lon=\"{1}\" target_lat=\"{2}\" target_lon=\"{3}\" {5} >",
startLat + "", startLon + "", endLat + "", endLon + "", ctx.config.routerName, startLat + "", startLon + "", endLat + "", endLon + "", ctx.config.routerName,
"loadedTiles = \"" + ctx.loadedTiles + "\" " + "visitedSegments = \"" + ctx.visitedSegments + "\" " + "loadedTiles = \"" + ctx.loadedTiles + "\" " + "visitedSegments = \"" + ctx.visitedSegments + "\" " +
"complete_distance = \"" + completeDistance + "\" " + "complete_time = \"" + completeTime + "\" " + "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) { if (PRINT_TO_CONSOLE_ROUTE_INFORMATION_TO_TEST) {
for (RouteSegmentResult res : result) { for (RouteSegmentResult res : result) {
String name = res.getObject().getName(); String name = res.getObject().getName();

View file

@ -9,6 +9,8 @@
3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). 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 PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy
--> -->
<string name="text_size_descr">Set the text size on the map.</string>
<string name="text_size">Text size</string>
<string name="traffic_warning_speed_limit">Speed limit</string> <string name="traffic_warning_speed_limit">Speed limit</string>
<string name="traffic_warning_border_control">Border control</string> <string name="traffic_warning_border_control">Border control</string>
<string name="traffic_warning_payment">Toll booth</string> <string name="traffic_warning_payment">Toll booth</string>

View file

@ -9,6 +9,7 @@ import android.os.Build;
import android.os.Bundle; import android.os.Bundle;
import android.preference.ListPreference; import android.preference.ListPreference;
import android.preference.Preference; import android.preference.Preference;
import android.preference.PreferenceGroup;
import android.preference.Preference.OnPreferenceChangeListener; import android.preference.Preference.OnPreferenceChangeListener;
import android.preference.PreferenceCategory; import android.preference.PreferenceCategory;
import android.preference.PreferenceScreen; import android.preference.PreferenceScreen;
@ -41,6 +42,8 @@ public class SettingsAccessibilityActivity extends SettingsBaseActivity {
return true; return true;
} }
}); });
addTextScale(grp);
addSpeechRateSetting(grp);
grp.addPreference(accessibilityModePreference); grp.addPreference(accessibilityModePreference);
PreferenceCategory cat = new PreferenceCategory(this); 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, cat.addPreference(createCheckBoxPreference(settings.ZOOM_BY_TRACKBALL, R.string.zoom_by_trackball,
R.string.zoom_by_trackball_descr)); R.string.zoom_by_trackball_descr));
cat.addPreference(createCheckBoxPreference(settings.USE_SHORT_OBJECT_NAMES, R.string.use_short_object_names, cat.addPreference(createCheckBoxPreference(settings.USE_SHORT_OBJECT_NAMES, R.string.use_short_object_names,
R.string.use_short_object_names_descr)); 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 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, cat.addPreference(createCheckBoxPreference(settings.SCROLL_MAP_BY_GESTURES, R.string.scroll_map_by_gestures,
R.string.scroll_map_by_gestures_descr)); 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() { public void updateAllSettings() {
super.updateAllSettings(); super.updateAllSettings();
PreferenceCategory accessibilityOptions = ((PreferenceCategory)(getPreferenceScreen().findPreference("accessibility_options"))); PreferenceCategory accessibilityOptions = ((PreferenceCategory)(getPreferenceScreen().findPreference("accessibility_options")));