2f36731871991449f63fead0265d8c5f79a9e499
1 package be
.nikiroo
.fanfix
.library
;
4 static public final String INDEX_URL
= "/";
6 static public final String VERSION_URL
= "/version";
8 static public final String LOGOUT_URL
= "/logout";
10 static private final String VIEWER_URL_BASE
= "/view/story/";
11 static private final String VIEWER_URL
= VIEWER_URL_BASE
12 + "{luid}/{chap}/{para}";
14 static private final String STORY_URL_BASE
= "/story/";
15 static private final String STORY_URL
= STORY_URL_BASE
16 + "{luid}/{chap}/{para}";
17 static private final String STORY_URL_COVER
= STORY_URL_BASE
19 static private final String STORY_URL_JSON
= STORY_URL_BASE
+ "{luid}/json";
21 static private final String LIST_URL_BASE
= "/list/";
23 static public final String LIST_URL_METADATA
= LIST_URL_BASE
+ "metadata";
25 // GET/SET ("luid" param -> set cover to the cover of this story -- not ok
27 static private final String COVER_URL_BASE
= "/cover/";
28 static private final String COVER_URL_STORY
= COVER_URL_BASE
30 static private final String COVER_URL_AUTHOR
= COVER_URL_BASE
32 static private final String COVER_URL_SOURCE
= COVER_URL_BASE
35 static public String
getViewUrl(String luid
, Integer chap
, Integer para
) {
37 .replace("{luid}", luid
) //
38 .replace("/{chap}", chap
== null ?
"" : "/" + chap
) //
40 (chap
== null || para
== null) ?
"" : "/" + para
);
43 static public String
getStoryUrl(String luid
, int chap
, Integer para
) {
45 .replace("{luid}", luid
) //
46 .replace("{chap}", Integer
.toString(chap
)) //
47 .replace("{para}", para
== null ?
"" : Integer
.toString(para
));
50 static public String
getStoryUrlCover(String luid
) {
51 return STORY_URL_COVER
//
52 .replace("{luid}", luid
);
55 static public String
getStoryUrlJson(String luid
) {
56 return STORY_URL_JSON
//
57 .replace("{luid}", luid
);
60 static public boolean isSupportedUrl(String url
) {
61 return INDEX_URL
.equals(url
) || VERSION_URL
.equals(url
)
62 || LOGOUT_URL
.equals(url
) || isViewUrl(url
) || isStoryUrl(url
)
63 || isListUrl(url
) || isCoverUrl(url
);
66 static public String
getCoverUrlStory(String luid
) {
67 return COVER_URL_STORY
//
68 .replace("{luid}", luid
);
71 static public String
getCoverUrlSource(String source
) {
72 return COVER_URL_SOURCE
//
73 .replace("{source}", source
);
76 static public String
getCoverUrlAuthor(String author
) {
77 return COVER_URL_AUTHOR
//
78 .replace("{author}", author
);
81 static public boolean isViewUrl(String url
) {
82 return url
!= null && url
.startsWith(VIEWER_URL_BASE
);
85 static public boolean isStoryUrl(String url
) {
86 return url
!= null && url
.startsWith(STORY_URL_BASE
);
89 static public boolean isListUrl(String url
) {
90 return url
!= null && url
.startsWith(LIST_URL_BASE
);
93 static public boolean isCoverUrl(String url
) {
94 return url
!= null && url
.startsWith(COVER_URL_BASE
);