translation into russian

change settings layout

git-svn-id: https://osmand.googlecode.com/svn/trunk@166 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
Olga.shcherb 2010-06-16 11:01:19 +00:00
parent 42426f041f
commit 881d88ef40
6 changed files with 233 additions and 121 deletions

View file

@ -14,9 +14,8 @@
android:background="@drawable/btn_orange" android:background="@drawable/btn_orange"
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textStyle="bold" android:textStyle="bold"
android:layout_width="140dip"
android:layout_height="90dip" android:layout_height="90dip"
android:drawableLeft="@drawable/map"/> android:drawableLeft="@drawable/map" android:layout_width="150dip"/>
<Button <Button
android:id="@+id/SearchButton" android:id="@+id/SearchButton"
@ -24,9 +23,8 @@
android:background="@drawable/btn_orange" android:background="@drawable/btn_orange"
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textStyle="bold" android:textStyle="bold"
android:layout_width="140dip"
android:layout_height="90dip" android:layout_height="90dip"
android:drawableLeft="@drawable/find"/> android:drawableLeft="@drawable/find" android:layout_width="150dip"/>
</TableRow> </TableRow>
<TableRow> <TableRow>
<Button <Button
@ -35,7 +33,7 @@
android:background="@drawable/btn_orange" android:background="@drawable/btn_orange"
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textStyle="bold" android:textStyle="bold"
android:layout_width="140dip" android:layout_width="150dip"
android:layout_height="90dip" android:layout_height="90dip"
android:drawableLeft="@drawable/favorites"/> android:drawableLeft="@drawable/favorites"/>
<Button <Button
@ -44,7 +42,7 @@
android:background="@drawable/btn_orange" android:background="@drawable/btn_orange"
android:textColor="#FFFFFF" android:textColor="#FFFFFF"
android:textStyle="bold" android:textStyle="bold"
android:layout_width="140dip" android:layout_width="150dip"
android:layout_height="90dip" android:layout_height="90dip"
android:drawableLeft="@drawable/settings"/> android:drawableLeft="@drawable/settings"/>
</TableRow> </TableRow>

View file

