From 98cab00db7b13edb34cea7e73db983f545a30a41 Mon Sep 17 00:00:00 2001 From: GaidamakUA Date: Tue, 27 Oct 2015 11:57:06 +0200 Subject: [PATCH] Improved loading speed even further --- .../plus/osmedit/AdvancedEditPoiFragment.java | 20 ++++++++++++++++++- 1 file changed, 19 insertions(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java b/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java index 5090957ac6..1d38c7d428 100644 --- a/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java +++ b/OsmAnd/src/net/osmand/plus/osmedit/AdvancedEditPoiFragment.java @@ -82,7 +82,7 @@ public class AdvancedEditPoiFragment extends Fragment (LinearLayout) view.findViewById(R.id.editTagsList); final MapPoiTypes mapPoiTypes = ((OsmandApplication) getActivity().getApplication()).getPoiTypes(); - allTranslatedSubTypes = mapPoiTypes.getAllTranslatedNames(); + new InitTranslatedTypesTask(mapPoiTypes).execute(); mAdapter = new TagAdapterLinearLayoutHack(editTagsLineaLayout, getData()); // TODO do not restart initialization every time, and probably move initialization to appInit new InitTagsAndValuesAutocompleteTask(mapPoiTypes).execute(); @@ -362,6 +362,24 @@ public class AdvancedEditPoiFragment extends Fragment mAdapter.setTagData(tagKeys.toArray(new String[tagKeys.size()])); mAdapter.setValueData(valueKeys.toArray(new String[valueKeys.size()])); } + } + + class InitTranslatedTypesTask extends AsyncTask> { + private final MapPoiTypes mapPoiTypes; + + public InitTranslatedTypesTask(MapPoiTypes mapPoiTypes) { + this.mapPoiTypes = mapPoiTypes; + } + + @Override + protected Map doInBackground(Void... params) { + return mapPoiTypes.getAllTranslatedNames(); + } + + @Override + protected void onPostExecute(Map result) { + allTranslatedSubTypes = result; + } } }