From 6eefcd921fd84f8b95d7e8c0c8ae9a869431adc1 Mon Sep 17 00:00:00 2001 From: Alex Sytnyk Date: Tue, 17 Jul 2018 13:15:04 +0300 Subject: [PATCH] Fix #5553 --- OsmAnd/res/values/strings.xml | 1 + .../plus/liveupdates/CountrySelectionFragment.java | 14 +++++++++----- .../plus/liveupdates/LiveUpdatesFragment.java | 4 +--- 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index 367bcab4bc..103dd2a92d 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -10,6 +10,7 @@ - For wording and consistency, please note http://osmand.net/help-online?id=technical-articles#Creating_a_Consistent_User_Experience Thx - Hardy --> + World Point %1$s deleted Edit point Add point diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/CountrySelectionFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/CountrySelectionFragment.java index 12c46becc2..db69ac929f 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/CountrySelectionFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/CountrySelectionFragment.java @@ -26,6 +26,7 @@ import net.osmand.plus.base.BaseOsmAndDialogFragment; import net.osmand.util.Algorithms; import java.io.Serializable; +import java.text.Collator; import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; @@ -129,11 +130,12 @@ public class CountrySelectionFragment extends BaseOsmAndDialogFragment { } - public void initCountries(OsmandApplication app) { + public void initCountries(final OsmandApplication app) { final WorldRegion root = app.getRegions().getWorldRegion(); ArrayList groups = new ArrayList<>(); groups.add(root); processGroup(root, groups); + final Collator collator = Collator.getInstance(); Collections.sort(groups, new Comparator() { @Override public int compare(WorldRegion lhs, WorldRegion rhs) { @@ -143,11 +145,11 @@ public class CountrySelectionFragment extends BaseOsmAndDialogFragment { if (rhs == root) { return 1; } - return getHumanReadableName(lhs).compareTo(getHumanReadableName(rhs)); + return collator.compare(getHumanReadableName(app, lhs), getHumanReadableName(app, rhs)); } }); for (WorldRegion group : groups) { - String name = getHumanReadableName(group); + String name = getHumanReadableName(app, group); if (group == root) { countryItems.add(new CountryItem(name, "")); } else { @@ -169,9 +171,11 @@ public class CountrySelectionFragment extends BaseOsmAndDialogFragment { } } - private static String getHumanReadableName(WorldRegion group) { + private String getHumanReadableName(OsmandApplication app, WorldRegion group) { String name; - if (group.getLevel() > 2 || (group.getLevel() == 2 + if (group.getLevel() == 0) { + name = app.getString(R.string.shared_string_world); + } else if (group.getLevel() > 2 || (group.getLevel() == 2 && group.getSuperregion().getRegionId().equals(WorldRegion.RUSSIA_REGION_ID))) { WorldRegion parent = group.getSuperregion(); WorldRegion parentsParent = group.getSuperregion().getSuperregion(); diff --git a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java index 87193a86cd..f01dd20cb1 100644 --- a/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java +++ b/OsmAnd/src/net/osmand/plus/liveupdates/LiveUpdatesFragment.java @@ -38,7 +38,6 @@ import android.widget.ImageView; import android.widget.ProgressBar; import android.widget.TextView; -import net.osmand.map.WorldRegion; import net.osmand.plus.OsmandApplication; import net.osmand.plus.OsmandSettings; import net.osmand.plus.R; @@ -187,8 +186,7 @@ public class LiveUpdatesFragment extends BaseOsmAndFragment implements InAppPurc regionNameHeaderTextView.setText(R.string.default_buttons_support); countryName = getString(R.string.osmand_team); } else { - WorldRegion world = getMyApplication().getRegions().getWorldRegion(); - countryName = world.getLocaleName(); + countryName = getString(R.string.shared_string_world); } } regionNameTextView.setText(countryName);