Add support for images in gpx metadata
This commit is contained in:
parent
d0790075d8
commit
2b93241ae1
1 changed files with 16 additions and 6 deletions
|
@ -482,21 +482,31 @@ public class TrackActivityFragmentAdapter implements TrackBitmapDrawerListener {
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private String getMetadataDescription(@NonNull GPXUtilities.Metadata metadata) {
|
private String getMetadataDescription(@NonNull GPXUtilities.Metadata metadata) {
|
||||||
String description = metadata.desc;
|
String descHtml = metadata.desc;
|
||||||
if (TextUtils.isEmpty(description)) {
|
if (TextUtils.isEmpty(descHtml)) {
|
||||||
Map<String, String> extensions = metadata.getExtensionsToRead();
|
Map<String, String> extensions = metadata.getExtensionsToRead();
|
||||||
if (!extensions.isEmpty() && extensions.containsKey("desc")) {
|
if (!extensions.isEmpty() && extensions.containsKey("desc")) {
|
||||||
description = extensions.get("desc");
|
descHtml = extensions.get("desc");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return description != null ? Html.fromHtml(description).toString().trim() : null;
|
if (descHtml != null) {
|
||||||
|
String content = WikiArticleHelper.getPartialContent(descHtml);
|
||||||
|
if (!TextUtils.isEmpty(content)) {
|
||||||
|
return content;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return descHtml;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
private String getMetadataImageLink(@NonNull GPXUtilities.Metadata metadata) {
|
private String getMetadataImageLink(@NonNull GPXUtilities.Metadata metadata) {
|
||||||
String link = metadata.link;
|
String link = metadata.link;
|
||||||
|
if (!TextUtils.isEmpty(link)) {
|
||||||
return link;
|
if (link.contains(".jpg") || link.contains(".gif") || link.contains(".jpeg") || link.contains(".png") || link.contains(".bmp") || link.contains(".webp")) {
|
||||||
|
return link;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Nullable
|
@Nullable
|
||||||
|
|
Loading…
Reference in a new issue