Add settings for show limits
This commit is contained in:
parent
0cdd7ce9b7
commit
3061750eb7
5 changed files with 48 additions and 12 deletions
|
@ -9,6 +9,15 @@
|
|||
1. 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
|
||||
-->
|
||||
<string name="show_cameras_descr">Show speed cameras (may be forbidden in some countries)</string>
|
||||
<string name="show_speed_limits_descr">Show speed limits and traffic bumps</string>
|
||||
<string name="avoid_toll_roads_descr">Avoid toll roads for route calculation</string>
|
||||
<string name="show_cameras">Show speed cameras</string>
|
||||
<string name="show_speed_limits">Show speed limits</string>
|
||||
<string name="avoid_toll_roads">Avoid toll roads</string>
|
||||
<string name="tip_recent_changes_0_8_2_t">Changes in 0.8.2 :
|
||||
\n\t* Improved Routing
|
||||
</string>
|
||||
<string name="continue_follow_previous_route_auto">Previous navigation was unfinished. Continue following it? (%1$s seconds)</string>
|
||||
<string name="route_updated_loc_found">Route will be recalculated when location will be found</string>
|
||||
<string name="osmand_parking_hours">Hours</string>
|
||||
|
|
|
@ -25,6 +25,12 @@
|
|||
<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"
|
||||
android:summary="@string/choose_auto_follow_route_descr"></ListPreference>
|
||||
<CheckBoxPreference android:summary="@string/show_speed_limits_descr" android:title="@string/show_speed_limits"
|
||||
android:key="show_speed_limits"></CheckBoxPreference>
|
||||
<CheckBoxPreference android:summary="@string/show_cameras_descr" android:title="@string/show_cameras"
|
||||
android:key="show_cameras"></CheckBoxPreference>
|
||||
<CheckBoxPreference android:summary="@string/avoid_toll_roads_descr" android:title="@string/avoid_toll_roads"
|
||||
android:key="avoid_toll_roads"></CheckBoxPreference>
|
||||
<CheckBoxPreference android:summary="@string/use_compass_navigation_descr" android:title="@string/use_compass_navigation"
|
||||
android:key="use_compass_navigation"></CheckBoxPreference>
|
||||
</PreferenceScreen>
|
||||
|
|
|
@ -559,7 +559,16 @@ public class OsmandSettings {
|
|||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final OsmandPreference<Boolean> FAST_ROUTE_MODE = new BooleanPreference("fast_route_mode", true).makeProfile();
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final OsmandPreference<Boolean> SHOW_CAMERAS = new BooleanPreference("show_cameras", true).makeGlobal().cache();
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final OsmandPreference<Boolean> SHOW_SPEED_LIMITS = new BooleanPreference("show_speed_limits", true).makeGlobal().cache();
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final OsmandPreference<Boolean> AVOID_TOLL_ROADS = new BooleanPreference("avoid_toll_roads", false).makeGlobal().cache();
|
||||
|
||||
// this value string is synchronized with settings_pref.xml preference name
|
||||
public final CommonPreference<Integer> SAVE_TRACK_INTERVAL = new IntPreference("save_track_interval", 5).makeProfile();
|
||||
{
|
||||
|
|
|
@ -258,15 +258,18 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
|||
// bidForFixHelper.generatePreferenceList(screen, getString(R.string.support_new_features), this);
|
||||
OsmandPlugin.onSettingsActivityCreate(this, screen);
|
||||
|
||||
registerBooleanPreference(osmandSettings.SHOW_VIEW_ANGLE,screen);
|
||||
registerBooleanPreference(osmandSettings.USE_ENGLISH_NAMES,screen);
|
||||
registerBooleanPreference(osmandSettings.AUTO_ZOOM_MAP,screen);
|
||||
registerBooleanPreference(osmandSettings.FAST_ROUTE_MODE,screen);
|
||||
registerBooleanPreference(osmandSettings.USE_COMPASS_IN_NAVIGATION,screen);
|
||||
registerBooleanPreference(osmandSettings.LEFT_SIDE_NAVIGATION,screen);
|
||||
registerBooleanPreference(osmandSettings.SHOW_VIEW_ANGLE, screen);
|
||||
registerBooleanPreference(osmandSettings.USE_ENGLISH_NAMES, screen);
|
||||
registerBooleanPreference(osmandSettings.AUTO_ZOOM_MAP, screen);
|
||||
registerBooleanPreference(osmandSettings.FAST_ROUTE_MODE, screen);
|
||||
registerBooleanPreference(osmandSettings.USE_COMPASS_IN_NAVIGATION, screen);
|
||||
registerBooleanPreference(osmandSettings.LEFT_SIDE_NAVIGATION, screen);
|
||||
|
||||
registerBooleanPreference(osmandSettings.SHOW_CAMERAS, screen);
|
||||
registerBooleanPreference(osmandSettings.SHOW_SPEED_LIMITS, screen);
|
||||
registerBooleanPreference(osmandSettings.AVOID_TOLL_ROADS, screen);
|
||||
|
||||
|
||||
registerBooleanPreference(osmandSettings.SHOW_ALTITUDE_INFO,screen);
|
||||
registerBooleanPreference(osmandSettings.SHOW_ALTITUDE_INFO, screen);
|
||||
|
||||
CheckBoxPreference nativeCheckbox = registerBooleanPreference(osmandSettings.NATIVE_RENDERING,screen);
|
||||
//disable the checkbox if the library cannot be used
|
||||
|
|
|
@ -6,6 +6,7 @@ import java.util.Arrays;
|
|||
import net.osmand.Algoritms;
|
||||
import net.osmand.OsmAndFormatter;
|
||||
import net.osmand.osm.LatLon;
|
||||
import net.osmand.plus.OsmandSettings;
|
||||
import net.osmand.plus.R;
|
||||
import net.osmand.plus.activities.MapActivity;
|
||||
import net.osmand.plus.routing.AlarmInfo;
|
||||
|
@ -628,12 +629,15 @@ public class MapInfoLayer extends OsmandMapLayer {
|
|||
ptext.setAntiAlias(true);
|
||||
ptext.setTextAlign(Align.CENTER);
|
||||
|
||||
final OsmandSettings settings = view.getSettings();
|
||||
final MapInfoControl alarm = new MapInfoControl(map) {
|
||||
private String text = "";
|
||||
@Override
|
||||
public boolean updateInfo() {
|
||||
boolean visible = false;
|
||||
if (routeLayer != null && routingHelper.isFollowingMode()) {
|
||||
boolean limits = settings.SHOW_SPEED_LIMITS.get();
|
||||
boolean cams = settings.SHOW_CAMERAS.get();
|
||||
boolean visible = limits || cams;
|
||||
if (visible && routeLayer != null && routingHelper.isFollowingMode()) {
|
||||
AlarmInfo alarm = routingHelper.getMostImportantAlarm(view.getSettings().METRIC_SYSTEM.get());
|
||||
if(alarm != null) {
|
||||
if(alarm.getType() == AlarmInfo.SPEED_LIMIT) {
|
||||
|
@ -651,6 +655,11 @@ public class MapInfoLayer extends OsmandMapLayer {
|
|||
// text = "STOP";
|
||||
}
|
||||
visible = text.length() > 0;
|
||||
if(alarm.getType() == AlarmInfo.SPEED_CAMERA) {
|
||||
visible = cams;
|
||||
} else {
|
||||
visible = limits;
|
||||
}
|
||||
}
|
||||
}
|
||||
updateVisibility(visible);
|
||||
|
@ -789,10 +798,10 @@ public class MapInfoLayer extends OsmandMapLayer {
|
|||
|
||||
@Override
|
||||
protected void onDraw(Canvas canvas) {
|
||||
ShadowText.draw(getText().toString(), canvas, topText.getWidth() / 2, topText.getHeight(), topText.getPaint());
|
||||
ShadowText.draw(getText().toString(), canvas, topText.getWidth() / 2, topText.getHeight() - 4 * scaleCoefficient, topText.getPaint());
|
||||
}
|
||||
};
|
||||
topText.setGravity(Gravity.CENTER);
|
||||
topText.getPaint().setTextAlign(Align.CENTER);
|
||||
topText.setTextColor(Color.BLACK);
|
||||
statusBar.addView(topText, params);
|
||||
|
||||
|
|
Loading…
Reference in a new issue