Small fixes

This commit is contained in:
Victor Shcherb 2015-04-03 17:22:00 +02:00
parent 39c34ac7a3
commit b87148e01e
6 changed files with 12 additions and 19 deletions

View file

@ -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" />
</LinearLayout>

View file

@ -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) {

View file

@ -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());

View file

@ -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) {

View file

@ -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

View file

@ -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 {