@ -0,0 +1,88 @@
<?xml version="1.0" encoding="utf-8"?>
<resources>
<string name="osm_settings_descr">Упраление слоем open street bugs, установка osm логина </string>
<string name="monitor_preferences_descr">Включение мониторинга, установка интервала сохранения</string>
<string name="search_settings_descr">Настройка параметров поиска</string>
<string name="map_preferences_descr">Настройка источника, параметров карты, доступа в Интернет</string>
<string name="search_settings">Поиск</string>
<string name="osm_settings">Osm</string>
<string name="auto_zoom_map_descr">Автоматически измемять масштаб карты при изменении скорости</string>
<string name="auto_zoom_map">Масштаб</string>
<string name="additional_settings">Дополнительные настройки</string>
<string name="settings_preset_descr">Выбор режима работы приложения</string>
<string name="settings_preset">Режим работы</string>
<string name="settings">Настройки</string>
<string name="save_current_track_descr">Сохранить текущий путь на SD</string>
<string name="save_current_track">Сохранить путь</string>
<string name="save_track_interval_descr">Указать интервал между сохранениями пути</string>
<string name="save_track_interval">Интервал сохранения</string>
<string name="monitor_preferences">Мониторинг</string>
<string name="save_track_to_gpx_descrp">Сохранять путь в gpx формате в папку track</string>
<string name="save_track_to_gpx">Мониторить</string>
<string name="navigate_to">Перейти к</string>
<string name="update_tile">Обновить карту</string>
<string name="reload_tile">Обновить часть карты</string>
<string name="user_name_descr">Указать имя пользователя для работы с OSM</string>
<string name="user_name">Имя пользователя</string>
<string name="mark_point">Цель</string>
<string name="show_osm_bugs_descr">Показывать слой Open Street Bugs</string>
<string name="show_osm_bugs">Open Street Bugs</string>
<string name="favourites_activity">Список избранных точек</string>
<string name="add_to_favourite">Добавить к избранным</string>
<string name="use_english_names_descr">Использовать местные или английские названия</string>
<string name="use_english_names">Английские названия</string>
<string name="app_settings">Настройки приложения</string>
<string name="search_address">Искать адрес</string>
<string name="choose_building">Выберите здание</string>
<string name="choose_street">Выберите улицу</string>
<string name="choose_city">Выберите город</string>
<string name="ChooseCountry">Выберите страну</string>
<string name="position_on_map_descr">Установить расположение текущей позиции на карте</string>
<string name="position_on_map">Текущая позиция</string>
<string name="map_specify_point">Перейти к точке</string>
<string name="show_view_angle_descr">Показывать угол обзора в соответствии с компасом</string>
<string name="show_view_angle">Угол обзора</string>
<string name="stop_navigation">Снять отметку</string>
<string name="navigate_to_point">Отметить точку</string>
<string name="map_view_3d_descr">Вклюсить 3D вид для карты</string>
<string name="map_view_3d">3D вид</string>
<string name="rotate_map_to_bearing_descr">Вращать карту при изменении направления движения</string>
<string name="rotate_map_to_bearing">Вращать карту</string>
<string name="show_poi_over_map_description">Показывать слой POI</string>
<string name="show_poi_over_map">POI</string>
<string name="map_tile_source_descr">Загружать недостающие части карты из:</string>
<string name="map_tile_source">Источник данных</string>
<string name="map_source">Источник карты</string>
<string name="use_internet">Интернет</string>
<string name="show_location">Показать место</string>
<string name="map_preferences">Карта</string>
<string name="settings_activity">Настройки</string>
<string name="show_gps_coordinates_text">Показать gps координаты на карте</string>
<string name="use_internet_to_download_tile">Использовать Интернет для загрузки недостающих частей карты</string>
<string name="hello">Hello World, StartActivity!</string>
<string name="app_name">OsmAnd</string>
<string name="exit_Button">Выход</string>
<string name="map_Button">Карта</string>
<string name="settings_Button">Настройки</string>
<string name="favorites_Button">Избранное</string>
<string name="search_button">Поиск</string>
<color name="menu_background">#FF9030</color>
<string name="search_activity">Поиск</string>
<color name="color_white">#FFFFFF</color>
<color name="color_red">#FF0000</color>
<string name="searchpoi_activity">Choose poi</string>
<string name="search_POI_level_btn">Find more</string>
<string name="incremental_search_city">Search city incrementally. In order to find villages input more than 3 first symbols.</string>
<string name="incremental_search_street">Search street incrementally</string>
<string name="incremental_search_building">Search building incrementally</string>
<string name="choose_available_region">Choose region</string>
<string name="choose_intersected_street">Choose intersected street</string>
<string name="Closest_Amenities">Closest amenities</string>
<string name="app_mode_default">По умолчанию</string>
<string name="app_mode_car">Автомобиль</string>
<string name="app_mode_bicycle">Велосипед</string>
<string name="app_mode_pedestrian">Пешеход</string>
<string name="position_on_map_center">В центре</string>
<string name="position_on_map_bottom">Внизу</string>
</resources>

View file

@ -79,4 +79,10 @@
<string name="choose_available_region">Choose region</string> <string name="choose_available_region">Choose region</string>
<string name="choose_intersected_street">Choose intersected street</string> <string name="choose_intersected_street">Choose intersected street</string>
<string name="Closest_Amenities">Closest amenities</string> <string name="Closest_Amenities">Closest amenities</string>
<string name="app_mode_default">Default</string>
<string name="app_mode_car">Car</string>
<string name="app_mode_bicycle">Bicycle</string>
<string name="app_mode_pedestrian">Pedestrian</string>
<string name="position_on_map_center">Center</string>
<string name="position_on_map_bottom">Bottom</string>
</resources> </resources>

View file

