Changed Unknown to Wikidata Description (#5697)

* Delete app/src/main/res/values-yue-hant directory

* Changed Unknown to description
This commit is contained in:
Kanahia 2024-05-03 03:53:19 +05:30 committed by GitHub
parent d6ac307f63
commit 6b93c34f9e
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -1770,7 +1770,9 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
ArrayList<OverlayItem> items = new ArrayList<>(); ArrayList<OverlayItem> items = new ArrayList<>();
Drawable icon = ContextCompat.getDrawable(getContext(), getIconFor(place, isBookMarked)); Drawable icon = ContextCompat.getDrawable(getContext(), getIconFor(place, isBookMarked));
GeoPoint point = new GeoPoint(place.location.getLatitude(), place.location.getLongitude()); GeoPoint point = new GeoPoint(place.location.getLatitude(), place.location.getLongitude());
OverlayItem item = new OverlayItem(place.name, null, point); OverlayItem item = new OverlayItem(place.name,
containsParentheses(place.getLongDescription()) ? getTextBetweenParentheses(
place.getLongDescription()) : place.getLongDescription(), point);
item.setMarker(icon); item.setMarker(icon);
items.add(item); items.add(item);
ItemizedOverlayWithFocus overlay = new ItemizedOverlayWithFocus(items, ItemizedOverlayWithFocus overlay = new ItemizedOverlayWithFocus(items,
@ -1813,7 +1815,11 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
GeoPoint point = new GeoPoint( GeoPoint point = new GeoPoint(
nearbyBaseMarkers.get(i).getPlace().location.getLatitude(), nearbyBaseMarkers.get(i).getPlace().location.getLatitude(),
nearbyBaseMarkers.get(i).getPlace().location.getLongitude()); nearbyBaseMarkers.get(i).getPlace().location.getLongitude());
OverlayItem item = new OverlayItem(nearbyBaseMarkers.get(i).getPlace().name, null, OverlayItem item = new OverlayItem(nearbyBaseMarkers.get(i).getPlace().name,
containsParentheses(nearbyBaseMarkers.get(i).getPlace().getLongDescription())
? getTextBetweenParentheses(
nearbyBaseMarkers.get(i).getPlace().getLongDescription())
: nearbyBaseMarkers.get(i).getPlace().getLongDescription(),
point); point);
item.setMarker(icon); item.setMarker(icon);
items.add(item); items.add(item);
@ -1844,6 +1850,32 @@ public class NearbyParentFragment extends CommonsDaggerSupportFragment
binding.map.getOverlays().add(overlay); binding.map.getOverlays().add(overlay);
} }
/**
* Extracts text between the first occurrence of '(' and its corresponding ')' in the input string.
*
* @param input The input string from which to extract text between parentheses.
* @return The text between parentheses if found, or {@code null} if no parentheses are found.
*/
public static String getTextBetweenParentheses(String input) {
int startIndex = input.indexOf('(');
int endIndex = input.indexOf(')', startIndex);
if (startIndex != -1 && endIndex != -1) {
return input.substring(startIndex + 1, endIndex);
} else {
return null;
}
}
/**
* Checks if the given text contains '(' or ')'.
*
* @param input The input text to check.
* @return {@code true} if '(' or ')' is found, {@code false} otherwise.
*/
public static boolean containsParentheses(String input) {
return input.contains("(") || input.contains(")");
}
private void removeMarker(Place place){ private void removeMarker(Place place){
List<Overlay> overlays = binding.map.getOverlays(); List<Overlay> overlays = binding.map.getOverlays();
for (int i = 0; i < overlays.size();i++){ for (int i = 0; i < overlays.size();i++){