X-Git-Url: https://git.nikiroo.be/?a=blobdiff_plain;f=src%2Fbe%2Fnikiroo%2Fgofetch%2Fdata%2FStory.java;h=5944beccc56104692ad31bf1f1f3fd1fe01b8d52;hb=b34d1f357b076c1697e381b70cb6ff1bb0278b91;hp=a2ad7d3b9e3a3660d18c951c6c3904b49a91c6b6;hpb=86d03b2e4fe0a2b53b83e981388394f3c5965f27;p=gofetch.git diff --git a/src/be/nikiroo/gofetch/data/Story.java b/src/be/nikiroo/gofetch/data/Story.java index a2ad7d3..5944bec 100644 --- a/src/be/nikiroo/gofetch/data/Story.java +++ b/src/be/nikiroo/gofetch/data/Story.java @@ -15,6 +15,9 @@ public class Story { private Type type; private String id; private String title; + private String author; + private String date; + private String category; private String details; private String urlInternal; private String urlExternal; @@ -32,8 +35,15 @@ public class Story { * the news ID * @param title * the news title + * @param author + * the author name for the details + * @param date + * the post date for the details + * @param category + * the category for the details * @param details - * some details to add to the title + * some details to add to the title (author, date and category + * will be added in the getter if available) * @param urlInternal * the {@link URL} to get this news on the associated news site * @param urlExternal @@ -41,11 +51,15 @@ public class Story { * @param content * the story content */ - public Story(Type type, String id, String title, String details, - String urlInternal, String urlExternal, String content) { + public Story(Type type, String id, String title, String author, + String date, String category, String details, String urlInternal, + String urlExternal, String content) { this.type = type; this.id = id; this.title = title; + this.author = author; + this.date = date; + this.category = category; this.details = details; this.urlInternal = urlInternal; this.urlExternal = urlExternal; @@ -77,6 +91,17 @@ public class Story { * @return the details */ public String getDetails() { + String details = ""; + + if (category != null && !category.trim().isEmpty()) + details += "[" + category + "] "; + if (date != null && !date.trim().isEmpty()) + details += date + " "; + if (author != null && !author.trim().isEmpty()) + details += "(" + this.author + ") "; + if (this.details != null && !this.details.trim().isEmpty()) + details += "\n" + this.details; + return details; }