@ -7,11 +7,11 @@
<PreferenceScreen android:title="@string/map_preferences" android:summary="@string/map_preferences_descr"> <PreferenceScreen android:title="@string/map_preferences" android:summary="@string/map_preferences_descr">
<CheckBoxPreference android:key="use_internet_to_download_tiles" android:title="@string/use_internet" android:summary="@string/use_internet_to_download_tile"></CheckBoxPreference> <CheckBoxPreference android:key="use_internet_to_download_tiles" android:title="@string/use_internet" android:summary="@string/use_internet_to_download_tile"></CheckBoxPreference>
<CheckBoxPreference android:key="show_poi_over_map" android:title="@string/show_poi_over_map" android:summary="@string/show_poi_over_map_description"></CheckBoxPreference>
<ListPreference android:title="@string/map_tile_source" android:summary="@string/map_tile_source_descr" android:key="map_tile_sources"></ListPreference> <ListPreference android:title="@string/map_tile_source" android:summary="@string/map_tile_source_descr" android:key="map_tile_sources"></ListPreference>
<CheckBoxPreference android:key="show_poi_over_map" android:title="@string/show_poi_over_map" android:summary="@string/show_poi_over_map_description"></CheckBoxPreference>
<CheckBoxPreference android:title="@string/auto_zoom_map" android:summary="@string/auto_zoom_map_descr" android:key="auto_zoom_map"></CheckBoxPreference> <CheckBoxPreference android:title="@string/auto_zoom_map" android:summary="@string/auto_zoom_map_descr" android:key="auto_zoom_map"></CheckBoxPreference>
<CheckBoxPreference android:key="rotate_map_to_bearing" android:title="@string/rotate_map_to_bearing" android:summary="@string/rotate_map_to_bearing_descr"></CheckBoxPreference>
<CheckBoxPreference android:key="show_view_angle" android:title="@string/show_view_angle" android:summary="@string/show_view_angle_descr"></CheckBoxPreference> <CheckBoxPreference android:key="show_view_angle" android:title="@string/show_view_angle" android:summary="@string/show_view_angle_descr"></CheckBoxPreference>
<CheckBoxPreference android:key="rotate_map_to_bearing" android:title="@string/rotate_map_to_bearing" android:summary="@string/rotate_map_to_bearing_descr"></CheckBoxPreference>
<ListPreference android:key="position_on_map" android:title="@string/position_on_map" android:summary="@string/position_on_map_descr"></ListPreference> <ListPreference android:key="position_on_map" android:title="@string/position_on_map" android:summary="@string/position_on_map_descr"></ListPreference>
</PreferenceScreen> </PreferenceScreen>

View file

