diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index f1ac4b49c9..70083edd41 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 --> + Speed limit exceed value. + Select speed limit exceed value on which you will get voice announcement. We changed your favorite point name to %1$s because it is not possible to save string with emoticons to file. Print route Test native render diff --git a/OsmAnd/res/xml/navigation_settings.xml b/OsmAnd/res/xml/navigation_settings.xml index 375e595b88..0465fdef44 100644 --- a/OsmAnd/res/xml/navigation_settings.xml +++ b/OsmAnd/res/xml/navigation_settings.xml @@ -23,6 +23,10 @@ android:key="arrival_distance_factor" android:title="@string/arrival_distance" android:summary="@string/arrival_distance_descr" /> + diff --git a/OsmAnd/src/net/osmand/plus/OsmandSettings.java b/OsmAnd/src/net/osmand/plus/OsmandSettings.java index 74cf9d1108..0383c1a0f4 100644 --- a/OsmAnd/src/net/osmand/plus/OsmandSettings.java +++ b/OsmAnd/src/net/osmand/plus/OsmandSettings.java @@ -675,6 +675,9 @@ public class OsmandSettings { public final OsmandPreference ARRIVAL_DISTANCE_FACTOR = new FloatPreference("arrival_distance_factor", 1f).makeProfile(); + public final OsmandPreference SPEED_LIMIT_EXCEED = + new FloatPreference("speed_limit_exceed", 5f).makeProfile(); + // this value string is synchronized with settings_pref.xml preference name public final OsmandPreference USE_TRACKBALL_FOR_MOVEMENTS = new BooleanPreference("use_trackball_for_movements", true).makeGlobal(); diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java index a8edaea6f8..c048728991 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivity.java @@ -213,6 +213,8 @@ public class MapActivity extends AccessibleActivity { ((FrameLayout)mapView.getParent()).addView(lockView); } gpxImportHelper = new GpxImportHelper(this, getMyApplication(), getMapView()); + + mapActions.createOptionsMenuAsDrawer(false); } public void addLockView(FrameLayout lockView) { @@ -466,7 +468,7 @@ public class MapActivity extends AccessibleActivity { } return true; } else if (keyCode == KeyEvent.KEYCODE_MENU && event.getRepeatCount() == 0) { - mapActions.openOptionsMenuAsList(); + mapActions.createOptionsMenuAsDrawer(true); return true; } else if (keyCode == KeyEvent.KEYCODE_SEARCH && event.getRepeatCount() == 0) { Intent newIntent = new Intent(MapActivity.this, getMyApplication().getAppCustomization().getSearchActivity()); diff --git a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java index 0a4ebf7ee8..689bd1a111 100644 --- a/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java +++ b/OsmAnd/src/net/osmand/plus/activities/MapActivityActions.java @@ -723,12 +723,12 @@ public class MapActivityActions implements DialogProvider { } } - public void openOptionsMenuAsDrawer(){ + public void createOptionsMenuAsDrawer(boolean show){ final ContextMenuAdapter cm = createOptionsMenu(); final DrawerLayout mDrawerLayout = (DrawerLayout) mapActivity.findViewById(R.id.drawer_layout); final ListView mDrawerList = (ListView) mapActivity.findViewById(R.id.left_drawer); mDrawerLayout.setDrawerShadow(R.drawable.drawer_shadow, GravityCompat.START); - ListAdapter listAdapter ; + ListAdapter listAdapter; if(Build.VERSION.SDK_INT < Build.VERSION_CODES.HONEYCOMB){ listAdapter = cm.createListAdapter(mapActivity, R.layout.list_menu_item, getMyApplication().getSettings().isLightContentMenu()); @@ -755,7 +755,9 @@ public class MapActivityActions implements DialogProvider { } }); - mDrawerLayout.openDrawer(mDrawerList); + if (show){ + mDrawerLayout.openDrawer(mDrawerList); + } } public AlertDialog openOptionsMenuAsList() { diff --git a/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java b/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java index d1f03e911b..a2f1949aa6 100644 --- a/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/SettingsNavigationActivity.java @@ -6,6 +6,7 @@ import java.util.List; import java.util.Map; import net.osmand.plus.ApplicationMode; +import net.osmand.plus.OsmandSettings; import net.osmand.plus.OsmandSettings.AutoZoomMap; import net.osmand.plus.OsmandSettings.OsmandPreference; import net.osmand.plus.R; @@ -32,6 +33,7 @@ public class SettingsNavigationActivity extends SettingsBaseActivity { private Preference speakAlarms; private ListPreference routerServicePreference; private ListPreference autoZoomMapPreference; + private ListPreference speedLimitExceed; private List avoidParameters = new ArrayList(); @@ -109,7 +111,32 @@ public class SettingsNavigationActivity extends SettingsBaseActivity { getString(R.string.arrival_distance_factor_at_last) }; registerListPreference(settings.ARRIVAL_DISTANCE_FACTOR, screen, arrivalNames, arrivalValues); - + + //array size should be equal! + Float[] speedLimitsKm = new Float[]{5f, 7f, 10f, 15f, 20f}; + Float[] speedLimitsMiles = new Float[]{3f, 5f, 7f, 10f, 15f}; + if (settings.METRIC_SYSTEM.get() == OsmandSettings.MetricsConstants.KILOMETERS_AND_METERS) { + String[] speedNames = new String[speedLimitsKm.length]; + for (int i =0; i mxspeed + delta) { int speed; if (mc == MetricsConstants.KILOMETERS_AND_METERS) { diff --git a/OsmAnd/src/net/osmand/plus/views/controls/MapMenuControls.java b/OsmAnd/src/net/osmand/plus/views/controls/MapMenuControls.java index c4ce14bcc3..10d7b16356 100644 --- a/OsmAnd/src/net/osmand/plus/views/controls/MapMenuControls.java +++ b/OsmAnd/src/net/osmand/plus/views/controls/MapMenuControls.java @@ -39,7 +39,7 @@ public class MapMenuControls extends MapControls { // double lat = activity.getMapView().getLatitude(); // double lon = activity.getMapView().getLongitude(); // MainMenuActivity.backToMainMenuDialog(activity, new LatLon(lat, lon)); - mapActivity.getMapActions().openOptionsMenuAsDrawer(); + mapActivity.getMapActions().createOptionsMenuAsDrawer(true); notifyClicked(); } }); diff --git a/OsmAnd/src/net/osmand/plus/views/controls/SmallMapMenuControls.java b/OsmAnd/src/net/osmand/plus/views/controls/SmallMapMenuControls.java index aa8c7b1ed0..e671bb3617 100644 --- a/OsmAnd/src/net/osmand/plus/views/controls/SmallMapMenuControls.java +++ b/OsmAnd/src/net/osmand/plus/views/controls/SmallMapMenuControls.java @@ -27,7 +27,7 @@ public class SmallMapMenuControls extends MapControls { public void onClick(View v) { notifyClicked(); //mapActivity.getMapActions().openOptionsMenuAsDrawer(); - mapActivity.getMapActions().openOptionsMenuAsDrawer(); + mapActivity.getMapActions().createOptionsMenuAsDrawer(true); } }); }