Merge branch 'master' into clean_up

# Conflicts:
#	OsmAnd/src/net/osmand/plus/activities/SettingsBaseActivity.java
This commit is contained in:
Vitaliy 2020-10-28 03:43:09 +02:00
commit dab1a37e33
3 changed files with 28 additions and 17 deletions

View file

@ -11,6 +11,14 @@
Thx - Hardy
-->
<string name="icon_group_travel">Travel</string>
<string name="icon_group_emergency">Emergency</string>
<string name="icon_group_sport">Sport</string>
<string name="icon_group_symbols">Symbols</string>
<string name="icon_group_service">Service</string>
<string name="icon_group_transport">Transport</string>
<string name="icon_group_special">Special</string>
<string name="icon_group_amenity">Amenity</string>
<string name="app_mode_gap">Gap</string>
<string name="ltr_or_rtl_combine_via_dash">%1$s — %2$s</string>
<string name="message_graph_will_be_available_after_recalculation">Wait for the route recalculation.\nGraph will be available after recalculation.</string>

View file

@ -47,6 +47,7 @@ import net.osmand.plus.OsmandApplication;
import net.osmand.plus.R;
import net.osmand.plus.UiUtilities;
import net.osmand.plus.activities.MapActivity;
import net.osmand.plus.activities.SettingsBaseActivity;
import net.osmand.plus.base.BaseOsmAndFragment;
import net.osmand.plus.helpers.AndroidUiHelper;
import net.osmand.plus.helpers.ColorDialogs;
@ -567,23 +568,6 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
: R.color.inactive_buttons_and_links_bg_light)));
}
private void createIconSelector() {
iconCategories = new LinkedHashMap<>();
try {
JSONObject obj = new JSONObject(loadJSONFromAsset());
JSONObject categories = obj.getJSONObject("categories");
for (int i = 0; i < categories.length(); i++) {
JSONArray names = categories.names();
JSONObject icons = categories.getJSONObject(names.get(i).toString());
iconCategories.put(names.get(i).toString(), icons.getJSONArray("icons"));
}
} catch (JSONException e) {
e.printStackTrace();
}
selectedIconCategory = getInitCategory();
createIconForCategory();
}
private String getInitCategory() {
for (int j = 0; j < iconCategories.values().size(); j++) {
JSONArray iconJsonArray = (JSONArray) iconCategories.values().toArray()[j];
@ -604,6 +588,25 @@ public abstract class PointEditorFragmentNew extends BaseOsmAndFragment {
return app.getResources().getResourceEntryName(iconId).replaceFirst("mx_", "");
}
private void createIconSelector() {
iconCategories = new LinkedHashMap<>();
try {
JSONObject obj = new JSONObject(loadJSONFromAsset());
JSONObject categories = obj.getJSONObject("categories");
for (int i = 0; i < categories.length(); i++) {
JSONArray names = categories.names();
JSONObject icons = categories.getJSONObject(names.get(i).toString());
String name = names.get(i).toString();
String translatedName = SettingsBaseActivity.getIconStringPropertyName(app, name, name);
iconCategories.put(translatedName, icons.getJSONArray("icons"));
}
} catch (JSONException e) {
e.printStackTrace();
}
selectedIconCategory = getInitCategory();
createIconForCategory();
}
private void createIconForCategory() {
FlowLayout selectIcon = view.findViewById(R.id.select_icon);
selectIcon.removeAllViews();