@ -14,19 +14,24 @@ import com.osmand.osm.LatLon;
public class OsmandSettings { public class OsmandSettings {
public enum ApplicationMode { public enum ApplicationMode {
DEFAULT("Default"), /*
CAR("Car"), * DEFAULT("Default"), CAR("Car"), BICYCLE("Bicycle"), PEDESTRIAN("Pedestrian");
BICYCLE("Bicycle"), */
PEDESTRIAN("Pedestrian");
private final String name; DEFAULT(R.string.app_mode_default),
ApplicationMode(String name){ CAR(R.string.app_mode_car),
this.name = name; BICYCLE(R.string.app_mode_bicycle),
PEDESTRIAN(R.string.app_mode_pedestrian);
private final int key;
ApplicationMode(int key) {
this.key = key;
} }
@Override public static String toHumanString(ApplicationMode m, Context ctx){
public String toString() { return ctx.getResources().getString(m.key);
return name;
} }
} }
// These settings are stored in SharedPreferences // These settings are stored in SharedPreferences
@ -37,32 +42,36 @@ public class OsmandSettings {
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
public static final String USE_INTERNET_TO_DOWNLOAD_TILES = "use_internet_to_download_tiles"; public static final String USE_INTERNET_TO_DOWNLOAD_TILES = "use_internet_to_download_tiles";
public static boolean isUsingInternetToDownloadTiles(Context ctx){
public static boolean isUsingInternetToDownloadTiles(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.getBoolean(USE_INTERNET_TO_DOWNLOAD_TILES, true); return prefs.getBoolean(USE_INTERNET_TO_DOWNLOAD_TILES, true);
} }
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
public static final String SHOW_POI_OVER_MAP = "show_poi_over_map"; public static final String SHOW_POI_OVER_MAP = "show_poi_over_map";
public static boolean isShowingPoiOverMap(Context ctx){
public static boolean isShowingPoiOverMap(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.getBoolean(SHOW_POI_OVER_MAP, false); return prefs.getBoolean(SHOW_POI_OVER_MAP, false);
} }
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
public static final String USER_NAME = "user_name"; public static final String USER_NAME = "user_name";
public static String getUserName(Context ctx){
public static String getUserName(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.getString(USER_NAME, "NoName"); return prefs.getString(USER_NAME, "NoName");
} }
public static boolean setUserName(Context ctx, String name){ public static boolean setUserName(Context ctx, String name) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.edit().putString(USER_NAME, name).commit(); return prefs.edit().putString(USER_NAME, name).commit();
} }
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
public static final String APPLICATION_MODE = "application_mode"; public static final String APPLICATION_MODE = "application_mode";
public static ApplicationMode getApplicationMode(Context ctx) { public static ApplicationMode getApplicationMode(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
String s = prefs.getString(APPLICATION_MODE, ApplicationMode.DEFAULT.name()); String s = prefs.getString(APPLICATION_MODE, ApplicationMode.DEFAULT.name());
@ -73,7 +82,7 @@ public class OsmandSettings {
} }
} }
public static boolean setApplicationMode(Context ctx, ApplicationMode p){ public static boolean setApplicationMode(Context ctx, ApplicationMode p) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.edit().putString(APPLICATION_MODE, p.name()).commit(); return prefs.edit().putString(APPLICATION_MODE, p.name()).commit();
} }
@ -83,83 +92,91 @@ public class OsmandSettings {
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
public static final String SAVE_TRACK_TO_GPX = "save_track_to_gpx"; public static final String SAVE_TRACK_TO_GPX = "save_track_to_gpx";
public static boolean isSavingTrackToGpx(Context ctx){
public static boolean isSavingTrackToGpx(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.getBoolean(SAVE_TRACK_TO_GPX, false); return prefs.getBoolean(SAVE_TRACK_TO_GPX, false);
} }
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
public static final String SAVE_TRACK_INTERVAL = "save_track_interval"; public static final String SAVE_TRACK_INTERVAL = "save_track_interval";
public static int getSavingTrackInterval(Context ctx){
public static int getSavingTrackInterval(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.getInt(SAVE_TRACK_INTERVAL, 5); return prefs.getInt(SAVE_TRACK_INTERVAL, 5);
} }
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
public static final String SHOW_OSM_BUGS = "show_osm_bugs"; public static final String SHOW_OSM_BUGS = "show_osm_bugs";
public static boolean isShowingOsmBugs(Context ctx){
public static boolean isShowingOsmBugs(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.getBoolean(SHOW_OSM_BUGS, false); return prefs.getBoolean(SHOW_OSM_BUGS, false);
} }
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
public static final String SHOW_VIEW_ANGLE = "show_view_angle"; public static final String SHOW_VIEW_ANGLE = "show_view_angle";
public static boolean isShowingViewAngle(Context ctx){
public static boolean isShowingViewAngle(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.getBoolean(SHOW_VIEW_ANGLE, true); return prefs.getBoolean(SHOW_VIEW_ANGLE, true);
} }
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
public static final String AUTO_ZOOM_MAP = "auto_zoom_map"; public static final String AUTO_ZOOM_MAP = "auto_zoom_map";
public static boolean isAutoZoomEnabled(Context ctx){
public static boolean isAutoZoomEnabled(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.getBoolean(AUTO_ZOOM_MAP, false); return prefs.getBoolean(AUTO_ZOOM_MAP, false);
} }
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
public static final String ROTATE_MAP_TO_BEARING = "rotate_map_to_bearing"; public static final String ROTATE_MAP_TO_BEARING = "rotate_map_to_bearing";
public static boolean isRotateMapToBearing(Context ctx){
public static boolean isRotateMapToBearing(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.getBoolean(ROTATE_MAP_TO_BEARING, false); return prefs.getBoolean(ROTATE_MAP_TO_BEARING, false);
} }
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
public static final String POSITION_ON_MAP = "position_on_map"; public static final String POSITION_ON_MAP = "position_on_map";
public static int getPositionOnMap(Context ctx){
public static int getPositionOnMap(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.getInt(POSITION_ON_MAP, CENTER_CONSTANT); return prefs.getInt(POSITION_ON_MAP, CENTER_CONSTANT);
} }
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
public static final String MAP_VIEW_3D = "map_view_3d"; public static final String MAP_VIEW_3D = "map_view_3d";
public static boolean isMapView3D(Context ctx){
public static boolean isMapView3D(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.getBoolean(MAP_VIEW_3D, false); return prefs.getBoolean(MAP_VIEW_3D, false);
} }
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
public static final String USE_ENGLISH_NAMES = "use_english_names"; public static final String USE_ENGLISH_NAMES = "use_english_names";
public static boolean usingEnglishNames(Context ctx){
public static boolean usingEnglishNames(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.getBoolean(USE_ENGLISH_NAMES, false); return prefs.getBoolean(USE_ENGLISH_NAMES, false);
} }
public static boolean setUseEnglishNames(Context ctx, boolean useEnglishNames){ public static boolean setUseEnglishNames(Context ctx, boolean useEnglishNames) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.edit().putBoolean(USE_ENGLISH_NAMES, useEnglishNames).commit(); return prefs.edit().putBoolean(USE_ENGLISH_NAMES, useEnglishNames).commit();
} }
// this value string is synchronized with settings_pref.xml preference name // this value string is synchronized with settings_pref.xml preference name
public static final String MAP_TILE_SOURCES = "map_tile_sources"; public static final String MAP_TILE_SOURCES = "map_tile_sources";
public static ITileSource getMapTileSource(Context ctx){
public static ITileSource getMapTileSource(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
String tileName = prefs.getString(MAP_TILE_SOURCES, null); String tileName = prefs.getString(MAP_TILE_SOURCES, null);
if(tileName != null){ if (tileName != null) {
List<TileSourceTemplate> list = TileSourceManager.getKnownSourceTemplates(); List<TileSourceTemplate> list = TileSourceManager.getKnownSourceTemplates();
for(TileSourceTemplate l : list){ for (TileSourceTemplate l : list) {
if(l.getName().equals(tileName)){ if (l.getName().equals(tileName)) {
return l; return l;
} }
} }
@ -167,10 +184,10 @@ public class OsmandSettings {
return TileSourceManager.getMapnikSource(); return TileSourceManager.getMapnikSource();
} }
public static String getMapTileSourceName(Context ctx){ public static String getMapTileSourceName(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
String tileName = prefs.getString(MAP_TILE_SOURCES, null); String tileName = prefs.getString(MAP_TILE_SOURCES, null);
if(tileName != null){ if (tileName != null) {
return tileName; return tileName;
} }
return TileSourceManager.getMapnikSource().getName(); return TileSourceManager.getMapnikSource().getName();
@ -181,14 +198,15 @@ public class OsmandSettings {
public static final String LAST_KNOWN_MAP_LON = "last_known_map_lon"; public static final String LAST_KNOWN_MAP_LON = "last_known_map_lon";
public static final String IS_MAP_SYNC_TO_GPS_LOCATION = "is_map_sync_to_gps_location"; public static final String IS_MAP_SYNC_TO_GPS_LOCATION = "is_map_sync_to_gps_location";
public static final String LAST_KNOWN_MAP_ZOOM = "last_known_map_zoom"; public static final String LAST_KNOWN_MAP_ZOOM = "last_known_map_zoom";
public static LatLon getLastKnownMapLocation(Context ctx){
public static LatLon getLastKnownMapLocation(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
float lat = prefs.getFloat(LAST_KNOWN_MAP_LAT, 0); float lat = prefs.getFloat(LAST_KNOWN_MAP_LAT, 0);
float lon = prefs.getFloat(LAST_KNOWN_MAP_LON, 0); float lon = prefs.getFloat(LAST_KNOWN_MAP_LON, 0);
return new LatLon(lat, lon); return new LatLon(lat, lon);
} }
public static void setMapLocationToShow(Context ctx, double latitude, double longitude){ public static void setMapLocationToShow(Context ctx, double latitude, double longitude) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
Editor edit = prefs.edit(); Editor edit = prefs.edit();
edit.putFloat(LAST_KNOWN_MAP_LAT, (float) latitude); edit.putFloat(LAST_KNOWN_MAP_LAT, (float) latitude);
@ -198,7 +216,7 @@ public class OsmandSettings {
} }
// Do not use that method if you want to show point on map. Use setMapLocationToShow // Do not use that method if you want to show point on map. Use setMapLocationToShow
public static void setLastKnownMapLocation(Context ctx, double latitude, double longitude){ public static void setLastKnownMapLocation(Context ctx, double latitude, double longitude) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
Editor edit = prefs.edit(); Editor edit = prefs.edit();
edit.putFloat(LAST_KNOWN_MAP_LAT, (float) latitude); edit.putFloat(LAST_KNOWN_MAP_LAT, (float) latitude);
@ -206,47 +224,47 @@ public class OsmandSettings {
edit.commit(); edit.commit();
} }
public static boolean setSyncMapToGpsLocation(Context ctx, boolean value){ public static boolean setSyncMapToGpsLocation(Context ctx, boolean value) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.edit().putBoolean(IS_MAP_SYNC_TO_GPS_LOCATION, value).commit(); return prefs.edit().putBoolean(IS_MAP_SYNC_TO_GPS_LOCATION, value).commit();
} }
public static boolean isMapSyncToGpsLocation(Context ctx){
public static boolean isMapSyncToGpsLocation(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.getBoolean(IS_MAP_SYNC_TO_GPS_LOCATION, true); return prefs.getBoolean(IS_MAP_SYNC_TO_GPS_LOCATION, true);
} }
public static int getLastKnownMapZoom(Context ctx){ public static int getLastKnownMapZoom(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.getInt(LAST_KNOWN_MAP_ZOOM, 3); return prefs.getInt(LAST_KNOWN_MAP_ZOOM, 3);
} }
public static void setLastKnownMapZoom(Context ctx, int zoom){ public static void setLastKnownMapZoom(Context ctx, int zoom) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
Editor edit = prefs.edit(); Editor edit = prefs.edit();
edit.putInt(LAST_KNOWN_MAP_ZOOM, zoom); edit.putInt(LAST_KNOWN_MAP_ZOOM, zoom);
edit.commit(); edit.commit();
} }
public final static String POINT_NAVIGATE_LAT = "point_navigate_lat"; public final static String POINT_NAVIGATE_LAT = "point_navigate_lat";
public final static String POINT_NAVIGATE_LON = "point_navigate_lon"; public final static String POINT_NAVIGATE_LON = "point_navigate_lon";
public static LatLon getPointToNavigate(Context ctx){ public static LatLon getPointToNavigate(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
float lat = prefs.getFloat(POINT_NAVIGATE_LAT, 0); float lat = prefs.getFloat(POINT_NAVIGATE_LAT, 0);
float lon = prefs.getFloat(POINT_NAVIGATE_LON, 0); float lon = prefs.getFloat(POINT_NAVIGATE_LON, 0);
if(lat == 0 && lon == 0){ if (lat == 0 && lon == 0) {
return null; return null;
} }
return new LatLon(lat, lon); return new LatLon(lat, lon);
} }
public static boolean clearPointToNavigate(Context ctx){ public static boolean clearPointToNavigate(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.edit().remove(POINT_NAVIGATE_LAT).remove(POINT_NAVIGATE_LON).commit(); return prefs.edit().remove(POINT_NAVIGATE_LAT).remove(POINT_NAVIGATE_LON).commit();
} }
public static boolean setPointToNavigate(Context ctx, double latitude, double longitude){ public static boolean setPointToNavigate(Context ctx, double latitude, double longitude) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.edit().putFloat(POINT_NAVIGATE_LAT, (float) latitude).putFloat(POINT_NAVIGATE_LON, (float) longitude).commit(); return prefs.edit().putFloat(POINT_NAVIGATE_LAT, (float) latitude).putFloat(POINT_NAVIGATE_LON, (float) longitude).commit();
} }
@ -257,90 +275,90 @@ public class OsmandSettings {
public static final String LAST_SEARCHED_BUILDING = "last_searched_building"; public static final String LAST_SEARCHED_BUILDING = "last_searched_building";
public static final String LAST_SEARCHED_INTERSECTED_STREET = "last_searched_intersected_street"; public static final String LAST_SEARCHED_INTERSECTED_STREET = "last_searched_intersected_street";
public static String getLastSearchedRegion(Context ctx){ public static String getLastSearchedRegion(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.getString(LAST_SEARCHED_REGION, ""); return prefs.getString(LAST_SEARCHED_REGION, "");
} }
public static boolean setLastSearchedRegion(Context ctx, String region) { public static boolean setLastSearchedRegion(Context ctx, String region) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
Editor edit = prefs.edit().putString(LAST_SEARCHED_REGION, region).putLong(LAST_SEARCHED_CITY, -1). Editor edit = prefs.edit().putString(LAST_SEARCHED_REGION, region).putLong(LAST_SEARCHED_CITY, -1).putString(LAST_SEARCHED_STREET,
putString(LAST_SEARCHED_STREET,"").putString(LAST_SEARCHED_BUILDING, ""); "").putString(LAST_SEARCHED_BUILDING, "");
if (prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)) { if (prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)) {
edit.putString(LAST_SEARCHED_INTERSECTED_STREET, ""); edit.putString(LAST_SEARCHED_INTERSECTED_STREET, "");
} }
return edit.commit(); return edit.commit();
} }
public static Long getLastSearchedCity(Context ctx){ public static Long getLastSearchedCity(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.getLong(LAST_SEARCHED_CITY, -1); return prefs.getLong(LAST_SEARCHED_CITY, -1);
} }
public static boolean setLastSearchedCity(Context ctx, Long cityId){ public static boolean setLastSearchedCity(Context ctx, Long cityId) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
Editor edit = prefs.edit().putLong(LAST_SEARCHED_CITY, cityId).putString(LAST_SEARCHED_STREET, ""). Editor edit = prefs.edit().putLong(LAST_SEARCHED_CITY, cityId).putString(LAST_SEARCHED_STREET, "").putString(
putString(LAST_SEARCHED_BUILDING, ""); LAST_SEARCHED_BUILDING, "");
if(prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)){ if (prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)) {
edit.putString(LAST_SEARCHED_INTERSECTED_STREET, ""); edit.putString(LAST_SEARCHED_INTERSECTED_STREET, "");
} }
return edit.commit(); return edit.commit();
} }
public static String getLastSearchedStreet(Context ctx){ public static String getLastSearchedStreet(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.getString(LAST_SEARCHED_STREET, ""); return prefs.getString(LAST_SEARCHED_STREET, "");
} }
public static boolean setLastSearchedStreet(Context ctx, String street){ public static boolean setLastSearchedStreet(Context ctx, String street) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
Editor edit = prefs.edit().putString(LAST_SEARCHED_STREET, street).putString(LAST_SEARCHED_BUILDING, ""); Editor edit = prefs.edit().putString(LAST_SEARCHED_STREET, street).putString(LAST_SEARCHED_BUILDING, "");
if(prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)){ if (prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)) {
edit.putString(LAST_SEARCHED_INTERSECTED_STREET, ""); edit.putString(LAST_SEARCHED_INTERSECTED_STREET, "");
} }
return edit.commit(); return edit.commit();
} }
public static String getLastSearchedBuilding(Context ctx){ public static String getLastSearchedBuilding(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.getString(LAST_SEARCHED_BUILDING, ""); return prefs.getString(LAST_SEARCHED_BUILDING, "");
} }
public static boolean setLastSearchedBuilding(Context ctx, String building){ public static boolean setLastSearchedBuilding(Context ctx, String building) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.edit().putString(LAST_SEARCHED_BUILDING, building).remove(LAST_SEARCHED_INTERSECTED_STREET).commit(); return prefs.edit().putString(LAST_SEARCHED_BUILDING, building).remove(LAST_SEARCHED_INTERSECTED_STREET).commit();
} }
public static String getLastSearchedIntersectedStreet(Context ctx) {
public static String getLastSearchedIntersectedStreet(Context ctx){
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
if(!prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)){ if (!prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)) {
return null; return null;
} }
return prefs.getString(LAST_SEARCHED_INTERSECTED_STREET, ""); return prefs.getString(LAST_SEARCHED_INTERSECTED_STREET, "");
} }
public static boolean setLastSearchedIntersectedStreet(Context ctx, String street){ public static boolean setLastSearchedIntersectedStreet(Context ctx, String street) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.edit().putString(LAST_SEARCHED_INTERSECTED_STREET, street).commit(); return prefs.edit().putString(LAST_SEARCHED_INTERSECTED_STREET, street).commit();
} }
public static boolean removeLastSearchedIntersectedStreet(Context ctx){ public static boolean removeLastSearchedIntersectedStreet(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.edit().remove(LAST_SEARCHED_INTERSECTED_STREET).commit(); return prefs.edit().remove(LAST_SEARCHED_INTERSECTED_STREET).commit();
} }
public static final String SELECTED_POI_FILTER_FOR_MAP = "selected_poi_filter_for_map"; public static final String SELECTED_POI_FILTER_FOR_MAP = "selected_poi_filter_for_map";
public static boolean setPoiFilterForMap(Context ctx, String filterId){
public static boolean setPoiFilterForMap(Context ctx, String filterId) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
return prefs.edit().putString(SELECTED_POI_FILTER_FOR_MAP, filterId).commit(); return prefs.edit().putString(SELECTED_POI_FILTER_FOR_MAP, filterId).commit();
} }
public static PoiFilter getPoiFilterForMap(Context ctx){ public static PoiFilter getPoiFilterForMap(Context ctx) {
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
String filterId = prefs.getString(SELECTED_POI_FILTER_FOR_MAP, null); String filterId = prefs.getString(SELECTED_POI_FILTER_FOR_MAP, null);
PoiFilter filter = PoiFiltersHelper.getFilterById(ctx, filterId); PoiFilter filter = PoiFiltersHelper.getFilterById(ctx, filterId);
if(filter != null){ if (filter != null) {
return filter; return filter;
} }
return new PoiFilter(null); return new PoiFilter(null);

View file

@ -5,6 +5,7 @@ import java.util.List;
import android.content.Context; import android.content.Context;
import android.content.SharedPreferences; import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor; import android.content.SharedPreferences.Editor;
import android.content.res.Resources;
import android.os.Bundle; import android.os.Bundle;
import android.preference.CheckBoxPreference; import android.preference.CheckBoxPreference;
import android.preference.EditTextPreference; import android.preference.EditTextPreference;
@ -76,7 +77,6 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
tileSourcePreference =(ListPreference) screen.findPreference(OsmandSettings.MAP_TILE_SOURCES); tileSourcePreference =(ListPreference) screen.findPreference(OsmandSettings.MAP_TILE_SOURCES);
tileSourcePreference.setOnPreferenceChangeListener(this); tileSourcePreference.setOnPreferenceChangeListener(this);
} }
@Override @Override
@ -94,7 +94,9 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
saveTrackToGpx.setChecked(OsmandSettings.isSavingTrackToGpx(this)); saveTrackToGpx.setChecked(OsmandSettings.isSavingTrackToGpx(this));
useEnglishNames.setChecked(OsmandSettings.usingEnglishNames(this)); useEnglishNames.setChecked(OsmandSettings.usingEnglishNames(this));
autoZoom.setChecked(OsmandSettings.isAutoZoomEnabled(this)); autoZoom.setChecked(OsmandSettings.isAutoZoomEnabled(this));
String[] e = new String[] { "Center", "Bottom" }; Resources resources = this.getResources();
String[] e = new String[] {resources.getString(R.string.position_on_map_center),
resources.getString(R.string.position_on_map_bottom)};
positionOnMap.setEntryValues(e); positionOnMap.setEntryValues(e);
positionOnMap.setEntries(e); positionOnMap.setEntries(e);
positionOnMap.setValueIndex(OsmandSettings.getPositionOnMap(this)); positionOnMap.setValueIndex(OsmandSettings.getPositionOnMap(this));
@ -108,7 +110,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
String[] values = new String[presets.length]; String[] values = new String[presets.length];
String[] valueEntries = new String[presets.length]; String[] valueEntries = new String[presets.length];
for(int i=0; i<presets.length; i++){ for(int i=0; i<presets.length; i++){
values[i] = presets[i].toString(); values[i] = ApplicationMode.toHumanString(presets[i], this);
valueEntries[i] = presets[i].name(); valueEntries[i] = presets[i].name();
} }
applicationMode.setEntries(values); applicationMode.setEntries(values);