This commit is contained in:
Alex Sytnyk 2018-07-17 13:15:04 +03:00
parent 44a4269cf3
commit 6eefcd921f
3 changed files with 11 additions and 8 deletions

View file

@ -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
-->
<string name="shared_string_world">World</string>
<string name="point_deleted">Point %1$s deleted</string>
<string name="coord_input_edit_point">Edit point</string>
<string name="coord_input_add_point">Add point</string>

View file

@ -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<WorldRegion> groups = new ArrayList<>();
groups.add(root);
processGroup(root, groups);
final Collator collator = Collator.getInstance();
Collections.sort(groups, new Comparator<WorldRegion>() {
@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();

View file

@ -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);