Fix poi search (casing)
This commit is contained in:
parent
6272c849df
commit
81348e0071
2 changed files with 22 additions and 24 deletions
|
@ -40,6 +40,7 @@ import net.osmand.plus.poi.PoiLegacyFilter;
|
||||||
import net.osmand.plus.poi.PoiLegacyFilter.AmenityNameFilter;
|
import net.osmand.plus.poi.PoiLegacyFilter.AmenityNameFilter;
|
||||||
import net.osmand.plus.render.RenderingIcons;
|
import net.osmand.plus.render.RenderingIcons;
|
||||||
import net.osmand.plus.views.DirectionDrawable;
|
import net.osmand.plus.views.DirectionDrawable;
|
||||||
|
import net.osmand.plus.views.POIMapLayer;
|
||||||
import net.osmand.util.Algorithms;
|
import net.osmand.util.Algorithms;
|
||||||
import net.osmand.util.MapUtils;
|
import net.osmand.util.MapUtils;
|
||||||
import net.osmand.util.OpeningHoursParser;
|
import net.osmand.util.OpeningHoursParser;
|
||||||
|
@ -558,22 +559,7 @@ public class SearchPOIActivity extends OsmandListActivity implements OsmAndCompa
|
||||||
@Override
|
@Override
|
||||||
public boolean onMenuItemClick(MenuItem item) {
|
public boolean onMenuItemClick(MenuItem item) {
|
||||||
// Build text(amenity)
|
// Build text(amenity)
|
||||||
|
POIMapLayer.showDescriptionDialog(SearchPOIActivity.this, app, amenity);
|
||||||
// Find and format links
|
|
||||||
SpannableString spannable = new SpannableString(d);
|
|
||||||
Linkify.addLinks(spannable, Linkify.ALL);
|
|
||||||
|
|
||||||
// Create dialog
|
|
||||||
Builder bs = new AlertDialog.Builder(view.getContext());
|
|
||||||
bs.setTitle(OsmAndFormatter.getPoiStringWithoutType(amenity,
|
|
||||||
app.getSettings().MAP_PREFERRED_LOCALE.get()));
|
|
||||||
bs.setMessage(spannable);
|
|
||||||
AlertDialog dialog = bs.show();
|
|
||||||
|
|
||||||
// Make links clickable
|
|
||||||
TextView textView = (TextView) dialog.findViewById(android.R.id.message);
|
|
||||||
textView.setMovementMethod(LinkMovementMethod.getInstance());
|
|
||||||
textView.setLinksClickable(true);
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
|
@ -47,6 +47,9 @@ import android.graphics.drawable.Drawable;
|
||||||
import android.graphics.PointF;
|
import android.graphics.PointF;
|
||||||
import android.net.Uri;
|
import android.net.Uri;
|
||||||
import android.support.v7.widget.Toolbar;
|
import android.support.v7.widget.Toolbar;
|
||||||
|
import android.text.SpannableString;
|
||||||
|
import android.text.method.LinkMovementMethod;
|
||||||
|
import android.text.util.Linkify;
|
||||||
import android.util.TypedValue;
|
import android.util.TypedValue;
|
||||||
import android.view.MotionEvent;
|
import android.view.MotionEvent;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
|
@ -56,6 +59,7 @@ import android.webkit.WebViewClient;
|
||||||
import android.widget.ArrayAdapter;
|
import android.widget.ArrayAdapter;
|
||||||
import android.widget.LinearLayout;
|
import android.widget.LinearLayout;
|
||||||
import android.widget.ScrollView;
|
import android.widget.ScrollView;
|
||||||
|
import android.widget.TextView;
|
||||||
import android.widget.Toast;
|
import android.widget.Toast;
|
||||||
|
|
||||||
public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider,
|
public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.IContextMenuProvider,
|
||||||
|
@ -303,7 +307,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
AccessibleToast.makeText(view.getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
AccessibleToast.makeText(view.getContext(), e.getMessage(), Toast.LENGTH_SHORT).show();
|
||||||
}
|
}
|
||||||
} else if (itemId == R.string.poi_context_menu_showdescription) {
|
} else if (itemId == R.string.poi_context_menu_showdescription) {
|
||||||
showDescriptionDialog(a);
|
showDescriptionDialog(view.getContext(), app, a);
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
@ -324,17 +328,25 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showDescriptionDialog(Amenity a) {
|
public static void showDescriptionDialog(Context ctx, OsmandApplication app, Amenity a) {
|
||||||
String lang = view.getSettings().MAP_PREFERRED_LOCALE.get();
|
String lang = app.getSettings().MAP_PREFERRED_LOCALE.get();
|
||||||
if (a.getType().isWiki()) {
|
if (a.getType().isWiki()) {
|
||||||
showWiki(view.getContext(), a.getName(lang),
|
showWiki(ctx, app, a.getName(lang),
|
||||||
a.getDescription(lang));
|
a.getDescription(lang));
|
||||||
} else {
|
} else {
|
||||||
Builder bs = new AlertDialog.Builder(view.getContext());
|
String d = OsmAndFormatter.getAmenityDescriptionContent(app, a, false);
|
||||||
|
SpannableString spannable = new SpannableString(d);
|
||||||
|
Linkify.addLinks(spannable, Linkify.ALL);
|
||||||
|
|
||||||
|
Builder bs = new AlertDialog.Builder(ctx);
|
||||||
bs.setTitle(OsmAndFormatter.getPoiStringWithoutType(a, lang));
|
bs.setTitle(OsmAndFormatter.getPoiStringWithoutType(a, lang));
|
||||||
bs.setMessage(OsmAndFormatter.getAmenityDescriptionContent(view.getApplication(), a, false));
|
bs.setMessage(spannable);
|
||||||
bs.setPositiveButton(R.string.shared_string_ok, null);
|
bs.setPositiveButton(R.string.shared_string_ok, null);
|
||||||
bs.show();
|
AlertDialog dialog = bs.show();
|
||||||
|
// Make links clickable
|
||||||
|
TextView textView = (TextView) dialog.findViewById(android.R.id.message);
|
||||||
|
textView.setMovementMethod(LinkMovementMethod.getInstance());
|
||||||
|
textView.setLinksClickable(true);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -346,7 +358,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
|
||||||
return typedvalueattr.resourceId;
|
return typedvalueattr.resourceId;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void showWiki(Context ctx, String name, String content ) {
|
private static void showWiki(Context ctx, OsmandApplication app, String name, String content ) {
|
||||||
final Dialog dialog = new Dialog(ctx,
|
final Dialog dialog = new Dialog(ctx,
|
||||||
app.getSettings().isLightContent() ?
|
app.getSettings().isLightContent() ?
|
||||||
R.style.OsmandLightTheme:
|
R.style.OsmandLightTheme:
|
||||||
|
|
Loading…
Reference in a new issue