add style background-image to article image

This commit is contained in:
Chumva 2018-04-03 18:59:42 +03:00
parent 24ba4688e8
commit 42475b1956

View file

@ -40,7 +40,7 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
"<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n" + "<meta name=\"viewport\" content=\"width=device-width, initial-scale=1\" />\n" +
"<meta http-equiv=\"cleartype\" content=\"on\" />\n" + "<meta http-equiv=\"cleartype\" content=\"on\" />\n" +
"<link href=\"article_style.css\" type=\"text/css\" rel=\"stylesheet\"/>\n" + "<link href=\"article_style.css\" type=\"text/css\" rel=\"stylesheet\"/>\n" +
"</head><body>"; "</head><body>\n";
private static final String FOOTER_INNER = "</div></body></html>"; private static final String FOOTER_INNER = "</div></body></html>";
private long cityId = NO_VALUE; private long cityId = NO_VALUE;
@ -156,7 +156,8 @@ public class WikivoyageArticleDialogFragment extends WikivoyageBaseDialogFragmen
String articleTitle = article.getImageTitle(); String articleTitle = article.getImageTitle();
if (!TextUtils.isEmpty(articleTitle)) { if (!TextUtils.isEmpty(articleTitle)) {
String url = WikivoyageArticle.getImageUrl(articleTitle); String url = WikivoyageArticle.getImageUrl(articleTitle);
sb.append("<img class=\"title-image\" src=\"").append(url).append("\"/>"); // sb.append("<img class=\"title-image\" src=\"").append(url).append("\"/>");
sb.append("<div class=\"title-image\" style=\"background-image: url(").append(url).append(")\"></div>");
} }
sb.append("<div class=\"main\">\n"); sb.append("<div class=\"main\">\n");
sb.append("<h1>").append(article.getTitle()).append("</h1>"); sb.append("<h1>").append(article.getTitle()).append("</h1>");