Fix issue 77
git-svn-id: https://osmand.googlecode.com/svn/trunk@565 e29c36b1-1cfa-d876-8d93-3434fc2bb7b8
This commit is contained in:
parent
565e6659b3
commit
8927b9f41e
29 changed files with 226 additions and 235 deletions
|
@ -12,6 +12,7 @@ import android.content.BroadcastReceiver;
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
import android.content.IntentFilter;
|
import android.content.IntentFilter;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.location.Location;
|
import android.location.Location;
|
||||||
import android.location.LocationListener;
|
import android.location.LocationListener;
|
||||||
import android.location.LocationManager;
|
import android.location.LocationManager;
|
||||||
|
@ -36,6 +37,7 @@ public class NavigationService extends Service implements LocationListener {
|
||||||
private int serviceError;
|
private int serviceError;
|
||||||
private RoutingHelper routingHelper;
|
private RoutingHelper routingHelper;
|
||||||
private Notification notification;
|
private Notification notification;
|
||||||
|
private SharedPreferences settings;
|
||||||
|
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
@ -70,10 +72,10 @@ public class NavigationService extends Service implements LocationListener {
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
setForeground(true);
|
setForeground(true);
|
||||||
handler = new Handler();
|
handler = new Handler();
|
||||||
|
settings = OsmandSettings.getSharedPreferences(this);
|
||||||
serviceOffInterval = OsmandSettings.getServiceOffInterval(this);
|
serviceOffInterval = OsmandSettings.getServiceOffInterval(settings);
|
||||||
serviceOffProvider = OsmandSettings.getServiceOffProvider(this);
|
serviceOffProvider = OsmandSettings.getServiceOffProvider(settings);
|
||||||
serviceError = OsmandSettings.getServiceOffWaitInterval(this);
|
serviceError = OsmandSettings.getServiceOffWaitInterval(settings);
|
||||||
savingTrackHelper = new SavingTrackHelper(this);
|
savingTrackHelper = new SavingTrackHelper(this);
|
||||||
delayedAction(true, 500);
|
delayedAction(true, 500);
|
||||||
routingHelper = ((OsmandApplication)getApplication()).getRoutingHelper();
|
routingHelper = ((OsmandApplication)getApplication()).getRoutingHelper();
|
||||||
|
@ -114,9 +116,9 @@ public class NavigationService extends Service implements LocationListener {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onLocationChanged(Location location) {
|
public void onLocationChanged(Location location) {
|
||||||
if(location != null && !OsmandSettings.getMapActivityEnabled(this)){
|
if(location != null && !OsmandSettings.getMapActivityEnabled(settings)){
|
||||||
savingTrackHelper.insertData(location.getLatitude(), location.getLongitude(), location.getAltitude(),
|
savingTrackHelper.insertData(location.getLatitude(), location.getLongitude(), location.getAltitude(),
|
||||||
location.getSpeed(), location.getTime());
|
location.getSpeed(), location.getTime(), settings);
|
||||||
if(routingHelper.isFollowingMode()){
|
if(routingHelper.isFollowingMode()){
|
||||||
routingHelper.setCurrentLocation(location);
|
routingHelper.setCurrentLocation(location);
|
||||||
}
|
}
|
||||||
|
|
|
@ -59,6 +59,14 @@ public class OsmandSettings {
|
||||||
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();
|
return prefs.edit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static final SharedPreferences getSharedPreferences(Context ctx){
|
||||||
|
return ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
|
}
|
||||||
|
|
||||||
|
public static final SharedPreferences getPrefs(Context ctx){
|
||||||
|
return ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
||||||
|
}
|
||||||
|
|
||||||
// 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"; //$NON-NLS-1$
|
public static final String USE_INTERNET_TO_DOWNLOAD_TILES = "use_internet_to_download_tiles"; //$NON-NLS-1$
|
||||||
|
@ -67,9 +75,8 @@ public class OsmandSettings {
|
||||||
private static long lastTimeInternetConnectionChecked = 0;
|
private static long lastTimeInternetConnectionChecked = 0;
|
||||||
private static boolean internetConnectionAvailable = true;
|
private static boolean internetConnectionAvailable = true;
|
||||||
|
|
||||||
public static boolean isUsingInternetToDownloadTiles(Context ctx) {
|
public static boolean isUsingInternetToDownloadTiles(SharedPreferences prefs) {
|
||||||
if(CACHE_USE_INTERNET_TO_DOWNLOAD_TILES == null){
|
if(CACHE_USE_INTERNET_TO_DOWNLOAD_TILES == null){
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
CACHE_USE_INTERNET_TO_DOWNLOAD_TILES = prefs.getBoolean(USE_INTERNET_TO_DOWNLOAD_TILES, USE_INTERNET_TO_DOWNLOAD_TILES_DEF);
|
CACHE_USE_INTERNET_TO_DOWNLOAD_TILES = prefs.getBoolean(USE_INTERNET_TO_DOWNLOAD_TILES, USE_INTERNET_TO_DOWNLOAD_TILES_DEF);
|
||||||
}
|
}
|
||||||
return CACHE_USE_INTERNET_TO_DOWNLOAD_TILES;
|
return CACHE_USE_INTERNET_TO_DOWNLOAD_TILES;
|
||||||
|
@ -101,8 +108,7 @@ public class OsmandSettings {
|
||||||
public static final String USE_TRACKBALL_FOR_MOVEMENTS = "use_trackball_for_movements"; //$NON-NLS-1$
|
public static final String USE_TRACKBALL_FOR_MOVEMENTS = "use_trackball_for_movements"; //$NON-NLS-1$
|
||||||
public static final boolean USE_TRACKBALL_FOR_MOVEMENTS_DEF = true;
|
public static final boolean USE_TRACKBALL_FOR_MOVEMENTS_DEF = true;
|
||||||
|
|
||||||
public static boolean isUsingTrackBall(Context ctx) {
|
public static boolean isUsingTrackBall(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getBoolean(USE_TRACKBALL_FOR_MOVEMENTS, USE_TRACKBALL_FOR_MOVEMENTS_DEF);
|
return prefs.getBoolean(USE_TRACKBALL_FOR_MOVEMENTS, USE_TRACKBALL_FOR_MOVEMENTS_DEF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -111,8 +117,7 @@ public class OsmandSettings {
|
||||||
public static final String SHOW_POI_OVER_MAP = "show_poi_over_map"; //$NON-NLS-1$
|
public static final String SHOW_POI_OVER_MAP = "show_poi_over_map"; //$NON-NLS-1$
|
||||||
public static final Boolean SHOW_POI_OVER_MAP_DEF = false;
|
public static final Boolean SHOW_POI_OVER_MAP_DEF = false;
|
||||||
|
|
||||||
public static boolean isShowingPoiOverMap(Context ctx) {
|
public static boolean isShowingPoiOverMap(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getBoolean(SHOW_POI_OVER_MAP, SHOW_POI_OVER_MAP_DEF);
|
return prefs.getBoolean(SHOW_POI_OVER_MAP, SHOW_POI_OVER_MAP_DEF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -125,8 +130,7 @@ public class OsmandSettings {
|
||||||
public static final String SHOW_TRANSPORT_OVER_MAP = "show_transport_over_map"; //$NON-NLS-1$
|
public static final String SHOW_TRANSPORT_OVER_MAP = "show_transport_over_map"; //$NON-NLS-1$
|
||||||
public static final boolean SHOW_TRANSPORT_OVER_MAP_DEF = false;
|
public static final boolean SHOW_TRANSPORT_OVER_MAP_DEF = false;
|
||||||
|
|
||||||
public static boolean isShowingTransportOverMap(Context ctx) {
|
public static boolean isShowingTransportOverMap(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getBoolean(SHOW_TRANSPORT_OVER_MAP, SHOW_TRANSPORT_OVER_MAP_DEF);
|
return prefs.getBoolean(SHOW_TRANSPORT_OVER_MAP, SHOW_TRANSPORT_OVER_MAP_DEF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -138,8 +142,7 @@ 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 USER_NAME = "user_name"; //$NON-NLS-1$
|
public static final String USER_NAME = "user_name"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static String getUserName(Context ctx) {
|
public static String getUserName(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getString(USER_NAME, "NoName"); //$NON-NLS-1$
|
return prefs.getString(USER_NAME, "NoName"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -152,8 +155,7 @@ 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 USER_OSM_BUG_NAME = "user_osm_bug_name"; //$NON-NLS-1$
|
public static final String USER_OSM_BUG_NAME = "user_osm_bug_name"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static String getUserNameForOsmBug(Context ctx) {
|
public static String getUserNameForOsmBug(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getString(USER_OSM_BUG_NAME, "NoName/Osmand"); //$NON-NLS-1$
|
return prefs.getString(USER_OSM_BUG_NAME, "NoName/Osmand"); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -163,8 +165,7 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String USER_PASSWORD = "user_password"; //$NON-NLS-1$
|
public static final String USER_PASSWORD = "user_password"; //$NON-NLS-1$
|
||||||
public static String getUserPassword(Context ctx){
|
public static String getUserPassword(SharedPreferences prefs){
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getString(USER_PASSWORD, ""); //$NON-NLS-1$
|
return prefs.getString(USER_PASSWORD, ""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -176,8 +177,7 @@ 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 APPLICATION_MODE = "application_mode"; //$NON-NLS-1$
|
public static final String APPLICATION_MODE = "application_mode"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static ApplicationMode getApplicationMode(Context ctx) {
|
public static ApplicationMode getApplicationMode(SharedPreferences prefs) {
|
||||||
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());
|
||||||
try {
|
try {
|
||||||
return ApplicationMode.valueOf(s);
|
return ApplicationMode.valueOf(s);
|
||||||
|
@ -194,8 +194,7 @@ 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 ROUTER_SERVICE = "router_service"; //$NON-NLS-1$
|
public static final String ROUTER_SERVICE = "router_service"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static RouteService getRouterService(Context ctx) {
|
public static RouteService getRouterService(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
int ord = prefs.getInt(ROUTER_SERVICE, RouteService.CLOUDMADE.ordinal());
|
int ord = prefs.getInt(ROUTER_SERVICE, RouteService.CLOUDMADE.ordinal());
|
||||||
if(ord < RouteService.values().length){
|
if(ord < RouteService.values().length){
|
||||||
return RouteService.values()[ord];
|
return RouteService.values()[ord];
|
||||||
|
@ -226,8 +225,7 @@ 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_INTERVAL = "save_track_interval"; //$NON-NLS-1$
|
public static final String SAVE_TRACK_INTERVAL = "save_track_interval"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static int getSavingTrackInterval(Context ctx) {
|
public static int getSavingTrackInterval(SharedPreferences prefs) {
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -235,8 +233,7 @@ public class OsmandSettings {
|
||||||
public static final String SHOW_OSM_BUGS = "show_osm_bugs"; //$NON-NLS-1$
|
public static final String SHOW_OSM_BUGS = "show_osm_bugs"; //$NON-NLS-1$
|
||||||
public static final boolean SHOW_OSM_BUGS_DEF = false;
|
public static final boolean SHOW_OSM_BUGS_DEF = false;
|
||||||
|
|
||||||
public static boolean isShowingOsmBugs(Context ctx) {
|
public static boolean isShowingOsmBugs(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getBoolean(SHOW_OSM_BUGS, SHOW_OSM_BUGS_DEF);
|
return prefs.getBoolean(SHOW_OSM_BUGS, SHOW_OSM_BUGS_DEF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -249,8 +246,7 @@ public class OsmandSettings {
|
||||||
public static final String SHOW_YANDEX_TRAFFIC = "show_yandex_traffic"; //$NON-NLS-1$
|
public static final String SHOW_YANDEX_TRAFFIC = "show_yandex_traffic"; //$NON-NLS-1$
|
||||||
public static final boolean SHOW_YANDEX_TRAFFIC_DEF = false;
|
public static final boolean SHOW_YANDEX_TRAFFIC_DEF = false;
|
||||||
|
|
||||||
public static boolean isShowingYandexTraffic(Context ctx) {
|
public static boolean isShowingYandexTraffic(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getBoolean(SHOW_YANDEX_TRAFFIC, SHOW_YANDEX_TRAFFIC_DEF);
|
return prefs.getBoolean(SHOW_YANDEX_TRAFFIC, SHOW_YANDEX_TRAFFIC_DEF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -263,8 +259,7 @@ public class OsmandSettings {
|
||||||
public static final String SHOW_FAVORITES = "show_favorites"; //$NON-NLS-1$
|
public static final String SHOW_FAVORITES = "show_favorites"; //$NON-NLS-1$
|
||||||
public static final boolean SHOW_FAVORITES_DEF = false;
|
public static final boolean SHOW_FAVORITES_DEF = false;
|
||||||
|
|
||||||
public static boolean isShowingFavorites(Context ctx) {
|
public static boolean isShowingFavorites(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getBoolean(SHOW_FAVORITES, SHOW_FAVORITES_DEF);
|
return prefs.getBoolean(SHOW_FAVORITES, SHOW_FAVORITES_DEF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -276,8 +271,7 @@ 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 MAP_SCREEN_ORIENTATION = "map_screen_orientation"; //$NON-NLS-1$
|
public static final String MAP_SCREEN_ORIENTATION = "map_screen_orientation"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static int getMapOrientation(Context ctx){
|
public static int getMapOrientation(SharedPreferences prefs){
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getInt(MAP_SCREEN_ORIENTATION, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
return prefs.getInt(MAP_SCREEN_ORIENTATION, ActivityInfo.SCREEN_ORIENTATION_PORTRAIT);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -285,8 +279,7 @@ public class OsmandSettings {
|
||||||
public static final String SHOW_VIEW_ANGLE = "show_view_angle"; //$NON-NLS-1$
|
public static final String SHOW_VIEW_ANGLE = "show_view_angle"; //$NON-NLS-1$
|
||||||
public static final boolean SHOW_VIEW_ANGLE_DEF = false;
|
public static final boolean SHOW_VIEW_ANGLE_DEF = false;
|
||||||
|
|
||||||
public static boolean isShowingViewAngle(Context ctx) {
|
public static boolean isShowingViewAngle(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getBoolean(SHOW_VIEW_ANGLE, SHOW_VIEW_ANGLE_DEF);
|
return prefs.getBoolean(SHOW_VIEW_ANGLE, SHOW_VIEW_ANGLE_DEF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -294,8 +287,7 @@ public class OsmandSettings {
|
||||||
public static final String AUTO_ZOOM_MAP = "auto_zoom_map"; //$NON-NLS-1$
|
public static final String AUTO_ZOOM_MAP = "auto_zoom_map"; //$NON-NLS-1$
|
||||||
public static final boolean AUTO_ZOOM_MAP_DEF = false;
|
public static final boolean AUTO_ZOOM_MAP_DEF = false;
|
||||||
|
|
||||||
public static boolean isAutoZoomEnabled(Context ctx) {
|
public static boolean isAutoZoomEnabled(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getBoolean(AUTO_ZOOM_MAP, AUTO_ZOOM_MAP_DEF);
|
return prefs.getBoolean(AUTO_ZOOM_MAP, AUTO_ZOOM_MAP_DEF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -307,24 +299,21 @@ public class OsmandSettings {
|
||||||
public static final int ROTATE_MAP_COMPASS = 2;
|
public static final int ROTATE_MAP_COMPASS = 2;
|
||||||
|
|
||||||
// return 0 - no rotate, 1 - to bearing, 2 - to compass
|
// return 0 - no rotate, 1 - to bearing, 2 - to compass
|
||||||
public static int getRotateMap(Context ctx) {
|
public static int getRotateMap(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getInt(ROTATE_MAP, ROTATE_MAP_TO_BEARING_DEF);
|
return prefs.getInt(ROTATE_MAP, ROTATE_MAP_TO_BEARING_DEF);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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"; //$NON-NLS-1$
|
public static final String POSITION_ON_MAP = "position_on_map"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static int getPositionOnMap(Context ctx) {
|
public static int getPositionOnMap(SharedPreferences prefs) {
|
||||||
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 MAX_LEVEL_TO_DOWNLOAD_TILE = "max_level_download_tile"; //$NON-NLS-1$
|
public static final String MAX_LEVEL_TO_DOWNLOAD_TILE = "max_level_download_tile"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static int getMaximumLevelToDownloadTile(Context ctx) {
|
public static int getMaximumLevelToDownloadTile(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getInt(MAX_LEVEL_TO_DOWNLOAD_TILE, 18);
|
return prefs.getInt(MAX_LEVEL_TO_DOWNLOAD_TILE, 18);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -332,8 +321,7 @@ public class OsmandSettings {
|
||||||
public static final String MAP_VIEW_3D = "map_view_3d"; //$NON-NLS-1$
|
public static final String MAP_VIEW_3D = "map_view_3d"; //$NON-NLS-1$
|
||||||
public static final boolean MAP_VIEW_3D_DEF = false;
|
public static final boolean MAP_VIEW_3D_DEF = false;
|
||||||
|
|
||||||
public static boolean isMapView3D(Context ctx) {
|
public static boolean isMapView3D(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getBoolean(MAP_VIEW_3D, MAP_VIEW_3D_DEF);
|
return prefs.getBoolean(MAP_VIEW_3D, MAP_VIEW_3D_DEF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -341,8 +329,7 @@ public class OsmandSettings {
|
||||||
public static final String USE_ENGLISH_NAMES = "use_english_names"; //$NON-NLS-1$
|
public static final String USE_ENGLISH_NAMES = "use_english_names"; //$NON-NLS-1$
|
||||||
public static final boolean USE_ENGLISH_NAMES_DEF = false;
|
public static final boolean USE_ENGLISH_NAMES_DEF = false;
|
||||||
|
|
||||||
public static boolean usingEnglishNames(Context ctx) {
|
public static boolean usingEnglishNames(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getBoolean(USE_ENGLISH_NAMES, USE_ENGLISH_NAMES_DEF);
|
return prefs.getBoolean(USE_ENGLISH_NAMES, USE_ENGLISH_NAMES_DEF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -355,13 +342,11 @@ public class OsmandSettings {
|
||||||
public static final String MAP_VECTOR_DATA = "map_vector_data"; //$NON-NLS-1$
|
public static final String MAP_VECTOR_DATA = "map_vector_data"; //$NON-NLS-1$
|
||||||
public static final String MAP_TILE_SOURCES = "map_tile_sources"; //$NON-NLS-1$
|
public static final String MAP_TILE_SOURCES = "map_tile_sources"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static boolean isUsingMapVectorData(Context ctx){
|
public static boolean isUsingMapVectorData(SharedPreferences prefs){
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getBoolean(MAP_VECTOR_DATA, false);
|
return prefs.getBoolean(MAP_VECTOR_DATA, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ITileSource getMapTileSource(Context ctx) {
|
public static ITileSource getMapTileSource(SharedPreferences prefs) {
|
||||||
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) {
|
||||||
|
|
||||||
|
@ -399,8 +384,7 @@ public class OsmandSettings {
|
||||||
return TileSourceManager.getMapnikSource();
|
return TileSourceManager.getMapnikSource();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getMapTileSourceName(Context ctx) {
|
public static String getMapTileSourceName(SharedPreferences prefs) {
|
||||||
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;
|
||||||
|
@ -418,23 +402,21 @@ public class OsmandSettings {
|
||||||
public static final String MAP_LON_TO_SHOW = "map_lon_to_show"; //$NON-NLS-1$
|
public static final String MAP_LON_TO_SHOW = "map_lon_to_show"; //$NON-NLS-1$
|
||||||
public static final String MAP_ZOOM_TO_SHOW = "map_zoom_to_show"; //$NON-NLS-1$
|
public static final String MAP_ZOOM_TO_SHOW = "map_zoom_to_show"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static LatLon getLastKnownMapLocation(Context ctx) {
|
public static LatLon getLastKnownMapLocation(SharedPreferences prefs) {
|
||||||
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) {
|
||||||
setMapLocationToShow(ctx, latitude, longitude, getLastKnownMapZoom(ctx), null);
|
setMapLocationToShow(ctx, latitude, longitude, getLastKnownMapZoom(getSharedPreferences(ctx)), null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setMapLocationToShow(Context ctx, double latitude, double longitude, int zoom) {
|
public static void setMapLocationToShow(Context ctx, double latitude, double longitude, int zoom) {
|
||||||
setMapLocationToShow(ctx, latitude, longitude, null);
|
setMapLocationToShow(ctx, latitude, longitude, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LatLon getAndClearMapLocationToShow(Context ctx){
|
public static LatLon getAndClearMapLocationToShow(SharedPreferences prefs){
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
if(!prefs.contains(MAP_LAT_TO_SHOW)){
|
if(!prefs.contains(MAP_LAT_TO_SHOW)){
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
@ -444,8 +426,7 @@ public class OsmandSettings {
|
||||||
return new LatLon(lat, lon);
|
return new LatLon(lat, lon);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static int getMapZoomToShow(Context ctx) {
|
public static int getMapZoomToShow(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getInt(MAP_ZOOM_TO_SHOW, 5);
|
return prefs.getInt(MAP_ZOOM_TO_SHOW, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -463,7 +444,7 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void setMapLocationToShow(Context ctx, double latitude, double longitude, String historyDescription) {
|
public static void setMapLocationToShow(Context ctx, double latitude, double longitude, String historyDescription) {
|
||||||
setMapLocationToShow(ctx, latitude, longitude, getLastKnownMapZoom(ctx), historyDescription);
|
setMapLocationToShow(ctx, latitude, longitude, getLastKnownMapZoom(getSharedPreferences(ctx)), historyDescription);
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
|
@ -480,13 +461,11 @@ public class OsmandSettings {
|
||||||
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(SharedPreferences prefs) {
|
||||||
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(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getInt(LAST_KNOWN_MAP_ZOOM, 5);
|
return prefs.getInt(LAST_KNOWN_MAP_ZOOM, 5);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -500,8 +479,7 @@ public class OsmandSettings {
|
||||||
public final static String POINT_NAVIGATE_LAT = "point_navigate_lat"; //$NON-NLS-1$
|
public final static String POINT_NAVIGATE_LAT = "point_navigate_lat"; //$NON-NLS-1$
|
||||||
public final static String POINT_NAVIGATE_LON = "point_navigate_lon"; //$NON-NLS-1$
|
public final static String POINT_NAVIGATE_LON = "point_navigate_lon"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static LatLon getPointToNavigate(Context ctx) {
|
public static LatLon getPointToNavigate(SharedPreferences prefs) {
|
||||||
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) {
|
||||||
|
@ -510,8 +488,7 @@ public class OsmandSettings {
|
||||||
return new LatLon(lat, lon);
|
return new LatLon(lat, lon);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static boolean clearPointToNavigate(Context ctx) {
|
public static boolean clearPointToNavigate(SharedPreferences prefs) {
|
||||||
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();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -527,8 +504,7 @@ public class OsmandSettings {
|
||||||
public static final String LAST_SEARCHED_BUILDING = "last_searched_building"; //$NON-NLS-1$
|
public static final String LAST_SEARCHED_BUILDING = "last_searched_building"; //$NON-NLS-1$
|
||||||
public static final String LAST_SEARCHED_INTERSECTED_STREET = "last_searched_intersected_street"; //$NON-NLS-1$
|
public static final String LAST_SEARCHED_INTERSECTED_STREET = "last_searched_intersected_street"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static String getLastSearchedRegion(Context ctx) {
|
public static String getLastSearchedRegion(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getString(LAST_SEARCHED_REGION, ""); //$NON-NLS-1$
|
return prefs.getString(LAST_SEARCHED_REGION, ""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -542,8 +518,7 @@ public class OsmandSettings {
|
||||||
return edit.commit();
|
return edit.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getLastSearchedPostcode(Context ctx){
|
public static String getLastSearchedPostcode(SharedPreferences prefs){
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getString(lAST_SEARCHED_POSTCODE, null);
|
return prefs.getString(lAST_SEARCHED_POSTCODE, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -557,8 +532,7 @@ public class OsmandSettings {
|
||||||
return edit.commit();
|
return edit.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Long getLastSearchedCity(Context ctx) {
|
public static Long getLastSearchedCity(SharedPreferences prefs) {
|
||||||
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);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -573,8 +547,7 @@ public class OsmandSettings {
|
||||||
return edit.commit();
|
return edit.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getLastSearchedStreet(Context ctx) {
|
public static String getLastSearchedStreet(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getString(LAST_SEARCHED_STREET, ""); //$NON-NLS-1$
|
return prefs.getString(LAST_SEARCHED_STREET, ""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -587,8 +560,7 @@ public class OsmandSettings {
|
||||||
return edit.commit();
|
return edit.commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
public static String getLastSearchedBuilding(Context ctx) {
|
public static String getLastSearchedBuilding(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getString(LAST_SEARCHED_BUILDING, ""); //$NON-NLS-1$
|
return prefs.getString(LAST_SEARCHED_BUILDING, ""); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -597,8 +569,7 @@ public class OsmandSettings {
|
||||||
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(SharedPreferences prefs) {
|
||||||
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;
|
||||||
}
|
}
|
||||||
|
@ -611,7 +582,7 @@ public class OsmandSettings {
|
||||||
}
|
}
|
||||||
|
|
||||||
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 = getPrefs(ctx);
|
||||||
return prefs.edit().remove(LAST_SEARCHED_INTERSECTED_STREET).commit();
|
return prefs.edit().remove(LAST_SEARCHED_INTERSECTED_STREET).commit();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -636,16 +607,14 @@ 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 VOICE_PROVIDER = "voice_provider"; //$NON-NLS-1$
|
public static final String VOICE_PROVIDER = "voice_provider"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static String getVoiceProvider(Context ctx){
|
public static String getVoiceProvider(SharedPreferences prefs){
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getString(VOICE_PROVIDER, null);
|
return prefs.getString(VOICE_PROVIDER, null);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static final String VOICE_MUTE = "voice_mute"; //$NON-NLS-1$
|
public static final String VOICE_MUTE = "voice_mute"; //$NON-NLS-1$
|
||||||
public static final boolean VOICE_MUTE_DEF = false;
|
public static final boolean VOICE_MUTE_DEF = false;
|
||||||
|
|
||||||
public static boolean isVoiceMute(Context ctx){
|
public static boolean isVoiceMute(SharedPreferences prefs){
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getBoolean(VOICE_MUTE, VOICE_MUTE_DEF);
|
return prefs.getBoolean(VOICE_MUTE, VOICE_MUTE_DEF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -657,8 +626,7 @@ public class OsmandSettings {
|
||||||
// for background service
|
// for background service
|
||||||
public static final String MAP_ACTIVITY_ENABLED = "map_activity_enabled"; //$NON-NLS-1$
|
public static final String MAP_ACTIVITY_ENABLED = "map_activity_enabled"; //$NON-NLS-1$
|
||||||
public static final boolean MAP_ACTIVITY_ENABLED_DEF = false;
|
public static final boolean MAP_ACTIVITY_ENABLED_DEF = false;
|
||||||
public static boolean getMapActivityEnabled(Context ctx) {
|
public static boolean getMapActivityEnabled(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getBoolean(MAP_ACTIVITY_ENABLED, MAP_ACTIVITY_ENABLED_DEF);
|
return prefs.getBoolean(MAP_ACTIVITY_ENABLED, MAP_ACTIVITY_ENABLED_DEF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -670,8 +638,7 @@ 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 SERVICE_OFF_ENABLED = "service_off_enabled"; //$NON-NLS-1$
|
public static final String SERVICE_OFF_ENABLED = "service_off_enabled"; //$NON-NLS-1$
|
||||||
public static final boolean SERVICE_OFF_ENABLED_DEF = false;
|
public static final boolean SERVICE_OFF_ENABLED_DEF = false;
|
||||||
public static boolean getServiceOffEnabled(Context ctx) {
|
public static boolean getServiceOffEnabled(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getBoolean(SERVICE_OFF_ENABLED, SERVICE_OFF_ENABLED_DEF);
|
return prefs.getBoolean(SERVICE_OFF_ENABLED, SERVICE_OFF_ENABLED_DEF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -683,8 +650,7 @@ 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 SERVICE_OFF_PROVIDER = "service_off_provider"; //$NON-NLS-1$
|
public static final String SERVICE_OFF_PROVIDER = "service_off_provider"; //$NON-NLS-1$
|
||||||
public static String getServiceOffProvider(Context ctx) {
|
public static String getServiceOffProvider(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getString(SERVICE_OFF_PROVIDER, LocationManager.GPS_PROVIDER);
|
return prefs.getString(SERVICE_OFF_PROVIDER, LocationManager.GPS_PROVIDER);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -692,8 +658,7 @@ 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 SERVICE_OFF_INTERVAL = "service_off_interval"; //$NON-NLS-1$
|
public static final String SERVICE_OFF_INTERVAL = "service_off_interval"; //$NON-NLS-1$
|
||||||
public static final int SERVICE_OFF_INTERVAL_DEF = 5 * 60 * 1000;
|
public static final int SERVICE_OFF_INTERVAL_DEF = 5 * 60 * 1000;
|
||||||
public static int getServiceOffInterval(Context ctx) {
|
public static int getServiceOffInterval(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getInt(SERVICE_OFF_INTERVAL, SERVICE_OFF_INTERVAL_DEF);
|
return prefs.getInt(SERVICE_OFF_INTERVAL, SERVICE_OFF_INTERVAL_DEF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -701,16 +666,14 @@ 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 SERVICE_OFF_WAIT_INTERVAL = "service_off_wait_interval"; //$NON-NLS-1$
|
public static final String SERVICE_OFF_WAIT_INTERVAL = "service_off_wait_interval"; //$NON-NLS-1$
|
||||||
public static final int SERVICE_OFF_WAIT_INTERVAL_DEF = 90 * 1000;
|
public static final int SERVICE_OFF_WAIT_INTERVAL_DEF = 90 * 1000;
|
||||||
public static int getServiceOffWaitInterval(Context ctx) {
|
public static int getServiceOffWaitInterval(SharedPreferences prefs) {
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getInt(SERVICE_OFF_WAIT_INTERVAL, SERVICE_OFF_WAIT_INTERVAL_DEF);
|
return prefs.getInt(SERVICE_OFF_WAIT_INTERVAL, SERVICE_OFF_WAIT_INTERVAL_DEF);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
public static final String FOLLOW_TO_THE_ROUTE = "follow_to_route"; //$NON-NLS-1$
|
public static final String FOLLOW_TO_THE_ROUTE = "follow_to_route"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static boolean isFollowingByRoute(Context ctx){
|
public static boolean isFollowingByRoute(SharedPreferences prefs){
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getBoolean(FOLLOW_TO_THE_ROUTE, false);
|
return prefs.getBoolean(FOLLOW_TO_THE_ROUTE, false);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -721,8 +684,7 @@ public class OsmandSettings {
|
||||||
|
|
||||||
public static final String SHOW_ARRIVAL_TIME_OTHERWISE_EXPECTED_TIME = "show_arrival_time"; //$NON-NLS-1$
|
public static final String SHOW_ARRIVAL_TIME_OTHERWISE_EXPECTED_TIME = "show_arrival_time"; //$NON-NLS-1$
|
||||||
|
|
||||||
public static boolean isShowingArrivalTime(Context ctx){
|
public static boolean isShowingArrivalTime(SharedPreferences prefs){
|
||||||
SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE);
|
|
||||||
return prefs.getBoolean(SHOW_ARRIVAL_TIME_OTHERWISE_EXPECTED_TIME, true);
|
return prefs.getBoolean(SHOW_ARRIVAL_TIME_OTHERWISE_EXPECTED_TIME, true);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -62,7 +62,7 @@ public class EditPOIFilterActivity extends ListActivity {
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
Bundle extras = getIntent().getExtras();
|
Bundle extras = getIntent().getExtras();
|
||||||
boolean searchNearBy = true;
|
boolean searchNearBy = true;
|
||||||
LatLon lastKnownMapLocation = OsmandSettings.getLastKnownMapLocation(EditPOIFilterActivity.this);
|
LatLon lastKnownMapLocation = OsmandSettings.getLastKnownMapLocation(OsmandSettings.getPrefs(EditPOIFilterActivity.this));
|
||||||
double latitude = lastKnownMapLocation != null ? lastKnownMapLocation.getLatitude() : 0;
|
double latitude = lastKnownMapLocation != null ? lastKnownMapLocation.getLatitude() : 0;
|
||||||
double longitude = lastKnownMapLocation != null ? lastKnownMapLocation.getLongitude() : 0;
|
double longitude = lastKnownMapLocation != null ? lastKnownMapLocation.getLongitude() : 0;
|
||||||
final Intent newIntent = new Intent(EditPOIFilterActivity.this, SearchPOIActivity.class);
|
final Intent newIntent = new Intent(EditPOIFilterActivity.this, SearchPOIActivity.class);
|
||||||
|
|
|
@ -134,7 +134,7 @@ public class EditingPOIActivity {
|
||||||
}
|
}
|
||||||
|
|
||||||
Builder builder = new AlertDialog.Builder(ctx);
|
Builder builder = new AlertDialog.Builder(ctx);
|
||||||
builder.setTitle(MessageFormat.format(this.view.getResources().getString(R.string.poi_remove_confirm_template), a.getStringWithoutType(OsmandSettings.usingEnglishNames(ctx))));
|
builder.setTitle(MessageFormat.format(this.view.getResources().getString(R.string.poi_remove_confirm_template), a.getStringWithoutType(OsmandSettings.usingEnglishNames(OsmandSettings.getPrefs(ctx)))));
|
||||||
final EditText comment = new EditText(ctx);
|
final EditText comment = new EditText(ctx);
|
||||||
comment.setText(R.string.poi_remove_title);
|
comment.setText(R.string.poi_remove_title);
|
||||||
builder.setView(comment);
|
builder.setView(comment);
|
||||||
|
@ -365,8 +365,8 @@ public class EditingPOIActivity {
|
||||||
DefaultHttpClient httpclient = new DefaultHttpClient(params);
|
DefaultHttpClient httpclient = new DefaultHttpClient(params);
|
||||||
|
|
||||||
if (doAuthenticate) {
|
if (doAuthenticate) {
|
||||||
UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(OsmandSettings.getUserName(ctx) + ":" //$NON-NLS-1$
|
UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(OsmandSettings.getUserName(OsmandSettings.getPrefs(ctx)) + ":" //$NON-NLS-1$
|
||||||
+ OsmandSettings.getUserPassword(ctx));
|
+ OsmandSettings.getUserPassword(OsmandSettings.getPrefs(ctx)));
|
||||||
httpclient.getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), credentials);
|
httpclient.getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), credentials);
|
||||||
}
|
}
|
||||||
HttpRequestBase method = null;
|
HttpRequestBase method = null;
|
||||||
|
@ -445,7 +445,7 @@ public class EditingPOIActivity {
|
||||||
connection.setRequestMethod(requestMethod);
|
connection.setRequestMethod(requestMethod);
|
||||||
StringBuilder responseBody = new StringBuilder();
|
StringBuilder responseBody = new StringBuilder();
|
||||||
if (doAuthenticate) {
|
if (doAuthenticate) {
|
||||||
String token = OsmandSettings.getUserName(ctx) + ":" + OsmandSettings.getUserPassword(ctx); //$NON-NLS-1$
|
String token = OsmandSettings.getUserName(OsmandSettings.getPrefs(ctx)) + ":" + OsmandSettings.getUserPassword(OsmandSettings.getPrefs(ctx)); //$NON-NLS-1$
|
||||||
connection.addRequestProperty("Authorization", "Basic " + Base64.encode(token.getBytes("UTF-8"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
connection.addRequestProperty("Authorization", "Basic " + Base64.encode(token.getBytes("UTF-8"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
}
|
}
|
||||||
connection.setDoInput(true);
|
connection.setDoInput(true);
|
||||||
|
@ -626,7 +626,7 @@ public class EditingPOIActivity {
|
||||||
ser.startTag(null, action);
|
ser.startTag(null, action);
|
||||||
ser.attribute(null, "version", "0.6"); //$NON-NLS-1$ //$NON-NLS-2$
|
ser.attribute(null, "version", "0.6"); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
ser.attribute(null, "generator", Version.APP_NAME); //$NON-NLS-1$
|
ser.attribute(null, "generator", Version.APP_NAME); //$NON-NLS-1$
|
||||||
writeNode(n, info, ser, changeSetId, OsmandSettings.getUserName(ctx));
|
writeNode(n, info, ser, changeSetId, OsmandSettings.getUserName(OsmandSettings.getPrefs(ctx)));
|
||||||
ser.endTag(null, action);
|
ser.endTag(null, action);
|
||||||
ser.endTag(null, "osmChange"); //$NON-NLS-1$
|
ser.endTag(null, "osmChange"); //$NON-NLS-1$
|
||||||
ser.endDocument();
|
ser.endDocument();
|
||||||
|
|
|
@ -368,7 +368,7 @@ public class FavouritesActivity extends ListActivity {
|
||||||
ImageView icon = (ImageView) row.findViewById(R.id.favourite_icon);
|
ImageView icon = (ImageView) row.findViewById(R.id.favourite_icon);
|
||||||
FavouritePoint model = (FavouritePoint) getItem(position);
|
FavouritePoint model = (FavouritePoint) getItem(position);
|
||||||
icon.setImageResource(R.drawable.opened_poi);
|
icon.setImageResource(R.drawable.opened_poi);
|
||||||
LatLon lastKnownMapLocation = OsmandSettings.getLastKnownMapLocation(FavouritesActivity.this);
|
LatLon lastKnownMapLocation = OsmandSettings.getLastKnownMapLocation(OsmandSettings.getPrefs(FavouritesActivity.this));
|
||||||
int dist = (int) (MapUtils.getDistance(model.getLatitude(), model.getLongitude(),
|
int dist = (int) (MapUtils.getDistance(model.getLatitude(), model.getLongitude(),
|
||||||
lastKnownMapLocation.getLatitude(), lastKnownMapLocation.getLongitude()));
|
lastKnownMapLocation.getLatitude(), lastKnownMapLocation.getLongitude()));
|
||||||
distanceLabel.setText(MapUtils.getFormattedDistance(dist));
|
distanceLabel.setText(MapUtils.getFormattedDistance(dist));
|
||||||
|
|
|
@ -159,11 +159,12 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
||||||
private boolean currentShowingAngle;
|
private boolean currentShowingAngle;
|
||||||
|
|
||||||
private Dialog progressDlg = null;
|
private Dialog progressDlg = null;
|
||||||
|
private SharedPreferences settings;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
private boolean isMapLinkedToLocation(){
|
private boolean isMapLinkedToLocation(){
|
||||||
return OsmandSettings.isMapSyncToGpsLocation(this);
|
return OsmandSettings.isMapSyncToGpsLocation(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Notification getNotification(){
|
private Notification getNotification(){
|
||||||
|
@ -181,7 +182,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle savedInstanceState) {
|
public void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
settings = OsmandSettings.getPrefs(this);
|
||||||
// for voice navigation
|
// for voice navigation
|
||||||
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
setVolumeControlStream(AudioManager.STREAM_MUSIC);
|
||||||
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
requestWindowFeature(Window.FEATURE_NO_TITLE);
|
||||||
|
@ -263,7 +264,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
||||||
|
|
||||||
savingTrackHelper = new SavingTrackHelper(this);
|
savingTrackHelper = new SavingTrackHelper(this);
|
||||||
|
|
||||||
LatLon pointToNavigate = OsmandSettings.getPointToNavigate(this);
|
LatLon pointToNavigate = OsmandSettings.getPointToNavigate(settings);
|
||||||
|
|
||||||
// TODO how this situation could be ?
|
// TODO how this situation could be ?
|
||||||
if(!Algoritms.objectEquals(routingHelper.getFinalLocation(), pointToNavigate)){
|
if(!Algoritms.objectEquals(routingHelper.getFinalLocation(), pointToNavigate)){
|
||||||
|
@ -273,7 +274,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
||||||
routingHelper.setFinalAndCurrentLocation(pointToNavigate, null);
|
routingHelper.setFinalAndCurrentLocation(pointToNavigate, null);
|
||||||
|
|
||||||
}
|
}
|
||||||
if(OsmandSettings.isFollowingByRoute(this)){
|
if(OsmandSettings.isFollowingByRoute(settings)){
|
||||||
if(pointToNavigate == null){
|
if(pointToNavigate == null){
|
||||||
OsmandSettings.setFollowingByRoute(this, false);
|
OsmandSettings.setFollowingByRoute(this, false);
|
||||||
} else if(!routingHelper.isRouteCalculated()){
|
} else if(!routingHelper.isRouteCalculated()){
|
||||||
|
@ -325,7 +326,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
||||||
mapView.getAnimatedDraggingThread().startZooming(mapView.getZoom(), mapView.getZoom() + 1);
|
mapView.getAnimatedDraggingThread().startZooming(mapView.getZoom(), mapView.getZoom() + 1);
|
||||||
showAndHideMapPosition();
|
showAndHideMapPosition();
|
||||||
// user can preview map manually switch off auto zoom while user don't press back to location
|
// user can preview map manually switch off auto zoom while user don't press back to location
|
||||||
if(OsmandSettings.isAutoZoomEnabled(MapActivity.this)){
|
if(OsmandSettings.isAutoZoomEnabled(settings)){
|
||||||
locationChanged(mapView.getLatitude(), mapView.getLongitude(), null);
|
locationChanged(mapView.getLatitude(), mapView.getLongitude(), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -339,7 +340,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
||||||
mapView.getAnimatedDraggingThread().startZooming(mapView.getZoom(), mapView.getZoom() - 1);
|
mapView.getAnimatedDraggingThread().startZooming(mapView.getZoom(), mapView.getZoom() - 1);
|
||||||
showAndHideMapPosition();
|
showAndHideMapPosition();
|
||||||
// user can preview map manually switch off auto zoom while user don't press back to location
|
// user can preview map manually switch off auto zoom while user don't press back to location
|
||||||
if(OsmandSettings.isAutoZoomEnabled(MapActivity.this)){
|
if(OsmandSettings.isAutoZoomEnabled(settings)){
|
||||||
locationChanged(mapView.getLatitude(), mapView.getLongitude(), null);
|
locationChanged(mapView.getLatitude(), mapView.getLongitude(), null);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -388,7 +389,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
||||||
}
|
}
|
||||||
@Override
|
@Override
|
||||||
public boolean onTrackballEvent(MotionEvent event) {
|
public boolean onTrackballEvent(MotionEvent event) {
|
||||||
if(event.getAction() == MotionEvent.ACTION_MOVE && OsmandSettings.isUsingTrackBall(this)){
|
if(event.getAction() == MotionEvent.ACTION_MOVE && OsmandSettings.isUsingTrackBall(settings)){
|
||||||
float x = event.getX();
|
float x = event.getX();
|
||||||
float y = event.getY();
|
float y = event.getY();
|
||||||
LatLon l = mapView.getLatLonFromScreenPoint(mapView.getCenterPointX() + x * 15, mapView.getCenterPointY() + y * 15);
|
LatLon l = mapView.getLatLonFromScreenPoint(mapView.getCenterPointX() + x * 15, mapView.getCenterPointY() + y * 15);
|
||||||
|
@ -483,7 +484,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
||||||
}
|
}
|
||||||
if(location != null && OsmandSettings.isSavingTrackToGpx(this)){
|
if(location != null && OsmandSettings.isSavingTrackToGpx(this)){
|
||||||
savingTrackHelper.insertData(location.getLatitude(), location.getLongitude(),
|
savingTrackHelper.insertData(location.getLatitude(), location.getLongitude(),
|
||||||
location.getAltitude(), location.getSpeed(), location.getTime());
|
location.getAltitude(), location.getSpeed(), location.getTime(), settings);
|
||||||
}
|
}
|
||||||
registerUnregisterSensor(location);
|
registerUnregisterSensor(location);
|
||||||
updateSpeedBearing(location);
|
updateSpeedBearing(location);
|
||||||
|
@ -494,7 +495,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
||||||
}
|
}
|
||||||
if (location != null) {
|
if (location != null) {
|
||||||
if (isMapLinkedToLocation()) {
|
if (isMapLinkedToLocation()) {
|
||||||
if(OsmandSettings.isAutoZoomEnabled(this) && location.hasSpeed()){
|
if(OsmandSettings.isAutoZoomEnabled(settings) && location.hasSpeed()){
|
||||||
int z = defineZoomFromSpeed(location.getSpeed(), mapView.getZoom());
|
int z = defineZoomFromSpeed(location.getSpeed(), mapView.getZoom());
|
||||||
if(mapView.getZoom() != z && !mapView.mapIsAnimating()){
|
if(mapView.getZoom() != z && !mapView.mapIsAnimating()){
|
||||||
mapView.setZoom(z);
|
mapView.setZoom(z);
|
||||||
|
@ -536,7 +537,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
||||||
if(point != null){
|
if(point != null){
|
||||||
OsmandSettings.setPointToNavigate(this, point.getLatitude(), point.getLongitude());
|
OsmandSettings.setPointToNavigate(this, point.getLatitude(), point.getLongitude());
|
||||||
} else {
|
} else {
|
||||||
OsmandSettings.clearPointToNavigate(this);
|
OsmandSettings.clearPointToNavigate(settings);
|
||||||
}
|
}
|
||||||
routingHelper.setFinalAndCurrentLocation(point, null, routingHelper.getCurrentGPXRoute());
|
routingHelper.setFinalAndCurrentLocation(point, null, routingHelper.getCurrentGPXRoute());
|
||||||
if(point == null){
|
if(point == null){
|
||||||
|
@ -679,57 +680,57 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateApplicationModeSettings(){
|
private void updateApplicationModeSettings(){
|
||||||
currentMapRotation = OsmandSettings.getRotateMap(this);
|
currentMapRotation = OsmandSettings.getRotateMap(settings);
|
||||||
currentShowingAngle = OsmandSettings.isShowingViewAngle(this);
|
currentShowingAngle = OsmandSettings.isShowingViewAngle(settings);
|
||||||
if(currentMapRotation == OsmandSettings.ROTATE_MAP_NONE){
|
if(currentMapRotation == OsmandSettings.ROTATE_MAP_NONE){
|
||||||
mapView.setRotate(0);
|
mapView.setRotate(0);
|
||||||
}
|
}
|
||||||
if(!currentShowingAngle){
|
if(!currentShowingAngle){
|
||||||
locationLayer.setHeading(null);
|
locationLayer.setHeading(null);
|
||||||
}
|
}
|
||||||
locationLayer.setAppMode(OsmandSettings.getApplicationMode(this));
|
locationLayer.setAppMode(OsmandSettings.getApplicationMode(settings));
|
||||||
routingHelper.setAppMode(OsmandSettings.getApplicationMode(this));
|
routingHelper.setAppMode(OsmandSettings.getApplicationMode(settings));
|
||||||
mapView.setMapPosition(OsmandSettings.getPositionOnMap(this));
|
mapView.setMapPosition(OsmandSettings.getPositionOnMap(settings));
|
||||||
registerUnregisterSensor(getLastKnownLocation());
|
registerUnregisterSensor(getLastKnownLocation());
|
||||||
updateLayers();
|
updateLayers();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateLayers(){
|
private void updateLayers(){
|
||||||
if(mapView.getLayers().contains(transportStopsLayer) != OsmandSettings.isShowingTransportOverMap(this)){
|
if(mapView.getLayers().contains(transportStopsLayer) != OsmandSettings.isShowingTransportOverMap(settings)){
|
||||||
if(OsmandSettings.isShowingTransportOverMap(this)){
|
if(OsmandSettings.isShowingTransportOverMap(settings)){
|
||||||
mapView.addLayer(transportStopsLayer, 5);
|
mapView.addLayer(transportStopsLayer, 5);
|
||||||
} else {
|
} else {
|
||||||
mapView.removeLayer(transportStopsLayer);
|
mapView.removeLayer(transportStopsLayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if(mapView.getLayers().contains(osmBugsLayer) != OsmandSettings.isShowingOsmBugs(this)){
|
if(mapView.getLayers().contains(osmBugsLayer) != OsmandSettings.isShowingOsmBugs(settings)){
|
||||||
if(OsmandSettings.isShowingOsmBugs(this)){
|
if(OsmandSettings.isShowingOsmBugs(settings)){
|
||||||
mapView.addLayer(osmBugsLayer, 2);
|
mapView.addLayer(osmBugsLayer, 2);
|
||||||
} else {
|
} else {
|
||||||
mapView.removeLayer(osmBugsLayer);
|
mapView.removeLayer(osmBugsLayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mapView.getLayers().contains(poiMapLayer) != OsmandSettings.isShowingPoiOverMap(this)){
|
if(mapView.getLayers().contains(poiMapLayer) != OsmandSettings.isShowingPoiOverMap(settings)){
|
||||||
if(OsmandSettings.isShowingPoiOverMap(this)){
|
if(OsmandSettings.isShowingPoiOverMap(settings)){
|
||||||
mapView.addLayer(poiMapLayer, 3);
|
mapView.addLayer(poiMapLayer, 3);
|
||||||
} else {
|
} else {
|
||||||
mapView.removeLayer(poiMapLayer);
|
mapView.removeLayer(poiMapLayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mapView.getLayers().contains(favoritesLayer) != OsmandSettings.isShowingFavorites(this)){
|
if(mapView.getLayers().contains(favoritesLayer) != OsmandSettings.isShowingFavorites(settings)){
|
||||||
if(OsmandSettings.isShowingFavorites(this)){
|
if(OsmandSettings.isShowingFavorites(settings)){
|
||||||
mapView.addLayer(favoritesLayer, 4);
|
mapView.addLayer(favoritesLayer, 4);
|
||||||
} else {
|
} else {
|
||||||
mapView.removeLayer(favoritesLayer);
|
mapView.removeLayer(favoritesLayer);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
trafficLayer.setVisible(OsmandSettings.isShowingYandexTraffic(this));
|
trafficLayer.setVisible(OsmandSettings.isShowingYandexTraffic(settings));
|
||||||
}
|
}
|
||||||
|
|
||||||
private void updateMapSource(){
|
private void updateMapSource(){
|
||||||
boolean vectorData = OsmandSettings.isUsingMapVectorData(this);
|
boolean vectorData = OsmandSettings.isUsingMapVectorData(settings);
|
||||||
ResourceManager rm = ((OsmandApplication)getApplication()).getResourceManager();
|
ResourceManager rm = ((OsmandApplication)getApplication()).getResourceManager();
|
||||||
if(vectorData){
|
if(vectorData){
|
||||||
if(rm.getRenderer().isEmpty()){
|
if(rm.getRenderer().isEmpty()){
|
||||||
|
@ -737,7 +738,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
||||||
vectorData = false;
|
vectorData = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
ITileSource newSource = OsmandSettings.getMapTileSource(this);
|
ITileSource newSource = OsmandSettings.getMapTileSource(settings);
|
||||||
if(mapView.getMap() instanceof SQLiteTileSource){
|
if(mapView.getMap() instanceof SQLiteTileSource){
|
||||||
((SQLiteTileSource)mapView.getMap()).closeDB();
|
((SQLiteTileSource)mapView.getMap()).closeDB();
|
||||||
}
|
}
|
||||||
|
@ -750,19 +751,19 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if(OsmandSettings.getMapOrientation(this) != getRequestedOrientation()){
|
if(OsmandSettings.getMapOrientation(settings) != getRequestedOrientation()){
|
||||||
setRequestedOrientation(OsmandSettings.getMapOrientation(this));
|
setRequestedOrientation(OsmandSettings.getMapOrientation(settings));
|
||||||
// do nothing now (let recreate activity)
|
// do nothing now (let recreate activity)
|
||||||
// only save map position
|
// only save map position
|
||||||
LatLon l = OsmandSettings.getLastKnownMapLocation(this);
|
LatLon l = OsmandSettings.getLastKnownMapLocation(settings);
|
||||||
mapView.setLatLon(l.getLatitude(), l.getLongitude());
|
mapView.setLatLon(l.getLatitude(), l.getLongitude());
|
||||||
mapView.setZoom(OsmandSettings.getLastKnownMapZoom(this));
|
mapView.setZoom(OsmandSettings.getLastKnownMapZoom(settings));
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
currentScreenOrientation = getWindow().getWindowManager().getDefaultDisplay().getOrientation();
|
currentScreenOrientation = getWindow().getWindowManager().getDefaultDisplay().getOrientation();
|
||||||
|
|
||||||
boolean showTiles = !OsmandSettings.isUsingMapVectorData(this);
|
boolean showTiles = !OsmandSettings.isUsingMapVectorData(settings);
|
||||||
ITileSource source = showTiles ? OsmandSettings.getMapTileSource(this) : null;
|
ITileSource source = showTiles ? OsmandSettings.getMapTileSource(settings) : null;
|
||||||
if (showTiles != !rendererLayer.isVisible() || !Algoritms.objectEquals(mapView.getMap(), source)) {
|
if (showTiles != !rendererLayer.isVisible() || !Algoritms.objectEquals(mapView.getMap(), source)) {
|
||||||
updateMapSource();
|
updateMapSource();
|
||||||
}
|
}
|
||||||
|
@ -798,15 +799,15 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
||||||
}
|
}
|
||||||
SharedPreferences prefs = getSharedPreferences(OsmandSettings.SHARED_PREFERENCES_NAME, MODE_WORLD_READABLE);
|
SharedPreferences prefs = getSharedPreferences(OsmandSettings.SHARED_PREFERENCES_NAME, MODE_WORLD_READABLE);
|
||||||
if(prefs != null && prefs.contains(OsmandSettings.LAST_KNOWN_MAP_LAT)){
|
if(prefs != null && prefs.contains(OsmandSettings.LAST_KNOWN_MAP_LAT)){
|
||||||
LatLon l = OsmandSettings.getLastKnownMapLocation(this);
|
LatLon l = OsmandSettings.getLastKnownMapLocation(settings);
|
||||||
mapView.setLatLon(l.getLatitude(), l.getLongitude());
|
mapView.setLatLon(l.getLatitude(), l.getLongitude());
|
||||||
mapView.setZoom(OsmandSettings.getLastKnownMapZoom(this));
|
mapView.setZoom(OsmandSettings.getLastKnownMapZoom(settings));
|
||||||
LatLon latLon = OsmandSettings.getAndClearMapLocationToShow(this);
|
LatLon latLon = OsmandSettings.getAndClearMapLocationToShow(settings);
|
||||||
LatLon cur = new LatLon(mapView.getLatitude(), mapView.getLongitude());
|
LatLon cur = new LatLon(mapView.getLatitude(), mapView.getLongitude());
|
||||||
if(latLon != null && !latLon.equals(cur)){
|
if(latLon != null && !latLon.equals(cur)){
|
||||||
mapView.getAnimatedDraggingThread().startMoving(cur.getLatitude(), cur.getLongitude(),
|
mapView.getAnimatedDraggingThread().startMoving(cur.getLatitude(), cur.getLongitude(),
|
||||||
latLon.getLatitude(), latLon.getLongitude(),
|
latLon.getLatitude(), latLon.getLongitude(),
|
||||||
mapView.getZoom(), OsmandSettings.getMapZoomToShow(this),
|
mapView.getZoom(), OsmandSettings.getMapZoomToShow(settings),
|
||||||
mapView.getSourceTileSize(), mapView.getRotate(), true);
|
mapView.getSourceTileSize(), mapView.getRotate(), true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -928,7 +929,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
||||||
MenuItem navigateToPointMenu = menu.findItem(R.id.map_navigate_to_point);
|
MenuItem navigateToPointMenu = menu.findItem(R.id.map_navigate_to_point);
|
||||||
if (navigateToPointMenu != null) {
|
if (navigateToPointMenu != null) {
|
||||||
navigateToPointMenu.setTitle(routingHelper.isRouteCalculated() ? R.string.stop_routing : R.string.stop_navigation);
|
navigateToPointMenu.setTitle(routingHelper.isRouteCalculated() ? R.string.stop_routing : R.string.stop_navigation);
|
||||||
if (OsmandSettings.getPointToNavigate(this) != null) {
|
if (OsmandSettings.getPointToNavigate(settings) != null) {
|
||||||
navigateToPointMenu.setVisible(true);
|
navigateToPointMenu.setVisible(true);
|
||||||
} else {
|
} else {
|
||||||
navigateToPointMenu.setVisible(false);
|
navigateToPointMenu.setVisible(false);
|
||||||
|
@ -1007,7 +1008,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
||||||
return ApplicationMode.values()[i];
|
return ApplicationMode.values()[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return OsmandSettings.getApplicationMode(this);
|
return OsmandSettings.getApplicationMode(settings);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -1023,7 +1024,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
||||||
buttons[ApplicationMode.CAR.ordinal()] = (ToggleButton) view.findViewById(R.id.CarButton);
|
buttons[ApplicationMode.CAR.ordinal()] = (ToggleButton) view.findViewById(R.id.CarButton);
|
||||||
buttons[ApplicationMode.BICYCLE.ordinal()] = (ToggleButton) view.findViewById(R.id.BicycleButton);
|
buttons[ApplicationMode.BICYCLE.ordinal()] = (ToggleButton) view.findViewById(R.id.BicycleButton);
|
||||||
buttons[ApplicationMode.PEDESTRIAN.ordinal()] = (ToggleButton) view.findViewById(R.id.PedestrianButton);
|
buttons[ApplicationMode.PEDESTRIAN.ordinal()] = (ToggleButton) view.findViewById(R.id.PedestrianButton);
|
||||||
ApplicationMode appMode = OsmandSettings.getApplicationMode(this);
|
ApplicationMode appMode = OsmandSettings.getApplicationMode(settings);
|
||||||
for(int i=0; i< buttons.length; i++){
|
for(int i=0; i< buttons.length; i++){
|
||||||
if(buttons[i] != null){
|
if(buttons[i] != null){
|
||||||
final int ind = i;
|
final int ind = i;
|
||||||
|
@ -1080,7 +1081,7 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
||||||
public void onClick(DialogInterface dialog, int which) {
|
public void onClick(DialogInterface dialog, int which) {
|
||||||
ApplicationMode mode = getAppMode(buttons);
|
ApplicationMode mode = getAppMode(buttons);
|
||||||
// change global settings
|
// change global settings
|
||||||
if (OsmandSettings.getApplicationMode(MapActivity.this) != mode) {
|
if (OsmandSettings.getApplicationMode(settings) != mode) {
|
||||||
Editor edit = getSharedPreferences(OsmandSettings.SHARED_PREFERENCES_NAME, MODE_WORLD_WRITEABLE).edit();
|
Editor edit = getSharedPreferences(OsmandSettings.SHARED_PREFERENCES_NAME, MODE_WORLD_WRITEABLE).edit();
|
||||||
edit.putString(OsmandSettings.APPLICATION_MODE, mode.name());
|
edit.putString(OsmandSettings.APPLICATION_MODE, mode.name());
|
||||||
SettingsActivity.setAppMode(mode, edit);
|
SettingsActivity.setAppMode(mode, edit);
|
||||||
|
@ -1245,10 +1246,10 @@ public class MapActivity extends Activity implements IMapLocationListener, Senso
|
||||||
|
|
||||||
final boolean[] selected = new boolean[layersList.size()];
|
final boolean[] selected = new boolean[layersList.size()];
|
||||||
Arrays.fill(selected, true);
|
Arrays.fill(selected, true);
|
||||||
selected[1] = OsmandSettings.isShowingPoiOverMap(this);
|
selected[1] = OsmandSettings.isShowingPoiOverMap(settings);
|
||||||
selected[2] = OsmandSettings.isShowingTransportOverMap(this);
|
selected[2] = OsmandSettings.isShowingTransportOverMap(settings);
|
||||||
selected[3] = OsmandSettings.isShowingOsmBugs(this);
|
selected[3] = OsmandSettings.isShowingOsmBugs(settings);
|
||||||
selected[4] = OsmandSettings.isShowingFavorites(this);
|
selected[4] = OsmandSettings.isShowingFavorites(settings);
|
||||||
selected[5] = gpxLayer.isVisible();
|
selected[5] = gpxLayer.isVisible();
|
||||||
selected[trafficInd] = trafficLayer.isVisible();
|
selected[trafficInd] = trafficLayer.isVisible();
|
||||||
if(routeInfoInd != -1){
|
if(routeInfoInd != -1){
|
||||||
|
|
|
@ -48,7 +48,7 @@ public class NavigatePointActivity extends Activity {
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
LatLon loc = OsmandSettings.getLastKnownMapLocation(this);
|
LatLon loc = OsmandSettings.getLastKnownMapLocation(OsmandSettings.getPrefs(this));
|
||||||
setContentView(R.layout.navigate_point);
|
setContentView(R.layout.navigate_point);
|
||||||
setTitle(R.string.map_specify_point);
|
setTitle(R.string.map_specify_point);
|
||||||
initUI(loc.getLatitude(), loc.getLongitude());
|
initUI(loc.getLatitude(), loc.getLongitude());
|
||||||
|
|
|
@ -44,7 +44,7 @@ public class OsmandApplication extends Application {
|
||||||
|
|
||||||
public void onCreate(){
|
public void onCreate(){
|
||||||
super.onCreate();
|
super.onCreate();
|
||||||
routingHelper = new RoutingHelper(OsmandSettings.getApplicationMode(OsmandApplication.this), OsmandApplication.this, player);
|
routingHelper = new RoutingHelper(OsmandSettings.getApplicationMode(OsmandSettings.getPrefs(OsmandApplication.this)), OsmandApplication.this, player);
|
||||||
manager = new ResourceManager(this);
|
manager = new ResourceManager(this);
|
||||||
uiHandler = new Handler();
|
uiHandler = new Handler();
|
||||||
startApplication();
|
startApplication();
|
||||||
|
@ -104,7 +104,7 @@ public class OsmandApplication extends Application {
|
||||||
List<String> warnings = null;
|
List<String> warnings = null;
|
||||||
try {
|
try {
|
||||||
warnings = manager.reloadIndexes(startDialog);
|
warnings = manager.reloadIndexes(startDialog);
|
||||||
String voice = OsmandSettings.getVoiceProvider(OsmandApplication.this);
|
String voice = OsmandSettings.getVoiceProvider(OsmandSettings.getPrefs(OsmandApplication.this));
|
||||||
player = null;
|
player = null;
|
||||||
if(voice != null){
|
if(voice != null){
|
||||||
startDialog.startTask(getString(R.string.voice_data_initializing), -1);
|
startDialog.startTask(getString(R.string.voice_data_initializing), -1);
|
||||||
|
|
|
@ -434,7 +434,7 @@ public class RoutingHelper {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void calculateRoute(final Location start, final LatLon end, final List<Location> currentGPXRoute){
|
public void calculateRoute(final Location start, final LatLon end, final List<Location> currentGPXRoute){
|
||||||
final RouteService service = OsmandSettings.getRouterService(context);
|
final RouteService service = OsmandSettings.getRouterService(OsmandSettings.getPrefs(context));
|
||||||
if(currentRunningJob == null){
|
if(currentRunningJob == null){
|
||||||
// do not evaluate very often
|
// do not evaluate very often
|
||||||
if (System.currentTimeMillis() - lastTimeEvaluatedRoute > evalWaitInterval) {
|
if (System.currentTimeMillis() - lastTimeEvaluatedRoute > evalWaitInterval) {
|
||||||
|
|
|
@ -14,6 +14,7 @@ import net.osmand.GPXUtilities.TrkPt;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.database.Cursor;
|
import android.database.Cursor;
|
||||||
import android.database.sqlite.SQLiteDatabase;
|
import android.database.sqlite.SQLiteDatabase;
|
||||||
import android.database.sqlite.SQLiteOpenHelper;
|
import android.database.sqlite.SQLiteOpenHelper;
|
||||||
|
@ -149,8 +150,8 @@ public class SavingTrackHelper extends SQLiteOpenHelper {
|
||||||
return warnings;
|
return warnings;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void insertData(double lat, double lon, double alt, double speed, long time){
|
public void insertData(double lat, double lon, double alt, double speed, long time, SharedPreferences settings){
|
||||||
if (time - lastTimeUpdated > OsmandSettings.getSavingTrackInterval(ctx)) {
|
if (time - lastTimeUpdated > OsmandSettings.getSavingTrackInterval(settings)) {
|
||||||
SQLiteDatabase db = getWritableDatabase();
|
SQLiteDatabase db = getWritableDatabase();
|
||||||
if (db != null) {
|
if (db != null) {
|
||||||
db.execSQL(updateScript, new Object[] { lat, lon, alt, speed, time });
|
db.execSQL(updateScript, new Object[] { lat, lon, alt, speed, time });
|
||||||
|
|
|
@ -191,16 +191,16 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
for(BooleanPreference b : booleanPreferences){
|
for(BooleanPreference b : booleanPreferences){
|
||||||
b.getPref().setChecked(prefs.getBoolean(b.getId(), b.getDefValue()));
|
b.getPref().setChecked(prefs.getBoolean(b.getId(), b.getDefValue()));
|
||||||
}
|
}
|
||||||
userName.setText(OsmandSettings.getUserName(this));
|
userName.setText(OsmandSettings.getUserName(prefs));
|
||||||
userPassword.setText(OsmandSettings.getUserPassword(this));
|
userPassword.setText(OsmandSettings.getUserPassword(prefs));
|
||||||
useInternetToDownload.setChecked(OsmandSettings.isUsingInternetToDownloadTiles(this));
|
useInternetToDownload.setChecked(OsmandSettings.isUsingInternetToDownloadTiles(prefs));
|
||||||
|
|
||||||
Resources resources = this.getResources();
|
Resources resources = this.getResources();
|
||||||
String[] e = new String[] {resources.getString(R.string.position_on_map_center),
|
String[] e = new String[] {resources.getString(R.string.position_on_map_center),
|
||||||
resources.getString(R.string.position_on_map_bottom)};
|
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(prefs));
|
||||||
|
|
||||||
|
|
||||||
saveTrackInterval.setEntries(new String[]{
|
saveTrackInterval.setEntries(new String[]{
|
||||||
|
@ -212,7 +212,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
resources.getString(R.string.interval_1_minute),
|
resources.getString(R.string.interval_1_minute),
|
||||||
resources.getString(R.string.interval_5_minutes)});
|
resources.getString(R.string.interval_5_minutes)});
|
||||||
saveTrackInterval.setEntryValues(new String[]{"1", "2", "5", "15", "30", "60", "300"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
|
saveTrackInterval.setEntryValues(new String[]{"1", "2", "5", "15", "30", "60", "300"}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$
|
||||||
saveTrackInterval.setValue(OsmandSettings.getSavingTrackInterval(this)+""); //$NON-NLS-1$
|
saveTrackInterval.setValue(OsmandSettings.getSavingTrackInterval(prefs)+""); //$NON-NLS-1$
|
||||||
|
|
||||||
String[] ints = new String[]{"1", "2", "5", "8", "10", "15", "20", "25", "30", "40", "45", "60", "90" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$
|
String[] ints = new String[]{"1", "2", "5", "8", "10", "15", "20", "25", "30", "40", "45", "60", "90" }; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$ //$NON-NLS-10$ //$NON-NLS-11$ //$NON-NLS-12$ //$NON-NLS-13$
|
||||||
String[] intDescriptions = new String[ints.length];
|
String[] intDescriptions = new String[ints.length];
|
||||||
|
@ -221,7 +221,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
}
|
}
|
||||||
routeServiceInterval.setEntries(intDescriptions);
|
routeServiceInterval.setEntries(intDescriptions);
|
||||||
routeServiceInterval.setEntryValues(ints);
|
routeServiceInterval.setEntryValues(ints);
|
||||||
routeServiceInterval.setValue(OsmandSettings.getServiceOffInterval(this)/60000+""); //$NON-NLS-1$
|
routeServiceInterval.setValue(OsmandSettings.getServiceOffInterval(prefs)/60000+""); //$NON-NLS-1$
|
||||||
|
|
||||||
ints = new String[]{"15", "30", "45", "60", "90", "120", "180", "300", "600"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
|
ints = new String[]{"15", "30", "45", "60", "90", "120", "180", "300", "600"}; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ //$NON-NLS-6$ //$NON-NLS-7$ //$NON-NLS-8$ //$NON-NLS-9$
|
||||||
intDescriptions = new String[ints.length];
|
intDescriptions = new String[ints.length];
|
||||||
|
@ -230,17 +230,17 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
}
|
}
|
||||||
routeServiceWaitInterval.setEntries(intDescriptions);
|
routeServiceWaitInterval.setEntries(intDescriptions);
|
||||||
routeServiceWaitInterval.setEntryValues(ints);
|
routeServiceWaitInterval.setEntryValues(ints);
|
||||||
routeServiceWaitInterval.setValue(OsmandSettings.getServiceOffWaitInterval(this)/1000+""); //$NON-NLS-1$
|
routeServiceWaitInterval.setValue(OsmandSettings.getServiceOffWaitInterval(prefs)/1000+""); //$NON-NLS-1$
|
||||||
|
|
||||||
rotateMap.setEntries(new String[]{getString(R.string.rotate_map_none_opt), getString(R.string.rotate_map_bearing_opt), getString(R.string.rotate_map_compass_opt)});
|
rotateMap.setEntries(new String[]{getString(R.string.rotate_map_none_opt), getString(R.string.rotate_map_bearing_opt), getString(R.string.rotate_map_compass_opt)});
|
||||||
rotateMap.setEntryValues(new String[]{OsmandSettings.ROTATE_MAP_NONE+"", OsmandSettings.ROTATE_MAP_BEARING+"", OsmandSettings.ROTATE_MAP_COMPASS+""}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
rotateMap.setEntryValues(new String[]{OsmandSettings.ROTATE_MAP_NONE+"", OsmandSettings.ROTATE_MAP_BEARING+"", OsmandSettings.ROTATE_MAP_COMPASS+""}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
|
||||||
rotateMap.setValue(OsmandSettings.getRotateMap(this)+""); //$NON-NLS-1$
|
rotateMap.setValue(OsmandSettings.getRotateMap(prefs)+""); //$NON-NLS-1$
|
||||||
|
|
||||||
routeServiceProvider.setEntries(new String[]{getString(R.string.gps_provider), getString(R.string.network_provider)});
|
routeServiceProvider.setEntries(new String[]{getString(R.string.gps_provider), getString(R.string.network_provider)});
|
||||||
routeServiceProvider.setEntryValues(new String[]{LocationManager.GPS_PROVIDER, LocationManager.NETWORK_PROVIDER});
|
routeServiceProvider.setEntryValues(new String[]{LocationManager.GPS_PROVIDER, LocationManager.NETWORK_PROVIDER});
|
||||||
routeServiceProvider.setValue(OsmandSettings.getServiceOffProvider(this));
|
routeServiceProvider.setValue(OsmandSettings.getServiceOffProvider(prefs));
|
||||||
|
|
||||||
routeServiceEnabled.setChecked(OsmandSettings.getServiceOffEnabled(this));
|
routeServiceEnabled.setChecked(OsmandSettings.getServiceOffEnabled(prefs));
|
||||||
|
|
||||||
mapScreenOrientation.setEntries(new String[]{
|
mapScreenOrientation.setEntries(new String[]{
|
||||||
resources.getString(R.string.map_orientation_portrait),
|
resources.getString(R.string.map_orientation_portrait),
|
||||||
|
@ -249,7 +249,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
});
|
});
|
||||||
mapScreenOrientation.setEntryValues(new String[]{ActivityInfo.SCREEN_ORIENTATION_PORTRAIT+"", //$NON-NLS-1$
|
mapScreenOrientation.setEntryValues(new String[]{ActivityInfo.SCREEN_ORIENTATION_PORTRAIT+"", //$NON-NLS-1$
|
||||||
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE+"", ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED+""}); //$NON-NLS-1$ //$NON-NLS-2$
|
ActivityInfo.SCREEN_ORIENTATION_LANDSCAPE+"", ActivityInfo.SCREEN_ORIENTATION_UNSPECIFIED+""}); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
mapScreenOrientation.setValue(OsmandSettings.getMapOrientation(this)+""); //$NON-NLS-1$
|
mapScreenOrientation.setValue(OsmandSettings.getMapOrientation(prefs)+""); //$NON-NLS-1$
|
||||||
|
|
||||||
ApplicationMode[] presets = ApplicationMode.values();
|
ApplicationMode[] presets = ApplicationMode.values();
|
||||||
String[] values = new String[presets.length];
|
String[] values = new String[presets.length];
|
||||||
|
@ -260,11 +260,11 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
}
|
}
|
||||||
applicationMode.setEntries(values);
|
applicationMode.setEntries(values);
|
||||||
applicationMode.setEntryValues(valueEntries);
|
applicationMode.setEntryValues(valueEntries);
|
||||||
applicationMode.setValue(OsmandSettings.getApplicationMode(this).name());
|
applicationMode.setValue(OsmandSettings.getApplicationMode(prefs).name());
|
||||||
|
|
||||||
|
|
||||||
String[] entries = new String[RouteService.values().length];
|
String[] entries = new String[RouteService.values().length];
|
||||||
String entry = OsmandSettings.getRouterService(this).getName();
|
String entry = OsmandSettings.getRouterService(prefs).getName();
|
||||||
for(int i=0; i<entries.length; i++){
|
for(int i=0; i<entries.length; i++){
|
||||||
entries[i] = RouteService.values()[i].getName();
|
entries[i] = RouteService.values()[i].getName();
|
||||||
}
|
}
|
||||||
|
@ -282,7 +282,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
String provider = OsmandSettings.getVoiceProvider(this);
|
String provider = OsmandSettings.getVoiceProvider(prefs);
|
||||||
entries = new String[setFiles.size() + 1];
|
entries = new String[setFiles.size() + 1];
|
||||||
int k = 0;
|
int k = 0;
|
||||||
entries[k++] = getString(R.string.voice_not_use);
|
entries[k++] = getString(R.string.voice_not_use);
|
||||||
|
@ -305,7 +305,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
}
|
}
|
||||||
maxLevelToDownload.setEntries(entries);
|
maxLevelToDownload.setEntries(entries);
|
||||||
maxLevelToDownload.setEntryValues(entries);
|
maxLevelToDownload.setEntryValues(entries);
|
||||||
maxLevelToDownload.setValue(OsmandSettings.getMaximumLevelToDownloadTile(this)+""); //$NON-NLS-1$
|
maxLevelToDownload.setValue(OsmandSettings.getMaximumLevelToDownloadTile(prefs)+""); //$NON-NLS-1$
|
||||||
|
|
||||||
|
|
||||||
Map<String, String> entriesMap = getTileSourceEntries(this);
|
Map<String, String> entriesMap = getTileSourceEntries(this);
|
||||||
|
@ -322,9 +322,9 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
|
|
||||||
tileSourcePreference.setEntries(entries);
|
tileSourcePreference.setEntries(entries);
|
||||||
tileSourcePreference.setEntryValues(valueEntries);
|
tileSourcePreference.setEntryValues(valueEntries);
|
||||||
String value = OsmandSettings.isUsingMapVectorData(this)? VECTOR_MAP : OsmandSettings.getMapTileSourceName(this);
|
String value = OsmandSettings.isUsingMapVectorData(prefs)? VECTOR_MAP : OsmandSettings.getMapTileSourceName(prefs);
|
||||||
String mapName = " " + (OsmandSettings.isUsingMapVectorData(this) ? getString(R.string.vector_data) : //$NON-NLS-1$
|
String mapName = " " + (OsmandSettings.isUsingMapVectorData(prefs) ? getString(R.string.vector_data) : //$NON-NLS-1$
|
||||||
OsmandSettings.getMapTileSourceName(this));
|
OsmandSettings.getMapTileSourceName(prefs));
|
||||||
tileSourcePreference.setValue(value);
|
tileSourcePreference.setValue(value);
|
||||||
String summary = tileSourcePreference.getSummary().toString();
|
String summary = tileSourcePreference.getSummary().toString();
|
||||||
if (summary.lastIndexOf(':') != -1) {
|
if (summary.lastIndexOf(':') != -1) {
|
||||||
|
@ -432,11 +432,11 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
if ((Boolean) newValue) {
|
if ((Boolean) newValue) {
|
||||||
ComponentName name = startService(serviceIntent);
|
ComponentName name = startService(serviceIntent);
|
||||||
if (name == null) {
|
if (name == null) {
|
||||||
routeServiceEnabled.setChecked(OsmandSettings.getServiceOffEnabled(this));
|
routeServiceEnabled.setChecked(OsmandSettings.getServiceOffEnabled(prefs));
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if(!stopService(serviceIntent)){
|
if(!stopService(serviceIntent)){
|
||||||
routeServiceEnabled.setChecked(OsmandSettings.getServiceOffEnabled(this));
|
routeServiceEnabled.setChecked(OsmandSettings.getServiceOffEnabled(prefs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
} else if (preference == routerPreference) {
|
} else if (preference == routerPreference) {
|
||||||
|
@ -472,8 +472,8 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference
|
||||||
if (summary.lastIndexOf(':') != -1) {
|
if (summary.lastIndexOf(':') != -1) {
|
||||||
summary = summary.substring(0, summary.lastIndexOf(':') + 1);
|
summary = summary.substring(0, summary.lastIndexOf(':') + 1);
|
||||||
}
|
}
|
||||||
summary += " " + (OsmandSettings.isUsingMapVectorData(this) ? getString(R.string.vector_data) : //$NON-NLS-1$
|
summary += " " + (OsmandSettings.isUsingMapVectorData(prefs) ? getString(R.string.vector_data) : //$NON-NLS-1$
|
||||||
OsmandSettings.getMapTileSourceName(this));
|
OsmandSettings.getMapTileSourceName(prefs));
|
||||||
tileSourcePreference.setSummary(summary);
|
tileSourcePreference.setSummary(summary);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -19,6 +19,7 @@ import net.osmand.osm.Way;
|
||||||
import android.app.Activity;
|
import android.app.Activity;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.view.Window;
|
import android.view.Window;
|
||||||
|
@ -176,7 +177,7 @@ public class SearchAddressActivity extends Activity {
|
||||||
LatLon l = null;
|
LatLon l = null;
|
||||||
String historyName = null;
|
String historyName = null;
|
||||||
int zoom = 12;
|
int zoom = 12;
|
||||||
boolean en = OsmandSettings.usingEnglishNames(this);
|
boolean en = OsmandSettings.usingEnglishNames(OsmandSettings.getPrefs(this));
|
||||||
if (street2 != null && street != null) {
|
if (street2 != null && street != null) {
|
||||||
region.preloadWayNodes(street2);
|
region.preloadWayNodes(street2);
|
||||||
region.preloadWayNodes(street);
|
region.preloadWayNodes(street);
|
||||||
|
@ -296,27 +297,28 @@ public class SearchAddressActivity extends Activity {
|
||||||
}
|
}
|
||||||
|
|
||||||
public void loadData(){
|
public void loadData(){
|
||||||
|
SharedPreferences prefs = OsmandSettings.getPrefs(this);
|
||||||
if (region != null) {
|
if (region != null) {
|
||||||
if(region.useEnglishNames() != OsmandSettings.usingEnglishNames(this)){
|
if(region.useEnglishNames() != OsmandSettings.usingEnglishNames(prefs)){
|
||||||
region.setUseEnglishNames(OsmandSettings.usingEnglishNames(this));
|
region.setUseEnglishNames(OsmandSettings.usingEnglishNames(prefs));
|
||||||
}
|
}
|
||||||
String postcodeStr = OsmandSettings.getLastSearchedPostcode(this);
|
String postcodeStr = OsmandSettings.getLastSearchedPostcode(prefs);
|
||||||
if(postcodeStr != null){
|
if(postcodeStr != null){
|
||||||
postcode = region.getPostcode(postcodeStr);
|
postcode = region.getPostcode(postcodeStr);
|
||||||
} else {
|
} else {
|
||||||
city = region.getCityById(OsmandSettings.getLastSearchedCity(SearchAddressActivity.this));
|
city = region.getCityById(OsmandSettings.getLastSearchedCity(prefs));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (postcode != null || city != null) {
|
if (postcode != null || city != null) {
|
||||||
MapObject o = postcode == null ? city : postcode;
|
MapObject o = postcode == null ? city : postcode;
|
||||||
street = region.getStreetByName(o, OsmandSettings.getLastSearchedStreet(SearchAddressActivity.this));
|
street = region.getStreetByName(o, OsmandSettings.getLastSearchedStreet(prefs));
|
||||||
if (street != null) {
|
if (street != null) {
|
||||||
String str = OsmandSettings.getLastSearchedIntersectedStreet(SearchAddressActivity.this);
|
String str = OsmandSettings.getLastSearchedIntersectedStreet(prefs);
|
||||||
radioBuilding = str == null;
|
radioBuilding = str == null;
|
||||||
if(str != null){
|
if(str != null){
|
||||||
street2 = region.getStreetByName(o, str);
|
street2 = region.getStreetByName(o, str);
|
||||||
} else {
|
} else {
|
||||||
building = region.getBuildingByName(street, OsmandSettings.getLastSearchedBuilding(SearchAddressActivity.this));
|
building = region.getBuildingByName(street, OsmandSettings.getLastSearchedBuilding(prefs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,16 +351,16 @@ public class SearchAddressActivity extends Activity {
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
|
SharedPreferences prefs = OsmandSettings.getPrefs(this);
|
||||||
region = null;
|
region = null;
|
||||||
String lastSearchedRegion = OsmandSettings.getLastSearchedRegion(SearchAddressActivity.this);
|
String lastSearchedRegion = OsmandSettings.getLastSearchedRegion(prefs);
|
||||||
region = ((OsmandApplication)getApplication()).getResourceManager().getRegionRepository(lastSearchedRegion);
|
region = ((OsmandApplication)getApplication()).getResourceManager().getRegionRepository(lastSearchedRegion);
|
||||||
String progressMsg = null;
|
String progressMsg = null;
|
||||||
// try to determine whether progress dialog & new thread needed
|
// try to determine whether progress dialog & new thread needed
|
||||||
|
|
||||||
if (region != null) {
|
if (region != null) {
|
||||||
Long cityId = OsmandSettings.getLastSearchedCity(this);
|
Long cityId = OsmandSettings.getLastSearchedCity(prefs);
|
||||||
String postcode = OsmandSettings.getLastSearchedPostcode(this);
|
String postcode = OsmandSettings.getLastSearchedPostcode(prefs);
|
||||||
if (!region.areCitiesPreloaded()) {
|
if (!region.areCitiesPreloaded()) {
|
||||||
progressMsg = getString(R.string.loading_cities);
|
progressMsg = getString(R.string.loading_cities);
|
||||||
} else if (postcode != null && !region.arePostcodesPreloaded()) {
|
} else if (postcode != null && !region.arePostcodesPreloaded()) {
|
||||||
|
@ -367,7 +369,7 @@ public class SearchAddressActivity extends Activity {
|
||||||
progressMsg = getString(R.string.loading_streets_buildings);
|
progressMsg = getString(R.string.loading_streets_buildings);
|
||||||
} else if (postcode != null && region.getPostcode(postcode) != null && region.getPostcode(postcode).isEmptyWithStreets()) {
|
} else if (postcode != null && region.getPostcode(postcode) != null && region.getPostcode(postcode).isEmptyWithStreets()) {
|
||||||
progressMsg = getString(R.string.loading_streets_buildings);
|
progressMsg = getString(R.string.loading_streets_buildings);
|
||||||
} else if (OsmandSettings.usingEnglishNames(this) != region.useEnglishNames()) {
|
} else if (OsmandSettings.usingEnglishNames(prefs) != region.useEnglishNames()) {
|
||||||
progressMsg = getString(R.string.converting_names);
|
progressMsg = getString(R.string.converting_names);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -64,7 +64,7 @@ public class SearchAddressOnlineActivity extends ListActivity {
|
||||||
searchPlaces(((EditText) findViewById(R.id.SearchText)).getText().toString());
|
searchPlaces(((EditText) findViewById(R.id.SearchText)).getText().toString());
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
location = OsmandSettings.getLastKnownMapLocation(this);
|
location = OsmandSettings.getLastKnownMapLocation(OsmandSettings.getPrefs(this));
|
||||||
}
|
}
|
||||||
|
|
||||||
protected void searchPlaces(final String search) {
|
protected void searchPlaces(final String search) {
|
||||||
|
|
|
@ -11,6 +11,7 @@ import net.osmand.data.Building;
|
||||||
import net.osmand.data.City;
|
import net.osmand.data.City;
|
||||||
import net.osmand.data.PostCode;
|
import net.osmand.data.PostCode;
|
||||||
import net.osmand.data.Street;
|
import net.osmand.data.Street;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
@ -22,14 +23,15 @@ public class SearchBuildingByNameActivity extends SearchByNameAbstractActivity<B
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
region = ((OsmandApplication)getApplication()).getResourceManager().getRegionRepository(OsmandSettings.getLastSearchedRegion(this));
|
SharedPreferences prefs = OsmandSettings.getPrefs(this);
|
||||||
|
region = ((OsmandApplication)getApplication()).getResourceManager().getRegionRepository(OsmandSettings.getLastSearchedRegion(prefs));
|
||||||
if(region != null){
|
if(region != null){
|
||||||
postcode = region.getPostcode(OsmandSettings.getLastSearchedPostcode(this));
|
postcode = region.getPostcode(OsmandSettings.getLastSearchedPostcode(prefs));
|
||||||
city = region.getCityById(OsmandSettings.getLastSearchedCity(this));
|
city = region.getCityById(OsmandSettings.getLastSearchedCity(prefs));
|
||||||
if(postcode != null){
|
if(postcode != null){
|
||||||
street = region.getStreetByName(postcode, OsmandSettings.getLastSearchedStreet(this));
|
street = region.getStreetByName(postcode, OsmandSettings.getLastSearchedStreet(prefs));
|
||||||
} else if(city != null){
|
} else if(city != null){
|
||||||
street = region.getStreetByName(city, OsmandSettings.getLastSearchedStreet(this));
|
street = region.getStreetByName(city, OsmandSettings.getLastSearchedStreet(prefs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
|
@ -21,8 +21,8 @@ public class SearchCityByNameActivity extends SearchByNameAbstractActivity<MapOb
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
region = ((OsmandApplication)getApplication()).getResourceManager().getRegionRepository(OsmandSettings.getLastSearchedRegion(this));
|
region = ((OsmandApplication)getApplication()).getResourceManager().getRegionRepository(OsmandSettings.getLastSearchedRegion(OsmandSettings.getPrefs(this)));
|
||||||
location = OsmandSettings.getLastKnownMapLocation(this);
|
location = OsmandSettings.getLastKnownMapLocation(OsmandSettings.getPrefs(this));
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
((TextView)findViewById(R.id.Label)).setText(R.string.incremental_search_city);
|
((TextView)findViewById(R.id.Label)).setText(R.string.incremental_search_city);
|
||||||
}
|
}
|
||||||
|
|
|
@ -32,7 +32,7 @@ public class SearchHistoryActivity extends ListActivity {
|
||||||
lv.setId(android.R.id.list);
|
lv.setId(android.R.id.list);
|
||||||
|
|
||||||
setContentView(lv);
|
setContentView(lv);
|
||||||
location = OsmandSettings.getLastKnownMapLocation(this);
|
location = OsmandSettings.getLastKnownMapLocation(OsmandSettings.getPrefs(this));
|
||||||
helper = SearchHistoryHelper.getInstance();
|
helper = SearchHistoryHelper.getInstance();
|
||||||
|
|
||||||
|
|
||||||
|
|
|
@ -22,6 +22,7 @@ import net.osmand.osm.OpeningHoursParser;
|
||||||
import net.osmand.osm.OpeningHoursParser.OpeningHoursRule;
|
import net.osmand.osm.OpeningHoursParser.OpeningHoursRule;
|
||||||
import android.app.ListActivity;
|
import android.app.ListActivity;
|
||||||
import android.content.Intent;
|
import android.content.Intent;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.content.pm.ActivityInfo;
|
import android.content.pm.ActivityInfo;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
@ -91,6 +92,7 @@ public class SearchPOIActivity extends ListActivity implements SensorEventListen
|
||||||
private String currentLocationProvider = null;
|
private String currentLocationProvider = null;
|
||||||
private boolean sensorRegistered = false;
|
private boolean sensorRegistered = false;
|
||||||
private Handler uiHandler;
|
private Handler uiHandler;
|
||||||
|
private SharedPreferences settings;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -110,6 +112,8 @@ public class SearchPOIActivity extends ListActivity implements SensorEventListen
|
||||||
searchFilterLayout = findViewById(R.id.SearchFilterLayout);
|
searchFilterLayout = findViewById(R.id.SearchFilterLayout);
|
||||||
showOnMap = (Button) findViewById(R.id.ShowOnMap);
|
showOnMap = (Button) findViewById(R.id.ShowOnMap);
|
||||||
|
|
||||||
|
settings = OsmandSettings.getPrefs(this);
|
||||||
|
|
||||||
searchPOILevel.setOnClickListener(new OnClickListener() {
|
searchPOILevel.setOnClickListener(new OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(View v) {
|
public void onClick(View v) {
|
||||||
|
@ -209,7 +213,7 @@ public class SearchPOIActivity extends ListActivity implements SensorEventListen
|
||||||
@Override
|
@Override
|
||||||
public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) {
|
public boolean onItemLongClick(AdapterView<?> av, View v, int pos, long id) {
|
||||||
Amenity amenity = ((AmenityAdapter) getListAdapter()).getItem(pos);
|
Amenity amenity = ((AmenityAdapter) getListAdapter()).getItem(pos);
|
||||||
String format = amenity.getSimpleFormat(OsmandSettings.usingEnglishNames(v.getContext()));
|
String format = amenity.getSimpleFormat(OsmandSettings.usingEnglishNames(settings));
|
||||||
if (amenity.getOpeningHours() != null) {
|
if (amenity.getOpeningHours() != null) {
|
||||||
format += "\n"+getString(R.string.opening_hours) + " : " + amenity.getOpeningHours(); //$NON-NLS-1$ //$NON-NLS-2$
|
format += "\n"+getString(R.string.opening_hours) + " : " + amenity.getOpeningHours(); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
@ -448,10 +452,10 @@ public class SearchPOIActivity extends ListActivity implements SensorEventListen
|
||||||
OsmandSettings.setPoiFilterForMap(SearchPOIActivity.this, filter.getFilterId());
|
OsmandSettings.setPoiFilterForMap(SearchPOIActivity.this, filter.getFilterId());
|
||||||
OsmandSettings.setShowPoiOverMap(SearchPOIActivity.this, true);
|
OsmandSettings.setShowPoiOverMap(SearchPOIActivity.this, true);
|
||||||
}
|
}
|
||||||
int z = OsmandSettings.getLastKnownMapZoom(this);
|
int z = OsmandSettings.getLastKnownMapZoom(settings);
|
||||||
Amenity amenity = ((AmenityAdapter) getListAdapter()).getItem(position);
|
Amenity amenity = ((AmenityAdapter) getListAdapter()).getItem(position);
|
||||||
OsmandSettings.setMapLocationToShow(this, amenity.getLocation().getLatitude(), amenity.getLocation().getLongitude(),
|
OsmandSettings.setMapLocationToShow(this, amenity.getLocation().getLatitude(), amenity.getLocation().getLongitude(),
|
||||||
Math.max(16, z), getString(R.string.poi)+" : " + amenity.getSimpleFormat(OsmandSettings.usingEnglishNames(this))); //$NON-NLS-1$
|
Math.max(16, z), getString(R.string.poi)+" : " + amenity.getSimpleFormat(OsmandSettings.usingEnglishNames(settings))); //$NON-NLS-1$
|
||||||
Intent newIntent = new Intent(SearchPOIActivity.this, MapActivity.class);
|
Intent newIntent = new Intent(SearchPOIActivity.this, MapActivity.class);
|
||||||
startActivity(newIntent);
|
startActivity(newIntent);
|
||||||
}
|
}
|
||||||
|
@ -559,7 +563,7 @@ public class SearchPOIActivity extends ListActivity implements SensorEventListen
|
||||||
Location.distanceBetween(l.getLatitude(), l.getLongitude(), location.getLatitude(), location.getLongitude(), mes);
|
Location.distanceBetween(l.getLatitude(), l.getLongitude(), location.getLatitude(), location.getLongitude(), mes);
|
||||||
}
|
}
|
||||||
|
|
||||||
String str = amenity.getStringWithoutType(OsmandSettings.usingEnglishNames(SearchPOIActivity.this));
|
String str = amenity.getStringWithoutType(OsmandSettings.usingEnglishNames(settings));
|
||||||
label.setText(str);
|
label.setText(str);
|
||||||
int opened = -1;
|
int opened = -1;
|
||||||
if (amenity.getOpeningHours() != null) {
|
if (amenity.getOpeningHours() != null) {
|
||||||
|
|
|
@ -55,7 +55,7 @@ public class SearchPoiFilterActivity extends ListActivity {
|
||||||
latitude = extras.getDouble(SEARCH_LAT);
|
latitude = extras.getDouble(SEARCH_LAT);
|
||||||
longitude = extras.getDouble(SEARCH_LON);
|
longitude = extras.getDouble(SEARCH_LON);
|
||||||
} else {
|
} else {
|
||||||
LatLon loc = OsmandSettings.getLastKnownMapLocation(this);
|
LatLon loc = OsmandSettings.getLastKnownMapLocation(OsmandSettings.getPrefs(this));
|
||||||
latitude = loc.getLatitude();
|
latitude = loc.getLatitude();
|
||||||
longitude = loc.getLongitude();
|
longitude = loc.getLongitude();
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,6 +11,7 @@ import net.osmand.data.City;
|
||||||
import net.osmand.data.PostCode;
|
import net.osmand.data.PostCode;
|
||||||
import net.osmand.data.Street;
|
import net.osmand.data.Street;
|
||||||
import android.app.ProgressDialog;
|
import android.app.ProgressDialog;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
@ -24,17 +25,18 @@ public class SearchStreet2ByNameActivity extends SearchByNameAbstractActivity<St
|
||||||
private ProgressDialog progressDlg;
|
private ProgressDialog progressDlg;
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
region = ((OsmandApplication)getApplication()).getResourceManager().getRegionRepository(OsmandSettings.getLastSearchedRegion(this));
|
SharedPreferences prefs = OsmandSettings.getPrefs(this);
|
||||||
|
region = ((OsmandApplication)getApplication()).getResourceManager().getRegionRepository(OsmandSettings.getLastSearchedRegion(prefs));
|
||||||
if(region != null){
|
if(region != null){
|
||||||
postcode = region.getPostcode(OsmandSettings.getLastSearchedPostcode(this));
|
postcode = region.getPostcode(OsmandSettings.getLastSearchedPostcode(prefs));
|
||||||
city = region.getCityById(OsmandSettings.getLastSearchedCity(this));
|
city = region.getCityById(OsmandSettings.getLastSearchedCity(prefs));
|
||||||
if(postcode != null){
|
if(postcode != null){
|
||||||
street1 = region.getStreetByName(postcode, (OsmandSettings.getLastSearchedStreet(this)));
|
street1 = region.getStreetByName(postcode, (OsmandSettings.getLastSearchedStreet(prefs)));
|
||||||
if(street1 != null){
|
if(street1 != null){
|
||||||
city = street1.getCity();
|
city = street1.getCity();
|
||||||
}
|
}
|
||||||
} else if(city != null){
|
} else if(city != null){
|
||||||
street1 = region.getStreetByName(city, (OsmandSettings.getLastSearchedStreet(this)));
|
street1 = region.getStreetByName(city, (OsmandSettings.getLastSearchedStreet(prefs)));
|
||||||
}
|
}
|
||||||
if(city != null){
|
if(city != null){
|
||||||
startLoadDataInThread(getString(R.string.loading_streets));
|
startLoadDataInThread(getString(R.string.loading_streets));
|
||||||
|
|
|
@ -10,6 +10,7 @@ import net.osmand.activities.OsmandApplication;
|
||||||
import net.osmand.data.City;
|
import net.osmand.data.City;
|
||||||
import net.osmand.data.PostCode;
|
import net.osmand.data.PostCode;
|
||||||
import net.osmand.data.Street;
|
import net.osmand.data.Street;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
|
@ -19,11 +20,12 @@ public class SearchStreetByNameActivity extends SearchByNameAbstractActivity<Str
|
||||||
private PostCode postcode;
|
private PostCode postcode;
|
||||||
@Override
|
@Override
|
||||||
protected void onCreate(Bundle savedInstanceState) {
|
protected void onCreate(Bundle savedInstanceState) {
|
||||||
region = ((OsmandApplication)getApplication()).getResourceManager().getRegionRepository(OsmandSettings.getLastSearchedRegion(this));
|
SharedPreferences prefs = OsmandSettings.getPrefs(this);
|
||||||
|
region = ((OsmandApplication)getApplication()).getResourceManager().getRegionRepository(OsmandSettings.getLastSearchedRegion(prefs));
|
||||||
if(region != null){
|
if(region != null){
|
||||||
postcode = region.getPostcode(OsmandSettings.getLastSearchedPostcode(this));
|
postcode = region.getPostcode(OsmandSettings.getLastSearchedPostcode(prefs));
|
||||||
if (postcode == null) {
|
if (postcode == null) {
|
||||||
city = region.getCityById(OsmandSettings.getLastSearchedCity(this));
|
city = region.getCityById(OsmandSettings.getLastSearchedCity(prefs));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
super.onCreate(savedInstanceState);
|
super.onCreate(savedInstanceState);
|
||||||
|
|
|
@ -23,6 +23,7 @@ import android.app.AlertDialog;
|
||||||
import android.app.ListActivity;
|
import android.app.ListActivity;
|
||||||
import android.app.AlertDialog.Builder;
|
import android.app.AlertDialog.Builder;
|
||||||
import android.content.DialogInterface;
|
import android.content.DialogInterface;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Typeface;
|
import android.graphics.Typeface;
|
||||||
import android.os.Bundle;
|
import android.os.Bundle;
|
||||||
import android.view.LayoutInflater;
|
import android.view.LayoutInflater;
|
||||||
|
@ -65,6 +66,7 @@ public class SearchTransportActivity extends ListActivity {
|
||||||
|
|
||||||
private TransportStopAdapter stopsAdapter;
|
private TransportStopAdapter stopsAdapter;
|
||||||
private TransportRouteAdapter intermediateListAdapater;
|
private TransportRouteAdapter intermediateListAdapater;
|
||||||
|
private SharedPreferences settings;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
@ -72,11 +74,12 @@ public class SearchTransportActivity extends ListActivity {
|
||||||
@Override
|
@Override
|
||||||
public void onCreate(Bundle icicle) {
|
public void onCreate(Bundle icicle) {
|
||||||
super.onCreate(icicle);
|
super.onCreate(icicle);
|
||||||
|
settings = OsmandSettings.getPrefs(this);
|
||||||
Bundle extras = getIntent().getExtras();
|
Bundle extras = getIntent().getExtras();
|
||||||
if(extras != null && extras.containsKey(LAT_KEY) && extras.containsKey(LON_KEY)){
|
if(extras != null && extras.containsKey(LAT_KEY) && extras.containsKey(LON_KEY)){
|
||||||
lastKnownMapLocation = new LatLon(extras.getDouble(LAT_KEY), extras.getDouble(LON_KEY));
|
lastKnownMapLocation = new LatLon(extras.getDouble(LAT_KEY), extras.getDouble(LON_KEY));
|
||||||
} else {
|
} else {
|
||||||
lastKnownMapLocation = OsmandSettings.getLastKnownMapLocation(this);
|
lastKnownMapLocation = OsmandSettings.getLastKnownMapLocation(settings);
|
||||||
}
|
}
|
||||||
setContentView(R.layout.search_transport);
|
setContentView(R.layout.search_transport);
|
||||||
searchTransportLevel = (Button) findViewById(R.id.SearchTransportLevelButton);
|
searchTransportLevel = (Button) findViewById(R.id.SearchTransportLevelButton);
|
||||||
|
@ -129,8 +132,9 @@ public class SearchTransportActivity extends ListActivity {
|
||||||
@Override
|
@Override
|
||||||
protected void onResume() {
|
protected void onResume() {
|
||||||
super.onResume();
|
super.onResume();
|
||||||
if(!Algoritms.objectEquals(OsmandSettings.getPointToNavigate(this), this.destinationLocation)){
|
LatLon pointToNavigate = OsmandSettings.getPointToNavigate(OsmandSettings.getPrefs(this));
|
||||||
destinationLocation = OsmandSettings.getPointToNavigate(this);
|
if(!Algoritms.objectEquals(pointToNavigate, this.destinationLocation)){
|
||||||
|
destinationLocation = pointToNavigate;
|
||||||
selectedDestinationLocation = destinationLocation;
|
selectedDestinationLocation = destinationLocation;
|
||||||
searchTransport();
|
searchTransport();
|
||||||
}
|
}
|
||||||
|
@ -261,7 +265,7 @@ public class SearchTransportActivity extends ListActivity {
|
||||||
} else {
|
} else {
|
||||||
n.append(". "); //$NON-NLS-1$
|
n.append(". "); //$NON-NLS-1$
|
||||||
}
|
}
|
||||||
String name = st.getName(OsmandSettings.usingEnglishNames(this));
|
String name = st.getName(OsmandSettings.usingEnglishNames(settings));
|
||||||
if(locationToGo != null){
|
if(locationToGo != null){
|
||||||
n.append(name).append(" - ["); //$NON-NLS-1$
|
n.append(name).append(" - ["); //$NON-NLS-1$
|
||||||
n.append(MapUtils.getFormattedDistance((int) MapUtils.getDistance(locationToGo, st.getLocation()))).append("]"); //$NON-NLS-1$
|
n.append(MapUtils.getFormattedDistance((int) MapUtils.getDistance(locationToGo, st.getLocation()))).append("]"); //$NON-NLS-1$
|
||||||
|
@ -319,7 +323,7 @@ public class SearchTransportActivity extends ListActivity {
|
||||||
public void showContextMenuOnRoute(final RouteInfoLocation route, final int routeInd) {
|
public void showContextMenuOnRoute(final RouteInfoLocation route, final int routeInd) {
|
||||||
Builder b = new AlertDialog.Builder(this);
|
Builder b = new AlertDialog.Builder(this);
|
||||||
List<TransportStop> stops = route.getDirection() ? route.getRoute().getForwardStops() : route.getRoute().getBackwardStops();
|
List<TransportStop> stops = route.getDirection() ? route.getRoute().getForwardStops() : route.getRoute().getBackwardStops();
|
||||||
boolean en = OsmandSettings.usingEnglishNames(this);
|
boolean en = OsmandSettings.usingEnglishNames(settings);
|
||||||
|
|
||||||
String info = getInformation(route, stops, routeInd, false);
|
String info = getInformation(route, stops, routeInd, false);
|
||||||
StringBuilder txt = new StringBuilder(300);
|
StringBuilder txt = new StringBuilder(300);
|
||||||
|
@ -455,7 +459,7 @@ public class SearchTransportActivity extends ListActivity {
|
||||||
} else {
|
} else {
|
||||||
labelW.append(getString(R.string.transport_search_none));
|
labelW.append(getString(R.string.transport_search_none));
|
||||||
}
|
}
|
||||||
labelW.append("]\n").append(route.getName(OsmandSettings.usingEnglishNames(SearchTransportActivity.this))); //$NON-NLS-1$
|
labelW.append("]\n").append(route.getName(OsmandSettings.usingEnglishNames(settings))); //$NON-NLS-1$
|
||||||
label.setText(labelW.toString());
|
label.setText(labelW.toString());
|
||||||
// TODO icons
|
// TODO icons
|
||||||
if (locationToGo != null && stop.getDistToLocation() < 400) {
|
if (locationToGo != null && stop.getDistToLocation() < 400) {
|
||||||
|
@ -527,7 +531,7 @@ public class SearchTransportActivity extends ListActivity {
|
||||||
icon.setVisibility(View.VISIBLE);
|
icon.setVisibility(View.VISIBLE);
|
||||||
StringBuilder labelW = new StringBuilder(150);
|
StringBuilder labelW = new StringBuilder(150);
|
||||||
labelW.append(route.getType()).append(" ").append(route.getRef()); //$NON-NLS-1$
|
labelW.append(route.getType()).append(" ").append(route.getRef()); //$NON-NLS-1$
|
||||||
boolean en = OsmandSettings.usingEnglishNames(SearchTransportActivity.this);
|
boolean en = OsmandSettings.usingEnglishNames(settings);
|
||||||
labelW.append(" : ").append(info.getStart().getName(en)).append(" - ").append(info.getStop().getName(en)); //$NON-NLS-1$ //$NON-NLS-2$
|
labelW.append(" : ").append(info.getStart().getName(en)).append(" - ").append(info.getStop().getName(en)); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
// additional information if route is calculated
|
// additional information if route is calculated
|
||||||
if (currentRouteLocation == -1) {
|
if (currentRouteLocation == -1) {
|
||||||
|
|
|
@ -411,7 +411,7 @@ public class MapRenderRepositories {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
Bitmap bmp = renderer.generateNewBitmap(currentRenderingContext, cObjects, OsmandSettings.usingEnglishNames(context));
|
Bitmap bmp = renderer.generateNewBitmap(currentRenderingContext, cObjects, OsmandSettings.usingEnglishNames(OsmandSettings.getPrefs(context)));
|
||||||
if(checkWhetherInterrupted()){
|
if(checkWhetherInterrupted()){
|
||||||
currentRenderingContext = null;
|
currentRenderingContext = null;
|
||||||
return;
|
return;
|
||||||
|
|
|
@ -172,7 +172,7 @@ public class MapInfoLayer implements OsmandMapLayer {
|
||||||
pathTransform.postTranslate(boundsForMiniRoute.left, boundsForMiniRoute.top);
|
pathTransform.postTranslate(boundsForMiniRoute.left, boundsForMiniRoute.top);
|
||||||
|
|
||||||
|
|
||||||
showArrivalTime = OsmandSettings.isShowingArrivalTime(view.getContext());
|
showArrivalTime = OsmandSettings.isShowingArrivalTime(view.getSettings());
|
||||||
}
|
}
|
||||||
|
|
||||||
private void scaleRect(RectF r){
|
private void scaleRect(RectF r){
|
||||||
|
@ -574,7 +574,7 @@ public class MapInfoLayer implements OsmandMapLayer {
|
||||||
}
|
}
|
||||||
if(cachedDistString != null && boundsForDist.contains(point.x, point.y)){
|
if(cachedDistString != null && boundsForDist.contains(point.x, point.y)){
|
||||||
AnimateDraggingMapThread thread = view.getAnimatedDraggingThread();
|
AnimateDraggingMapThread thread = view.getAnimatedDraggingThread();
|
||||||
LatLon pointToNavigate = OsmandSettings.getPointToNavigate(view.getContext());
|
LatLon pointToNavigate = OsmandSettings.getPointToNavigate(view.getSettings());
|
||||||
if(pointToNavigate != null){
|
if(pointToNavigate != null){
|
||||||
int fZoom = view.getZoom() < 15 ? 15 : view.getZoom();
|
int fZoom = view.getZoom() < 15 ? 15 : view.getZoom();
|
||||||
thread.startMoving(view.getLatitude(), view.getLongitude(), pointToNavigate.getLatitude(), pointToNavigate.getLongitude(),
|
thread.startMoving(view.getLatitude(), view.getLongitude(), pointToNavigate.getLatitude(), pointToNavigate.getLongitude(),
|
||||||
|
|
|
@ -319,7 +319,7 @@ public class OsmBugsLayer implements OsmandMapLayer, ContextMenuLayer.IContextMe
|
||||||
builder.setTitle(R.string.osb_add_dialog_title);
|
builder.setTitle(R.string.osb_add_dialog_title);
|
||||||
final View view = layoutInflater.inflate(R.layout.open_bug, null);
|
final View view = layoutInflater.inflate(R.layout.open_bug, null);
|
||||||
builder.setView(view);
|
builder.setView(view);
|
||||||
((EditText)view.findViewById(R.id.AuthorName)).setText(OsmandSettings.getUserNameForOsmBug(ctx));
|
((EditText)view.findViewById(R.id.AuthorName)).setText(OsmandSettings.getUserNameForOsmBug(OsmandSettings.getPrefs(ctx)));
|
||||||
builder.setNegativeButton(R.string.default_buttons_cancel, null);
|
builder.setNegativeButton(R.string.default_buttons_cancel, null);
|
||||||
builder.setPositiveButton(R.string.default_buttons_add, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.default_buttons_add, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
@ -349,7 +349,7 @@ public class OsmBugsLayer implements OsmandMapLayer, ContextMenuLayer.IContextMe
|
||||||
builder.setTitle(R.string.osb_comment_dialog_title);
|
builder.setTitle(R.string.osb_comment_dialog_title);
|
||||||
final View view = layoutInflater.inflate(R.layout.open_bug, null);
|
final View view = layoutInflater.inflate(R.layout.open_bug, null);
|
||||||
builder.setView(view);
|
builder.setView(view);
|
||||||
((EditText)view.findViewById(R.id.AuthorName)).setText(OsmandSettings.getUserNameForOsmBug(ctx));
|
((EditText)view.findViewById(R.id.AuthorName)).setText(OsmandSettings.getUserNameForOsmBug(OsmandSettings.getPrefs(ctx)));
|
||||||
builder.setNegativeButton(R.string.default_buttons_cancel, null);
|
builder.setNegativeButton(R.string.default_buttons_cancel, null);
|
||||||
builder.setPositiveButton(R.string.osb_comment_dialog_add_button, new DialogInterface.OnClickListener() {
|
builder.setPositiveButton(R.string.osb_comment_dialog_add_button, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
|
@ -22,6 +22,7 @@ import net.osmand.views.MultiTouchSupport.MultiTouchZoomListener;
|
||||||
import org.apache.commons.logging.Log;
|
import org.apache.commons.logging.Log;
|
||||||
|
|
||||||
import android.content.Context;
|
import android.content.Context;
|
||||||
|
import android.content.SharedPreferences;
|
||||||
import android.graphics.Bitmap;
|
import android.graphics.Bitmap;
|
||||||
import android.graphics.Canvas;
|
import android.graphics.Canvas;
|
||||||
import android.graphics.Color;
|
import android.graphics.Color;
|
||||||
|
@ -452,13 +453,21 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
||||||
protected Rect boundsRect = new Rect();
|
protected Rect boundsRect = new Rect();
|
||||||
protected RectF bitmapToDraw = new RectF();
|
protected RectF bitmapToDraw = new RectF();
|
||||||
protected Rect bitmapToZoom = new Rect();
|
protected Rect bitmapToZoom = new Rect();
|
||||||
|
protected SharedPreferences settings = null;
|
||||||
|
|
||||||
|
public SharedPreferences getSettings(){
|
||||||
|
if(settings == null){
|
||||||
|
settings = OsmandSettings.getPrefs(getContext());
|
||||||
|
}
|
||||||
|
return settings;
|
||||||
|
}
|
||||||
|
|
||||||
private void refreshMapInternal() {
|
private void refreshMapInternal() {
|
||||||
if (handler.hasMessages(1)) {
|
if (handler.hasMessages(1)) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
boolean useInternet = OsmandSettings.isUsingInternetToDownloadTiles(getContext());
|
boolean useInternet = OsmandSettings.isUsingInternetToDownloadTiles(getSettings());
|
||||||
if (useInternet) {
|
if (useInternet) {
|
||||||
MapTileDownloader.getInstance().refuseAllPreviousRequests();
|
MapTileDownloader.getInstance().refuseAllPreviousRequests();
|
||||||
}
|
}
|
||||||
|
@ -492,7 +501,7 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall
|
||||||
ResourceManager mgr = getApplication().getResourceManager();
|
ResourceManager mgr = getApplication().getResourceManager();
|
||||||
useInternet = useInternet && OsmandSettings.isInternetConnectionAvailable(getContext())
|
useInternet = useInternet && OsmandSettings.isInternetConnectionAvailable(getContext())
|
||||||
&& map.couldBeDownloadedFromInternet();
|
&& map.couldBeDownloadedFromInternet();
|
||||||
int maxLevel = Math.min(OsmandSettings.getMaximumLevelToDownloadTile(getContext()), map.getMaximumZoomSupported());
|
int maxLevel = Math.min(OsmandSettings.getMaximumLevelToDownloadTile(getSettings()), map.getMaximumZoomSupported());
|
||||||
|
|
||||||
|
|
||||||
for (int i = 0; i < width; i++) {
|
for (int i = 0; i < width; i++) {
|
||||||
|
|
|
@ -76,7 +76,7 @@ public class POIMapLayer implements OsmandMapLayer, ContextMenuLayer.IContextMen
|
||||||
public boolean onTouchEvent(PointF point) {
|
public boolean onTouchEvent(PointF point) {
|
||||||
Amenity n = getAmenityFromPoint(point);
|
Amenity n = getAmenityFromPoint(point);
|
||||||
if(n != null){
|
if(n != null){
|
||||||
String format = n.getSimpleFormat(OsmandSettings.usingEnglishNames(view.getContext()));
|
String format = n.getSimpleFormat(OsmandSettings.usingEnglishNames(view.getSettings()));
|
||||||
if(n.getOpeningHours() != null){
|
if(n.getOpeningHours() != null){
|
||||||
format += "\n" + view.getContext().getString(R.string.opening_hours) +" : "+ n.getOpeningHours(); //$NON-NLS-1$ //$NON-NLS-2$
|
format += "\n" + view.getContext().getString(R.string.opening_hours) +" : "+ n.getOpeningHours(); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
}
|
}
|
||||||
|
@ -164,7 +164,7 @@ public class POIMapLayer implements OsmandMapLayer, ContextMenuLayer.IContextMen
|
||||||
@Override
|
@Override
|
||||||
public String getObjectDescription(Object o) {
|
public String getObjectDescription(Object o) {
|
||||||
if(o instanceof Amenity){
|
if(o instanceof Amenity){
|
||||||
return ((Amenity)o).getSimpleFormat(OsmandSettings.usingEnglishNames(view.getContext()));
|
return ((Amenity)o).getSimpleFormat(OsmandSettings.usingEnglishNames(view.getSettings()));
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
|
@ -144,7 +144,7 @@ public class TransportInfoLayer implements OsmandMapLayer {
|
||||||
int x = view.getRotatedMapXForPoint(location.getLatitude(), location.getLongitude());
|
int x = view.getRotatedMapXForPoint(location.getLatitude(), location.getLongitude());
|
||||||
int y = view.getRotatedMapYForPoint(location.getLatitude(), location.getLongitude());
|
int y = view.getRotatedMapYForPoint(location.getLatitude(), location.getLongitude());
|
||||||
if (Math.abs(x - ex) < getRadius() * 3 /2 && Math.abs(y - ey) < getRadius() * 3 /2) {
|
if (Math.abs(x - ex) < getRadius() * 3 /2 && Math.abs(y - ey) < getRadius() * 3 /2) {
|
||||||
Toast.makeText(view.getContext(), st.getName(OsmandSettings.usingEnglishNames(view.getContext())) + " : " + //$NON-NLS-1$
|
Toast.makeText(view.getContext(), st.getName(OsmandSettings.usingEnglishNames(view.getSettings())) + " : " + //$NON-NLS-1$
|
||||||
route.getType() + " " + route.getRef() //$NON-NLS-1$
|
route.getType() + " " + route.getRef() //$NON-NLS-1$
|
||||||
, Toast.LENGTH_LONG).show();
|
, Toast.LENGTH_LONG).show();
|
||||||
return true;
|
return true;
|
||||||
|
|
|
@ -80,14 +80,14 @@ public class TransportStopsLayer implements OsmandMapLayer, ContextMenuLayer.ICo
|
||||||
|
|
||||||
private String getStopDescription(TransportStop n, boolean useName) {
|
private String getStopDescription(TransportStop n, boolean useName) {
|
||||||
StringBuilder text = new StringBuilder(250);
|
StringBuilder text = new StringBuilder(250);
|
||||||
text.append(view.getContext().getString(R.string.transport_Stop)).append(" : ").append(n.getName(OsmandSettings.usingEnglishNames(view.getContext()))); //$NON-NLS-1$
|
text.append(view.getContext().getString(R.string.transport_Stop)).append(" : ").append(n.getName(OsmandSettings.usingEnglishNames(view.getSettings()))); //$NON-NLS-1$
|
||||||
text.append("\n").append(view.getContext().getString(R.string.transport_Routes)).append(" : "); //$NON-NLS-1$ //$NON-NLS-2$
|
text.append("\n").append(view.getContext().getString(R.string.transport_Routes)).append(" : "); //$NON-NLS-1$ //$NON-NLS-2$
|
||||||
List<TransportIndexRepository> reps = view.getApplication().getResourceManager().searchTransportRepositories(n.getLocation().getLatitude(), n.getLocation().getLongitude());
|
List<TransportIndexRepository> reps = view.getApplication().getResourceManager().searchTransportRepositories(n.getLocation().getLatitude(), n.getLocation().getLongitude());
|
||||||
if(!reps.isEmpty()){
|
if(!reps.isEmpty()){
|
||||||
List<String> l;
|
List<String> l;
|
||||||
if(!useName){
|
if(!useName){
|
||||||
l = reps.get(0).getRouteDescriptionsForStop(n, "{1} {0}"); //$NON-NLS-1$
|
l = reps.get(0).getRouteDescriptionsForStop(n, "{1} {0}"); //$NON-NLS-1$
|
||||||
} else if(OsmandSettings.usingEnglishNames(view.getContext())){
|
} else if(OsmandSettings.usingEnglishNames(view.getSettings())){
|
||||||
l = reps.get(0).getRouteDescriptionsForStop(n, "{1} {0} - {3}"); //$NON-NLS-1$
|
l = reps.get(0).getRouteDescriptionsForStop(n, "{1} {0} - {3}"); //$NON-NLS-1$
|
||||||
} else {
|
} else {
|
||||||
l = reps.get(0).getRouteDescriptionsForStop(n, "{1} {0} - {2}"); //$NON-NLS-1$
|
l = reps.get(0).getRouteDescriptionsForStop(n, "{1} {0} - {2}"); //$NON-NLS-1$
|
||||||
|
|
|
@ -77,7 +77,7 @@ public class CommandPlayer {
|
||||||
}
|
}
|
||||||
|
|
||||||
public String init(){
|
public String init(){
|
||||||
String voiceProvider = OsmandSettings.getVoiceProvider(ctx);
|
String voiceProvider = OsmandSettings.getVoiceProvider(OsmandSettings.getPrefs(ctx));
|
||||||
prologSystem.clearTheory();
|
prologSystem.clearTheory();
|
||||||
voiceDir = null;
|
voiceDir = null;
|
||||||
if(voiceProvider != null){
|
if(voiceProvider != null){
|
||||||
|
|
Loading…
Reference in a new issue