Nearby places icons localization bug fix (#1947)

* Changed the places icon selection from english text to QID
This commit is contained in:
Rulino 2018-11-05 00:44:39 +01:00 committed by Adam Jones
parent 7b7d17a33b
commit c8a8e5b714
2 changed files with 33 additions and 23 deletions

View file

@ -103,12 +103,19 @@ public class NearbyPlaces {
String point = fields[0]; String point = fields[0];
String wikiDataLink = Utils.stripLocalizedString(fields[1]); String wikiDataLink = Utils.stripLocalizedString(fields[1]);
String name = Utils.stripLocalizedString(fields[2]); String name = Utils.stripLocalizedString(fields[2]);
//getting icon link here
String identifier = Utils.stripLocalizedString(fields[3]);
//getting the ID which is at the end of link
identifier = identifier.split("/")[Utils.stripLocalizedString(fields[3]).split("/").length-1];
//replaced the extra > char from fields
identifier = identifier.replace(">","");
String type = Utils.stripLocalizedString(fields[4]); String type = Utils.stripLocalizedString(fields[4]);
String icon = fields[5]; String icon = fields[5];
String wikipediaSitelink = Utils.stripLocalizedString(fields[7]); String wikipediaSitelink = Utils.stripLocalizedString(fields[7]);
String commonsSitelink = Utils.stripLocalizedString(fields[8]); String commonsSitelink = Utils.stripLocalizedString(fields[8]);
String category = Utils.stripLocalizedString(fields[9]); String category = Utils.stripLocalizedString(fields[9]);
Timber.v("Name: " + name + ", type: " + type + ", category: " + category + ", wikipediaSitelink: " + wikipediaSitelink + ", commonsSitelink: " + commonsSitelink); Timber.v("Name: " + name + ", type: " + type + ", category: " + category + ", wikipediaSitelink: " + wikipediaSitelink + ", commonsSitelink: " + commonsSitelink);
double latitude; double latitude;
@ -127,7 +134,7 @@ public class NearbyPlaces {
places.add(new Place( places.add(new Place(
name, name,
Place.Label.fromText(type), // list Place.Label.fromText(identifier), // list
type, // details type, // details
Uri.parse(icon), Uri.parse(icon),
new LatLng(latitude, longitude, 0), new LatLng(latitude, longitude, 0),

View file

@ -121,27 +121,30 @@ public class Place {
*/ */
public enum Label { public enum Label {
BUILDING("building", R.drawable.round_icon_generic_building), BUILDING("Q41176", R.drawable.round_icon_generic_building),
HOUSE("house", R.drawable.round_icon_house), HOUSE("Q3947", R.drawable.round_icon_house),
COTTAGE("cottage", R.drawable.round_icon_house), COTTAGE("Q5783996", R.drawable.round_icon_house),
FARMHOUSE("farmhouse", R.drawable.round_icon_house), FARMHOUSE("Q489357", R.drawable.round_icon_house),
CHURCH("church", R.drawable.round_icon_church), CHURCH("Q16970", R.drawable.round_icon_church), //changed from church to church building
RAILWAY_STATION("railway station", R.drawable.round_icon_railway_station), RAILWAY_STATION("Q55488", R.drawable.round_icon_railway_station),
GATEHOUSE("gatehouse", R.drawable.round_icon_gatehouse), GATEHOUSE("Q277760", R.drawable.round_icon_gatehouse),
MILESTONE("milestone", R.drawable.round_icon_milestone), MILESTONE("Q10145", R.drawable.round_icon_milestone),
INN("inn", R.drawable.round_icon_house), INN("Q256020", R.drawable.round_icon_house), //Q27686
CITY("city", R.drawable.round_icon_city), HOTEL("Q27686", R.drawable.round_icon_house),
SECONDARY_SCHOOL("secondary school", R.drawable.round_icon_school), CITY("Q515", R.drawable.round_icon_city),
EDU("edu", R.drawable.round_icon_school), UNIVERSITY("Q3918",R.drawable.round_icon_school), //added university
ISLE("isle", R.drawable.round_icon_island), SCHOOL("Q3914", R.drawable.round_icon_school), //changed from "secondary school" to school
MOUNTAIN("mountain", R.drawable.round_icon_mountain), EDUCATION("Q8434", R.drawable.round_icon_school), //changed from edu to education, there is no id for "edu"
AIRPORT("airport", R.drawable.round_icon_airport), ISLE("Q23442", R.drawable.round_icon_island),
BRIDGE("bridge", R.drawable.round_icon_bridge), MOUNTAIN("Q8502", R.drawable.round_icon_mountain),
ROAD("road", R.drawable.round_icon_road), AIRPORT("Q1248784", R.drawable.round_icon_airport),
FOREST("forest", R.drawable.round_icon_forest), BRIDGE("Q12280", R.drawable.round_icon_bridge),
PARK("park", R.drawable.round_icon_park), ROAD("Q34442", R.drawable.round_icon_road),
RIVER("river", R.drawable.round_icon_river), FOREST("Q4421", R.drawable.round_icon_forest),
WATERFALL("waterfall", R.drawable.round_icon_waterfall), PARK("Q22698", R.drawable.round_icon_park),
RIVER("Q4022", R.drawable.round_icon_river),
WATERFALL("Q34038", R.drawable.round_icon_waterfall),
TEMPLE("Q44539",R.drawable.round_icon_church),
UNKNOWN("?", R.drawable.round_icon_unknown); UNKNOWN("?", R.drawable.round_icon_unknown);
private static final Map<String, Label> TEXT_TO_DESCRIPTION private static final Map<String, Label> TEXT_TO_DESCRIPTION