Untitled

mail@pastecode.io avatarunknown
plain_text
2 months ago
2.3 kB
2
Indexable
Never
public String stringContentNews(String titleOrg, String bodyOrg, String pubdate, String urlimg, String urlvideo, String nameLink, String link) {
        int fontSize = preferenceHelper.getFontSize();
        String body = TagColorHelper.Companion.convertTag(bodyOrg);
        String title = TagColorHelper.Companion.convertTag(titleOrg);
        String videoOrImg = "";

        if (urlvideo == null || urlvideo.isEmpty()) {
            if (urlimg != null && !urlimg.isEmpty()) {
                videoOrImg = "<img id=\"videoOrImg\" src=\"" + urlimg + "\" width=\"100%\">";
            }
        } else {
            videoOrImg = "<video id=\"videoOrImg\" width=\"100%\" controls onplay=\"onPlayVideo()\" onpause=\"onPauseVideo()\" poster=\"" + urlimg + "\">\n" +
                    "<source src=\"" + urlvideo + "\">\n" +
                    "</video>";
        }

        String newsLink = link != null ? link : "";
        String sourceTag, sourceName;

        sourceName = nameLink == null ? "EASY GERMAN" : nameLink;

        if (title.isEmpty() && pubdate.isEmpty() && link.isEmpty()) {
            sourceTag = "<br><br>";
        } else {
            sourceTag = "<div class=\"news-source\">Source:<a href=\"" + newsLink + "\" target=\"blank\">" + sourceName + "</a></div>";
        }

        return convertHtmlContentBasic(
                newsContentHtml.replace("<titlenew>", title)
                        .replace("<myLetterSpacing>", preferenceHelper.getLetterSpacing())
                        .replace("<pubdate>", pubdate)
                        .replace("<imageorvideo>", videoOrImg)
                        .replace("<nguyenthelinh>", body)
                        .replace("<sourcenews>", sourceTag)
                        .replaceAll("<dateColor>", getDateColor())
                        .replaceAll("<dateFontSize>", String.valueOf(fontSize - 6))
                        .replaceAll("<myFontSize>", String.valueOf(fontSize))
                        .replaceAll("<sourceFontSize>", String.valueOf(fontSize - 6))
                        .replaceAll("<bodyColor>", getBodyColor())
                        .replaceAll("<linkColor>", getLinkColor())
                        .replaceAll("<rubyColor>", getRubyColor())
        );
    }