From b87148e01e54a19d5c0c81e3ac395478d21db608 Mon Sep 17 00:00:00 2001 From: Victor Shcherb Date: Fri, 3 Apr 2015 17:22:00 +0200 Subject: [PATCH] Small fixes --- OsmAnd/res/layout/searchpoifolder_list.xml | 1 + OsmAnd/src/net/osmand/plus/OsmAndFormatter.java | 14 +++----------- .../plus/activities/search/GeoIntentActivity.java | 2 +- .../plus/activities/search/SearchPOIActivity.java | 6 +++--- .../net/osmand/plus/helpers/WaypointHelper.java | 3 ++- OsmAnd/src/net/osmand/plus/views/POIMapLayer.java | 5 ++--- 6 files changed, 12 insertions(+), 19 deletions(-) diff --git a/OsmAnd/res/layout/searchpoifolder_list.xml b/OsmAnd/res/layout/searchpoifolder_list.xml index d8502d3724..e1e83da2c3 100644 --- a/OsmAnd/res/layout/searchpoifolder_list.xml +++ b/OsmAnd/res/layout/searchpoifolder_list.xml @@ -35,5 +35,6 @@ android:layout_height="@dimen/standard_icon_size" android:layout_marginLeft="4dp" android:layout_marginRight="4dp" + android:background="?attr/dashboard_button" android:src="@drawable/ic_action_filter_dark" /> diff --git a/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java b/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java index 7da167569c..195a685357 100644 --- a/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java +++ b/OsmAnd/src/net/osmand/plus/OsmAndFormatter.java @@ -160,22 +160,14 @@ public class OsmAndFormatter { return ""; } - - public static String getPoiSimpleFormat(Amenity amenity, Context ctx, boolean en) { - return getPoiStringWithoutType(amenity, en, - amenity.getType().getTranslation() + ": " + amenity.getSubType()); //$NON-NLS-1$ - } - public static String getPoiStringWithoutType(Amenity amenity, boolean en) { - return getPoiStringWithoutType(amenity, en, amenity.getSubType()); - } - - public static String getPoiStringWithoutType(Amenity amenity, boolean en, String defName) { PoiCategory pc = amenity.getType(); PoiType pt = pc.getPoiTypeByKeyName(amenity.getSubType()); - String nm = defName; + String nm = amenity.getSubType(); if (pt != null) { nm = pt.getTranslation(); + } else if(nm != null){ + nm = Algorithms.capitalizeFirstLetterAndLowercase(nm.replace('_', ' ')); } String n = amenity.getName(en); if (n.indexOf(nm) != -1) { diff --git a/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java index 76c1134087..d25a9e3aaa 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/GeoIntentActivity.java @@ -176,7 +176,7 @@ public class GeoIntentActivity extends OsmandListActivity { private PointDescription getString(MapObject o) { if (o instanceof Amenity) { return new PointDescription(PointDescription.POINT_TYPE_POI, - OsmAndFormatter.getPoiSimpleFormat((Amenity) o, getMyApplication(), false)); + OsmAndFormatter.getPoiStringWithoutType((Amenity) o, false)); } if (o instanceof Street) { return new PointDescription(PointDescription.POINT_TYPE_ADDRESS, ((Street) o).getCity().getName() + " " + o.getName()); diff --git a/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java b/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java index 8f2104e08b..437cb90b36 100644 --- a/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java +++ b/OsmAnd/src/net/osmand/plus/activities/search/SearchPOIActivity.java @@ -547,7 +547,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa @Override public void onItemClick(AdapterView parent, final View view, int position, long id) { final Amenity amenity = ((AmenityAdapter) getListAdapter()).getItem(position); - String poiSimpleFormat = OsmAndFormatter.getPoiSimpleFormat(amenity, getMyApplication(), + String poiSimpleFormat = OsmAndFormatter.getPoiStringWithoutType(amenity, settings.usingEnglishNames()); PointDescription name = new PointDescription(PointDescription.POINT_TYPE_POI, poiSimpleFormat); int z = Math.max(16, settings.getLastKnownMapZoom()); @@ -572,7 +572,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa // Create dialog Builder bs = new AlertDialog.Builder(view.getContext()); - bs.setTitle(OsmAndFormatter.getPoiSimpleFormat(amenity, getMyApplication(), + bs.setTitle(OsmAndFormatter.getPoiStringWithoutType(amenity, settings.usingEnglishNames())); bs.setMessage(spannable); AlertDialog dialog = bs.show(); @@ -857,7 +857,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa private void showPOIDetails(final Amenity amenity, boolean en) { AlertDialog.Builder b = new AlertDialog.Builder(SearchPOIActivity.this); - b.setTitle(OsmAndFormatter.getPoiSimpleFormat(amenity, getMyApplication(), en)); + b.setTitle(OsmAndFormatter.getPoiStringWithoutType(amenity, en)); b.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() { @Override public void onClick(DialogInterface dialog, int id) { diff --git a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java index 9382c75597..500642dbb7 100644 --- a/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java +++ b/OsmAnd/src/net/osmand/plus/helpers/WaypointHelper.java @@ -785,7 +785,8 @@ public class WaypointHelper { @Override public PointDescription getPointDescription(Context ctx) { - return new PointDescription(PointDescription.POINT_TYPE_POI, OsmAndFormatter.getPoiSimpleFormat(a, ctx, app.getSettings().usingEnglishNames())); + return new PointDescription(PointDescription.POINT_TYPE_POI, + OsmAndFormatter.getPoiStringWithoutType(a, app.getSettings().usingEnglishNames())); } @Override diff --git a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java index 95439ae66c..de2ac0ab86 100644 --- a/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java +++ b/OsmAnd/src/net/osmand/plus/views/POIMapLayer.java @@ -158,7 +158,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon } private StringBuilder buildPoiInformation(StringBuilder res, Amenity n) { - String format = OsmAndFormatter.getPoiSimpleFormat(n, view.getApplication(), + String format = OsmAndFormatter.getPoiStringWithoutType(n, view.getSettings().usingEnglishNames()); res.append(" " + format + "\n" + OsmAndFormatter.getAmenityDescriptionContent(view.getApplication(), n, true)); return res; @@ -302,8 +302,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon private void showDescriptionDialog(Amenity a) { Builder bs = new AlertDialog.Builder(view.getContext()); - bs.setTitle(OsmAndFormatter.getPoiSimpleFormat(a, view.getApplication(), - view.getSettings().usingEnglishNames())); + bs.setTitle(OsmAndFormatter.getPoiStringWithoutType(a, view.getSettings().usingEnglishNames())); if (a.getType().isWiki()) { bs.setMessage(a.getDescription()); } else {