@Override public void buildInternal(View view) { boolean hasWiki = false; MapPoiTypes poiTypes = app.getPoiTypes(); String preferredLang = app.getSettings().MAP_PREFERRED_LOCALE.get(); if (Algorithms.isEmpty(preferredLang)) { preferredLang = app.getLanguage(); } List<AmenityDescription> descriptions = new LinkedList<>(); for (Map.Entry<String, String> e : amenity.getAdditionalInfo().entrySet()) { int iconId; Drawable icon = null; int textColor = 0; String key = e.getKey(); String vl = e.getValue(); String textPrefix = ""; boolean isWiki = false; boolean isText = false; boolean needLinks = !"population".equals(key); if (amenity.getType().isWiki()) { if (!hasWiki) { iconId = R.drawable.ic_action_note_dark; String lng = amenity.getContentSelected("content", preferredLang, "en"); if (Algorithms.isEmpty(lng)) { lng = "en"; } final String langSelected = lng; String content = amenity.getDescription(langSelected); vl = Html.fromHtml(content).toString(); if (vl.length() > 300) { vl = vl.substring(0, 300); } hasWiki = true; isWiki = true; } else { continue; } } else if (key.startsWith("name:")) { continue; } else if (Amenity.OPENING_HOURS.equals(key)) { iconId = R.drawable.ic_action_time; OpeningHoursParser.OpeningHours rs = OpeningHoursParser.parseOpenedHours(amenity.getOpeningHours()); if (rs != null) { Calendar inst = Calendar.getInstance(); inst.setTimeInMillis(System.currentTimeMillis()); boolean opened = rs.isOpenedForTime(inst); if (opened) { textColor = R.color.color_ok; } else { textColor = R.color.color_invalid; } } } else if (Amenity.PHONE.equals(key)) { iconId = R.drawable.ic_action_call_dark; } else if (Amenity.WEBSITE.equals(key)) { iconId = R.drawable.ic_world_globe_dark; vl = vl.replace(' ', '_'); } else { if (Amenity.DESCRIPTION.equals(key)) { iconId = R.drawable.ic_action_note_dark; } else { iconId = R.drawable.ic_action_info_dark; } AbstractPoiType pt = poiTypes.getAnyPoiAdditionalTypeByKey(key); if (pt != null) { PoiType pType = (PoiType) pt; if (pType.getParentType() != null && pType.getParentType() instanceof PoiType) { icon = getRowIcon( view.getContext(), ((PoiType) pType.getParentType()).getOsmTag() + "_" + pType.getOsmTag().replace(':', '_') + "_" + pType.getOsmValue()); } if (!pType.isText()) { vl = pType.getTranslation(); } else { isText = true; iconId = R.drawable.ic_action_note_dark; textPrefix = pType.getTranslation(); vl = amenity.unzipContent(e.getValue()); } } else { textPrefix = Algorithms.capitalizeFirstLetterAndLowercase(e.getKey()); vl = amenity.unzipContent(e.getValue()); } } if (isText && iconId == R.drawable.ic_action_note_dark) { descriptions.add(new AmenityDescription(key, textPrefix, vl)); } else if (icon != null) { buildRow(view, icon, vl, textPrefix, textColor, isWiki, isText, needLinks); } else { buildRow(view, iconId, vl, textPrefix, textColor, isWiki, isText, needLinks); } } String langSuffix = ":" + preferredLang; AmenityDescription descInPrefLang = null; for (AmenityDescription desc : descriptions) { if (desc.key.length() > langSuffix.length() && desc.key .substring(desc.key.length() - langSuffix.length(), desc.key.length()) .equals(langSuffix)) { descInPrefLang = desc; break; } } if (descInPrefLang != null) { descriptions.remove(descInPrefLang); descriptions.add(0, descInPrefLang); } for (AmenityDescription desc : descriptions) { buildRow( view, R.drawable.ic_action_note_dark, desc.text, desc.textPrefix, 0, false, true, true); } }