Merge remote-tracking branch 'origin/master'

This commit is contained in:
Weblate 2016-01-15 14:30:56 +01:00
commit 61290f73e6
4 changed files with 42 additions and 7 deletions

View file

@ -20,7 +20,10 @@ public class WorldRegion implements Serializable {
public static final String JAPAN_REGION_ID = "japan_asia";
public static final String SOUTH_AMERICA_REGION_ID = "southamerica";
protected static final String WORLD = "world";
// Just a string constant
public static final String UNITED_KINGDOM_REGION_ID = "gb_europe";
// Hierarchy
protected WorldRegion superregion;
protected List<WorldRegion> subregions;

View file

@ -92,6 +92,7 @@ public class ReportsFragment extends BaseOsmAndFragment {
String monthUrlString = monthsForReportsAdapter.getQueryString(monthItemPosition);
int regionItemPosition = regionReportsSpinner.getSelectedItemPosition();
String regionUrlString = regionsForReportsAdapter.getQueryString(regionItemPosition);
regionUrlString = regionUrlString == null ? "" : regionUrlString;
GetJsonAsyncTask.OnResponseListener<Protocol.TotalChangesByMonthResponse> onResponseListener =
new GetJsonAsyncTask.OnResponseListener<Protocol.TotalChangesByMonthResponse>() {
@Override
@ -150,21 +151,52 @@ public class ReportsFragment extends BaseOsmAndFragment {
public RegionsForReportsAdapter(final OsmandActionBarActivity context) {
super(context, R.layout.reports_for_spinner_item, android.R.id.text1);
WorldRegion root = context.getMyApplication().getRegions().getWorldRegion();
final WorldRegion root = context.getMyApplication().getRegions().getWorldRegion();
ArrayList<WorldRegion> groups = new ArrayList<>();
groups.add(root);
processGroup(root, groups, context);
Collections.sort(groups, new Comparator<WorldRegion>() {
@Override
public int compare(WorldRegion lhs, WorldRegion rhs) {
return lhs.getLocaleName().compareTo(rhs.getLocaleName());
if (lhs == root) {
return -1;
}
if (rhs == root) {
return 1;
}
return getHumanReadableName(lhs).compareTo(getHumanReadableName(rhs));
}
});
for (WorldRegion group : groups) {
add(group.getLocaleName());
String name = getHumanReadableName(group);
add(name);
queryRegionNames.add(group.getRegionDownloadName());
}
}
private static String getHumanReadableName(WorldRegion group) {
String name;
if(group.getLevel() > 2 || (group.getLevel() == 2
&& group.getSuperregion().getRegionId().equals(WorldRegion.RUSSIA_REGION_ID))) {
WorldRegion parent = group.getSuperregion();
WorldRegion parentsParent = group.getSuperregion().getSuperregion();
if(group.getLevel() == 3) {
if(parentsParent.getRegionId().equals(WorldRegion.RUSSIA_REGION_ID)) {
name = parentsParent.getLocaleName() + " " + group.getLocaleName();
} else if (!parent.getRegionId().equals(WorldRegion.UNITED_KINGDOM_REGION_ID)) {
name = parent.getLocaleName() + " " + group.getLocaleName();
} else {
name = group.getLocaleName();
}
} else {
name = parent.getLocaleName() + " " + group.getLocaleName();
}
} else {
name = group.getLocaleName();
}
return name;
}
public String getQueryString(int position) {
return queryRegionNames.get(position);
}

View file

@ -32,7 +32,7 @@ public class ImpassibleRoadsMenuController extends MenuController {
}
};
rightTitleButtonController.caption = getMapActivity().getString(R.string.shared_string_delete);
rightTitleButtonController.leftIconId = R.drawable.map_pin_avoid_road;
rightTitleButtonController.leftIconId = R.drawable.ic_action_delete_dark;
}
@Override
@ -47,6 +47,6 @@ public class ImpassibleRoadsMenuController extends MenuController {
@Override
public Drawable getLeftIcon() {
return getMapActivity().getResources().getDrawable(R.drawable.ic_action_road_works_dark);
return getMapActivity().getResources().getDrawable(R.drawable.map_pin_avoid_road);
}
}

View file

@ -51,7 +51,7 @@ public class ImpassableRoadsLayer extends OsmandMapLayer implements ContextMenuL
float x = tileBox.getPixXFromLatLon(location.getLatitude(), location.getLongitude());
float y = tileBox.getPixYFromLatLon(location.getLatitude(), location.getLongitude());
float left = x - roadWorkIcon.getWidth() / 2;
float top = y - roadWorkIcon.getHeight() / 2;
float top = y - roadWorkIcon.getHeight();
canvas.drawBitmap(roadWorkIcon, left, top, paint);
}
}