Merge pull request #10890 from osmandapp/support_links_in_plain_text

Add support of URLs in plain text inside favourites and waypoints description
This commit is contained in:
Vitaliy 2021-02-15 20:29:52 +02:00 committed by GitHub
commit 81fb35936a
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 9 additions and 5 deletions

View file

@ -808,7 +808,11 @@ public class MenuBuilder {
View.OnClickListener onClickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
if (description.contains("</")) {
POIMapLayer.showHtmlDescriptionDialog(view.getContext(), app, description, descriptionLabel);
} else {
POIMapLayer.showPlainDescriptionDialog(view.getContext(), app, description, descriptionLabel);
}
}
};

View file

@ -302,7 +302,7 @@ public class AmenityMenuBuilder extends MenuBuilder {
ll.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
POIMapLayer.showDescriptionDialog(view.getContext(), app, text, textPrefix);
POIMapLayer.showPlainDescriptionDialog(view.getContext(), app, text, textPrefix);
}
});
}

View file

@ -61,7 +61,7 @@ public class WptPtMenuBuilder extends MenuBuilder {
View.OnClickListener clickListener = new View.OnClickListener() {
@Override
public void onClick(View v) {
POIMapLayer.showDescriptionDialog(view.getContext(), app, wpt.desc, textPrefix);
POIMapLayer.showPlainDescriptionDialog(view.getContext(), app, wpt.desc, textPrefix);
}
};
@ -103,7 +103,7 @@ public class WptPtMenuBuilder extends MenuBuilder {
rowc.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
POIMapLayer.showDescriptionDialog(rowc.getContext(), app, wpt.comment,
POIMapLayer.showPlainDescriptionDialog(rowc.getContext(), app, wpt.comment,
rowc.getResources().getString(R.string.poi_dialog_comment));
}
});

View file

@ -274,7 +274,7 @@ public class POIMapLayer extends OsmandMapLayer implements ContextMenuLayer.ICon
return true;
}
public static void showDescriptionDialog(Context ctx, OsmandApplication app, String text, String title) {
public static void showPlainDescriptionDialog(Context ctx, OsmandApplication app, String text, String title) {
final TextView textView = new TextView(ctx);
LinearLayout.LayoutParams llTextParams = new LinearLayout.LayoutParams(ViewGroup.LayoutParams.MATCH_PARENT, ViewGroup.LayoutParams.WRAP_CONTENT);
int textMargin = dpToPx(app, 10f);