Small fixes
This commit is contained in:
parent
39c34ac7a3
commit
b87148e01e
6 changed files with 12 additions and 19 deletions
|
@ -35,5 +35,6 @@
|
||||||
android:layout_height="@dimen/standard_icon_size"
|
android:layout_height="@dimen/standard_icon_size"
|
||||||
android:layout_marginLeft="4dp"
|
android:layout_marginLeft="4dp"
|
||||||
android:layout_marginRight="4dp"
|
android:layout_marginRight="4dp"
|
||||||
|
android:background="?attr/dashboard_button"
|
||||||
android:src="@drawable/ic_action_filter_dark" />
|
android:src="@drawable/ic_action_filter_dark" />
|
||||||
</LinearLayout>
|
</LinearLayout>
|
||||||
|
|
|
@ -160,22 +160,14 @@ public class OsmAndFormatter {
|
||||||
return "";
|
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) {
|
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();
|
PoiCategory pc = amenity.getType();
|
||||||
PoiType pt = pc.getPoiTypeByKeyName(amenity.getSubType());
|
PoiType pt = pc.getPoiTypeByKeyName(amenity.getSubType());
|
||||||
String nm = defName;
|
String nm = amenity.getSubType();
|
||||||
if (pt != null) {
|
if (pt != null) {
|
||||||
nm = pt.getTranslation();
|
nm = pt.getTranslation();
|
||||||
|
} else if(nm != null){
|
||||||
|
nm = Algorithms.capitalizeFirstLetterAndLowercase(nm.replace('_', ' '));
|
||||||
}
|
}
|
||||||
String n = amenity.getName(en);
|
String n = amenity.getName(en);
|
||||||
if (n.indexOf(nm) != -1) {
|
if (n.indexOf(nm) != -1) {
|
||||||
|
|
|
@ -176,7 +176,7 @@ public class GeoIntentActivity extends OsmandListActivity {
|
||||||
private PointDescription getString(MapObject o) {
|
private PointDescription getString(MapObject o) {
|
||||||
if (o instanceof Amenity) {
|
if (o instanceof Amenity) {
|
||||||
return new PointDescription(PointDescription.POINT_TYPE_POI,
|
return new PointDescription(PointDescription.POINT_TYPE_POI,
|
||||||
OsmAndFormatter.getPoiSimpleFormat((Amenity) o, getMyApplication(), false));
|
OsmAndFormatter.getPoiStringWithoutType((Amenity) o, false));
|
||||||
}
|
}
|
||||||
if (o instanceof Street) {
|
if (o instanceof Street) {
|
||||||
return new PointDescription(PointDescription.POINT_TYPE_ADDRESS, ((Street) o).getCity().getName() + " " + o.getName());
|
return new PointDescription(PointDescription.POINT_TYPE_ADDRESS, ((Street) o).getCity().getName() + " " + o.getName());
|
||||||
|
|
|
@ -547,7 +547,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
@Override
|
@Override
|
||||||
public void onItemClick(AdapterView<?> parent, final View view, int position, long id) {
|
public void onItemClick(AdapterView<?> parent, final View view, int position, long id) {
|
||||||
final Amenity amenity = ((AmenityAdapter) getListAdapter()).getItem(position);
|
final Amenity amenity = ((AmenityAdapter) getListAdapter()).getItem(position);
|
||||||
String poiSimpleFormat = OsmAndFormatter.getPoiSimpleFormat(amenity, getMyApplication(),
|
String poiSimpleFormat = OsmAndFormatter.getPoiStringWithoutType(amenity,
|
||||||
settings.usingEnglishNames());
|
settings.usingEnglishNames());
|
||||||
PointDescription name = new PointDescription(PointDescription.POINT_TYPE_POI, poiSimpleFormat);
|
PointDescription name = new PointDescription(PointDescription.POINT_TYPE_POI, poiSimpleFormat);
|
||||||
int z = Math.max(16, settings.getLastKnownMapZoom());
|
int z = Math.max(16, settings.getLastKnownMapZoom());
|
||||||
|
@ -572,7 +572,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
|
|
||||||
// Create dialog
|
// Create dialog
|
||||||
Builder bs = new AlertDialog.Builder(view.getContext());
|
Builder bs = new AlertDialog.Builder(view.getContext());
|
||||||
bs.setTitle(OsmAndFormatter.getPoiSimpleFormat(amenity, getMyApplication(),
|
bs.setTitle(OsmAndFormatter.getPoiStringWithoutType(amenity,
|
||||||
settings.usingEnglishNames()));
|
settings.usingEnglishNames()));
|
||||||
bs.setMessage(spannable);
|
bs.setMessage(spannable);
|
||||||
AlertDialog dialog = bs.show();
|
AlertDialog dialog = bs.show();
|
||||||
|
@ -857,7 +857,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
|
|
||||||
private void showPOIDetails(final Amenity amenity, boolean en) {
|
private void showPOIDetails(final Amenity amenity, boolean en) {
|
||||||
AlertDialog.Builder b = new AlertDialog.Builder(SearchPOIActivity.this);
|
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() {
|
b.setPositiveButton(R.string.shared_string_ok, new DialogInterface.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
public void onClick(DialogInterface dialog, int id) {
|
public void onClick(DialogInterface dialog, int id) {
|
||||||
|
|
|
@ -785,7 +785,8 @@ public class WaypointHelper {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public PointDescription getPointDescription(Context ctx) {
|
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
|
@Override
|
||||||
|
|
|
@ -158,7 +158,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
}
|
}
|
||||||
|
|
||||||
private StringBuilder buildPoiInformation(StringBuilder res, Amenity n) {
|
private StringBuilder buildPoiInformation(StringBuilder res, Amenity n) {
|
||||||
String format = OsmAndFormatter.getPoiSimpleFormat(n, view.getApplication(),
|
String format = OsmAndFormatter.getPoiStringWithoutType(n,
|
||||||
view.getSettings().usingEnglishNames());
|
view.getSettings().usingEnglishNames());
|
||||||
res.append(" " + format + "\n" + OsmAndFormatter.getAmenityDescriptionContent(view.getApplication(), n, true));
|
res.append(" " + format + "\n" + OsmAndFormatter.getAmenityDescriptionContent(view.getApplication(), n, true));
|
||||||
return res;
|
return res;
|
||||||
|
@ -302,8 +302,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
|
|
||||||
private void showDescriptionDialog(Amenity a) {
|
private void showDescriptionDialog(Amenity a) {
|
||||||
Builder bs = new AlertDialog.Builder(view.getContext());
|
Builder bs = new AlertDialog.Builder(view.getContext());
|
||||||
bs.setTitle(OsmAndFormatter.getPoiSimpleFormat(a, view.getApplication(),
|
bs.setTitle(OsmAndFormatter.getPoiStringWithoutType(a, view.getSettings().usingEnglishNames()));
|
||||||
view.getSettings().usingEnglishNames()));
|
|
||||||
if (a.getType().isWiki()) {
|
if (a.getType().isWiki()) {
|
||||||
bs.setMessage(a.getDescription());
|
bs.setMessage(a.getDescription());
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue