From 1dfa04c1d3ed50e3a592c29d3a2713e3ea9c0f00 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 17 Apr 2015 10:48:02 +0200 Subject: [PATCH 1/3] Update poi --- OsmAnd/res/layout/searchpoi.xml | 1 - OsmAnd/res/values/strings.xml | 2 ++ .../net/osmand/plus/activities/search/SearchPOIActivity.java | 4 ++++ .../plus/activities/search/SearchPoiFilterFragment.java | 5 ++++- 4 files changed, 10 insertions(+), 2 deletions(-) diff --git a/OsmAnd/res/layout/searchpoi.xml b/OsmAnd/res/layout/searchpoi.xml index ab5c3d8704..a1b842917e 100644 --- a/OsmAnd/res/layout/searchpoi.xml +++ b/OsmAnd/res/layout/searchpoi.xml @@ -35,7 +35,6 @@ android:layout_gravity="bottom" android:layout_marginRight="@dimen/list_content_padding" android:layout_weight="1" - android:hint="@string/shared_string_search" android:maxLines="1" android:nextFocusLeft="@id/edit" android:nextFocusUp="@id/edit" diff --git a/OsmAnd/res/values/strings.xml b/OsmAnd/res/values/strings.xml index a8fb61a784..f08ec0e97d 100644 --- a/OsmAnd/res/values/strings.xml +++ b/OsmAnd/res/values/strings.xml @@ -9,6 +9,8 @@ 3. All your modified/created strings are in the top of the file (to make easier find what\'s translated). PLEASE: Have a look at http://code.google.com/p/osmand/wiki/UIConsistency, it may really improve your and our work :-) Thx - Hardy --> + Filter by name + Type to search all Open OSM mapper assistant A-GPS info diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java index 791de41d16..4551476bec 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java @@ -247,6 +247,10 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa } } }); + ((EditText)findViewById(R.id.edit)).setHint(R.string.filter_poi_hint); + ((ImageView)findViewById(R.id.search_icon)).setImageDrawable( + getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_filter_dark)); + findViewById(R.id.options).setOnClickListener(new View.OnClickListener() { @Override public void onClick(View v) { diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchPoiFilterFragment.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchPoiFilterFragment.java index 86ebeb2214..87850baefc 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchPoiFilterFragment.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchPoiFilterFragment.java @@ -61,8 +61,11 @@ public class SearchPoiFilterFragment extends ListFragment implements SearchActiv public View onCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState) { View v = inflater.inflate(R.layout.searchpoi, container, false); - v.findViewById(R.id.SearchFilterLayout).setVisibility(View.VISIBLE); + ((EditText)v.findViewById(R.id.edit)).setHint(R.string.search_poi_category_hint); + ((ImageView)v.findViewById(R.id.search_icon)).setImageDrawable( + getMyApplication().getIconsCache().getContentIcon(R.drawable.ic_action_search_dark)); + setupSearchEditText((EditText) v.findViewById(R.id.edit)); setupOptions(v.findViewById(R.id.options)); v.findViewById(R.id.poiSplitbar).setVisibility(View.GONE); From 7a02407b802bbe8ef6594851c0369e15ff5f5057 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 17 Apr 2015 10:49:42 +0200 Subject: [PATCH 2/3] Update poi --- .../net/osmand/plus/activities/search/SearchPOIActivity.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java index 4551476bec..22e39a5b75 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java @@ -174,7 +174,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa }); showOnMapItem.setEnabled(!isNameSearch() || amenityAdapter.getCount() > 0); if (filter != null && !isNameSearch()) { - createMenuItem(omenu, SAVE_FILTER, R.string.edit_filter_save_as_menu_item, R.drawable.ic_action_gsave_dark, + createMenuItem(omenu, SAVE_FILTER, R.string.edit_filter_save_as_menu_item, R.drawable.ic_action_fav_dark, MenuItemCompat.SHOW_AS_ACTION_IF_ROOM); if (!filter.isStandardFilter()) { createMenuItem(omenu, DELETE_FILTER, R.string.shared_string_delete, R.drawable.ic_action_delete_dark, From 2d854fa4f0b9d2cb13d78a239cb76c0b2efecb14 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Sat, 18 Apr 2015 17:39:48 +0200 Subject: [PATCH 3/3] Fix exceptions --- .../net/osmand/plus/helpers/GpxUiHelper.java | 17 ++++------------- .../net/osmand/plus/poi/PoiLegacyFilter.java | 11 ++++++----- 2 files changed, 10 insertions(+), 18 deletions(-) diff --git a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java index a9cff91bb3..9eaf5f07d4 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/GpxUiHelper.java @@ -368,13 +368,9 @@ public class GpxUiHelper { public int compare(String object1, String object2) { Long l1 = mp.get(object1); Long l2 = mp.get(object2); - if(l2 == null) { - l2 = 0l; - } - if(l1== null) { - l1 = 0l; - } - return l1 < l2 ? 1 : (l1 == l2 ? 0 : -1); + long lhs = l1 == null ? 0 : l1.longValue(); + long rhs = l2 == null ? 0 : l2.longValue(); + return lhs < rhs ? 1 : (lhs == rhs ? 0 : -1); } }); return list; @@ -388,12 +384,7 @@ public class GpxUiHelper { Collections.sort(list, new Comparator() { @Override public int compare(String object1, String object2) { - if (object1.compareTo(object2) > 0) { - return -1; - } else if (object1.equals(object2)) { - return 0; - } - return 1; + return -object1.compareTo(object2); } }); diff --git a/OsmAnd/src/net/osmand/plus/poi/PoiLegacyFilter.java b/OsmAnd/src/net/osmand/plus/poi/PoiLegacyFilter.java index 342b8c63e8..8e64227fc4 100644 --- a/OsmAnd/src/net/osmand/plus/poi/PoiLegacyFilter.java +++ b/OsmAnd/src/net/osmand/plus/poi/PoiLegacyFilter.java @@ -454,7 +454,7 @@ public class PoiLegacyFilter implements SearchPoiTypeFilter { } private void fillPoiAdditionals(AbstractPoiType pt) { - for(PoiType add : pt.getPoiAdditionals()) { + for (PoiType add : pt.getPoiAdditionals()) { poiAdditionals.put(add.getKeyName().replace('_', ':').replace(' ', ':'), add); poiAdditionals.put(add.getTranslation().replace(' ', ':').toLowerCase(), add); } @@ -471,10 +471,12 @@ public class PoiLegacyFilter implements SearchPoiTypeFilter { while(e.hasNext()) { Entry> pc = e.next(); fillPoiAdditionals(pc.getKey()); - if(pc.getValue() != null) { - for(String s : pc.getValue()) { + if (pc.getValue() != null) { + for (String s : pc.getValue()) { PoiType subtype = poiTypes.getPoiTypeByKey(s); - fillPoiAdditionals(subtype); + if (subtype != null) { + fillPoiAdditionals(subtype); + } } } } @@ -504,7 +506,6 @@ public class PoiLegacyFilter implements SearchPoiTypeFilter { acceptedTypes.remove(poiCategory); } updatePoiAdditionals(); - } public String getFilterId(){