diff --git a/DataExtractionOSM/src/com/osmand/Algoritms.java b/DataExtractionOSM/src/com/osmand/Algoritms.java index ecd395709a..00f2822109 100644 --- a/DataExtractionOSM/src/com/osmand/Algoritms.java +++ b/DataExtractionOSM/src/com/osmand/Algoritms.java @@ -65,7 +65,7 @@ public class Algoritms { stream.close(); } } catch(IOException e){ - log.warn("Closing stream warn", e); + log.warn("Closing stream warn", e); //$NON-NLS-1$ } } @@ -74,10 +74,10 @@ public class Algoritms { for(File c : f.listFiles()){ updateAllExistingImgTilesToOsmandFormat(c); } - } else if(f.getName().endsWith(".png") || f.getName().endsWith(".jpg")){ - f.renameTo(new File(f.getAbsolutePath() + ".tile")); - } else if(f.getName().endsWith(".andnav2")) { - f.renameTo(new File(f.getAbsolutePath().substring(0, f.getAbsolutePath().length() - ".andnav2".length()) + ".tile")); + } else if(f.getName().endsWith(".png") || f.getName().endsWith(".jpg")){ //$NON-NLS-1$ //$NON-NLS-2$ + f.renameTo(new File(f.getAbsolutePath() + ".tile")); //$NON-NLS-1$ + } else if(f.getName().endsWith(".andnav2")) { //$NON-NLS-1$ + f.renameTo(new File(f.getAbsolutePath().substring(0, f.getAbsolutePath().length() - ".andnav2".length()) + ".tile")); //$NON-NLS-1$ //$NON-NLS-2$ } } diff --git a/DataExtractionOSM/src/com/osmand/Messages.java b/DataExtractionOSM/src/com/osmand/Messages.java index 1cd6e3e580..940f777dc1 100644 --- a/DataExtractionOSM/src/com/osmand/Messages.java +++ b/DataExtractionOSM/src/com/osmand/Messages.java @@ -4,8 +4,7 @@ import java.util.ResourceBundle; public class Messages { - - private static ResourceBundle bundle = ResourceBundle.getBundle("messages"); + private static ResourceBundle bundle = ResourceBundle.getBundle("messages"); //$NON-NLS-1$ public static String getMessage(String key){ diff --git a/DataExtractionOSM/src/com/osmand/ToDoConstants.java b/DataExtractionOSM/src/com/osmand/ToDoConstants.java index c2d84b8d16..665514df0d 100644 --- a/DataExtractionOSM/src/com/osmand/ToDoConstants.java +++ b/DataExtractionOSM/src/com/osmand/ToDoConstants.java @@ -23,13 +23,15 @@ public class ToDoConstants { // TODO ANDROID // 31. Translation. -// GOT : olga +// DONE : partially olga +// TODO : everywhere put non-nls, check all translated into russian [swing could not be translated] // 42. Revise UI (icons/layouts). Support different devices. Add inactive/focus(!) icon versions. +// Some icons are not fine (as back menu from map - it is blured). // 37. Get rid of exit button (!). Think about when notification should go & how clear resources if it is necessary // DONE : -// TODO : add to app settings preference (Refresh indexes). +// TODO : add to app settings preference (Refresh indexes). // 32. Introduce POI predefined filters (car filter(other-fuel, transportation-car_wash, show-car) and others) // DONE : back end (POI filter object, save, delete, read) @@ -53,15 +55,16 @@ public class ToDoConstants { // That setting should rule all activities that use internet. It should ask whenever internet is used // (would you like to use internet for that operation - if using internet is not checked). // Internet using now for : edit POI osm, show osm bugs layer, download tiles. + // 47. Internet connectivity could be checked before trying to use + // 46. Implement downloading strategy for tiles (do not load 17 zoom, load only 16 for example) - try to scale 15 zoom for 17 (?) // 40. Support simple vector road rendering (require new index file) (?) // 26. Show the whole street on map (when it is chosen in search activity). Possibly extend that story to show layer with streets. (?) - // 46. Implement downloading strategy for tiles (do not load 17 zoom, load only 16 for example) - try to scale 15 zoom for 17 (?) - // 47. Internet connectivity could be checked before trying to use + // BUGS Android + // 6. Improvement postal_code search : replace search city <-> postal_code (show streets for postal_code) // 5. Improvement : Implement caching files existing on FS, implement specific method in RM // Introducing cache of file names that are on disk (creating new File() consumes a lot of memory) - // 6. Improvement postal_code search : replace search city <-> postal_code (show streets for postal_code) // 7. Update map is duplicated in target & in update menu (context menu) diff --git a/DataExtractionOSM/src/com/osmand/Version.java b/DataExtractionOSM/src/com/osmand/Version.java index 4785376c48..6b11db0332 100644 --- a/DataExtractionOSM/src/com/osmand/Version.java +++ b/DataExtractionOSM/src/com/osmand/Version.java @@ -2,9 +2,9 @@ package com.osmand; public class Version { - public static final String APP_VERSION = "0.2"; - public static final String APP_NAME = "OsmAnd"; + public static final String APP_VERSION = "0.2"; //$NON-NLS-1$ + public static final String APP_NAME = "OsmAnd"; //$NON-NLS-1$ - public static final String APP_NAME_VERSION = APP_NAME + " " + APP_VERSION; + public static final String APP_NAME_VERSION = APP_NAME + " " + APP_VERSION; //$NON-NLS-1$ } diff --git a/DataExtractionOSM/src/com/osmand/data/Amenity.java b/DataExtractionOSM/src/com/osmand/data/Amenity.java index 897550fd40..035bc9eb53 100644 --- a/DataExtractionOSM/src/com/osmand/data/Amenity.java +++ b/DataExtractionOSM/src/com/osmand/data/Amenity.java @@ -49,11 +49,11 @@ public class Amenity extends MapObject { } else if (node.getTag(OSMTagKey.HISTORIC) != null) { return node.getTag(OSMTagKey.HISTORIC); } else if (node.getTag(OSMTagKey.INTERNET_ACCESS) != null) { - return "internet_access"; + return "internet_access"; //$NON-NLS-1$ } else if (node.getTag(OSMTagKey.AMENITY) != null) { return node.getTag(OSMTagKey.AMENITY); } - return ""; + return ""; //$NON-NLS-1$ } protected AmenityType getType(Entity node){ @@ -118,7 +118,7 @@ public class Amenity extends MapObject { public String getSimpleFormat(boolean en){ - return AmenityType.toPublicString(type) + " : " + getStringWithoutType(en); + return AmenityType.toPublicString(type) + " : " + getStringWithoutType(en); //$NON-NLS-1$ } public String getStringWithoutType(boolean en){ @@ -126,7 +126,7 @@ public class Amenity extends MapObject { if(n.length() == 0){ return getSubType(); } - return getSubType() + " " + n; + return getSubType() + " " + n; //$NON-NLS-1$ } @Override diff --git a/DataExtractionOSM/src/com/osmand/data/AmenityType.java b/DataExtractionOSM/src/com/osmand/data/AmenityType.java index c6911c15e0..30ea460356 100644 --- a/DataExtractionOSM/src/com/osmand/data/AmenityType.java +++ b/DataExtractionOSM/src/com/osmand/data/AmenityType.java @@ -15,14 +15,14 @@ public enum AmenityType { EDUCATION("amenity_type_education"), // school, ... //$NON-NLS-1$ TRANSPORTATION("amenity_type_transportation"), // car_wash, parking, ... //$NON-NLS-1$ FINANCE("amenity_type_finance"), // bank, atm, ... //$NON-NLS-1$ - HEALTHCARE("amenity_type_healthcare"), // hospital ... - ENTERTAINMENT("amenity_type_entertainment"), // cinema, ... (+! sauna, brothel) - TOURISM("amenity_type_tourism"), // [TAG] hotel, sights, museum .. - HISTORIC("amenity_type_historic"), // [TAG] historic places, monuments (should we unify tourism/historic) - SHOP("amenity_type_shop"), // [TAG] convenience (product), clothes... - LEISURE("amenity_type_leisure"), // [TAG] leisure - SPORT("amenity_type_sport"), // [TAG] sport - OTHER("amenity_type_other"), // grave-yard, police, post-office [+Internet_access] + HEALTHCARE("amenity_type_healthcare"), // hospital ... //$NON-NLS-1$ + ENTERTAINMENT("amenity_type_entertainment"), // cinema, ... (+! sauna, brothel) //$NON-NLS-1$ + TOURISM("amenity_type_tourism"), // [TAG] hotel, sights, museum .. //$NON-NLS-1$ + HISTORIC("amenity_type_historic"), // [TAG] historic places, monuments (should we unify tourism/historic) //$NON-NLS-1$ + SHOP("amenity_type_shop"), // [TAG] convenience (product), clothes... //$NON-NLS-1$ + LEISURE("amenity_type_leisure"), // [TAG] leisure //$NON-NLS-1$ + SPORT("amenity_type_sport"), // [TAG] sport //$NON-NLS-1$ + OTHER("amenity_type_other"), // grave-yard, police, post-office [+Internet_access] //$NON-NLS-1$ ; private String name; @@ -67,247 +67,247 @@ public enum AmenityType { protected static Map amenityMap = new LinkedHashMap(); static { - amenityMap.put("alpine_hut", AmenityType.TOURISM); - amenityMap.put("attraction", AmenityType.TOURISM); - amenityMap.put("artwork", AmenityType.TOURISM); - amenityMap.put("camp_site", AmenityType.TOURISM); - amenityMap.put("caravan_site", AmenityType.TOURISM); - amenityMap.put("chalet", AmenityType.TOURISM); - amenityMap.put("guest_house", AmenityType.TOURISM); - amenityMap.put("hostel", AmenityType.TOURISM); - amenityMap.put("hotel", AmenityType.TOURISM); - amenityMap.put("information", AmenityType.TOURISM); - amenityMap.put("motel", AmenityType.TOURISM); - amenityMap.put("museum", AmenityType.TOURISM); - amenityMap.put("picnic_site", AmenityType.TOURISM); - amenityMap.put("theme_park", AmenityType.TOURISM); - amenityMap.put("viewpoint", AmenityType.TOURISM); - amenityMap.put("zoo", AmenityType.TOURISM); + amenityMap.put("alpine_hut", AmenityType.TOURISM); //$NON-NLS-1$ + amenityMap.put("attraction", AmenityType.TOURISM); //$NON-NLS-1$ + amenityMap.put("artwork", AmenityType.TOURISM); //$NON-NLS-1$ + amenityMap.put("camp_site", AmenityType.TOURISM); //$NON-NLS-1$ + amenityMap.put("caravan_site", AmenityType.TOURISM); //$NON-NLS-1$ + amenityMap.put("chalet", AmenityType.TOURISM); //$NON-NLS-1$ + amenityMap.put("guest_house", AmenityType.TOURISM); //$NON-NLS-1$ + amenityMap.put("hostel", AmenityType.TOURISM); //$NON-NLS-1$ + amenityMap.put("hotel", AmenityType.TOURISM); //$NON-NLS-1$ + amenityMap.put("information", AmenityType.TOURISM); //$NON-NLS-1$ + amenityMap.put("motel", AmenityType.TOURISM); //$NON-NLS-1$ + amenityMap.put("museum", AmenityType.TOURISM); //$NON-NLS-1$ + amenityMap.put("picnic_site", AmenityType.TOURISM); //$NON-NLS-1$ + amenityMap.put("theme_park", AmenityType.TOURISM); //$NON-NLS-1$ + amenityMap.put("viewpoint", AmenityType.TOURISM); //$NON-NLS-1$ + amenityMap.put("zoo", AmenityType.TOURISM); //$NON-NLS-1$ - amenityMap.put("archaeological_site", AmenityType.HISTORIC); - amenityMap.put("battlefield", AmenityType.HISTORIC); - amenityMap.put("boundary_stone", AmenityType.HISTORIC); - amenityMap.put("castle", AmenityType.HISTORIC); - amenityMap.put("fort", AmenityType.HISTORIC); - amenityMap.put("memorial", AmenityType.HISTORIC); - amenityMap.put("pa", AmenityType.HISTORIC); - amenityMap.put("monument", AmenityType.HISTORIC); - amenityMap.put("ruins", AmenityType.HISTORIC); - amenityMap.put("wayside_cross", AmenityType.HISTORIC); - amenityMap.put("wayside_shrine", AmenityType.HISTORIC); - amenityMap.put("wreck", AmenityType.HISTORIC); + amenityMap.put("archaeological_site", AmenityType.HISTORIC); //$NON-NLS-1$ + amenityMap.put("battlefield", AmenityType.HISTORIC); //$NON-NLS-1$ + amenityMap.put("boundary_stone", AmenityType.HISTORIC); //$NON-NLS-1$ + amenityMap.put("castle", AmenityType.HISTORIC); //$NON-NLS-1$ + amenityMap.put("fort", AmenityType.HISTORIC); //$NON-NLS-1$ + amenityMap.put("memorial", AmenityType.HISTORIC); //$NON-NLS-1$ + amenityMap.put("pa", AmenityType.HISTORIC); //$NON-NLS-1$ + amenityMap.put("monument", AmenityType.HISTORIC); //$NON-NLS-1$ + amenityMap.put("ruins", AmenityType.HISTORIC); //$NON-NLS-1$ + amenityMap.put("wayside_cross", AmenityType.HISTORIC); //$NON-NLS-1$ + amenityMap.put("wayside_shrine", AmenityType.HISTORIC); //$NON-NLS-1$ + amenityMap.put("wreck", AmenityType.HISTORIC); //$NON-NLS-1$ - amenityMap.put("alcohol", AmenityType.SHOP); - amenityMap.put("bakery", AmenityType.SHOP); - amenityMap.put("beauty", AmenityType.SHOP); - amenityMap.put("beverages", AmenityType.SHOP); - amenityMap.put("bicycle", AmenityType.SHOP); + amenityMap.put("alcohol", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("bakery", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("beauty", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("beverages", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("bicycle", AmenityType.SHOP); //$NON-NLS-1$ amenityMap.put("books", AmenityType.SHOP); //$NON-NLS-1$ - amenityMap.put("boutique", AmenityType.SHOP); - amenityMap.put("butcher", AmenityType.SHOP); - amenityMap.put("car", AmenityType.SHOP); - amenityMap.put("car_repair", AmenityType.SHOP); - amenityMap.put("charity", AmenityType.SHOP); - amenityMap.put("chemist", AmenityType.SHOP); - amenityMap.put("clothes", AmenityType.SHOP); - amenityMap.put("computer", AmenityType.SHOP); - amenityMap.put("confectionery", AmenityType.SHOP); - amenityMap.put("convenience", AmenityType.SHOP); - amenityMap.put("department_store", AmenityType.SHOP); - amenityMap.put("dry_cleaning", AmenityType.SHOP); - amenityMap.put("doityourself", AmenityType.SHOP); - amenityMap.put("electronics", AmenityType.SHOP); - amenityMap.put("fabrics", AmenityType.SHOP); - amenityMap.put("farm", AmenityType.SHOP); - amenityMap.put("florist", AmenityType.SHOP); - amenityMap.put("funeral_directors", AmenityType.SHOP); - amenityMap.put("furniture", AmenityType.SHOP); - amenityMap.put("garden_centre", AmenityType.SHOP); - amenityMap.put("general", AmenityType.SHOP); - amenityMap.put("gift", AmenityType.SHOP); - amenityMap.put("glaziery", AmenityType.SHOP); - amenityMap.put("greengrocer", AmenityType.SHOP); - amenityMap.put("hairdresser", AmenityType.SHOP); + amenityMap.put("boutique", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("butcher", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("car", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("car_repair", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("charity", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("chemist", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("clothes", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("computer", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("confectionery", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("convenience", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("department_store", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("dry_cleaning", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("doityourself", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("electronics", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("fabrics", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("farm", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("florist", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("funeral_directors", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("furniture", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("garden_centre", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("general", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("gift", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("glaziery", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("greengrocer", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("hairdresser", AmenityType.SHOP); //$NON-NLS-1$ amenityMap.put("hardware", AmenityType.SHOP); //$NON-NLS-1$ amenityMap.put("hearing_aids", AmenityType.SHOP); //$NON-NLS-1$ amenityMap.put("hifi", AmenityType.SHOP); //$NON-NLS-1$ amenityMap.put("ice_cream", AmenityType.SHOP); //$NON-NLS-1$ - amenityMap.put("hardware", AmenityType.SHOP); - amenityMap.put("hearing_aids", AmenityType.SHOP); - amenityMap.put("hifi", AmenityType.SHOP); - amenityMap.put("ice_cream", AmenityType.SHOP); - amenityMap.put("jewelry", AmenityType.SHOP); - amenityMap.put("kiosk", AmenityType.SHOP); - amenityMap.put("laundry", AmenityType.SHOP); - amenityMap.put("mall", AmenityType.SHOP); - amenityMap.put("massage", AmenityType.SHOP); - amenityMap.put("money_lender", AmenityType.SHOP); - amenityMap.put("motorcycle", AmenityType.SHOP); - amenityMap.put("newsagent", AmenityType.SHOP); - amenityMap.put("optician", AmenityType.SHOP); - amenityMap.put("organic", AmenityType.SHOP); - amenityMap.put("outdoor", AmenityType.SHOP); - amenityMap.put("pawnbroker", AmenityType.SHOP); - amenityMap.put("second_hand", AmenityType.SHOP); - amenityMap.put("sports", AmenityType.SHOP); - amenityMap.put("stationery", AmenityType.SHOP); - amenityMap.put("supermarket", AmenityType.SHOP); - amenityMap.put("shoes", AmenityType.SHOP); - amenityMap.put("tattoo", AmenityType.SHOP); - amenityMap.put("toys", AmenityType.SHOP); - amenityMap.put("travel_agency", AmenityType.SHOP); - amenityMap.put("variety_store", AmenityType.SHOP); - amenityMap.put("video", AmenityType.SHOP); + amenityMap.put("hardware", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("hearing_aids", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("hifi", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("ice_cream", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("jewelry", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("kiosk", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("laundry", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("mall", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("massage", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("money_lender", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("motorcycle", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("newsagent", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("optician", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("organic", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("outdoor", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("pawnbroker", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("second_hand", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("sports", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("stationery", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("supermarket", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("shoes", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("tattoo", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("toys", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("travel_agency", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("variety_store", AmenityType.SHOP); //$NON-NLS-1$ + amenityMap.put("video", AmenityType.SHOP); //$NON-NLS-1$ - amenityMap.put("dog_park", AmenityType.LEISURE); - amenityMap.put("sports_centre", AmenityType.LEISURE); - amenityMap.put("golf_course", AmenityType.LEISURE); - amenityMap.put("stadium", AmenityType.LEISURE); - amenityMap.put("track", AmenityType.LEISURE); - amenityMap.put("pitch", AmenityType.LEISURE); - amenityMap.put("water_park", AmenityType.LEISURE); - amenityMap.put("marina", AmenityType.LEISURE); - amenityMap.put("slipway", AmenityType.LEISURE); - amenityMap.put("fishing", AmenityType.LEISURE); - amenityMap.put("nature_reserve", AmenityType.LEISURE); - amenityMap.put("park", AmenityType.LEISURE); - amenityMap.put("playground", AmenityType.LEISURE); - amenityMap.put("garden", AmenityType.LEISURE); - amenityMap.put("common", AmenityType.LEISURE); - amenityMap.put("ice_rink", AmenityType.LEISURE); - amenityMap.put("miniature_golf", AmenityType.LEISURE); - amenityMap.put("dance", AmenityType.LEISURE); + amenityMap.put("dog_park", AmenityType.LEISURE); //$NON-NLS-1$ + amenityMap.put("sports_centre", AmenityType.LEISURE); //$NON-NLS-1$ + amenityMap.put("golf_course", AmenityType.LEISURE); //$NON-NLS-1$ + amenityMap.put("stadium", AmenityType.LEISURE); //$NON-NLS-1$ + amenityMap.put("track", AmenityType.LEISURE); //$NON-NLS-1$ + amenityMap.put("pitch", AmenityType.LEISURE); //$NON-NLS-1$ + amenityMap.put("water_park", AmenityType.LEISURE); //$NON-NLS-1$ + amenityMap.put("marina", AmenityType.LEISURE); //$NON-NLS-1$ + amenityMap.put("slipway", AmenityType.LEISURE); //$NON-NLS-1$ + amenityMap.put("fishing", AmenityType.LEISURE); //$NON-NLS-1$ + amenityMap.put("nature_reserve", AmenityType.LEISURE); //$NON-NLS-1$ + amenityMap.put("park", AmenityType.LEISURE); //$NON-NLS-1$ + amenityMap.put("playground", AmenityType.LEISURE); //$NON-NLS-1$ + amenityMap.put("garden", AmenityType.LEISURE); //$NON-NLS-1$ + amenityMap.put("common", AmenityType.LEISURE); //$NON-NLS-1$ + amenityMap.put("ice_rink", AmenityType.LEISURE); //$NON-NLS-1$ + amenityMap.put("miniature_golf", AmenityType.LEISURE); //$NON-NLS-1$ + amenityMap.put("dance", AmenityType.LEISURE); //$NON-NLS-1$ - amenityMap.put("9pin", AmenityType.SPORT); - amenityMap.put("10pin", AmenityType.SPORT); - amenityMap.put("archery", AmenityType.SPORT); - amenityMap.put("athletics", AmenityType.SPORT); - amenityMap.put("australian_football", AmenityType.SPORT); - amenityMap.put("baseball", AmenityType.SPORT); - amenityMap.put("basketball", AmenityType.SPORT); - amenityMap.put("beachvolleyball", AmenityType.SPORT); - amenityMap.put("boules", AmenityType.SPORT); - amenityMap.put("bowls", AmenityType.SPORT); - amenityMap.put("canoe", AmenityType.SPORT); - amenityMap.put("chess", AmenityType.SPORT); - amenityMap.put("climbing", AmenityType.SPORT); - amenityMap.put("cricket", AmenityType.SPORT); - amenityMap.put("cricket_nets", AmenityType.SPORT); - amenityMap.put("croquet", AmenityType.SPORT); - amenityMap.put("cycling", AmenityType.SPORT); - amenityMap.put("diving", AmenityType.SPORT); - amenityMap.put("dog_racing", AmenityType.SPORT); - amenityMap.put("equestrian", AmenityType.SPORT); - amenityMap.put("football", AmenityType.SPORT); - amenityMap.put("golf", AmenityType.SPORT); - amenityMap.put("gymnastics", AmenityType.SPORT); - amenityMap.put("hockey", AmenityType.SPORT); - amenityMap.put("horse_racing", AmenityType.SPORT); - amenityMap.put("ice_stock", AmenityType.SPORT); - amenityMap.put("korfball", AmenityType.SPORT); - amenityMap.put("motor", AmenityType.SPORT); - amenityMap.put("multi", AmenityType.SPORT); - amenityMap.put("orienteering", AmenityType.SPORT); - amenityMap.put("paddle_tennis", AmenityType.SPORT); - amenityMap.put("paragliding", AmenityType.SPORT); - amenityMap.put("pelota", AmenityType.SPORT); - amenityMap.put("racquet", AmenityType.SPORT); - amenityMap.put("rowing", AmenityType.SPORT); - amenityMap.put("rugby", AmenityType.SPORT); - amenityMap.put("shooting", AmenityType.SPORT); - amenityMap.put("skating", AmenityType.SPORT); - amenityMap.put("skateboard", AmenityType.SPORT); - amenityMap.put("skiing", AmenityType.SPORT); - amenityMap.put("soccer", AmenityType.SPORT); - amenityMap.put("swimming", AmenityType.SPORT); - amenityMap.put("table_tennis", AmenityType.SPORT); - amenityMap.put("team_handball", AmenityType.SPORT); - amenityMap.put("tennis", AmenityType.SPORT); - amenityMap.put("toboggan", AmenityType.SPORT); - amenityMap.put("volleyball", AmenityType.SPORT); + amenityMap.put("9pin", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("10pin", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("archery", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("athletics", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("australian_football", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("baseball", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("basketball", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("beachvolleyball", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("boules", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("bowls", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("canoe", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("chess", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("climbing", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("cricket", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("cricket_nets", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("croquet", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("cycling", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("diving", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("dog_racing", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("equestrian", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("football", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("golf", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("gymnastics", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("hockey", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("horse_racing", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("ice_stock", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("korfball", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("motor", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("multi", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("orienteering", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("paddle_tennis", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("paragliding", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("pelota", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("racquet", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("rowing", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("rugby", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("shooting", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("skating", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("skateboard", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("skiing", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("soccer", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("swimming", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("table_tennis", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("team_handball", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("tennis", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("toboggan", AmenityType.SPORT); //$NON-NLS-1$ + amenityMap.put("volleyball", AmenityType.SPORT); //$NON-NLS-1$ // amenity sub type - amenityMap.put("place_of_worship", AmenityType.OTHER); + amenityMap.put("place_of_worship", AmenityType.OTHER); //$NON-NLS-1$ - amenityMap.put("restaurant", AmenityType.SUSTENANCE); - amenityMap.put("food_court", AmenityType.SUSTENANCE); - amenityMap.put("fast_food", AmenityType.SUSTENANCE); - amenityMap.put("drinking_water", AmenityType.SUSTENANCE); - amenityMap.put("bbq", AmenityType.SUSTENANCE); - amenityMap.put("pub", AmenityType.SUSTENANCE); - amenityMap.put("bar", AmenityType.SUSTENANCE); - amenityMap.put("cafe", AmenityType.SUSTENANCE); - amenityMap.put("biergarten", AmenityType.SUSTENANCE); + amenityMap.put("restaurant", AmenityType.SUSTENANCE); //$NON-NLS-1$ + amenityMap.put("food_court", AmenityType.SUSTENANCE); //$NON-NLS-1$ + amenityMap.put("fast_food", AmenityType.SUSTENANCE); //$NON-NLS-1$ + amenityMap.put("drinking_water", AmenityType.SUSTENANCE); //$NON-NLS-1$ + amenityMap.put("bbq", AmenityType.SUSTENANCE); //$NON-NLS-1$ + amenityMap.put("pub", AmenityType.SUSTENANCE); //$NON-NLS-1$ + amenityMap.put("bar", AmenityType.SUSTENANCE); //$NON-NLS-1$ + amenityMap.put("cafe", AmenityType.SUSTENANCE); //$NON-NLS-1$ + amenityMap.put("biergarten", AmenityType.SUSTENANCE); //$NON-NLS-1$ - amenityMap.put("kindergarten", AmenityType.EDUCATION); - amenityMap.put("school", AmenityType.EDUCATION); - amenityMap.put("college", AmenityType.EDUCATION); - amenityMap.put("library", AmenityType.EDUCATION); - amenityMap.put("university", AmenityType.EDUCATION); + amenityMap.put("kindergarten", AmenityType.EDUCATION); //$NON-NLS-1$ + amenityMap.put("school", AmenityType.EDUCATION); //$NON-NLS-1$ + amenityMap.put("college", AmenityType.EDUCATION); //$NON-NLS-1$ + amenityMap.put("library", AmenityType.EDUCATION); //$NON-NLS-1$ + amenityMap.put("university", AmenityType.EDUCATION); //$NON-NLS-1$ - amenityMap.put("ferry_terminal", AmenityType.TRANSPORTATION); - amenityMap.put("bicycle_parking", AmenityType.TRANSPORTATION); - amenityMap.put("bicycle_rental", AmenityType.TRANSPORTATION); - amenityMap.put("bus_station", AmenityType.TRANSPORTATION); - amenityMap.put("car_rental", AmenityType.TRANSPORTATION); - amenityMap.put("car_sharing", AmenityType.TRANSPORTATION); - amenityMap.put("fuel", AmenityType.TRANSPORTATION); - amenityMap.put("car_wash", AmenityType.TRANSPORTATION); - amenityMap.put("grit_bin", AmenityType.TRANSPORTATION); - amenityMap.put("parking", AmenityType.TRANSPORTATION); - amenityMap.put("taxi", AmenityType.TRANSPORTATION); + amenityMap.put("ferry_terminal", AmenityType.TRANSPORTATION); //$NON-NLS-1$ + amenityMap.put("bicycle_parking", AmenityType.TRANSPORTATION); //$NON-NLS-1$ + amenityMap.put("bicycle_rental", AmenityType.TRANSPORTATION); //$NON-NLS-1$ + amenityMap.put("bus_station", AmenityType.TRANSPORTATION); //$NON-NLS-1$ + amenityMap.put("car_rental", AmenityType.TRANSPORTATION); //$NON-NLS-1$ + amenityMap.put("car_sharing", AmenityType.TRANSPORTATION); //$NON-NLS-1$ + amenityMap.put("fuel", AmenityType.TRANSPORTATION); //$NON-NLS-1$ + amenityMap.put("car_wash", AmenityType.TRANSPORTATION); //$NON-NLS-1$ + amenityMap.put("grit_bin", AmenityType.TRANSPORTATION); //$NON-NLS-1$ + amenityMap.put("parking", AmenityType.TRANSPORTATION); //$NON-NLS-1$ + amenityMap.put("taxi", AmenityType.TRANSPORTATION); //$NON-NLS-1$ - amenityMap.put("atm", AmenityType.FINANCE); - amenityMap.put("bank", AmenityType.FINANCE); - amenityMap.put("bureau_de_change", AmenityType.FINANCE); + amenityMap.put("atm", AmenityType.FINANCE); //$NON-NLS-1$ + amenityMap.put("bank", AmenityType.FINANCE); //$NON-NLS-1$ + amenityMap.put("bureau_de_change", AmenityType.FINANCE); //$NON-NLS-1$ - amenityMap.put("pharmacy", AmenityType.HEALTHCARE); - amenityMap.put("hospital", AmenityType.HEALTHCARE); - amenityMap.put("baby_hatch", AmenityType.HEALTHCARE); - amenityMap.put("dentist", AmenityType.HEALTHCARE); - amenityMap.put("doctors", AmenityType.HEALTHCARE); - amenityMap.put("veterinary", AmenityType.HEALTHCARE); - amenityMap.put("first_aid", AmenityType.HEALTHCARE); + amenityMap.put("pharmacy", AmenityType.HEALTHCARE); //$NON-NLS-1$ + amenityMap.put("hospital", AmenityType.HEALTHCARE); //$NON-NLS-1$ + amenityMap.put("baby_hatch", AmenityType.HEALTHCARE); //$NON-NLS-1$ + amenityMap.put("dentist", AmenityType.HEALTHCARE); //$NON-NLS-1$ + amenityMap.put("doctors", AmenityType.HEALTHCARE); //$NON-NLS-1$ + amenityMap.put("veterinary", AmenityType.HEALTHCARE); //$NON-NLS-1$ + amenityMap.put("first_aid", AmenityType.HEALTHCARE); //$NON-NLS-1$ - amenityMap.put("architect_office", AmenityType.ENTERTAINMENT); - amenityMap.put("arts_centre", AmenityType.ENTERTAINMENT); - amenityMap.put("cinema", AmenityType.ENTERTAINMENT); - amenityMap.put("community_centre", AmenityType.ENTERTAINMENT); - amenityMap.put("fountain", AmenityType.ENTERTAINMENT); - amenityMap.put("nightclub", AmenityType.ENTERTAINMENT); - amenityMap.put("stripclub", AmenityType.ENTERTAINMENT); - amenityMap.put("studio", AmenityType.ENTERTAINMENT); - amenityMap.put("theatre", AmenityType.ENTERTAINMENT); - amenityMap.put("sauna", AmenityType.ENTERTAINMENT); - amenityMap.put("brothel", AmenityType.ENTERTAINMENT); + amenityMap.put("architect_office", AmenityType.ENTERTAINMENT); //$NON-NLS-1$ + amenityMap.put("arts_centre", AmenityType.ENTERTAINMENT); //$NON-NLS-1$ + amenityMap.put("cinema", AmenityType.ENTERTAINMENT); //$NON-NLS-1$ + amenityMap.put("community_centre", AmenityType.ENTERTAINMENT); //$NON-NLS-1$ + amenityMap.put("fountain", AmenityType.ENTERTAINMENT); //$NON-NLS-1$ + amenityMap.put("nightclub", AmenityType.ENTERTAINMENT); //$NON-NLS-1$ + amenityMap.put("stripclub", AmenityType.ENTERTAINMENT); //$NON-NLS-1$ + amenityMap.put("studio", AmenityType.ENTERTAINMENT); //$NON-NLS-1$ + amenityMap.put("theatre", AmenityType.ENTERTAINMENT); //$NON-NLS-1$ + amenityMap.put("sauna", AmenityType.ENTERTAINMENT); //$NON-NLS-1$ + amenityMap.put("brothel", AmenityType.ENTERTAINMENT); //$NON-NLS-1$ - amenityMap.put("internet_access", AmenityType.OTHER); - amenityMap.put("bench", AmenityType.OTHER); - amenityMap.put("clock", AmenityType.OTHER); - amenityMap.put("courthouse", AmenityType.OTHER); - amenityMap.put("crematorium", AmenityType.OTHER); - amenityMap.put("embassy", AmenityType.OTHER); - amenityMap.put("emergency_phone", AmenityType.OTHER); - amenityMap.put("fire_hydrant", AmenityType.OTHER); - amenityMap.put("fire_station", AmenityType.OTHER); - amenityMap.put("grave_yard", AmenityType.OTHER); - amenityMap.put("hunting_stand", AmenityType.OTHER); - amenityMap.put("marketplace", AmenityType.OTHER); - amenityMap.put("police", AmenityType.OTHER); - amenityMap.put("post_box", AmenityType.OTHER); - amenityMap.put("post_office", AmenityType.OTHER); - amenityMap.put("prison", AmenityType.OTHER); - amenityMap.put("public_building", AmenityType.OTHER); - amenityMap.put("recycling", AmenityType.OTHER); - amenityMap.put("shelter", AmenityType.OTHER); - amenityMap.put("telephone", AmenityType.OTHER); - amenityMap.put("toilets", AmenityType.OTHER); - amenityMap.put("townhall", AmenityType.OTHER); - amenityMap.put("vending_machine", AmenityType.OTHER); - amenityMap.put("waste_basket", AmenityType.OTHER); - amenityMap.put("waste_disposal", AmenityType.OTHER); + amenityMap.put("internet_access", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("bench", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("clock", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("courthouse", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("crematorium", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("embassy", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("emergency_phone", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("fire_hydrant", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("fire_station", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("grave_yard", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("hunting_stand", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("marketplace", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("police", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("post_box", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("post_office", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("prison", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("public_building", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("recycling", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("shelter", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("telephone", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("toilets", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("townhall", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("vending_machine", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("waste_basket", AmenityType.OTHER); //$NON-NLS-1$ + amenityMap.put("waste_disposal", AmenityType.OTHER); //$NON-NLS-1$ } diff --git a/DataExtractionOSM/src/com/osmand/data/City.java b/DataExtractionOSM/src/com/osmand/data/City.java index 597e9be68d..014e5920a9 100644 --- a/DataExtractionOSM/src/com/osmand/data/City.java +++ b/DataExtractionOSM/src/com/osmand/data/City.java @@ -116,10 +116,6 @@ public class City extends MapObject { return type; } - public SortedSet getPostcodes() { - return postcodes; - } - public Collection getStreets(){ return streets.values(); } @@ -130,7 +126,7 @@ public class City extends MapObject { @Override public String toString() { - return "City [" +type+"] " + getName(); + return "City [" +type+"] " + getName(); //$NON-NLS-1$ //$NON-NLS-2$ } public void doDataPreparation(){ diff --git a/DataExtractionOSM/src/com/osmand/data/DataTileManager.java b/DataExtractionOSM/src/com/osmand/data/DataTileManager.java index ea3440219e..b0f4e06387 100644 --- a/DataExtractionOSM/src/com/osmand/data/DataTileManager.java +++ b/DataExtractionOSM/src/com/osmand/data/DataTileManager.java @@ -138,7 +138,7 @@ public class DataTileManager { } private String evTile(int tileX, int tileY){ - return tileX +"_"+tileY; + return tileX +"_"+tileY; //$NON-NLS-1$ } diff --git a/DataExtractionOSM/src/com/osmand/data/MapObject.java b/DataExtractionOSM/src/com/osmand/data/MapObject.java index 52084a9c87..1ab1e8c70d 100644 --- a/DataExtractionOSM/src/com/osmand/data/MapObject.java +++ b/DataExtractionOSM/src/com/osmand/data/MapObject.java @@ -57,7 +57,7 @@ public abstract class MapObject implements Comparable { if (this.name != null) { return this.name; } - return ""; + return ""; //$NON-NLS-1$ } public void setName(String name) { @@ -68,7 +68,7 @@ public abstract class MapObject implements Comparable { if(this.enName != null){ return this.enName; } - return ""; + return ""; //$NON-NLS-1$ } public void setEnName(String enName) { diff --git a/DataExtractionOSM/src/com/osmand/data/Region.java b/DataExtractionOSM/src/com/osmand/data/Region.java index 80a8d5b71b..2f0e5fdeb6 100644 --- a/DataExtractionOSM/src/com/osmand/data/Region.java +++ b/DataExtractionOSM/src/com/osmand/data/Region.java @@ -47,7 +47,7 @@ public class Region extends MapObject { } public Region(){ - name = "Region"; + name = "Region"; //$NON-NLS-1$ } public OsmBaseStorage getStorage() { diff --git a/DataExtractionOSM/src/com/osmand/data/index/DataIndexReader.java b/DataExtractionOSM/src/com/osmand/data/index/DataIndexReader.java index 59128c4e36..363c0c51e0 100644 --- a/DataExtractionOSM/src/com/osmand/data/index/DataIndexReader.java +++ b/DataExtractionOSM/src/com/osmand/data/index/DataIndexReader.java @@ -25,12 +25,12 @@ public class DataIndexReader { public Connection getConnection(File file) throws SQLException{ try { - Class.forName("org.sqlite.JDBC"); + Class.forName("org.sqlite.JDBC"); //$NON-NLS-1$ } catch (ClassNotFoundException e) { - log.error("Illegal configuration", e); + log.error("Illegal configuration", e); //$NON-NLS-1$ throw new IllegalStateException(e); } - return DriverManager.getConnection("jdbc:sqlite:"+file.getAbsolutePath()); + return DriverManager.getConnection("jdbc:sqlite:"+file.getAbsolutePath()); //$NON-NLS-1$ } @@ -57,7 +57,7 @@ public class DataIndexReader { List streets = new ArrayList(); Statement stat = c.createStatement(); ResultSet set = stat.executeQuery(IndexConstants.generateSelectSQL(IndexStreetTable.values(), - IndexStreetTable.CITY.toString() +" = " + city.getId())); + IndexStreetTable.CITY.toString() +" = " + city.getId())); //$NON-NLS-1$ while(set.next()){ Street street = new Street(city); street.setName(set.getString(IndexStreetTable.NAME.ordinal() + 1)); @@ -76,7 +76,7 @@ public class DataIndexReader { List buildings = new ArrayList(); Statement stat = c.createStatement(); ResultSet set = stat.executeQuery(IndexConstants.generateSelectSQL(IndexBuildingTable.values(), - IndexBuildingTable.STREET.toString() +" = " + street.getId())); + IndexBuildingTable.STREET.toString() +" = " + street.getId())); //$NON-NLS-1$ while(set.next()){ Building building = new Building(); building.setName(set.getString(IndexBuildingTable.NAME.ordinal() + 1)); @@ -95,11 +95,11 @@ public class DataIndexReader { Connection c = getConnection(f); try { for (City city : readCities(c)) { - System.out.println("CITY " + city.getName()); + System.out.println("CITY " + city.getName()); //$NON-NLS-1$ for (Street s : readStreets(c, city)) { - System.out.println("\tSTREET " + s.getName()); + System.out.println("\tSTREET " + s.getName()); //$NON-NLS-1$ for (Building b : readBuildings(c, s)) { - System.out.println("\t\tBULDING " + b.getName()); + System.out.println("\t\tBULDING " + b.getName()); //$NON-NLS-1$ } } diff --git a/DataExtractionOSM/src/com/osmand/data/index/DataIndexWriter.java b/DataExtractionOSM/src/com/osmand/data/index/DataIndexWriter.java index e31c81a9ef..e04770a0ed 100644 --- a/DataExtractionOSM/src/com/osmand/data/index/DataIndexWriter.java +++ b/DataExtractionOSM/src/com/osmand/data/index/DataIndexWriter.java @@ -50,7 +50,7 @@ public class DataIndexWriter { f.mkdirs(); // remove existing file if (f.exists()) { - log.warn("Remove existing index : " + f.getAbsolutePath()); + log.warn("Remove existing index : " + f.getAbsolutePath()); //$NON-NLS-1$ f.delete(); } return f; @@ -61,18 +61,18 @@ public class DataIndexWriter { File file = checkFile(IndexConstants.POI_INDEX_DIR+region.getName()+IndexConstants.POI_INDEX_EXT); long now = System.currentTimeMillis(); try { - Class.forName("org.sqlite.JDBC"); + Class.forName("org.sqlite.JDBC"); //$NON-NLS-1$ } catch (ClassNotFoundException e) { - log.error("Illegal configuration", e); + log.error("Illegal configuration", e); //$NON-NLS-1$ throw new IllegalStateException(e); } - Connection conn = DriverManager.getConnection("jdbc:sqlite:"+file.getAbsolutePath()); + Connection conn = DriverManager.getConnection("jdbc:sqlite:"+file.getAbsolutePath()); //$NON-NLS-1$ try { Statement stat = conn.createStatement(); assert IndexPoiTable.values().length == 8; stat.executeUpdate(IndexConstants.generateCreateSQL(IndexPoiTable.values())); stat.executeUpdate(IndexConstants.generateCreateIndexSQL(IndexPoiTable.values())); - stat.execute("PRAGMA user_version = " + IndexConstants.POI_TABLE_VERSION); + stat.execute("PRAGMA user_version = " + IndexConstants.POI_TABLE_VERSION); //$NON-NLS-1$ stat.close(); PreparedStatement prep = conn.prepareStatement( @@ -102,7 +102,7 @@ public class DataIndexWriter { conn.setAutoCommit(true); } finally { conn.close(); - log.info(String.format("Indexing poi done in %s ms.", System.currentTimeMillis() - now)); + log.info(String.format("Indexing poi done in %s ms.", System.currentTimeMillis() - now)); //$NON-NLS-1$ } return this; } @@ -111,12 +111,12 @@ public class DataIndexWriter { File file = checkFile(IndexConstants.ADDRESS_INDEX_DIR+region.getName()+IndexConstants.ADDRESS_INDEX_EXT); long now = System.currentTimeMillis(); try { - Class.forName("org.sqlite.JDBC"); + Class.forName("org.sqlite.JDBC"); //$NON-NLS-1$ } catch (ClassNotFoundException e) { - log.error("Illegal configuration", e); + log.error("Illegal configuration", e); //$NON-NLS-1$ throw new IllegalStateException(e); } - Connection conn = DriverManager.getConnection("jdbc:sqlite:"+file.getAbsolutePath()); + Connection conn = DriverManager.getConnection("jdbc:sqlite:"+file.getAbsolutePath()); //$NON-NLS-1$ try { Statement stat = conn.createStatement(); @@ -130,7 +130,7 @@ public class DataIndexWriter { stat.executeUpdate(IndexConstants.generateCreateIndexSQL(IndexStreetNodeTable.values())); stat.executeUpdate(IndexConstants.generateCreateSQL(IndexStreetTable.values())); stat.executeUpdate(IndexConstants.generateCreateIndexSQL(IndexStreetTable.values())); - stat.execute("PRAGMA user_version = " + IndexConstants.ADDRESS_TABLE_VERSION); + stat.execute("PRAGMA user_version = " + IndexConstants.ADDRESS_TABLE_VERSION); //$NON-NLS-1$ stat.close(); PreparedStatement prepCity = conn.prepareStatement( @@ -220,7 +220,7 @@ public class DataIndexWriter { conn.setAutoCommit(true); } finally { conn.close(); - log.info(String.format("Indexing address done in %s ms.", System.currentTimeMillis() - now)); + log.info(String.format("Indexing address done in %s ms.", System.currentTimeMillis() - now)); //$NON-NLS-1$ } return this; } diff --git a/DataExtractionOSM/src/com/osmand/data/index/IndexConstants.java b/DataExtractionOSM/src/com/osmand/data/index/IndexConstants.java index 85c7e10e5c..850e9d06d6 100644 --- a/DataExtractionOSM/src/com/osmand/data/index/IndexConstants.java +++ b/DataExtractionOSM/src/com/osmand/data/index/IndexConstants.java @@ -7,11 +7,11 @@ public class IndexConstants { public final static int POI_TABLE_VERSION = 0; public final static int ADDRESS_TABLE_VERSION = 1; - public static final String POI_INDEX_DIR = "POI/"; - public static final String ADDRESS_INDEX_DIR = "Address/"; + public static final String POI_INDEX_DIR = "POI/"; //$NON-NLS-1$ + public static final String ADDRESS_INDEX_DIR = "Address/"; //$NON-NLS-1$ - public static final String POI_INDEX_EXT = ".poi.odb"; - public static final String ADDRESS_INDEX_EXT = ".addr.odb"; + public static final String POI_INDEX_EXT = ".poi.odb"; //$NON-NLS-1$ + public static final String ADDRESS_INDEX_EXT = ".addr.odb"; //$NON-NLS-1$ public interface IndexColumn { public boolean isIndex(); @@ -31,20 +31,20 @@ public class IndexConstants { public static String generateCreateSQL(IndexColumn[] columns){ StringBuilder b = new StringBuilder(); - b.append("create table ").append(columns[0].getTableName()).append(" ("); + b.append("create table ").append(columns[0].getTableName()).append(" ("); //$NON-NLS-1$ //$NON-NLS-2$ boolean first = true; for(IndexColumn c : columns){ if(first) { first = false; } else { - b.append(", "); + b.append(", "); //$NON-NLS-1$ } b.append(c.toString()); if(c.getType() != null){ - b.append(" ").append(c.getType()); + b.append(" ").append(c.getType()); //$NON-NLS-1$ } } - b.append(" ); "); + b.append(" ); "); //$NON-NLS-1$ return b.toString(); } @@ -54,41 +54,41 @@ public class IndexConstants { public static String generateSelectSQL(IndexColumn[] select, String where){ StringBuilder b = new StringBuilder(); - b.append("select "); + b.append("select "); //$NON-NLS-1$ boolean first = true; for(IndexColumn c : select){ if(first) { first = false; } else { - b.append(", "); + b.append(", "); //$NON-NLS-1$ } b.append(c.toString()); } - b.append(" FROM ").append(select[0].getTableName()); + b.append(" FROM ").append(select[0].getTableName()); //$NON-NLS-1$ if(where != null){ - b.append(" WHERE " ).append(where); + b.append(" WHERE " ).append(where); //$NON-NLS-1$ } - b.append(" ; "); + b.append(" ; "); //$NON-NLS-1$ return b.toString(); } public static String generatePrepareStatementToInsert(String tableName, int numColumns){ StringBuilder b = new StringBuilder(); - b.append("insert into ").append(tableName).append(" values ("); + b.append("insert into ").append(tableName).append(" values ("); //$NON-NLS-1$ //$NON-NLS-2$ for(int i=0; i< numColumns; i++){ if(i > 0){ - b.append(", "); + b.append(", "); //$NON-NLS-1$ } - b.append("?"); + b.append("?"); //$NON-NLS-1$ } - b.append(");"); + b.append(");"); //$NON-NLS-1$ return b.toString(); } public static String generateCreateIndexSQL(IndexColumn[] columns){ StringBuilder b = new StringBuilder(); String tableName = columns[0].getTableName(); - b.append("create index ").append(tableName).append("_index ON ").append(tableName).append(" ("); + b.append("create index ").append(tableName).append("_index ON ").append(tableName).append(" ("); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ boolean first = true; for(IndexColumn c : columns){ if(!c.isIndex()){ @@ -97,11 +97,11 @@ public class IndexConstants { if(first) { first = false; } else { - b.append(", "); + b.append(", "); //$NON-NLS-1$ } b.append(c.toString()); } - b.append(" ); "); + b.append(" ); "); //$NON-NLS-1$ if(first){ return null; } @@ -110,7 +110,7 @@ public class IndexConstants { public enum IndexPoiTable implements IndexColumn { - ID("long"), LATITUDE("double", true), LONGITUDE("double", true), OPENING_HOURS, NAME, NAME_EN, TYPE, SUBTYPE; + ID("long"), LATITUDE("double", true), LONGITUDE("double", true), OPENING_HOURS, NAME, NAME_EN, TYPE, SUBTYPE; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ boolean index = false; String type = null; private IndexPoiTable(){} @@ -120,7 +120,7 @@ public class IndexConstants { private IndexPoiTable(String type, boolean index){ this(type); this.index = index;} public static String getTable(){ - return "poi"; + return "poi"; //$NON-NLS-1$ } public String getTableName(){ @@ -140,7 +140,7 @@ public class IndexConstants { public enum IndexCityTable implements IndexColumn { - ID("long"), LATITUDE("double", true), LONGITUDE("double", true), NAME, NAME_EN, CITY_TYPE; + ID("long"), LATITUDE("double", true), LONGITUDE("double", true), NAME, NAME_EN, CITY_TYPE; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ boolean index = false; String type = null; @@ -157,7 +157,7 @@ public class IndexConstants { } public static String getTable() { - return "city"; + return "city"; //$NON-NLS-1$ } public String getTableName() { @@ -176,7 +176,7 @@ public class IndexConstants { } public enum IndexStreetTable implements IndexColumn { - ID("long"), LATITUDE("double", true), LONGITUDE("double", true), NAME, NAME_EN, CITY("long", true); + ID("long"), LATITUDE("double", true), LONGITUDE("double", true), NAME, NAME_EN, CITY("long", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ boolean index = false; String type = null; @@ -193,7 +193,7 @@ public class IndexConstants { } public static String getTable() { - return "street"; + return "street"; //$NON-NLS-1$ } public String getTableName() { @@ -212,7 +212,7 @@ public class IndexConstants { } public enum IndexStreetNodeTable implements IndexColumn { - ID("long", true), LATITUDE("double"), LONGITUDE("double"), STREET("long", true), WAY("long", true); + ID("long", true), LATITUDE("double"), LONGITUDE("double"), STREET("long", true), WAY("long", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ boolean index = false; String type = null; @@ -229,7 +229,7 @@ public class IndexConstants { } public static String getTable() { - return "street_node"; + return "street_node"; //$NON-NLS-1$ } public String getTableName() { @@ -248,7 +248,7 @@ public class IndexConstants { } public enum IndexBuildingTable implements IndexColumn { - ID("long"), LATITUDE("double"), LONGITUDE("double"), NAME, NAME_EN, STREET("long", true), POSTCODE(null, true); + ID("long"), LATITUDE("double"), LONGITUDE("double"), NAME, NAME_EN, STREET("long", true), POSTCODE(null, true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ boolean index = false; String type = null; @@ -265,7 +265,7 @@ public class IndexConstants { } public static String getTable() { - return "building"; + return "building"; //$NON-NLS-1$ } public String getTableName() { diff --git a/DataExtractionOSM/src/com/osmand/data/preparation/MapTileDownloader.java b/DataExtractionOSM/src/com/osmand/data/preparation/MapTileDownloader.java index c89d6bf54f..3d99e314b9 100644 --- a/DataExtractionOSM/src/com/osmand/data/preparation/MapTileDownloader.java +++ b/DataExtractionOSM/src/com/osmand/data/preparation/MapTileDownloader.java @@ -175,14 +175,14 @@ public class MapTileDownloader { currentlyDownloaded.add(request.fileToSave); if(log.isDebugEnabled()){ - log.debug("Start downloading tile : " + request.url); + log.debug("Start downloading tile : " + request.url); //$NON-NLS-1$ } long time = System.currentTimeMillis(); try { request.fileToSave.getParentFile().mkdirs(); URL url = new URL(request.url); URLConnection connection = url.openConnection(); - connection.setRequestProperty("User-Agent", Version.APP_NAME_VERSION); + connection.setRequestProperty("User-Agent", Version.APP_NAME_VERSION); //$NON-NLS-1$ BufferedInputStream inputStream = new BufferedInputStream(connection.getInputStream(), 8 * 1024); FileOutputStream stream = null; try { @@ -194,16 +194,16 @@ public class MapTileDownloader { Algoritms.closeStream(stream); } if (log.isDebugEnabled()) { - log.debug("Downloading tile : " + request.url + " successfull " + (System.currentTimeMillis() - time) + " ms"); + log.debug("Downloading tile : " + request.url + " successfull " + (System.currentTimeMillis() - time) + " ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } catch (UnknownHostException e) { currentErrors++; request.setError(true); - log.error("UnknownHostException, cannot download tile " + request.url + " " + e.getMessage()); + log.error("UnknownHostException, cannot download tile " + request.url + " " + e.getMessage()); //$NON-NLS-1$ //$NON-NLS-2$ } catch (IOException e) { currentErrors++; request.setError(true); - log.warn("Cannot download tile : " + request.url, e); + log.warn("Cannot download tile : " + request.url, e); //$NON-NLS-1$ } finally { currentlyDownloaded.remove(request.fileToSave); } diff --git a/DataExtractionOSM/src/com/osmand/impl/ConsoleProgressImplementation.java b/DataExtractionOSM/src/com/osmand/impl/ConsoleProgressImplementation.java index c1248d4c4d..edc5a1ebf8 100644 --- a/DataExtractionOSM/src/com/osmand/impl/ConsoleProgressImplementation.java +++ b/DataExtractionOSM/src/com/osmand/impl/ConsoleProgressImplementation.java @@ -16,7 +16,7 @@ public class ConsoleProgressImplementation implements IProgress { @Override public void finishTask() { - System.out.println("Task " + currentTask + " is finished "); + System.out.println("Task " + currentTask + " is finished "); //$NON-NLS-1$ //$NON-NLS-2$ this.currentTask = null; } @@ -34,7 +34,7 @@ public class ConsoleProgressImplementation implements IProgress { private void printIfNeeded() { if(getCurrentPercent() - lastPercentPrint >= deltaPercentsToPrint){ - System.out.println(MessageFormat.format("Done {0} %.", getCurrentPercent())); + System.out.println(MessageFormat.format("Done {0} %.", getCurrentPercent())); //$NON-NLS-1$ this.lastPercentPrint = getCurrentPercent(); } } @@ -53,7 +53,7 @@ public class ConsoleProgressImplementation implements IProgress { public void startTask(String taskName, int work) { if(!Algoritms.objectEquals(currentTask, taskName)){ this.currentTask = taskName; - System.out.println("Started new task : " + currentTask + " - " + work); + System.out.println("Started new task : " + currentTask + " - " + work); //$NON-NLS-1$ //$NON-NLS-2$ } startWork(work); @@ -63,7 +63,7 @@ public class ConsoleProgressImplementation implements IProgress { public void startWork(int work) { if(this.work != work){ this.work = work; - System.out.println("Amount of work was changed to " + work); + System.out.println("Amount of work was changed to " + work); //$NON-NLS-1$ } this.currentDone = 0; this.lastPercentPrint = 0; diff --git a/DataExtractionOSM/src/com/osmand/map/TileSourceManager.java b/DataExtractionOSM/src/com/osmand/map/TileSourceManager.java index ee21644999..c9e884f390 100644 --- a/DataExtractionOSM/src/com/osmand/map/TileSourceManager.java +++ b/DataExtractionOSM/src/com/osmand/map/TileSourceManager.java @@ -58,7 +58,7 @@ public class TileSourceManager { @Override public String getUrlToLoad(int x, int y, int zoom) { - return MessageFormat.format(urlToLoad, zoom+"", x+"", y+""); + return MessageFormat.format(urlToLoad, zoom, x, y); } diff --git a/DataExtractionOSM/src/com/osmand/swing/OsmExtractionUI.java b/DataExtractionOSM/src/com/osmand/swing/OsmExtractionUI.java index e541173794..44fd9c062a 100644 --- a/DataExtractionOSM/src/com/osmand/swing/OsmExtractionUI.java +++ b/DataExtractionOSM/src/com/osmand/swing/OsmExtractionUI.java @@ -403,7 +403,7 @@ public class OsmExtractionUI implements IMapLocationListener { buildTransportIndex = new JCheckBox(); buildTransportIndex.setText("Build transport index"); panel.add(buildTransportIndex); - buildTransportIndex.setSelected(true); + buildTransportIndex.setSelected(false); loadingAllData = new JCheckBox(); loadingAllData.setText("Loading all osm data"); diff --git a/OsmAnd/src/com/osmand/AmenityIndexRepository.java b/OsmAnd/src/com/osmand/AmenityIndexRepository.java index 127ac7b409..b2e2630cd7 100644 --- a/OsmAnd/src/com/osmand/AmenityIndexRepository.java +++ b/OsmAnd/src/com/osmand/AmenityIndexRepository.java @@ -42,12 +42,12 @@ public class AmenityIndexRepository { private final String[] columns = IndexConstants.generateColumnNames(IndexPoiTable.values()); public List searchAmenities(double topLatitude, double leftLongitude, double bottomLatitude, double rightLongitude, int limit, PoiFilter filter, List amenities){ long now = System.currentTimeMillis(); - String squery = "? < latitude AND latitude < ? AND ? < longitude AND longitude < ?"; + String squery = "? < latitude AND latitude < ? AND ? < longitude AND longitude < ?"; //$NON-NLS-1$ if(filter != null){ String sql = filter.buildSqlWhereFilter(); if(sql != null){ - squery += " AND " + sql; + squery += " AND " + sql; //$NON-NLS-1$ } } Cursor query = db.query(IndexPoiTable.getTable(), columns, squery, @@ -73,30 +73,30 @@ public class AmenityIndexRepository { query.close(); if (log.isDebugEnabled()) { - log.debug(String.format("Search for %s done in %s ms found %s.", - topLatitude + " " + leftLongitude, System.currentTimeMillis() - now, amenities.size())); + log.debug(String.format("Search for %s done in %s ms found %s.", //$NON-NLS-1$ + topLatitude + " " + leftLongitude, System.currentTimeMillis() - now, amenities.size())); //$NON-NLS-1$ } return amenities; } public boolean addAmenity(long id, double latitude, double longitude, String name, String nameEn, AmenityType t, String subType, String openingHours){ assert IndexPoiTable.values().length == 8; - db.execSQL("INSERT INTO " + IndexPoiTable.getTable() + " VALUES (?, ?, ?, ?, ?, ?, ?, ?)", + db.execSQL("INSERT INTO " + IndexPoiTable.getTable() + " VALUES (?, ?, ?, ?, ?, ?, ?, ?)", //$NON-NLS-1$ //$NON-NLS-2$ new Object[]{id, latitude, longitude, openingHours, name, nameEn,AmenityType.valueToString(t), subType}); return true; } public boolean updateAmenity(long id, double latitude, double longitude, String name, String nameEn, AmenityType t, String subType, String openingHours){ StringBuilder b = new StringBuilder(); - b.append("UPDATE " + IndexPoiTable.getTable() + " SET "); - b.append(IndexPoiTable.LATITUDE.name()).append(" = ?").append(", "). - append(IndexPoiTable.LONGITUDE.name()).append(" = ?").append(", "). - append(IndexPoiTable.OPENING_HOURS.name()).append(" = ?").append(", "). - append(IndexPoiTable.NAME.name()).append(" = ?").append(", "). - append(IndexPoiTable.NAME_EN.name()).append(" = ?").append(", "). - append(IndexPoiTable.TYPE.name()).append(" = ?").append(", "). - append(IndexPoiTable.SUBTYPE.name()).append(" = ?").append(" "). - append(" WHERE ").append(IndexPoiTable.ID.name()).append(" = ?"); + b.append("UPDATE " + IndexPoiTable.getTable() + " SET "); //$NON-NLS-1$ //$NON-NLS-2$ + b.append(IndexPoiTable.LATITUDE.name()).append(" = ?").append(", "). //$NON-NLS-1$ //$NON-NLS-2$ + append(IndexPoiTable.LONGITUDE.name()).append(" = ?").append(", "). //$NON-NLS-1$ //$NON-NLS-2$ + append(IndexPoiTable.OPENING_HOURS.name()).append(" = ?").append(", "). //$NON-NLS-1$ //$NON-NLS-2$ + append(IndexPoiTable.NAME.name()).append(" = ?").append(", "). //$NON-NLS-1$ //$NON-NLS-2$ + append(IndexPoiTable.NAME_EN.name()).append(" = ?").append(", "). //$NON-NLS-1$ //$NON-NLS-2$ + append(IndexPoiTable.TYPE.name()).append(" = ?").append(", "). //$NON-NLS-1$ //$NON-NLS-2$ + append(IndexPoiTable.SUBTYPE.name()).append(" = ?").append(" "). //$NON-NLS-1$ //$NON-NLS-2$ + append(" WHERE ").append(IndexPoiTable.ID.name()).append(" = ?"); //$NON-NLS-1$ //$NON-NLS-2$ db.execSQL(b.toString(), new Object[]{latitude, longitude, openingHours, name, nameEn,AmenityType.valueToString(t), subType, id}); @@ -104,7 +104,7 @@ public class AmenityIndexRepository { } public boolean deleteAmenity(long id){ - db.execSQL("DELETE FROM " + IndexPoiTable.getTable()+ " WHERE id="+id); + db.execSQL("DELETE FROM " + IndexPoiTable.getTable()+ " WHERE id="+id); //$NON-NLS-1$ //$NON-NLS-2$ return true; } @@ -172,7 +172,7 @@ public class AmenityIndexRepository { return false; } - Cursor query = db.query(IndexPoiTable.getTable(), new String[]{"MAX(latitude)", "MAX(longitude)", "MIN(latitude)", "MIN(longitude)"}, null, null,null, null, null); + Cursor query = db.query(IndexPoiTable.getTable(), new String[]{"MAX(latitude)", "MAX(longitude)", "MIN(latitude)", "MIN(longitude)"}, null, null,null, null, null); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ if(query.moveToFirst()){ dataTopLatitude = query.getDouble(0); dataRightLongitude = query.getDouble(1); @@ -181,7 +181,7 @@ public class AmenityIndexRepository { } query.close(); if (log.isDebugEnabled()) { - log.debug("Initializing db " + file.getAbsolutePath() + " " + (System.currentTimeMillis() - start) + "ms"); + log.debug("Initializing db " + file.getAbsolutePath() + " " + (System.currentTimeMillis() - start) + "ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } return true; } diff --git a/OsmAnd/src/com/osmand/LogUtil.java b/OsmAnd/src/com/osmand/LogUtil.java index c4c0333766..5a853d7098 100644 --- a/OsmAnd/src/com/osmand/LogUtil.java +++ b/OsmAnd/src/com/osmand/LogUtil.java @@ -16,7 +16,7 @@ import org.apache.commons.logging.Log; * */ public class LogUtil { - public static String TAG = "com.osmand"; + public static String TAG = "com.osmand"; //$NON-NLS-1$ private static class OsmandLogImplementation implements Log { private final String fullName; @@ -29,35 +29,35 @@ public class LogUtil { @Override public void debug(Object message) { if(isDebugEnabled()){ - android.util.Log.d(TAG, name + " " + message); + android.util.Log.d(TAG, name + " " + message); //$NON-NLS-1$ } } @Override public void debug(Object message, Throwable t) { if(isDebugEnabled()){ - android.util.Log.d(TAG, name + " " + message, t); + android.util.Log.d(TAG, name + " " + message, t); //$NON-NLS-1$ } } @Override public void error(Object message) { if(isErrorEnabled()){ - android.util.Log.e(TAG, name + " " + message); + android.util.Log.e(TAG, name + " " + message); //$NON-NLS-1$ } } @Override public void error(Object message, Throwable t) { if(isErrorEnabled()){ - android.util.Log.e(TAG, name + " " + message, t); + android.util.Log.e(TAG, name + " " + message, t); //$NON-NLS-1$ } } @Override public void fatal(Object message) { if(isFatalEnabled()){ - android.util.Log.e(TAG, name + " " + message); + android.util.Log.e(TAG, name + " " + message); //$NON-NLS-1$ } } @@ -65,21 +65,21 @@ public class LogUtil { @Override public void fatal(Object message, Throwable t) { if(isFatalEnabled()){ - android.util.Log.e(TAG, name + " " + message, t); + android.util.Log.e(TAG, name + " " + message, t); //$NON-NLS-1$ } } @Override public void info(Object message) { if(isInfoEnabled()){ - android.util.Log.i(TAG, name + " " + message); + android.util.Log.i(TAG, name + " " + message); //$NON-NLS-1$ } } @Override public void info(Object message, Throwable t) { if(isInfoEnabled()){ - android.util.Log.i(TAG, name + " " + message, t); + android.util.Log.i(TAG, name + " " + message, t); //$NON-NLS-1$ } } @@ -118,28 +118,28 @@ public class LogUtil { @Override public void trace(Object message) { if(isTraceEnabled()){ - android.util.Log.d(TAG, name + " " + message); + android.util.Log.d(TAG, name + " " + message); //$NON-NLS-1$ } } @Override public void trace(Object message, Throwable t) { if(isTraceEnabled()){ - android.util.Log.d(TAG, name + " " + message, t); + android.util.Log.d(TAG, name + " " + message, t); //$NON-NLS-1$ } } @Override public void warn(Object message) { if(isWarnEnabled()){ - android.util.Log.w(TAG, name + " " + message); + android.util.Log.w(TAG, name + " " + message); //$NON-NLS-1$ } } @Override public void warn(Object message, Throwable t) { if(isWarnEnabled()){ - android.util.Log.w(TAG, name + " " + message, t); + android.util.Log.w(TAG, name + " " + message, t); //$NON-NLS-1$ } } } diff --git a/OsmAnd/src/com/osmand/OsmandSettings.java b/OsmAnd/src/com/osmand/OsmandSettings.java index fa59cab2c2..713fb55764 100644 --- a/OsmAnd/src/com/osmand/OsmandSettings.java +++ b/OsmAnd/src/com/osmand/OsmandSettings.java @@ -35,13 +35,13 @@ public class OsmandSettings { } // These settings are stored in SharedPreferences - public static final String SHARED_PREFERENCES_NAME = "com.osmand.settings"; + public static final String SHARED_PREFERENCES_NAME = "com.osmand.settings"; //$NON-NLS-1$ public static final int CENTER_CONSTANT = 0; public static final int BOTTOM_CONSTANT = 1; // this value string is synchronized with settings_pref.xml preference name - public static final String USE_INTERNET_TO_DOWNLOAD_TILES = "use_internet_to_download_tiles"; + public static final String USE_INTERNET_TO_DOWNLOAD_TILES = "use_internet_to_download_tiles"; //$NON-NLS-1$ public static boolean isUsingInternetToDownloadTiles(Context ctx) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); @@ -49,7 +49,7 @@ public class OsmandSettings { } // this value string is synchronized with settings_pref.xml preference name - public static final String USE_INTERNET_TO_CALCULATE_ROUTE = "use_internet_to_calculate_route"; + public static final String USE_INTERNET_TO_CALCULATE_ROUTE = "use_internet_to_calculate_route"; //$NON-NLS-1$ public static boolean isUsingInternetToCalculateRoute(Context ctx) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); @@ -57,7 +57,7 @@ public class OsmandSettings { } // this value string is synchronized with settings_pref.xml preference name - public static final String SHOW_POI_OVER_MAP = "show_poi_over_map"; + public static final String SHOW_POI_OVER_MAP = "show_poi_over_map"; //$NON-NLS-1$ public static boolean isShowingPoiOverMap(Context ctx) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); @@ -65,11 +65,11 @@ public class OsmandSettings { } // this value string is synchronized with settings_pref.xml preference name - public static final String USER_NAME = "user_name"; + public static final String USER_NAME = "user_name"; //$NON-NLS-1$ public static String getUserName(Context ctx) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); - return prefs.getString(USER_NAME, "NoName"); + return prefs.getString(USER_NAME, "NoName"); //$NON-NLS-1$ } public static boolean setUserName(Context ctx, String name) { @@ -77,10 +77,10 @@ public class OsmandSettings { return prefs.edit().putString(USER_NAME, name).commit(); } - public static final String USER_PASSWORD = "user_password"; + public static final String USER_PASSWORD = "user_password"; //$NON-NLS-1$ public static String getUserPassword(Context ctx){ SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); - return prefs.getString(USER_PASSWORD, ""); + return prefs.getString(USER_PASSWORD, ""); //$NON-NLS-1$ } public static boolean setUserPassword(Context ctx, String name){ @@ -89,7 +89,7 @@ public class OsmandSettings { } // this value string is synchronized with settings_pref.xml preference name - public static final String APPLICATION_MODE = "application_mode"; + public static final String APPLICATION_MODE = "application_mode"; //$NON-NLS-1$ public static ApplicationMode getApplicationMode(Context ctx) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); @@ -107,10 +107,10 @@ public class OsmandSettings { } // this value string is synchronized with settings_pref.xml preference name - public static final String SAVE_CURRENT_TRACK = "save_current_track"; + public static final String SAVE_CURRENT_TRACK = "save_current_track"; //$NON-NLS-1$ // this value string is synchronized with settings_pref.xml preference name - public static final String SAVE_TRACK_TO_GPX = "save_track_to_gpx"; + public static final String SAVE_TRACK_TO_GPX = "save_track_to_gpx"; //$NON-NLS-1$ public static boolean isSavingTrackToGpx(Context ctx) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); @@ -118,7 +118,7 @@ public class OsmandSettings { } // this value string is synchronized with settings_pref.xml preference name - public static final String SAVE_TRACK_INTERVAL = "save_track_interval"; + public static final String SAVE_TRACK_INTERVAL = "save_track_interval"; //$NON-NLS-1$ public static int getSavingTrackInterval(Context ctx) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); @@ -126,7 +126,7 @@ public class OsmandSettings { } // this value string is synchronized with settings_pref.xml preference name - public static final String SHOW_OSM_BUGS = "show_osm_bugs"; + public static final String SHOW_OSM_BUGS = "show_osm_bugs"; //$NON-NLS-1$ public static boolean isShowingOsmBugs(Context ctx) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); @@ -134,7 +134,7 @@ public class OsmandSettings { } // this value string is synchronized with settings_pref.xml preference name - public static final String SHOW_VIEW_ANGLE = "show_view_angle"; + public static final String SHOW_VIEW_ANGLE = "show_view_angle"; //$NON-NLS-1$ public static boolean isShowingViewAngle(Context ctx) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); @@ -142,7 +142,7 @@ public class OsmandSettings { } // this value string is synchronized with settings_pref.xml preference name - public static final String AUTO_ZOOM_MAP = "auto_zoom_map"; + public static final String AUTO_ZOOM_MAP = "auto_zoom_map"; //$NON-NLS-1$ public static boolean isAutoZoomEnabled(Context ctx) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); @@ -150,7 +150,7 @@ public class OsmandSettings { } // this value string is synchronized with settings_pref.xml preference name - public static final String ROTATE_MAP_TO_BEARING = "rotate_map_to_bearing"; + public static final String ROTATE_MAP_TO_BEARING = "rotate_map_to_bearing"; //$NON-NLS-1$ public static boolean isRotateMapToBearing(Context ctx) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); @@ -158,7 +158,7 @@ public class OsmandSettings { } // this value string is synchronized with settings_pref.xml preference name - public static final String POSITION_ON_MAP = "position_on_map"; + public static final String POSITION_ON_MAP = "position_on_map"; //$NON-NLS-1$ public static int getPositionOnMap(Context ctx) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); @@ -166,7 +166,7 @@ public class OsmandSettings { } // this value string is synchronized with settings_pref.xml preference name - public static final String MAP_VIEW_3D = "map_view_3d"; + public static final String MAP_VIEW_3D = "map_view_3d"; //$NON-NLS-1$ public static boolean isMapView3D(Context ctx) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); @@ -174,7 +174,7 @@ public class OsmandSettings { } // this value string is synchronized with settings_pref.xml preference name - public static final String USE_ENGLISH_NAMES = "use_english_names"; + public static final String USE_ENGLISH_NAMES = "use_english_names"; //$NON-NLS-1$ public static boolean usingEnglishNames(Context ctx) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); @@ -187,7 +187,7 @@ public class OsmandSettings { } // this value string is synchronized with settings_pref.xml preference name - public static final String MAP_TILE_SOURCES = "map_tile_sources"; + public static final String MAP_TILE_SOURCES = "map_tile_sources"; //$NON-NLS-1$ public static ITileSource getMapTileSource(Context ctx) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); @@ -213,10 +213,10 @@ public class OsmandSettings { } // This value is a key for saving last known location shown on the map - public static final String LAST_KNOWN_MAP_LAT = "last_known_map_lat"; - public static final String LAST_KNOWN_MAP_LON = "last_known_map_lon"; - public static final String IS_MAP_SYNC_TO_GPS_LOCATION = "is_map_sync_to_gps_location"; - public static final String LAST_KNOWN_MAP_ZOOM = "last_known_map_zoom"; + public static final String LAST_KNOWN_MAP_LAT = "last_known_map_lat"; //$NON-NLS-1$ + public static final String LAST_KNOWN_MAP_LON = "last_known_map_lon"; //$NON-NLS-1$ + public static final String IS_MAP_SYNC_TO_GPS_LOCATION = "is_map_sync_to_gps_location"; //$NON-NLS-1$ + public static final String LAST_KNOWN_MAP_ZOOM = "last_known_map_zoom"; //$NON-NLS-1$ public static LatLon getLastKnownMapLocation(Context ctx) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); @@ -265,8 +265,8 @@ public class OsmandSettings { edit.commit(); } - public final static String POINT_NAVIGATE_LAT = "point_navigate_lat"; - public final static String POINT_NAVIGATE_LON = "point_navigate_lon"; + public final static String POINT_NAVIGATE_LAT = "point_navigate_lat"; //$NON-NLS-1$ + public final static String POINT_NAVIGATE_LON = "point_navigate_lon"; //$NON-NLS-1$ public static LatLon getPointToNavigate(Context ctx) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); @@ -288,23 +288,23 @@ public class OsmandSettings { return prefs.edit().putFloat(POINT_NAVIGATE_LAT, (float) latitude).putFloat(POINT_NAVIGATE_LON, (float) longitude).commit(); } - public static final String LAST_SEARCHED_REGION = "last_searched_region"; - public static final String LAST_SEARCHED_CITY = "last_searched_city"; - public static final String LAST_SEARCHED_STREET = "last_searched_street"; - public static final String LAST_SEARCHED_BUILDING = "last_searched_building"; - public static final String LAST_SEARCHED_INTERSECTED_STREET = "last_searched_intersected_street"; + public static final String LAST_SEARCHED_REGION = "last_searched_region"; //$NON-NLS-1$ + public static final String LAST_SEARCHED_CITY = "last_searched_city"; //$NON-NLS-1$ + public static final String LAST_SEARCHED_STREET = "last_searched_street"; //$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 String getLastSearchedRegion(Context ctx) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); - return prefs.getString(LAST_SEARCHED_REGION, ""); + return prefs.getString(LAST_SEARCHED_REGION, ""); //$NON-NLS-1$ } public static boolean setLastSearchedRegion(Context ctx, String region) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); Editor edit = prefs.edit().putString(LAST_SEARCHED_REGION, region).putLong(LAST_SEARCHED_CITY, -1).putString(LAST_SEARCHED_STREET, - "").putString(LAST_SEARCHED_BUILDING, ""); + "").putString(LAST_SEARCHED_BUILDING, ""); //$NON-NLS-1$ //$NON-NLS-2$ if (prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)) { - edit.putString(LAST_SEARCHED_INTERSECTED_STREET, ""); + edit.putString(LAST_SEARCHED_INTERSECTED_STREET, ""); //$NON-NLS-1$ } return edit.commit(); } @@ -316,31 +316,31 @@ public class OsmandSettings { public static boolean setLastSearchedCity(Context ctx, Long cityId) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); - Editor edit = prefs.edit().putLong(LAST_SEARCHED_CITY, cityId).putString(LAST_SEARCHED_STREET, "").putString( - LAST_SEARCHED_BUILDING, ""); + Editor edit = prefs.edit().putLong(LAST_SEARCHED_CITY, cityId).putString(LAST_SEARCHED_STREET, "").putString( //$NON-NLS-1$ + LAST_SEARCHED_BUILDING, ""); //$NON-NLS-1$ if(prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)){ - edit.putString(LAST_SEARCHED_INTERSECTED_STREET, ""); + edit.putString(LAST_SEARCHED_INTERSECTED_STREET, ""); //$NON-NLS-1$ } return edit.commit(); } public static String getLastSearchedStreet(Context ctx) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); - return prefs.getString(LAST_SEARCHED_STREET, ""); + return prefs.getString(LAST_SEARCHED_STREET, ""); //$NON-NLS-1$ } public static boolean setLastSearchedStreet(Context ctx, String street) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); - Editor edit = prefs.edit().putString(LAST_SEARCHED_STREET, street).putString(LAST_SEARCHED_BUILDING, ""); + Editor edit = prefs.edit().putString(LAST_SEARCHED_STREET, street).putString(LAST_SEARCHED_BUILDING, ""); //$NON-NLS-1$ if (prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)) { - edit.putString(LAST_SEARCHED_INTERSECTED_STREET, ""); + edit.putString(LAST_SEARCHED_INTERSECTED_STREET, ""); //$NON-NLS-1$ } return edit.commit(); } public static String getLastSearchedBuilding(Context ctx) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); - return prefs.getString(LAST_SEARCHED_BUILDING, ""); + return prefs.getString(LAST_SEARCHED_BUILDING, ""); //$NON-NLS-1$ } public static boolean setLastSearchedBuilding(Context ctx, String building) { @@ -353,7 +353,7 @@ public class OsmandSettings { if (!prefs.contains(LAST_SEARCHED_INTERSECTED_STREET)) { return null; } - return prefs.getString(LAST_SEARCHED_INTERSECTED_STREET, ""); + return prefs.getString(LAST_SEARCHED_INTERSECTED_STREET, ""); //$NON-NLS-1$ } public static boolean setLastSearchedIntersectedStreet(Context ctx, String street) { @@ -366,7 +366,7 @@ public class OsmandSettings { return prefs.edit().remove(LAST_SEARCHED_INTERSECTED_STREET).commit(); } - public static final String SELECTED_POI_FILTER_FOR_MAP = "selected_poi_filter_for_map"; + public static final String SELECTED_POI_FILTER_FOR_MAP = "selected_poi_filter_for_map"; //$NON-NLS-1$ public static boolean setPoiFilterForMap(Context ctx, String filterId) { SharedPreferences prefs = ctx.getSharedPreferences(SHARED_PREFERENCES_NAME, Context.MODE_WORLD_READABLE); diff --git a/OsmAnd/src/com/osmand/PoiFilter.java b/OsmAnd/src/com/osmand/PoiFilter.java index 660e4c720b..156bdb6e29 100644 --- a/OsmAnd/src/com/osmand/PoiFilter.java +++ b/OsmAnd/src/com/osmand/PoiFilter.java @@ -12,9 +12,9 @@ import com.osmand.osm.MapUtils; public class PoiFilter { - public final static String STD_PREFIX = "std_"; - public final static String USER_PREFIX = "user_"; - public final static String CUSTOM_FILTER_ID = USER_PREFIX + "custom_id"; + public final static String STD_PREFIX = "std_"; //$NON-NLS-1$ + public final static String USER_PREFIX = "user_"; //$NON-NLS-1$ + public final static String CUSTOM_FILTER_ID = USER_PREFIX + "custom_id"; //$NON-NLS-1$ private Map> acceptedTypes = new LinkedHashMap>(); private String filterByName = null; @@ -33,7 +33,7 @@ public class PoiFilter { public PoiFilter(AmenityType type){ isStandardFilter = true; filterId = STD_PREFIX + type; - name = type == null ? Messages.getMessage("poi_filter_closest_poi") : AmenityType.toPublicString(type); + name = type == null ? Messages.getMessage("poi_filter_closest_poi") : AmenityType.toPublicString(type); //$NON-NLS-1$ if(type == null){ initSearchAll(); } else { @@ -147,38 +147,38 @@ public class PoiFilter { return null; } if(acceptedTypes.size() == 0){ - return "1 > 1"; + return "1 > 1"; //$NON-NLS-1$ } StringBuilder b = new StringBuilder(); - b.append("("); + b.append("("); //$NON-NLS-1$ boolean first = true; for(AmenityType a : acceptedTypes.keySet()){ if(first){ first = false; } else { - b.append(" OR "); + b.append(" OR "); //$NON-NLS-1$ } - b.append("("); - b.append(IndexPoiTable.TYPE.name().toLowerCase()).append(" = '").append(AmenityType.valueToString(a)).append("'"); + b.append("("); //$NON-NLS-1$ + b.append(IndexPoiTable.TYPE.name().toLowerCase()).append(" = '").append(AmenityType.valueToString(a)).append("'"); //$NON-NLS-1$ //$NON-NLS-2$ if(acceptedTypes.get(a) != null){ List list = acceptedTypes.get(a); - b.append(" AND "); - b.append(IndexPoiTable.SUBTYPE.name().toLowerCase()).append(" IN ("); + b.append(" AND "); //$NON-NLS-1$ + b.append(IndexPoiTable.SUBTYPE.name().toLowerCase()).append(" IN ("); //$NON-NLS-1$ boolean bfirst = true; for(String s : list){ if(bfirst){ bfirst = false; } else { - b.append(", "); + b.append(", "); //$NON-NLS-1$ } - b.append("'").append(s).append("'"); + b.append("'").append(s).append("'"); //$NON-NLS-1$ //$NON-NLS-2$ } - b.append(")"); + b.append(")"); //$NON-NLS-1$ } - b.append(")"); + b.append(")"); //$NON-NLS-1$ } - b.append(")"); + b.append(")"); //$NON-NLS-1$ return b.toString(); } diff --git a/OsmAnd/src/com/osmand/PoiFiltersHelper.java b/OsmAnd/src/com/osmand/PoiFiltersHelper.java index fd23a68743..ba54fc570c 100644 --- a/OsmAnd/src/com/osmand/PoiFiltersHelper.java +++ b/OsmAnd/src/com/osmand/PoiFiltersHelper.java @@ -42,59 +42,59 @@ public class PoiFiltersHelper { Map> types = new LinkedHashMap>(); List list = new ArrayList(); - list.add("fuel"); - list.add("car_wash"); - list.add("car_repair"); + list.add("fuel"); //$NON-NLS-1$ + list.add("car_wash"); //$NON-NLS-1$ + list.add("car_repair"); //$NON-NLS-1$ types.put(AmenityType.TRANSPORTATION, list); list = new ArrayList(); - list.add("car"); - list.add("car_repair"); + list.add("car"); //$NON-NLS-1$ + list.add("car_repair"); //$NON-NLS-1$ types.put(AmenityType.SHOP, list); - filters.add(new PoiFilter(Messages.getMessage("poi_filter_car_aid"), null, types)); + filters.add(new PoiFilter(Messages.getMessage("poi_filter_car_aid"), null, types)); //$NON-NLS-1$ types.clear(); types.put(AmenityType.HISTORIC, null); types.put(AmenityType.TOURISM, null); list = new ArrayList(); - list.add("place_of_worship"); - list.add("internet_access"); - list.add("bench"); - list.add("embassy"); - list.add("emergency_phone"); - list.add("marketplace"); - list.add("post_office"); - list.add("recycling"); - list.add("telephone"); - list.add("toilets"); - list.add("waste_basket"); - list.add("waste_disposal"); + list.add("place_of_worship"); //$NON-NLS-1$ + list.add("internet_access"); //$NON-NLS-1$ + list.add("bench"); //$NON-NLS-1$ + list.add("embassy"); //$NON-NLS-1$ + list.add("emergency_phone"); //$NON-NLS-1$ + list.add("marketplace"); //$NON-NLS-1$ + list.add("post_office"); //$NON-NLS-1$ + list.add("recycling"); //$NON-NLS-1$ + list.add("telephone"); //$NON-NLS-1$ + list.add("toilets"); //$NON-NLS-1$ + list.add("waste_basket"); //$NON-NLS-1$ + list.add("waste_disposal"); //$NON-NLS-1$ types.put(AmenityType.OTHER, list); - filters.add(new PoiFilter(Messages.getMessage("poi_filter_for_tourists"), null, types)); + filters.add(new PoiFilter(Messages.getMessage("poi_filter_for_tourists"), null, types)); //$NON-NLS-1$ types.clear(); list = new ArrayList(); - list.add("fuel"); + list.add("fuel"); //$NON-NLS-1$ types.put(AmenityType.TRANSPORTATION, list); - filters.add(new PoiFilter(Messages.getMessage("poi_filter_fuel"), null, types)); + filters.add(new PoiFilter(Messages.getMessage("poi_filter_fuel"), null, types)); //$NON-NLS-1$ types.clear(); list = new ArrayList(); - list.add("alcohol"); - list.add("bakery"); - list.add("beverages"); - list.add("butcher"); - list.add("convenience"); - list.add("department_store"); - list.add("convenience"); - list.add("farm"); - list.add("general"); - list.add("ice_cream"); - list.add("kiosk"); - list.add("supermarket"); - list.add("variety_store"); + list.add("alcohol"); //$NON-NLS-1$ + list.add("bakery"); //$NON-NLS-1$ + list.add("beverages"); //$NON-NLS-1$ + list.add("butcher"); //$NON-NLS-1$ + list.add("convenience"); //$NON-NLS-1$ + list.add("department_store"); //$NON-NLS-1$ + list.add("convenience"); //$NON-NLS-1$ + list.add("farm"); //$NON-NLS-1$ + list.add("general"); //$NON-NLS-1$ + list.add("ice_cream"); //$NON-NLS-1$ + list.add("kiosk"); //$NON-NLS-1$ + list.add("supermarket"); //$NON-NLS-1$ + list.add("variety_store"); //$NON-NLS-1$ types.put(AmenityType.SHOP, list); - filters.add(new PoiFilter(Messages.getMessage("poi_filter_food_shop"), null, types)); + filters.add(new PoiFilter(Messages.getMessage("poi_filter_food_shop"), null, types)); //$NON-NLS-1$ types.clear(); return filters; @@ -106,7 +106,7 @@ public class PoiFiltersHelper { ////ctx.deleteDatabase(PoiFilterDbHelper.DATABASE_NAME); cacheUserDefinedFilters = new ArrayList(); - PoiFilter filter = new PoiFilter(Messages.getMessage("poi_filter_custom_filter"), PoiFilter.CUSTOM_FILTER_ID, null); + PoiFilter filter = new PoiFilter(Messages.getMessage("poi_filter_custom_filter"), PoiFilter.CUSTOM_FILTER_ID, null); //$NON-NLS-1$ cacheUserDefinedFilters.add(filter); PoiFilterDbHelper helper = new PoiFilterDbHelper(ctx); cacheUserDefinedFilters.addAll(helper.getFilters()); @@ -157,22 +157,22 @@ public class PoiFiltersHelper { protected static class PoiFilterDbHelper extends SQLiteOpenHelper { - public static final String DATABASE_NAME = "poi_filters"; + public static final String DATABASE_NAME = "poi_filters"; //$NON-NLS-1$ private static final int DATABASE_VERSION = 1; - private static final String FILTER_NAME = "poi_filters"; - private static final String FILTER_COL_NAME = "name"; - private static final String FILTER_COL_ID = "id"; - private static final String FILTER_COL_FILTERBYNAME = "filterbyname"; - private static final String FILTER_TABLE_CREATE = "CREATE TABLE " + FILTER_NAME + " (" + - FILTER_COL_NAME + ", " + FILTER_COL_ID + ", " + FILTER_COL_FILTERBYNAME + ");"; + private static final String FILTER_NAME = "poi_filters"; //$NON-NLS-1$ + private static final String FILTER_COL_NAME = "name"; //$NON-NLS-1$ + private static final String FILTER_COL_ID = "id"; //$NON-NLS-1$ + private static final String FILTER_COL_FILTERBYNAME = "filterbyname"; //$NON-NLS-1$ + private static final String FILTER_TABLE_CREATE = "CREATE TABLE " + FILTER_NAME + " (" + //$NON-NLS-1$ //$NON-NLS-2$ + FILTER_COL_NAME + ", " + FILTER_COL_ID + ", " + FILTER_COL_FILTERBYNAME + ");"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ - private static final String CATEGORIES_NAME = "categories"; - private static final String CATEGORIES_FILTER_ID = "filter_id"; - private static final String CATEGORIES_COL_CATEGORY = "category"; - private static final String CATEGORIES_COL_SUBCATEGORY = "subcategory"; - private static final String CATEGORIES_TABLE_CREATE = "CREATE TABLE " + CATEGORIES_NAME + " (" + - CATEGORIES_FILTER_ID + ", " + CATEGORIES_COL_CATEGORY + ", " + CATEGORIES_COL_SUBCATEGORY + ");"; + private static final String CATEGORIES_NAME = "categories"; //$NON-NLS-1$ + private static final String CATEGORIES_FILTER_ID = "filter_id"; //$NON-NLS-1$ + private static final String CATEGORIES_COL_CATEGORY = "category"; //$NON-NLS-1$ + private static final String CATEGORIES_COL_SUBCATEGORY = "subcategory"; //$NON-NLS-1$ + private static final String CATEGORIES_TABLE_CREATE = "CREATE TABLE " + CATEGORIES_NAME + " (" + //$NON-NLS-1$ //$NON-NLS-2$ + CATEGORIES_FILTER_ID + ", " + CATEGORIES_COL_CATEGORY + ", " + CATEGORIES_COL_SUBCATEGORY + ");"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ PoiFilterDbHelper(Context context) { super(context, DATABASE_NAME, null, DATABASE_VERSION); @@ -195,16 +195,16 @@ public class PoiFiltersHelper { public boolean addFilter(PoiFilter p, SQLiteDatabase db, boolean addOnlyCategories){ if(db != null){ if(!addOnlyCategories){ - db.execSQL("INSERT INTO " + FILTER_NAME + " VALUES (?, ?, ?)",new Object[]{p.getName(), p.getFilterId(), p.getFilterByName()}); + db.execSQL("INSERT INTO " + FILTER_NAME + " VALUES (?, ?, ?)",new Object[]{p.getName(), p.getFilterId(), p.getFilterByName()}); //$NON-NLS-1$ //$NON-NLS-2$ } Map> types = p.getAcceptedTypes(); for(AmenityType a : types.keySet()){ if(types.get(a) == null){ - db.execSQL("INSERT INTO " + CATEGORIES_NAME + " VALUES (?, ?, ?)", + db.execSQL("INSERT INTO " + CATEGORIES_NAME + " VALUES (?, ?, ?)", //$NON-NLS-1$ //$NON-NLS-2$ new Object[]{p.getFilterId(), AmenityType.valueToString(a), null}); } else { for(String s : types.get(a)){ - db.execSQL("INSERT INTO " + CATEGORIES_NAME + " VALUES (?, ?, ?)", + db.execSQL("INSERT INTO " + CATEGORIES_NAME + " VALUES (?, ?, ?)", //$NON-NLS-1$ //$NON-NLS-2$ new Object[]{p.getFilterId(), AmenityType.valueToString(a), s}); } } @@ -218,7 +218,7 @@ public class PoiFiltersHelper { SQLiteDatabase db = getReadableDatabase(); ArrayList list = new ArrayList(); if(db != null){ - Cursor query = db.rawQuery("SELECT " + CATEGORIES_FILTER_ID +", " + CATEGORIES_COL_CATEGORY +"," + CATEGORIES_COL_SUBCATEGORY +" FROM " + + Cursor query = db.rawQuery("SELECT " + CATEGORIES_FILTER_ID +", " + CATEGORIES_COL_CATEGORY +"," + CATEGORIES_COL_SUBCATEGORY +" FROM " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ CATEGORIES_NAME, null); Map>> map = new LinkedHashMap>>(); if(query.moveToFirst()){ @@ -242,7 +242,7 @@ public class PoiFiltersHelper { } query.close(); - query = db.rawQuery("SELECT " + FILTER_COL_ID +", " + FILTER_COL_NAME +"," + FILTER_COL_FILTERBYNAME +" FROM " + + query = db.rawQuery("SELECT " + FILTER_COL_ID +", " + FILTER_COL_NAME +"," + FILTER_COL_FILTERBYNAME +" FROM " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ FILTER_NAME, null); if(query.moveToFirst()){ do { @@ -262,11 +262,11 @@ public class PoiFiltersHelper { public boolean editFilter(PoiFilter filter) { SQLiteDatabase db = getWritableDatabase(); if (db != null) { - db.execSQL("DELETE FROM " + CATEGORIES_NAME + " WHERE " + CATEGORIES_FILTER_ID + " = ?", + db.execSQL("DELETE FROM " + CATEGORIES_NAME + " WHERE " + CATEGORIES_FILTER_ID + " = ?", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ new Object[] { filter.getFilterId() }); addFilter(filter, db, true); - db.execSQL("UPDATE " + FILTER_NAME + " SET " + FILTER_COL_FILTERBYNAME + " = ?, " + FILTER_COL_NAME + " = ? " + " WHERE " - + FILTER_COL_ID + "= ?", new Object[] { filter.getFilterByName(), filter.getName(), filter.getFilterId() }); + db.execSQL("UPDATE " + FILTER_NAME + " SET " + FILTER_COL_FILTERBYNAME + " = ?, " + FILTER_COL_NAME + " = ? " + " WHERE " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ //$NON-NLS-5$ + + FILTER_COL_ID + "= ?", new Object[] { filter.getFilterByName(), filter.getName(), filter.getFilterId() }); //$NON-NLS-1$ return true; } return false; @@ -275,8 +275,8 @@ public class PoiFiltersHelper { public boolean deleteFilter(PoiFilter p){ SQLiteDatabase db = getWritableDatabase(); if(db != null){ - db.execSQL("DELETE FROM " + FILTER_NAME + " WHERE " +FILTER_COL_ID + " = ?",new Object[]{p.getFilterId()}); - db.execSQL("DELETE FROM " + CATEGORIES_NAME + " WHERE " +CATEGORIES_FILTER_ID + " = ?", new Object[]{p.getFilterId()}); + db.execSQL("DELETE FROM " + FILTER_NAME + " WHERE " +FILTER_COL_ID + " = ?",new Object[]{p.getFilterId()}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + db.execSQL("DELETE FROM " + CATEGORIES_NAME + " WHERE " +CATEGORIES_FILTER_ID + " = ?", new Object[]{p.getFilterId()}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ return true; } return false; diff --git a/OsmAnd/src/com/osmand/ProgressDialogImplementation.java b/OsmAnd/src/com/osmand/ProgressDialogImplementation.java index 47fdd1b1cd..5a06d91636 100644 --- a/OsmAnd/src/com/osmand/ProgressDialogImplementation.java +++ b/OsmAnd/src/com/osmand/ProgressDialogImplementation.java @@ -11,7 +11,7 @@ public class ProgressDialogImplementation implements IProgress { private int progress; private int work; private int deltaWork; - private String message = ""; + private String message = ""; //$NON-NLS-1$ private Handler mViewUpdateHandler; private Thread run; @@ -47,7 +47,7 @@ public class ProgressDialogImplementation implements IProgress { } private void updateMessage() { - message = taskName + String.format(" %.1f %%", this.progress * 100f / ((float) this.work)); + message = taskName + String.format(" %.1f %%", this.progress * 100f / ((float) this.work)); //$NON-NLS-1$ mViewUpdateHandler.sendEmptyMessage(0); } @@ -76,7 +76,7 @@ public class ProgressDialogImplementation implements IProgress { @Override public void startTask(String taskName, int work) { if(taskName == null){ - taskName = ""; + taskName = ""; //$NON-NLS-1$ } message = taskName; mViewUpdateHandler.sendEmptyMessage(0); diff --git a/OsmAnd/src/com/osmand/RegionAddressRepository.java b/OsmAnd/src/com/osmand/RegionAddressRepository.java index bf9735856e..d92bc11248 100644 --- a/OsmAnd/src/com/osmand/RegionAddressRepository.java +++ b/OsmAnd/src/com/osmand/RegionAddressRepository.java @@ -1,6 +1,7 @@ package com.osmand; import java.io.File; +import java.text.Collator; import java.util.ArrayList; import java.util.Collection; import java.util.Collections; @@ -10,6 +11,7 @@ import java.util.LinkedHashMap; import java.util.List; import java.util.Map; import java.util.Set; +import java.util.SortedSet; import java.util.TreeSet; import org.apache.commons.logging.Log; @@ -39,6 +41,7 @@ public class RegionAddressRepository { private LinkedHashMap cities = new LinkedHashMap(); private Map> cityTypes = new HashMap>(); + private SortedSet postCodes = new TreeSet(Collator.getInstance()); private boolean useEnglishNames = false; @@ -57,7 +60,7 @@ public class RegionAddressRepository { } if (log.isDebugEnabled()) { - log.debug("Initializing address db " + file.getAbsolutePath() + " " + (System.currentTimeMillis() - start) + "ms"); + log.debug("Initializing address db " + file.getAbsolutePath() + " " + (System.currentTimeMillis() - start) + " ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } return true; } @@ -76,6 +79,7 @@ public class RegionAddressRepository { public void clearCities(){ cities.clear(); cityTypes.clear(); + postCodes.clear(); } public boolean areCitiesPreloaded(){ @@ -95,12 +99,12 @@ public class RegionAddressRepository { if(city.isEmptyWithStreets()){ preloadStreets(city); } - if (city.getPostcodes().isEmpty()) { - preloadPostcodes(city); + if (postCodes.isEmpty()) { + preloadPostcodes(); } Street street = city.getStreet(name); if (street == null) { - street = city.getPostcodes().contains(name.toUpperCase()) ? new PostcodeBasedStreet(city, name) : null; + street = postCodes.contains(name.toUpperCase()) ? new PostcodeBasedStreet(city, name) : null; } return street; } @@ -167,9 +171,9 @@ public class RegionAddressRepository { public void fillWithSuggestedStreetsIntersectStreets(City city, Street st, List streetsToFill) { if (st != null) { Set strIds = new TreeSet(); - log.debug("Start loading instersection streets for " + city.getName()); - Cursor query = db.rawQuery("SELECT B.STREET FROM street_node A JOIN street_node B ON A.ID = B.ID WHERE A.STREET = ?", - new String[] { st.getId() + "" }); + log.debug("Start loading instersection streets for " + city.getName()); //$NON-NLS-1$ + Cursor query = db.rawQuery("SELECT B.STREET FROM street_node A JOIN street_node B ON A.ID = B.ID WHERE A.STREET = ?", //$NON-NLS-1$ + new String[] { st.getId() + "" }); //$NON-NLS-1$ if (query.moveToFirst()) { do { if (st.getId() != query.getLong(0)) { @@ -183,7 +187,7 @@ public class RegionAddressRepository { streetsToFill.add(s); } } - log.debug("Loaded " + strIds.size() + " streets"); + log.debug("Loaded " + strIds.size() + " streets"); //$NON-NLS-1$ //$NON-NLS-2$ preloadWayNodes(st); } } @@ -191,7 +195,7 @@ public class RegionAddressRepository { public void fillWithSuggestedStreets(City c, String name, List streetsToFill){ preloadStreets(c); - preloadPostcodes(c); + preloadPostcodes(); name = name.toLowerCase(); int ind = 0; @@ -202,7 +206,7 @@ public class RegionAddressRepository { Character.isDigit(name.charAt(0)) && Character.isDigit(name.charAt(1))) { // also try to identify postcodes - for (String code : c.getPostcodes()) { + for (String code : postCodes) { code = code.toLowerCase(); if (code.startsWith(name)) { streetsToFill.add(ind++,new PostcodeBasedStreet(c, code)); @@ -226,17 +230,40 @@ public class RegionAddressRepository { public void fillWithSuggestedCities(String name, List citiesToFill){ preloadCities(); + // essentially index is created that cities towns are first in cities map + int ind = 0; + if (name.length() >= 2 && + Character.isDigit(name.charAt(0)) && + Character.isDigit(name.charAt(1))) { + preloadPostcodes(); + name = name.toLowerCase(); + // also try to identify postcodes + for (String code : postCodes) { + String lcode = code.toLowerCase(); + // TODO postcode + City c = new City(CityType.CITY); + c.setName(code); + c.setEnName(code); + if (lcode.startsWith(name)) { + citiesToFill.add(ind++,c); + } else if(lcode.contains(name)){ + citiesToFill.add(c); + } + } + + } if(name.length() < 3){ EnumSet set = EnumSet.of(CityType.CITY, CityType.TOWN); for(CityType t : set){ + List list = cityTypes.get(t); + if(list == null){ + continue; + } if(name.length() == 0){ - List list = cityTypes.get(t); - if (list != null) { - citiesToFill.addAll(list); - } + citiesToFill.addAll(list); } else { name = name.toLowerCase(); - for (City c : cityTypes.get(t)) { + for (City c : list) { String cName = useEnglishNames ? c.getEnName() : c.getName(); String lowerCase = cName.toLowerCase(); if(lowerCase.startsWith(name)){ @@ -246,8 +273,6 @@ public class RegionAddressRepository { } } } else { - // essentially index is created that cities towns are first in cities map - int ind = 0; name = name.toLowerCase(); Collection src = cities.values(); for (City c : src) { @@ -261,15 +286,15 @@ public class RegionAddressRepository { } } int initialsize = citiesToFill.size(); - log.debug("Start loading cities for " +getName() + " filter " + name); + log.debug("Start loading cities for " +getName() + " filter " + name); //$NON-NLS-1$ //$NON-NLS-2$ // lower function in SQLite requires ICU extension name = Algoritms.capitalizeFirstLetterAndLowercase(name); StringBuilder where = new StringBuilder(80); where. - append(IndexCityTable.CITY_TYPE.toString()).append(" not in ("). - append('\'').append(CityType.valueToString(CityType.CITY)).append('\'').append(", "). - append('\'').append(CityType.valueToString(CityType.TOWN)).append('\'').append(") and "). - append(useEnglishNames ? IndexCityTable.NAME_EN.toString() : IndexCityTable.NAME.toString()).append(" LIKE '"+name+"%'"); + append(IndexCityTable.CITY_TYPE.toString()).append(" not in ("). //$NON-NLS-1$ + append('\'').append(CityType.valueToString(CityType.CITY)).append('\'').append(", "). //$NON-NLS-1$ + append('\'').append(CityType.valueToString(CityType.TOWN)).append('\'').append(") and "). //$NON-NLS-1$ + append(useEnglishNames ? IndexCityTable.NAME_EN.toString() : IndexCityTable.NAME.toString()).append(" LIKE '"+name+"%'"); //$NON-NLS-1$ //$NON-NLS-2$ Cursor query = db.query(IndexCityTable.getTable(), IndexConstants.generateColumnNames(IndexCityTable.values()), where.toString(), null, null, null, null); if (query.moveToFirst()) { @@ -280,15 +305,15 @@ public class RegionAddressRepository { query.close(); - log.debug("Loaded citites " + (citiesToFill.size() - initialsize)); + log.debug("Loaded citites " + (citiesToFill.size() - initialsize)); //$NON-NLS-1$ } } public void preloadWayNodes(Street street){ if(street.getWayNodes().isEmpty()){ - Cursor query = db.query(IndexStreetNodeTable.getTable(), IndexConstants.generateColumnNames(IndexStreetNodeTable.values()), "? = street", - new String[] { street.getId() + "" }, null, null, null); - log.debug("Start loading waynodes for " + street.getName()); + Cursor query = db.query(IndexStreetNodeTable.getTable(), IndexConstants.generateColumnNames(IndexStreetNodeTable.values()), "? = street", //$NON-NLS-1$ + new String[] { street.getId() + "" }, null, null, null); //$NON-NLS-1$ + log.debug("Start loading waynodes for " + street.getName()); //$NON-NLS-1$ Map ways = new LinkedHashMap(); if (query.moveToFirst()) { do { @@ -306,27 +331,27 @@ public class RegionAddressRepository { for(Way w : ways.values()){ street.getWayNodes().add(w); } - log.debug("Loaded " + ways.size() + " ways"); + log.debug("Loaded " + ways.size() + " ways"); //$NON-NLS-1$ //$NON-NLS-2$ } } - public void preloadPostcodes(City city) { - if (city.getPostcodes().isEmpty()) { + public void preloadPostcodes() { + if (postCodes.isEmpty()) { // check if it possible to load postcodes Cursor query = db.query(true, IndexBuildingTable.getTable(), new String[] { IndexBuildingTable.POSTCODE.toString() }, null, null, null, null, null, null); - log.debug("Start loading postcodes for " + city.getName()); + log.debug("Start loading postcodes for "); //$NON-NLS-1$ if (query.moveToFirst()) { do { String postcode = query.getString(0); if (postcode != null) { - city.getPostcodes().add(postcode); + postCodes.add(postcode); } } while (query.moveToNext()); } query.close(); - log.debug("Loaded " + city.getPostcodes().size() + " postcodes "); + log.debug("Loaded " + postCodes.size() + " postcodes "); //$NON-NLS-1$ //$NON-NLS-2$ } } @@ -335,13 +360,13 @@ public class RegionAddressRepository { Cursor query = null; if (street instanceof PostcodeBasedStreet) { // this is postcode - query = db.query(IndexBuildingTable.getTable(), IndexConstants.generateColumnNames(IndexBuildingTable.values()), "? = postcode", + query = db.query(IndexBuildingTable.getTable(), IndexConstants.generateColumnNames(IndexBuildingTable.values()), "? = postcode", //$NON-NLS-1$ new String[] { street.getName().toUpperCase()}, null, null, null); } else { - query = db.query(IndexBuildingTable.getTable(), IndexConstants.generateColumnNames(IndexBuildingTable.values()), "? = street", - new String[] { street.getId() + "" }, null, null, null); + query = db.query(IndexBuildingTable.getTable(), IndexConstants.generateColumnNames(IndexBuildingTable.values()), "? = street", //$NON-NLS-1$ + new String[] { street.getId() + "" }, null, null, null); //$NON-NLS-1$ } - log.debug("Start loading buildings for " + street.getName()); + log.debug("Start loading buildings for " + street.getName()); //$NON-NLS-1$ if (query.moveToFirst()) { do { Building building = new Building(); @@ -354,15 +379,15 @@ public class RegionAddressRepository { } while (query.moveToNext()); } query.close(); - log.debug("Loaded " + street.getBuildings().size() + " buildings"); + log.debug("Loaded " + street.getBuildings().size() + " buildings"); //$NON-NLS-1$ //$NON-NLS-2$ } } public void preloadStreets(City city){ if (city.isEmptyWithStreets()) { - log.debug("Start loading streets for " + city.getName()); - Cursor query = db.query(IndexStreetTable.getTable(), IndexConstants.generateColumnNames(IndexStreetTable.values()), "? = city", - new String[] { city.getId() + "" }, null, null, null); + log.debug("Start loading streets for " + city.getName()); //$NON-NLS-1$ + Cursor query = db.query(IndexStreetTable.getTable(), IndexConstants.generateColumnNames(IndexStreetTable.values()), "? = city", //$NON-NLS-1$ + new String[] { city.getId() + "" }, null, null, null); //$NON-NLS-1$ if (query.moveToFirst()) { do { Street street = new Street(city); @@ -375,7 +400,7 @@ public class RegionAddressRepository { } while (query.moveToNext()); } query.close(); - log.debug("Loaded " + city.getStreets().size() + " streets"); + log.debug("Loaded " + city.getStreets().size() + " streets"); //$NON-NLS-1$ //$NON-NLS-2$ } } @@ -404,10 +429,10 @@ public class RegionAddressRepository { public void preloadCities(){ if (cities.isEmpty()) { - log.debug("Start loading cities for " +getName()); + log.debug("Start loading cities for " +getName()); //$NON-NLS-1$ StringBuilder where = new StringBuilder(); where.append(IndexCityTable.CITY_TYPE.toString()).append('='). - append('\'').append(CityType.valueToString(CityType.CITY)).append('\'').append(" or "). + append('\'').append(CityType.valueToString(CityType.CITY)).append('\'').append(" or "). //$NON-NLS-1$ append(IndexCityTable.CITY_TYPE.toString()).append('='). append('\'').append(CityType.valueToString(CityType.TOWN)).append('\''); Cursor query = db.query(IndexCityTable.getTable(), IndexConstants.generateColumnNames(IndexCityTable.values()), @@ -426,7 +451,7 @@ public class RegionAddressRepository { } while(query.moveToNext()); } - log.debug("Loaded " + cities.size() + " cities"); + log.debug("Loaded " + cities.size() + " cities"); //$NON-NLS-1$ //$NON-NLS-2$ query.close(); } } diff --git a/OsmAnd/src/com/osmand/ResourceManager.java b/OsmAnd/src/com/osmand/ResourceManager.java index 8f30e19155..ece67bc659 100644 --- a/OsmAnd/src/com/osmand/ResourceManager.java +++ b/OsmAnd/src/com/osmand/ResourceManager.java @@ -35,9 +35,9 @@ import com.osmand.views.POIMapLayer; */ public class ResourceManager { - private static final String POI_PATH = "osmand/" + IndexConstants.POI_INDEX_DIR; - private static final String ADDRESS_PATH = "osmand/" + IndexConstants.ADDRESS_INDEX_DIR; - private static final String TILES_PATH = "osmand/tiles/"; + private static final String POI_PATH = "osmand/" + IndexConstants.POI_INDEX_DIR; //$NON-NLS-1$ + private static final String ADDRESS_PATH = "osmand/" + IndexConstants.ADDRESS_INDEX_DIR; //$NON-NLS-1$ + private static final String TILES_PATH = "osmand/tiles/"; //$NON-NLS-1$ private static final Log log = LogUtil.getLog(ResourceManager.class); @@ -116,7 +116,7 @@ public class ResourceManager { } builder.setLength(0); builder.append(map.getName()).append('/').append(zoom). append('/').append(x). - append('/').append(y).append(map.getTileFormat()).append(".tile"); + append('/').append(y).append(map.getTileFormat()).append(".tile"); //$NON-NLS-1$ String file = builder.toString(); if(deleteBefore){ cacheOfImages.remove(file); @@ -155,7 +155,7 @@ public class ResourceManager { long time = System.currentTimeMillis(); cacheOfImages.put(req.fileToLoad, BitmapFactory.decodeFile(en.getAbsolutePath())); if (log.isDebugEnabled()) { - log.debug("Loaded file : " + req.fileToLoad + " " + -(time - System.currentTimeMillis()) + " ms"); + log.debug("Loaded file : " + req.fileToLoad + " " + -(time - System.currentTimeMillis()) + " ms"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } @@ -291,7 +291,7 @@ public class ResourceManager { /// On low memory method /// public void onLowMemory() { - log.info("On low memory : cleaning tiles - size = " + cacheOfImages.size()); + log.info("On low memory : cleaning tiles - size = " + cacheOfImages.size()); //$NON-NLS-1$ clearTiles(); for(AmenityIndexRepository r : amenityRepositories){ r.clearCache(); @@ -362,7 +362,7 @@ public class ResourceManager { Stack requests = new Stack(); public AsyncLoadingThread(){ - super("Loader map objects (tiles, poi)"); + super("Loader map objects (tiles, poi)"); //$NON-NLS-1$ } @Override diff --git a/OsmAnd/src/com/osmand/activities/EditingPOIActivity.java b/OsmAnd/src/com/osmand/activities/EditingPOIActivity.java index 933a6358fe..44d9d0c42f 100644 --- a/OsmAnd/src/com/osmand/activities/EditingPOIActivity.java +++ b/OsmAnd/src/com/osmand/activities/EditingPOIActivity.java @@ -64,11 +64,11 @@ import com.osmand.views.OsmandMapTileView; public class EditingPOIActivity { // private final static String SITE_API = "http://api06.dev.openstreetmap.org/"; - private final static String SITE_API = "http://api.openstreetmap.org/"; + private final static String SITE_API = "http://api.openstreetmap.org/"; //$NON-NLS-1$ - private static final String DELETE_ACTION = "delete"; // NON-NLS - private static final String MODIFY_ACTION = "modify"; // NON-NLS - private static final String CREATE_ACTION = "create"; // NON-NLS + private static final String DELETE_ACTION = "delete"; //$NON-NLS-1$ + private static final String MODIFY_ACTION = "modify"; //$NON-NLS-1$ + private static final String CREATE_ACTION = "create"; //$NON-NLS-1$ private Dialog dlg; private final Context ctx; @@ -105,7 +105,7 @@ public class EditingPOIActivity { dlg = new Dialog(ctx); Node n = new Node(latitude, longitude, -1); n.putTag(OSMTagKey.AMENITY.getValue(), ""); - n.putTag(OSMTagKey.OPENING_HOURS.getValue(), "Mo-Su 08:00-20:00"); + n.putTag(OSMTagKey.OPENING_HOURS.getValue(), "Mo-Su 08:00-20:00"); //$NON-NLS-1$ dlg.setTitle(R.string.poi_create_title); showDialog(n); } @@ -167,7 +167,7 @@ public class EditingPOIActivity { AmenityType aType = AmenityType.values()[which]; if(aType != a.getType()){ a.setType(aType); - a.setSubType(""); + a.setSubType(""); //$NON-NLS-1$ updateType(a); } } @@ -230,24 +230,24 @@ public class EditingPOIActivity { DefaultHttpClient httpclient = new DefaultHttpClient(params); if (doAuthenticate) { - UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(OsmandSettings.getUserName(ctx) + ":" + UsernamePasswordCredentials credentials = new UsernamePasswordCredentials(OsmandSettings.getUserName(ctx) + ":" //$NON-NLS-1$ + OsmandSettings.getUserPassword(ctx)); httpclient.getCredentialsProvider().setCredentials(new AuthScope(AuthScope.ANY_HOST, AuthScope.ANY_PORT), credentials); } HttpRequestBase method = null; - if (requestMethod.equals("GET")) { + if (requestMethod.equals("GET")) { //$NON-NLS-1$ method = new HttpGet(url); - } else if (requestMethod.equals("POST")) { + } else if (requestMethod.equals("POST")) { //$NON-NLS-1$ method = new HttpPost(url); - } else if (requestMethod.equals("PUT")) { + } else if (requestMethod.equals("PUT")) { //$NON-NLS-1$ method = new HttpPut(url); - } else if (requestMethod.equals("DELETE")) { + } else if (requestMethod.equals("DELETE")) { //$NON-NLS-1$ method = new HttpDelete(url); } else { - throw new IllegalArgumentException(requestMethod + " is invalid method"); + throw new IllegalArgumentException(requestMethod + " is invalid method"); //$NON-NLS-1$ } - if (requestMethod.equals("PUT") || requestMethod.equals("POST") || requestMethod.equals("DELETE")) { + if (requestMethod.equals("PUT") || requestMethod.equals("POST") || requestMethod.equals("DELETE")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ // TODO // connection.setDoOutput(true); // connection.setRequestProperty("Content-type", "text/xml"); @@ -266,9 +266,9 @@ public class EditingPOIActivity { String msg; if(response.getStatusLine() != null){ - msg = userOperation + " failed" ; + msg = userOperation + " failed" ; //$NON-NLS-1$ } else { - msg = userOperation + " failed " + response.getStatusLine().getStatusCode() +" : "+ + msg = userOperation + " failed " + response.getStatusLine().getStatusCode() +" : "+ //$NON-NLS-1$//$NON-NLS-2$ response.getStatusLine().getReasonPhrase(); } log.error(msg); @@ -276,11 +276,11 @@ public class EditingPOIActivity { } else { InputStream is = response.getEntity().getContent(); if (is != null) { - BufferedReader in = new BufferedReader(new InputStreamReader(is, "UTF-8")); + BufferedReader in = new BufferedReader(new InputStreamReader(is, "UTF-8")); //$NON-NLS-1$ String s; while ((s = in.readLine()) != null) { responseBody.append(s); - responseBody.append("\n"); + responseBody.append("\n"); //$NON-NLS-1$ } is.close(); } @@ -288,17 +288,17 @@ public class EditingPOIActivity { return responseBody.toString(); } } catch (MalformedURLException e) { - log.error(userOperation + " failed", e); + log.error(userOperation + " failed", e); //$NON-NLS-1$ Toast.makeText(ctx, MessageFormat.format(ctx.getResources().getString(R.string.poi_error_unexpected_template), userOperation), Toast.LENGTH_LONG).show(); } catch (IOException e) { - log.error(userOperation + " failed", e); - Toast.makeText(ctx, MessageFormat.format(ctx.getResources().getString(R.string.poi_error_io_error_template), userOperation), Toast.LENGTH_LONG).show(); + log.error(userOperation + " failed", e); //$NON-NLS-1$ + Toast.makeText(ctx, MessageFormat.format(ctx.getResources().getString(R.string.poi_error_unexpected_template), userOperation), Toast.LENGTH_LONG).show(); } return null; } private String sendRequest(String url, String requestMethod, String requestBody, String userOperation, boolean doAuthenticate) { - log.info("Sending request " + url); + log.info("Sending request " + url); //$NON-NLS-1$ // if(true){ // return sendRequsetThroughHttpClient(url, requestMethod, requestBody, userOperation, doAuthenticate); // } @@ -310,16 +310,16 @@ public class EditingPOIActivity { connection.setRequestMethod(requestMethod); StringBuilder responseBody = new StringBuilder(); if (doAuthenticate) { - String token = OsmandSettings.getUserName(ctx) + ":" + OsmandSettings.getUserPassword(ctx); - connection.addRequestProperty("Authorization", "Basic " + Base64.encode(token.getBytes("UTF-8"))); + String token = OsmandSettings.getUserName(ctx) + ":" + OsmandSettings.getUserPassword(ctx); //$NON-NLS-1$ + connection.addRequestProperty("Authorization", "Basic " + Base64.encode(token.getBytes("UTF-8"))); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } connection.setDoInput(true); - if (requestMethod.equals("PUT") || requestMethod.equals("POST") || requestMethod.equals("DELETE")) { + if (requestMethod.equals("PUT") || requestMethod.equals("POST") || requestMethod.equals("DELETE")) { //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ connection.setDoOutput(true); - connection.setRequestProperty("Content-type", "text/xml"); + connection.setRequestProperty("Content-type", "text/xml"); //$NON-NLS-1$ //$NON-NLS-2$ OutputStream out = connection.getOutputStream(); if (requestBody != null) { - BufferedWriter bwr = new BufferedWriter(new OutputStreamWriter(out, "UTF-8"), 1024); + BufferedWriter bwr = new BufferedWriter(new OutputStreamWriter(out, "UTF-8"), 1024); //$NON-NLS-1$ bwr.write(requestBody); bwr.flush(); } @@ -331,12 +331,12 @@ public class EditingPOIActivity { log.error(msg); Toast.makeText(ctx, msg, Toast.LENGTH_LONG).show(); } else { - log.info("Response : " + connection.getResponseMessage()); + log.info("Response : " + connection.getResponseMessage()); //$NON-NLS-1$ // populate return fields. responseBody.setLength(0); InputStream i = connection.getInputStream(); if (i != null) { - BufferedReader in = new BufferedReader(new InputStreamReader(i, "UTF-8"), 256); + BufferedReader in = new BufferedReader(new InputStreamReader(i, "UTF-8"), 256); //$NON-NLS-1$ String s; boolean f = true; while ((s = in.readLine()) != null) { @@ -372,27 +372,27 @@ public class EditingPOIActivity { XmlSerializer ser = Xml.newSerializer(); try { ser.setOutput(writer); - ser.startDocument("UTF-8", true); - ser.startTag(null, "osm"); - ser.startTag(null, "changeset"); + ser.startDocument("UTF-8", true); //$NON-NLS-1$ + ser.startTag(null, "osm"); //$NON-NLS-1$ + ser.startTag(null, "changeset"); //$NON-NLS-1$ - ser.startTag(null, "tag"); - ser.attribute(null, "k", "comment"); - ser.attribute(null, "v", comment); - ser.endTag(null, "tag"); + ser.startTag(null, "tag"); //$NON-NLS-1$ + ser.attribute(null, "k", "comment"); //$NON-NLS-1$ //$NON-NLS-2$ + ser.attribute(null, "v", comment); //$NON-NLS-1$ + ser.endTag(null, "tag"); //$NON-NLS-1$ - ser.startTag(null, "tag"); - ser.attribute(null, "k", "created_by"); - ser.attribute(null, "v", Version.APP_NAME_VERSION); - ser.endTag(null, "tag"); - ser.endTag(null, "changeset"); - ser.endTag(null, "osm"); + ser.startTag(null, "tag"); //$NON-NLS-1$ + ser.attribute(null, "k", "created_by"); //$NON-NLS-1$ //$NON-NLS-2$ + ser.attribute(null, "v", Version.APP_NAME_VERSION); //$NON-NLS-1$ + ser.endTag(null, "tag"); //$NON-NLS-1$ + ser.endTag(null, "changeset"); //$NON-NLS-1$ + ser.endTag(null, "osm"); //$NON-NLS-1$ ser.endDocument(); writer.close(); } catch (IOException e) { - log.error("Unhandled exception", e); + log.error("Unhandled exception", e); //$NON-NLS-1$ } - String response = sendRequest(SITE_API + "api/0.6/changeset/create/", "PUT", writer.getBuffer().toString(), "Opening changeset", true); + String response = sendRequest(SITE_API + "api/0.6/changeset/create/", "PUT", writer.getBuffer().toString(), "Opening changeset", true); //$NON-NLS-1$ //$NON-NLS-2$ if (response != null && response.length() > 0) { id = Long.parseLong(response); } @@ -401,32 +401,32 @@ public class EditingPOIActivity { } public void closeChangeSet(long id){ - String response = sendRequest(SITE_API+"api/0.6/changeset/"+id+"/close", "PUT", "", "Closing changeset", true); - log.info("Response : " + response); + String response = sendRequest(SITE_API+"api/0.6/changeset/"+id+"/close", "PUT", "", "Closing changeset", true); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + log.info("Response : " + response); //$NON-NLS-1$ } private void writeNode(Node n, EntityInfo i, XmlSerializer ser, long changeSetId, String user) throws IllegalArgumentException, IllegalStateException, IOException{ - ser.startTag(null, "node"); - ser.attribute(null, "id", n.getId()+""); - ser.attribute(null, "lat", n.getLatitude()+""); - ser.attribute(null, "lon", n.getLongitude()+""); + ser.startTag(null, "node"); //$NON-NLS-1$ + ser.attribute(null, "id", n.getId()+""); //$NON-NLS-1$ //$NON-NLS-2$ + ser.attribute(null, "lat", n.getLatitude()+""); //$NON-NLS-1$ //$NON-NLS-2$ + ser.attribute(null, "lon", n.getLongitude()+""); //$NON-NLS-1$ //$NON-NLS-2$ if (i != null) { // ser.attribute(null, "timestamp", i.getETimestamp()); // ser.attribute(null, "uid", i.getUid()); // ser.attribute(null, "user", i.getUser()); - ser.attribute(null, "visible", i.getVisible()); - ser.attribute(null, "version", i.getVersion()); + ser.attribute(null, "visible", i.getVisible()); //$NON-NLS-1$ + ser.attribute(null, "version", i.getVersion()); //$NON-NLS-1$ } - ser.attribute(null, "changeset", changeSetId+""); + ser.attribute(null, "changeset", changeSetId+""); //$NON-NLS-1$ //$NON-NLS-2$ for(String k : n.getTagKeySet()){ String val = n.getTag(k); - ser.startTag(null, "tag"); - ser.attribute(null, "k", k); - ser.attribute(null, "v", val); - ser.endTag(null, "tag"); + ser.startTag(null, "tag"); //$NON-NLS-1$ + ser.attribute(null, "k", k); //$NON-NLS-1$ + ser.attribute(null, "v", val); //$NON-NLS-1$ + ser.endTag(null, "tag"); //$NON-NLS-1$ } - ser.endTag(null, "node"); + ser.endTag(null, "node"); //$NON-NLS-1$ } private void updateNodeInIndexes(String action, Node n){ @@ -466,30 +466,30 @@ public class EditingPOIActivity { XmlSerializer ser = Xml.newSerializer(); try { ser.setOutput(writer); - ser.startDocument("UTF-8", true); - ser.startTag(null, "osmChange"); - ser.attribute(null, "version", "0.6"); - ser.attribute(null, "generator", Version.APP_NAME); + ser.startDocument("UTF-8", true); //$NON-NLS-1$ + ser.startTag(null, "osmChange"); //$NON-NLS-1$ + ser.attribute(null, "version", "0.6"); //$NON-NLS-1$ //$NON-NLS-2$ + ser.attribute(null, "generator", Version.APP_NAME); //$NON-NLS-1$ ser.startTag(null, action); - ser.attribute(null, "version", "0.6"); - ser.attribute(null, "generator", Version.APP_NAME); + ser.attribute(null, "version", "0.6"); //$NON-NLS-1$ //$NON-NLS-2$ + ser.attribute(null, "generator", Version.APP_NAME); //$NON-NLS-1$ writeNode(n, info, ser, changeSetId, OsmandSettings.getUserName(ctx)); ser.endTag(null, action); - ser.endTag(null, "osmChange"); + ser.endTag(null, "osmChange"); //$NON-NLS-1$ ser.endDocument(); } catch (IOException e) { - log.error("Unhandled exception", e); + log.error("Unhandled exception", e); //$NON-NLS-1$ } - String res = sendRequest(SITE_API+"api/0.6/changeset/"+changeSetId + "/upload", "POST", + String res = sendRequest(SITE_API+"api/0.6/changeset/"+changeSetId + "/upload", "POST", //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ writer.getBuffer().toString(), "Commiting node", true); - log.debug(res+""); + log.debug(res+""); //$NON-NLS-1$ if (res != null) { if (CREATE_ACTION.equals(action)) { long newId = n.getId(); - int i = res.indexOf("new_id=\""); + int i = res.indexOf("new_id=\""); //$NON-NLS-1$ if (i > 0) { - i = i + "new_id=\"".length(); - int end = res.indexOf("\"", i); + i = i + "new_id=\"".length(); //$NON-NLS-1$ + int end = res.indexOf("\"", i); //$NON-NLS-1$ if (end > 0) { newId = Long.parseLong(res.substring(i, end)); Node newN = new Node(n.getLatitude(), n.getLongitude(), newId); @@ -511,7 +511,7 @@ public class EditingPOIActivity { public Node loadNode(long id) { try { - String res = sendRequest(SITE_API+"api/0.6/node/"+id, "GET", null, "Loading poi " + id, false); + String res = sendRequest(SITE_API+"api/0.6/node/"+id, "GET", null, "Loading poi " + id, false); //$NON-NLS-1$ //$NON-NLS-2$ if(res != null){ OsmBaseStorage st = new OsmBaseStorage(); st.parseOSM(new ByteArrayInputStream(res.getBytes("UTF-8")), null, null, true); @@ -523,10 +523,10 @@ public class EditingPOIActivity { } } catch (IOException e) { - log.error("Loading node failed" + id, e); + log.error("Loading node failed" + id, e); //$NON-NLS-1$ Toast.makeText(ctx, ctx.getResources().getString(R.string.poi_error_io_error), Toast.LENGTH_LONG).show(); } catch (SAXException e) { - log.error("Loading node failed" + id, e); + log.error("Loading node failed" + id, e); //$NON-NLS-1$ Toast.makeText(ctx, ctx.getResources().getString(R.string.poi_error_io_error), Toast.LENGTH_LONG).show(); } return null; diff --git a/OsmAnd/src/com/osmand/activities/FavouritesActivity.java b/OsmAnd/src/com/osmand/activities/FavouritesActivity.java index ef8be6730e..79851e24f9 100644 --- a/OsmAnd/src/com/osmand/activities/FavouritesActivity.java +++ b/OsmAnd/src/com/osmand/activities/FavouritesActivity.java @@ -140,13 +140,13 @@ public class FavouritesActivity extends ListActivity { public static class FavouritesDbHelper extends SQLiteOpenHelper { private static final int DATABASE_VERSION = 1; - private static final String FAVOURITE_TABLE_NAME = "favourite"; - private static final String FAVOURITE_COL_NAME = "name"; - private static final String FAVOURITE_COL_LAT = "latitude"; - private static final String FAVOURITE_COL_LON = "longitude"; - private static final String FAVOURITE_TABLE_CREATE = "CREATE TABLE " + FAVOURITE_TABLE_NAME + " (" + - FAVOURITE_COL_NAME + " TEXT, " + FAVOURITE_COL_LAT + " double, " + - FAVOURITE_COL_LON + " double);"; + private static final String FAVOURITE_TABLE_NAME = "favourite"; //$NON-NLS-1$ + private static final String FAVOURITE_COL_NAME = "name"; //$NON-NLS-1$ + private static final String FAVOURITE_COL_LAT = "latitude"; //$NON-NLS-1$ + private static final String FAVOURITE_COL_LON = "longitude"; //$NON-NLS-1$ + private static final String FAVOURITE_TABLE_CREATE = "CREATE TABLE " + FAVOURITE_TABLE_NAME + " (" + //$NON-NLS-1$ //$NON-NLS-2$ + FAVOURITE_COL_NAME + " TEXT, " + FAVOURITE_COL_LAT + " double, " + //$NON-NLS-1$ //$NON-NLS-2$ + FAVOURITE_COL_LON + " double);"; //$NON-NLS-1$ FavouritesDbHelper(Context context) { super(context, FAVOURITE_TABLE_NAME, null, DATABASE_VERSION); @@ -155,7 +155,7 @@ public class FavouritesActivity extends ListActivity { public boolean addFavourite(FavouritePoint p){ SQLiteDatabase db = getWritableDatabase(); if(db != null){ - db.execSQL("INSERT INTO " + FAVOURITE_TABLE_NAME + " VALUES (?, ?, ?)",new Object[]{p.getName(), p.getLatitude(), p.getLongitude()}); + db.execSQL("INSERT INTO " + FAVOURITE_TABLE_NAME + " VALUES (?, ?, ?)",new Object[]{p.getName(), p.getLatitude(), p.getLongitude()}); //$NON-NLS-1$ //$NON-NLS-2$ return true; } return false; @@ -165,7 +165,7 @@ public class FavouritesActivity extends ListActivity { SQLiteDatabase db = getReadableDatabase(); ArrayList list = new ArrayList(); if(db != null){ - Cursor query = db.rawQuery("SELECT " + FAVOURITE_COL_NAME +", " + FAVOURITE_COL_LAT +"," + FAVOURITE_COL_LON +" FROM " + + Cursor query = db.rawQuery("SELECT " + FAVOURITE_COL_NAME +", " + FAVOURITE_COL_LAT +"," + FAVOURITE_COL_LON +" FROM " + //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ FAVOURITE_TABLE_NAME, null); if(query.moveToFirst()){ do { @@ -184,7 +184,7 @@ public class FavouritesActivity extends ListActivity { public boolean editFavouriteName(FavouritePoint p, String newName){ SQLiteDatabase db = getWritableDatabase(); if(db != null){ - db.execSQL("UPDATE " + FAVOURITE_TABLE_NAME + " SET name = ? WHERE name = ?",new Object[]{newName, p.getName()}); + db.execSQL("UPDATE " + FAVOURITE_TABLE_NAME + " SET name = ? WHERE name = ?",new Object[]{newName, p.getName()}); //$NON-NLS-1$ //$NON-NLS-2$ p.setName(newName); return true; } @@ -194,7 +194,7 @@ public class FavouritesActivity extends ListActivity { public boolean deleteFavourite(FavouritePoint p){ SQLiteDatabase db = getWritableDatabase(); if(db != null){ - db.execSQL("DELETE FROM " + FAVOURITE_TABLE_NAME + " WHERE name = ?",new Object[]{p.getName()}); + db.execSQL("DELETE FROM " + FAVOURITE_TABLE_NAME + " WHERE name = ?",new Object[]{p.getName()}); //$NON-NLS-1$ //$NON-NLS-2$ return true; } return false; @@ -243,7 +243,7 @@ public class FavouritesActivity extends ListActivity { @Override public String toString() { - return "Favourite " + getName(); + return "Favourite " + getName(); //$NON-NLS-1$ } } @Override diff --git a/OsmAnd/src/com/osmand/activities/MainMenuActivity.java b/OsmAnd/src/com/osmand/activities/MainMenuActivity.java index 4c70062593..2e67b8ea84 100644 --- a/OsmAnd/src/com/osmand/activities/MainMenuActivity.java +++ b/OsmAnd/src/com/osmand/activities/MainMenuActivity.java @@ -32,13 +32,14 @@ import com.osmand.LogUtil; import com.osmand.ProgressDialogImplementation; import com.osmand.R; import com.osmand.ResourceManager; +import com.osmand.Version; import com.osmand.activities.search.SearchActivity; public class MainMenuActivity extends Activity { private static boolean applicationAlreadyStarted = false; - private static final String EXCEPTION_PATH = "/osmand/exception.log"; - private static final String EXCEPTION_FILE_SIZE = "/osmand/exception.log"; + private static final String EXCEPTION_PATH = "/osmand/exception.log"; //$NON-NLS-1$ + private static final String EXCEPTION_FILE_SIZE = "/osmand/exception.log"; //$NON-NLS-1$ private Button showMap; private Button exitButton; @@ -55,7 +56,7 @@ public class MainMenuActivity extends Activity { if(!applicationAlreadyStarted){ final ProgressDialog dlg = ProgressDialog.show(this, "Loading data", "Reading indices...", true); final ProgressDialogImplementation impl = new ProgressDialogImplementation(dlg); - impl.setRunnable("Initializing app", new Runnable(){ + impl.setRunnable("Initializing app", new Runnable(){ //$NON-NLS-1$ @Override public void run() { try { @@ -109,9 +110,9 @@ public class MainMenuActivity extends Activity { Intent notificationIndent = new Intent(MainMenuActivity.this, MapActivity.class); notificationIndent.setFlags(Intent.FLAG_ACTIVITY_CLEAR_TOP); - Notification notification = new Notification(R.drawable.icon, "", + Notification notification = new Notification(R.drawable.icon, "", //$NON-NLS-1$ System.currentTimeMillis()); - notification.setLatestEventInfo(MainMenuActivity.this, "OsmAnd", + notification.setLatestEventInfo(MainMenuActivity.this, Version.APP_NAME, "OsmAnd is running in background", PendingIntent.getActivity( this.getBaseContext(), 0, notificationIndent, PendingIntent.FLAG_UPDATE_CURRENT)); @@ -222,8 +223,8 @@ public class MainMenuActivity extends Activity { PrintStream printStream = new PrintStream(out); ex.printStackTrace(printStream); StringBuilder msg = new StringBuilder(); - msg.append("Exception occured in thread " + thread.toString() + " : "). - append(DateFormat.format("MMMM dd, yyyy h:mm:ss", System.currentTimeMillis())).append("\n"). + msg.append("Exception occured in thread " + thread.toString() + " : "). //$NON-NLS-1$ //$NON-NLS-2$ + append(DateFormat.format("MMMM dd, yyyy h:mm:ss", System.currentTimeMillis())).append("\n"). //$NON-NLS-1$//$NON-NLS-2$ append(new String(out.toByteArray())); if(Environment.getExternalStorageDirectory().canRead()){ @@ -234,7 +235,7 @@ public class MainMenuActivity extends Activity { defaultHandler.uncaughtException(thread, ex); } catch (Exception e) { // swallow all exceptions - Log.e(LogUtil.TAG, "Exception while handle other exception", e); + Log.e(LogUtil.TAG, "Exception while handle other exception", e); //$NON-NLS-1$ } } diff --git a/OsmAnd/src/com/osmand/activities/MapActivity.java b/OsmAnd/src/com/osmand/activities/MapActivity.java index 7dec610c91..280858e30c 100644 --- a/OsmAnd/src/com/osmand/activities/MapActivity.java +++ b/OsmAnd/src/com/osmand/activities/MapActivity.java @@ -2,8 +2,6 @@ package com.osmand.activities; import java.text.MessageFormat; -import org.apache.http.entity.StringEntity; - import android.app.Activity; import android.app.AlertDialog; import android.app.AlertDialog.Builder; @@ -23,7 +21,6 @@ import android.location.LocationProvider; import android.os.Bundle; import android.os.PowerManager; import android.os.PowerManager.WakeLock; -import android.text.format.Formatter; import android.util.Log; import android.view.KeyEvent; import android.view.Menu; @@ -248,14 +245,14 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat // show point view only if gps enabled if(location == null){ if(sensorRegistered) { - Log.d(LogUtil.TAG, "Disable sensor"); + Log.d(LogUtil.TAG, "Disable sensor"); //$NON-NLS-1$ ((SensorManager) getSystemService(SENSOR_SERVICE)).unregisterListener(this); sensorRegistered = false; locationLayer.setHeading(null); } } else { if(!sensorRegistered && OsmandSettings.isShowingViewAngle(this)){ - Log.d(LogUtil.TAG, "Enable sensor"); + Log.d(LogUtil.TAG, "Enable sensor"); //$NON-NLS-1$ SensorManager sensorMgr = (SensorManager) getSystemService(SENSOR_SERVICE); Sensor s = sensorMgr.getDefaultSensor(Sensor.TYPE_ORIENTATION); if (s != null) { @@ -264,7 +261,6 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat sensorRegistered = true; } } - Log.d(LogUtil.TAG, "Location changed"); // TODO delete !!! (only for test purposes) devices support that information (possibly keep for other providers?) if(!location.hasSpeed() && locationLayer.getLastKnownLocation() != null){ float d = location.distanceTo(locationLayer.getLastKnownLocation()); @@ -440,7 +436,7 @@ public class MapActivity extends Activity implements LocationListener, IMapLocat if (wakeLock == null) { PowerManager powerManager = (PowerManager) getSystemService(POWER_SERVICE); - wakeLock = powerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "com.osmand.map"); + wakeLock = powerManager.newWakeLock(PowerManager.SCREEN_BRIGHT_WAKE_LOCK, "com.osmand.map"); //$NON-NLS-1$ wakeLock.acquire(); } } diff --git a/OsmAnd/src/com/osmand/activities/NavigatePointActivity.java b/OsmAnd/src/com/osmand/activities/NavigatePointActivity.java index 14d3d44d68..d66bd0d79b 100644 --- a/OsmAnd/src/com/osmand/activities/NavigatePointActivity.java +++ b/OsmAnd/src/com/osmand/activities/NavigatePointActivity.java @@ -93,7 +93,7 @@ public class NavigatePointActivity extends Activity { ((TextView)findViewById(R.id.LongitudeEdit)).setText(convert(lon, newFormat)); } catch (RuntimeException e) { ((TextView) findViewById(R.id.ValidateTextView)).setText("Locations are invalid"); - Log.w(LogUtil.TAG, "Convertion failed", e); + Log.w(LogUtil.TAG, "Convertion failed", e); //$NON-NLS-1$ } } @@ -133,7 +133,7 @@ public class NavigatePointActivity extends Activity { close(); } catch (RuntimeException e) { ((TextView) findViewById(R.id.ValidateTextView)).setText("Locations are invalid"); - Log.w(LogUtil.TAG, "Convertion failed", e); + Log.w(LogUtil.TAG, "Convertion failed", e); //$NON-NLS-1$ } } @@ -145,10 +145,10 @@ public class NavigatePointActivity extends Activity { public static String convert(double coordinate, int outputType) { if (coordinate < -180.0 || coordinate > 180.0 || Double.isNaN(coordinate)) { - throw new IllegalArgumentException("coordinate=" + coordinate); + throw new IllegalArgumentException("coordinate=" + coordinate); //$NON-NLS-1$ } if ((outputType != FORMAT_DEGREES) && (outputType != FORMAT_MINUTES) && (outputType != FORMAT_SECONDS)) { - throw new IllegalArgumentException("outputType=" + outputType); + throw new IllegalArgumentException("outputType=" + outputType); //$NON-NLS-1$ } StringBuilder sb = new StringBuilder(); @@ -159,7 +159,7 @@ public class NavigatePointActivity extends Activity { coordinate = -coordinate; } - DecimalFormat df = new DecimalFormat("###.#####", new DecimalFormatSymbols(Locale.US)); + DecimalFormat df = new DecimalFormat("###.#####", new DecimalFormatSymbols(Locale.US)); //$NON-NLS-1$ if (outputType == FORMAT_MINUTES || outputType == FORMAT_SECONDS) { int degrees = (int) Math.floor(coordinate); sb.append(degrees); diff --git a/OsmAnd/src/com/osmand/activities/RoutingHelper.java b/OsmAnd/src/com/osmand/activities/RoutingHelper.java index 5e5947ee0c..6bb7dd2fb2 100644 --- a/OsmAnd/src/com/osmand/activities/RoutingHelper.java +++ b/OsmAnd/src/com/osmand/activities/RoutingHelper.java @@ -124,8 +124,8 @@ public class RoutingHelper { public boolean finishAtLocation(Location currentLocation) { Location lastPoint = routeNodes.get(routeNodes.size() - 1); - if(currentRoute > routeNodes.size() - 3 && currentLocation.distanceTo(lastPoint) < 50){ - if(lastFixedLocation != null && lastFixedLocation.distanceTo(lastPoint) < 50){ + if(currentRoute > routeNodes.size() - 3 && currentLocation.distanceTo(lastPoint) < 60){ + if(lastFixedLocation != null && lastFixedLocation.distanceTo(lastPoint) < 60){ // TODO mark as finished showMessage("You arrived at destination point"); currentRoute = routeNodes.size() - 1; diff --git a/OsmAnd/src/com/osmand/activities/SavingTrackHelper.java b/OsmAnd/src/com/osmand/activities/SavingTrackHelper.java index 747ca0534f..c35ee49e51 100644 --- a/OsmAnd/src/com/osmand/activities/SavingTrackHelper.java +++ b/OsmAnd/src/com/osmand/activities/SavingTrackHelper.java @@ -27,17 +27,17 @@ import com.osmand.OsmandSettings; import com.osmand.Version; public class SavingTrackHelper extends SQLiteOpenHelper { - public final static String TRACKS_PATH = "tracks"; + public final static String TRACKS_PATH = "tracks"; //$NON-NLS-1$ - public final static String DATABASE_NAME = "tracks"; + public final static String DATABASE_NAME = "tracks"; //$NON-NLS-1$ public final static int DATABASE_VERSION = 1; - public final static String TRACK_NAME = "track"; - public final static String TRACK_COL_DATE = "date"; - public final static String TRACK_COL_LAT = "lat"; - public final static String TRACK_COL_LON = "lon"; - public final static String TRACK_COL_ALTITUDE = "altitude"; - public final static String TRACK_COL_SPEED = "speed"; + public final static String TRACK_NAME = "track"; //$NON-NLS-1$ + public final static String TRACK_COL_DATE = "date"; //$NON-NLS-1$ + public final static String TRACK_COL_LAT = "lat"; //$NON-NLS-1$ + public final static String TRACK_COL_LON = "lon"; //$NON-NLS-1$ + public final static String TRACK_COL_ALTITUDE = "altitude"; //$NON-NLS-1$ + public final static String TRACK_COL_SPEED = "speed"; //$NON-NLS-1$ public final static Log log = LogUtil.getLog(SavingTrackHelper.class); @@ -49,14 +49,14 @@ public class SavingTrackHelper extends SQLiteOpenHelper { public SavingTrackHelper(Context ctx){ super(ctx, DATABASE_NAME, null, DATABASE_VERSION); this.ctx = ctx; - updateScript = "INSERT INTO " + TRACK_NAME + " VALUES (?, ?, ?, ?, ?)"; + updateScript = "INSERT INTO " + TRACK_NAME + " VALUES (?, ?, ?, ?, ?)"; //$NON-NLS-1$ //$NON-NLS-2$ } @Override public void onCreate(SQLiteDatabase db) { - db.execSQL("CREATE TABLE " + TRACK_NAME+ " ("+TRACK_COL_LAT +" double, " + TRACK_COL_LON+" double, " - + TRACK_COL_ALTITUDE+" double, " + TRACK_COL_SPEED+" double, " - + TRACK_COL_DATE +" long )" ); + db.execSQL("CREATE TABLE " + TRACK_NAME+ " ("+TRACK_COL_LAT +" double, " + TRACK_COL_LON+" double, " //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + + TRACK_COL_ALTITUDE+" double, " + TRACK_COL_SPEED+" double, " //$NON-NLS-1$ //$NON-NLS-2$ + + TRACK_COL_DATE +" long )" ); //$NON-NLS-1$ } @Override @@ -73,62 +73,62 @@ public class SavingTrackHelper extends SQLiteOpenHelper { protected void saveToXMLFiles(File dir, Map>> data ){ - SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); + SimpleDateFormat format = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss"); //$NON-NLS-1$ try { for (String f : data.keySet()) { - File fout = new File(dir, f + ".gpx"); + File fout = new File(dir, f + ".gpx"); //$NON-NLS-1$ int ind = 1; while(fout.exists()){ - fout = new File(dir, f + "_"+(++ind)+".gpx"); + fout = new File(dir, f + "_"+(++ind)+".gpx"); //$NON-NLS-1$ //$NON-NLS-2$ } FileOutputStream output = new FileOutputStream(fout); XmlSerializer serializer = Xml.newSerializer(); - serializer.setOutput(output, "UTF-8"); - serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true); - serializer.startDocument("UTF-8", true); - serializer.startTag(null, "gpx"); - serializer.attribute(null, "version", "1.1"); - serializer.attribute(null, "creator", Version.APP_NAME_VERSION); - serializer.attribute("xmlns", "xsi", "http://www.w3.org/2001/XMLSchema-instance"); - serializer.attribute("xsi", "schemaLocation", "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"); - serializer.attribute(null, "xmlns", "http://www.topografix.com/GPX/1/1"); + serializer.setOutput(output, "UTF-8"); //$NON-NLS-1$ + serializer.setFeature("http://xmlpull.org/v1/doc/features.html#indent-output", true); //$NON-NLS-1$ + serializer.startDocument("UTF-8", true); //$NON-NLS-1$ + serializer.startTag(null, "gpx"); //$NON-NLS-1$ + serializer.attribute(null, "version", "1.1"); //$NON-NLS-1$ //$NON-NLS-2$ + serializer.attribute(null, "creator", Version.APP_NAME_VERSION); //$NON-NLS-1$ + serializer.attribute("xmlns", "xsi", "http://www.w3.org/2001/XMLSchema-instance"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + serializer.attribute("xsi", "schemaLocation", "http://www.topografix.com/GPX/1/1 http://www.topografix.com/GPX/1/1/gpx.xsd"); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + serializer.attribute(null, "xmlns", "http://www.topografix.com/GPX/1/1"); //$NON-NLS-1$ //$NON-NLS-2$ - serializer.startTag(null, "trk"); + serializer.startTag(null, "trk"); //$NON-NLS-1$ for(List l : data.get(f)){ - serializer.startTag(null, "trkseg"); + serializer.startTag(null, "trkseg"); //$NON-NLS-1$ for(TrkPt p : l){ - serializer.startTag(null, "trkpt"); - serializer.attribute(null, "lat", p.lat+""); - serializer.attribute(null, "lon", p.lon+""); - serializer.startTag(null, "time"); + serializer.startTag(null, "trkpt"); //$NON-NLS-1$ + serializer.attribute(null, "lat", p.lat+""); //$NON-NLS-1$ //$NON-NLS-2$ + serializer.attribute(null, "lon", p.lon+""); //$NON-NLS-1$ //$NON-NLS-2$ + serializer.startTag(null, "time"); //$NON-NLS-1$ serializer.text(format.format(new Date(p.time))); - serializer.endTag(null, "time"); - serializer.startTag(null, "ele"); - serializer.text(p.ele+""); - serializer.endTag(null, "ele"); + serializer.endTag(null, "time"); //$NON-NLS-1$ + serializer.startTag(null, "ele"); //$NON-NLS-1$ + serializer.text(p.ele+""); //$NON-NLS-1$ + serializer.endTag(null, "ele"); //$NON-NLS-1$ if (p.speed > 0) { - serializer.startTag(null, "speed"); - serializer.text(p.speed + ""); - serializer.endTag(null, "speed"); + serializer.startTag(null, "speed"); //$NON-NLS-1$ + serializer.text(p.speed + ""); //$NON-NLS-1$ + serializer.endTag(null, "speed"); //$NON-NLS-1$ } - serializer.endTag(null, "trkpt"); + serializer.endTag(null, "trkpt"); //$NON-NLS-1$ } - serializer.endTag(null, "trkseg"); + serializer.endTag(null, "trkseg"); //$NON-NLS-1$ } - serializer.endTag(null, "trk"); + serializer.endTag(null, "trk"); //$NON-NLS-1$ - serializer.endTag(null, "gpx"); + serializer.endTag(null, "gpx"); //$NON-NLS-1$ serializer.flush(); serializer.endDocument(); } } catch (RuntimeException e) { - log.error("Error saving gpx"); + log.error("Error saving gpx", e); //$NON-NLS-1$ Toast.makeText(ctx, "Exception occurred while saving gpx", Toast.LENGTH_LONG); } catch (IOException e) { - log.error("Error saving gpx"); + log.error("Error saving gpx", e); //$NON-NLS-1$ Toast.makeText(ctx, "Exception occurred while saving gpx", Toast.LENGTH_LONG); } } @@ -149,11 +149,11 @@ public class SavingTrackHelper extends SQLiteOpenHelper { SQLiteDatabase db = getReadableDatabase(); File file = Environment.getExternalStorageDirectory(); if(db != null && file.canWrite()){ - file = new File(file, "/osmand/"+TRACKS_PATH); + file = new File(file, "/osmand/"+TRACKS_PATH); //$NON-NLS-1$ file.mkdirs(); if (file.exists()) { - Cursor query = db.rawQuery("SELECT " + TRACK_COL_LAT + "," + TRACK_COL_LON + "," + TRACK_COL_ALTITUDE + "," - + TRACK_COL_SPEED + "," + TRACK_COL_DATE + " FROM " + TRACK_NAME, null); + Cursor query = db.rawQuery("SELECT " + TRACK_COL_LAT + "," + TRACK_COL_LON + "," + TRACK_COL_ALTITUDE + "," //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ //$NON-NLS-4$ + + TRACK_COL_SPEED + "," + TRACK_COL_DATE + " FROM " + TRACK_NAME, null); //$NON-NLS-1$ //$NON-NLS-2$ long previousTime = 0; Map>> data = new LinkedHashMap>>(); List segment = new ArrayList(); @@ -170,7 +170,7 @@ public class SavingTrackHelper extends SQLiteOpenHelper { pt.time = time; if (previousTime == 0) { - data.put(DateFormat.format("yyyy-MM-dd", time).toString(), track); + data.put(DateFormat.format("yyyy-MM-dd", time).toString(), track); //$NON-NLS-1$ segment.add(pt); } else if (Math.abs(time - previousTime) < 60000) { // 1 hour - same segment @@ -182,7 +182,7 @@ public class SavingTrackHelper extends SQLiteOpenHelper { track.add(segment); } else { // check day (possibly better create new track (not new segment) - String date = DateFormat.format("yyyy-MM-dd", time).toString(); + String date = DateFormat.format("yyyy-MM-dd", time).toString(); //$NON-NLS-1$ if (data.containsKey(date)) { track = data.get(date); } else { @@ -211,7 +211,7 @@ public class SavingTrackHelper extends SQLiteOpenHelper { // cal.set(Calendar.SECOND, 0); // cal.set(Calendar.MILLISECOND, 0); // remove all from db - db.execSQL("DELETE FROM " + TRACK_NAME+ " WHERE " + TRACK_COL_DATE + " <= ?", new Object[]{System.currentTimeMillis()}); + db.execSQL("DELETE FROM " + TRACK_NAME+ " WHERE " + TRACK_COL_DATE + " <= ?", new Object[]{System.currentTimeMillis()}); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ } } diff --git a/OsmAnd/src/com/osmand/activities/SettingsActivity.java b/OsmAnd/src/com/osmand/activities/SettingsActivity.java index 2eb4a85ec6..8ce2f126b5 100644 --- a/OsmAnd/src/com/osmand/activities/SettingsActivity.java +++ b/OsmAnd/src/com/osmand/activities/SettingsActivity.java @@ -118,8 +118,8 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference resources.getString(R.string.interval_30_seconds), resources.getString(R.string.interval_1_minute), resources.getString(R.string.interval_5_minutes)}); - saveTrackInterval.setEntryValues(new String[]{"1", "2", "5", "15", "30", "60", "300"}); - saveTrackInterval.setValue(OsmandSettings.getSavingTrackInterval(this)+""); + 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$ ApplicationMode[] presets = ApplicationMode.values(); String[] values = new String[presets.length]; @@ -142,7 +142,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference tileSourcePreference.setEntries(entries); tileSourcePreference.setEntryValues(entries); tileSourcePreference.setValue(OsmandSettings.getMapTileSourceName(this)); - String mapName = " " +OsmandSettings.getMapTileSourceName(this); + String mapName = " " +OsmandSettings.getMapTileSourceName(this); //$NON-NLS-1$ String summary = tileSourcePreference.getSummary().toString(); if (summary.lastIndexOf(':') != -1) { summary = summary.substring(0, summary.lastIndexOf(':') + 1); @@ -210,7 +210,7 @@ public class SettingsActivity extends PreferenceActivity implements OnPreference if (summary.lastIndexOf(':') != -1) { summary = summary.substring(0, summary.lastIndexOf(':') + 1); } - summary += " " + OsmandSettings.getMapTileSourceName(this); + summary += " " + OsmandSettings.getMapTileSourceName(this); //$NON-NLS-1$ tileSourcePreference.setSummary(summary); } diff --git a/OsmAnd/src/com/osmand/activities/search/SearchActivity.java b/OsmAnd/src/com/osmand/activities/search/SearchActivity.java index aa8b132003..5a5b04f18c 100644 --- a/OsmAnd/src/com/osmand/activities/search/SearchActivity.java +++ b/OsmAnd/src/com/osmand/activities/search/SearchActivity.java @@ -24,9 +24,9 @@ public class SearchActivity extends TabActivity { protected void onCreate(Bundle savedInstanceState) { super.onCreate(savedInstanceState); TabHost host = getTabHost(); - host.addTab(host.newTabSpec("Search_POI").setIndicator("POI").setContent(new Intent(this, SearchPoiFilterActivity.class))); - host.addTab(host.newTabSpec("Search_Address").setIndicator(this.getResources().getString(R.string.search_tabs_address)).setContent(new Intent(this, SearchAddressActivity.class))); - host.addTab(host.newTabSpec("Search_Location").setIndicator(this.getResources().getString(R.string.search_tabs_location)).setContent(new Intent(this, NavigatePointActivity.class))); + host.addTab(host.newTabSpec("Search_POI").setIndicator("POI").setContent(new Intent(this, SearchPoiFilterActivity.class))); //$NON-NLS-1$ + host.addTab(host.newTabSpec("Search_Address").setIndicator(this.getResources().getString(R.string.search_tabs_address)).setContent(new Intent(this, SearchAddressActivity.class))); //$NON-NLS-1$ + host.addTab(host.newTabSpec("Search_Location").setIndicator(this.getResources().getString(R.string.search_tabs_location)).setContent(new Intent(this, NavigatePointActivity.class))); //$NON-NLS-1$ } } diff --git a/OsmAnd/src/com/osmand/activities/search/SearchAddressActivity.java b/OsmAnd/src/com/osmand/activities/search/SearchAddressActivity.java index 09efb76e99..c915c7239a 100644 --- a/OsmAnd/src/com/osmand/activities/search/SearchAddressActivity.java +++ b/OsmAnd/src/com/osmand/activities/search/SearchAddressActivity.java @@ -82,7 +82,7 @@ public class SearchAddressActivity extends Activity { OsmandSettings.removeLastSearchedIntersectedStreet(SearchAddressActivity.this); startActivity(new Intent(SearchAddressActivity.this, SearchBuildingByNameActivity.class)); } else { - OsmandSettings.setLastSearchedIntersectedStreet(SearchAddressActivity.this, ""); + OsmandSettings.setLastSearchedIntersectedStreet(SearchAddressActivity.this, ""); //$NON-NLS-1$ startActivity(new Intent(SearchAddressActivity.this, SearchStreet2ByNameActivity.class)); } } @@ -274,7 +274,7 @@ public class SearchAddressActivity extends Activity { protected void startLoadDataInThread(String progressMsg){ final ProgressDialog dlg = ProgressDialog.show(this, "Loading", progressMsg, true); - new Thread("Loader search data") { + new Thread("Loader search data") { //$NON-NLS-1$ @Override public void run() { try { diff --git a/OsmAnd/src/com/osmand/activities/search/SearchByNameAbstractActivity.java b/OsmAnd/src/com/osmand/activities/search/SearchByNameAbstractActivity.java index e51278e3a8..54e34e99d7 100644 --- a/OsmAnd/src/com/osmand/activities/search/SearchByNameAbstractActivity.java +++ b/OsmAnd/src/com/osmand/activities/search/SearchByNameAbstractActivity.java @@ -30,7 +30,7 @@ public abstract class SearchByNameAbstractActivity extends ListActivity { super.onCreate(savedInstanceState); requestWindowFeature(Window.FEATURE_NO_TITLE); setContentView(R.layout.search_by_name); - NamesAdapter namesAdapter = new NamesAdapter(getObjects("")); + NamesAdapter namesAdapter = new NamesAdapter(getObjects("")); //$NON-NLS-1$ setListAdapter(namesAdapter); searchText = (EditText) findViewById(R.id.SearchText); searchText.addTextChangedListener(new TextWatcher(){ @@ -51,7 +51,7 @@ public abstract class SearchByNameAbstractActivity extends ListActivity { @Override public void onClick(View v) { - searchText.setText(""); + searchText.setText(""); //$NON-NLS-1$ } }); @@ -119,7 +119,7 @@ public abstract class SearchByNameAbstractActivity extends ListActivity { protected void onResume() { synchronized (this) { if (handlerToLoop == null) { - new Thread("Filter data") { + new Thread("Filter data") { //$NON-NLS-1$ @Override public void run() { Looper.prepare(); diff --git a/OsmAnd/src/com/osmand/activities/search/SearchCityByNameActivity.java b/OsmAnd/src/com/osmand/activities/search/SearchCityByNameActivity.java index 94f6b94fb5..50839b27b4 100644 --- a/OsmAnd/src/com/osmand/activities/search/SearchCityByNameActivity.java +++ b/OsmAnd/src/com/osmand/activities/search/SearchCityByNameActivity.java @@ -37,8 +37,10 @@ public class SearchCityByNameActivity extends SearchByNameAbstractActivity @Override public void updateTextView(City obj, TextView txt) { - if(getFilter().length() > 2){ - txt.setText(obj.getName(region.useEnglishNames()) + " - " + MapUtils.getFormattedDistance((int) MapUtils.getDistance(obj.getLocation(), location))); + LatLon l = obj.getLocation(); + if (getFilter().length() > 2 && location != null && l != null) { + txt.setText(obj.getName(region.useEnglishNames()) + " - " + //$NON-NLS-1$ + MapUtils.getFormattedDistance((int) MapUtils.getDistance(l, location))); } else { txt.setText(obj.getName(region.useEnglishNames())); } diff --git a/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java b/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java index d3c5fcb2fd..10ee3c934b 100644 --- a/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java +++ b/OsmAnd/src/com/osmand/activities/search/SearchPOIActivity.java @@ -36,7 +36,7 @@ import com.osmand.osm.MapUtils; */ public class SearchPOIActivity extends ListActivity { - public static final String AMENITY_FILTER = "com.osmand.amenity_filter"; + public static final String AMENITY_FILTER = "com.osmand.amenity_filter"; //$NON-NLS-1$ private Button searchPOILevel; @@ -145,7 +145,7 @@ public class SearchPOIActivity extends ListActivity { icon.setImageResource(R.drawable.closed_poi); } - distanceLabel.setText(" " + MapUtils.getFormattedDistance(dist)); + distanceLabel.setText(" " + MapUtils.getFormattedDistance(dist)); //$NON-NLS-1$ return (row); } } diff --git a/OsmAnd/src/com/osmand/activities/search/SearchStreet2ByNameActivity.java b/OsmAnd/src/com/osmand/activities/search/SearchStreet2ByNameActivity.java index b11a04d0a2..4b8fd23d45 100644 --- a/OsmAnd/src/com/osmand/activities/search/SearchStreet2ByNameActivity.java +++ b/OsmAnd/src/com/osmand/activities/search/SearchStreet2ByNameActivity.java @@ -38,7 +38,7 @@ public class SearchStreet2ByNameActivity extends SearchByNameAbstractActivity objects = new ArrayList(); private Paint pointClosedUI; private Paint pointOpenedUI; - private Pattern patternToParse = Pattern.compile("putAJAXMarker\\((\\d*), ((\\d|\\.)*), ((\\d|\\.)*), '([^']*)', (\\d)\\);"); - private SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy hh:mm aaa", Locale.US); + private Pattern patternToParse = Pattern.compile("putAJAXMarker\\((\\d*), ((\\d|\\.)*), ((\\d|\\.)*), '([^']*)', (\\d)\\);"); //$NON-NLS-1$ + private SimpleDateFormat dateFormat = new SimpleDateFormat("dd.MM.yyyy hh:mm aaa", Locale.US); //$NON-NLS-1$ private double cTopLatitude; private double cBottomLatitude; @@ -75,7 +75,7 @@ public class OsmBugsLayer implements OsmandMapLayer { this.view = view; synchronized (this) { if (handlerToLoop == null) { - new Thread("Open street bugs layer") { + new Thread("Open street bugs layer") { //$NON-NLS-1$ @Override public void run() { Looper.prepare(); @@ -261,47 +261,47 @@ public class OsmBugsLayer implements OsmandMapLayer { public boolean createNewBug(double latitude, double longitude, String text, String authorName){ StringBuilder b = new StringBuilder(); - b.append("http://openstreetbugs.schokokeks.org/api/0.1/addPOIexec?"); - b.append("lat=").append(latitude); - b.append("&lon=").append(longitude); - text = text + " [" + authorName +" "+ dateFormat.format(new Date())+ "]"; - b.append("&text=").append(URLEncoder.encode(text)); - b.append("&name=").append(URLEncoder.encode(authorName)); - return editingPOI(b.toString(), "creating bug"); + b.append("http://openstreetbugs.schokokeks.org/api/0.1/addPOIexec?"); //$NON-NLS-1$ + b.append("lat=").append(latitude); //$NON-NLS-1$ + b.append("&lon=").append(longitude); //$NON-NLS-1$ + text = text + " [" + authorName +" "+ dateFormat.format(new Date())+ "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + b.append("&text=").append(URLEncoder.encode(text)); //$NON-NLS-1$ + b.append("&name=").append(URLEncoder.encode(authorName)); //$NON-NLS-1$ + return editingPOI(b.toString(), "creating bug"); //$NON-NLS-1$ } public boolean addingComment(long id, String text, String authorName){ StringBuilder b = new StringBuilder(); - b.append("http://openstreetbugs.schokokeks.org/api/0.1/editPOIexec?"); - b.append("id=").append(id); - text = text + " [" + authorName +" "+ dateFormat.format(new Date())+ "]"; - b.append("&text=").append(URLEncoder.encode(text)); - b.append("&name=").append(URLEncoder.encode(authorName)); - return editingPOI(b.toString(), "adding comment"); + b.append("http://openstreetbugs.schokokeks.org/api/0.1/editPOIexec?"); //$NON-NLS-1$ + b.append("id=").append(id); //$NON-NLS-1$ + text = text + " [" + authorName +" "+ dateFormat.format(new Date())+ "]"; //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$ + b.append("&text=").append(URLEncoder.encode(text)); //$NON-NLS-1$ + b.append("&name=").append(URLEncoder.encode(authorName)); //$NON-NLS-1$ + return editingPOI(b.toString(), "adding comment"); //$NON-NLS-1$ } public boolean closingBug(long id){ StringBuilder b = new StringBuilder(); - b.append("http://openstreetbugs.schokokeks.org/api/0.1/closePOIexec?"); - b.append("id=").append(id); - return editingPOI(b.toString(),"closing bug"); + b.append("http://openstreetbugs.schokokeks.org/api/0.1/closePOIexec?"); //$NON-NLS-1$ + b.append("id=").append(id); //$NON-NLS-1$ + return editingPOI(b.toString(),"closing bug"); //$NON-NLS-1$ } private boolean editingPOI(String urlStr, String debugAction){ try { - log.debug("Action " + debugAction + " " + urlStr); + log.debug("Action " + debugAction + " " + urlStr); //$NON-NLS-1$ //$NON-NLS-2$ URL url = new URL(urlStr); URLConnection connection = url.openConnection(); BufferedReader reader = new BufferedReader(new InputStreamReader(connection.getInputStream())); while(reader.readLine() != null){ } - log.debug("Action " + debugAction + " successfull"); + log.debug("Action " + debugAction + " successfull"); //$NON-NLS-1$ //$NON-NLS-2$ return true; } catch (IOException e) { - log.error("Error " +debugAction, e); + log.error("Error " +debugAction, e); //$NON-NLS-1$ } catch (RuntimeException e) { - log.error("Error "+debugAction, e); + log.error("Error "+debugAction, e); //$NON-NLS-1$ } return false; } @@ -309,11 +309,11 @@ public class OsmBugsLayer implements OsmandMapLayer { protected List loadingBugs(double topLatitude, double leftLongitude, double bottomLatitude,double rightLongitude){ List bugs = new ArrayList(); StringBuilder b = new StringBuilder(); - b.append("http://openstreetbugs.schokokeks.org/api/0.1/getBugs?"); - b.append("b=").append(bottomLatitude); - b.append("&t=").append(topLatitude); - b.append("&l=").append(leftLongitude); - b.append("&r=").append(rightLongitude); + b.append("http://openstreetbugs.schokokeks.org/api/0.1/getBugs?"); //$NON-NLS-1$ + b.append("b=").append(bottomLatitude); //$NON-NLS-1$ + b.append("&t=").append(topLatitude); //$NON-NLS-1$ + b.append("&l=").append(leftLongitude); //$NON-NLS-1$ + b.append("&r=").append(rightLongitude); //$NON-NLS-1$ try { URL url = new URL(b.toString()); URLConnection connection = url.openConnection(); @@ -326,17 +326,17 @@ public class OsmBugsLayer implements OsmandMapLayer { bug.setId(Long.parseLong(matcher.group(1))); bug.setLongitude(Double.parseDouble(matcher.group(2))); bug.setLatitude(Double.parseDouble(matcher.group(4))); - bug.setName(matcher.group(6).replace("
", "\n")); - bug.setOpened(matcher.group(7).equals("0")); + bug.setName(matcher.group(6).replace("
", "\n")); //$NON-NLS-1$ //$NON-NLS-2$ + bug.setOpened(matcher.group(7).equals("0")); //$NON-NLS-1$ bugs.add(bug); } } } catch (IOException e) { - log.warn("Error loading bugs", e); + log.warn("Error loading bugs", e); //$NON-NLS-1$ } catch (NumberFormatException e) { - log.warn("Error loading bugs", e); + log.warn("Error loading bugs", e); //$NON-NLS-1$ } catch (RuntimeException e) { - log.warn("Error loading bugs", e); + log.warn("Error loading bugs", e); //$NON-NLS-1$ } return bugs; diff --git a/OsmAnd/src/com/osmand/views/OsmandMapTileView.java b/OsmAnd/src/com/osmand/views/OsmandMapTileView.java index 54092b3e76..cde7304b8a 100644 --- a/OsmAnd/src/com/osmand/views/OsmandMapTileView.java +++ b/OsmAnd/src/com/osmand/views/OsmandMapTileView.java @@ -632,7 +632,7 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall if (point != null) { startDragging = null; if(log.isDebugEnabled()){ - log.debug("On long click event "+ point.x + " " + point.y); + log.debug("On long click event "+ point.x + " " + point.y); //$NON-NLS-1$ //$NON-NLS-2$ } for (int i = layers.size() - 1; i >= 0; i--) { if (layers.get(i).onLongPressEvent(point)) { @@ -661,7 +661,7 @@ public class OsmandMapTileView extends SurfaceView implements IMapDownloaderCall if (point != null) { startDragging = null; if(log.isDebugEnabled()){ - log.debug("On click event "+ point.x + " " + point.y); + log.debug("On click event "+ point.x + " " + point.y); //$NON-NLS-1$ //$NON-NLS-2$ } for (int i = layers.size() - 1; i >= 0; i--) { if (layers.get(i).onTouchEvent(point)) { diff --git a/OsmAnd/src/com/osmand/views/RouteLayer.java b/OsmAnd/src/com/osmand/views/RouteLayer.java index 6777c2a89f..ba0fe89db2 100644 --- a/OsmAnd/src/com/osmand/views/RouteLayer.java +++ b/OsmAnd/src/com/osmand/views/RouteLayer.java @@ -72,7 +72,7 @@ public class RouteLayer implements OsmandMapLayer { double rightLongitude = MapUtils.getLongitudeFromTile(view.getZoom(), tileRect.right); helper.fillLocationsToShow(topLatitude, leftLongitude, bottomLatitude, rightLongitude, points); if((System.currentTimeMillis() - time) > 40){ - Log.e(LogUtil.TAG, "Calculate route layer " + (System.currentTimeMillis() - time)); + Log.e(LogUtil.TAG, "Calculate route layer " + (System.currentTimeMillis() - time)); //$NON-NLS-1$ } if (points.size() > 0) {