c1d1cf21f3621ee4a89c99d2b96508fe3a3d1cea
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 // GET/SET ("value" param -> set STA to this value)
22 static private final String STORY_URL_SOURCE
= STORY_URL_BASE
24 static private final String STORY_URL_TITLE
= STORY_URL_BASE
26 static private final String STORY_URL_AUTHOR
= STORY_URL_BASE
29 static private final String LIST_URL_BASE
= "/list/";
31 static public final String LIST_URL_METADATA
= LIST_URL_BASE
+ "metadata";
33 // GET/SET ("luid" param -> set cover to the cover of this story -- not ok
35 static private final String COVER_URL_BASE
= "/cover/";
36 static private final String COVER_URL_STORY
= COVER_URL_BASE
38 static private final String COVER_URL_AUTHOR
= COVER_URL_BASE
40 static private final String COVER_URL_SOURCE
= COVER_URL_BASE
43 static public String
getViewUrl(String luid
, Integer chap
, Integer para
) {
45 .replace("{luid}", luid
) //
46 .replace("/{chap}", chap
== null ?
"" : "/" + chap
) //
48 (chap
== null || para
== null) ?
"" : "/" + para
);
51 static public String
getStoryUrl(String luid
, int chap
, Integer para
) {
53 .replace("{luid}", luid
) //
54 .replace("{chap}", Integer
.toString(chap
)) //
55 .replace("{para}", para
== null ?
"" : Integer
.toString(para
));
58 static public String
getStoryUrlCover(String luid
) {
59 return STORY_URL_COVER
//
60 .replace("{luid}", luid
);
63 static public String
getStoryUrlJson(String luid
) {
64 return STORY_URL_JSON
//
65 .replace("{luid}", luid
);
68 static public String
getStoryUrlSource(String luid
) {
69 return STORY_URL_SOURCE
//
70 .replace("{luid}", luid
);
73 static public String
getStoryUrlTitle(String luid
) {
74 return STORY_URL_TITLE
//
75 .replace("{luid}", luid
);
78 static public String
getStoryUrlAuthor(String luid
) {
79 return STORY_URL_AUTHOR
//
80 .replace("{luid}", luid
);
83 static public boolean isSupportedUrl(String url
) {
84 return INDEX_URL
.equals(url
) || VERSION_URL
.equals(url
)
85 || LOGOUT_URL
.equals(url
) || isViewUrl(url
) || isStoryUrl(url
)
86 || isListUrl(url
) || isCoverUrl(url
);
89 static public String
getCoverUrlStory(String luid
) {
90 return COVER_URL_STORY
//
91 .replace("{luid}", luid
);
94 static public String
getCoverUrlSource(String source
) {
95 return COVER_URL_SOURCE
//
96 .replace("{source}", source
);
99 static public String
getCoverUrlAuthor(String author
) {
100 return COVER_URL_AUTHOR
//
101 .replace("{author}", author
);
104 static public boolean isViewUrl(String url
) {
105 return url
!= null && url
.startsWith(VIEWER_URL_BASE
);
108 static public boolean isStoryUrl(String url
) {
109 return url
!= null && url
.startsWith(STORY_URL_BASE
);
112 static public boolean isListUrl(String url
) {
113 return url
!= null && url
.startsWith(LIST_URL_BASE
);
116 static public boolean isCoverUrl(String url
) {
117 return url
!= null && url
.startsWith(COVER_URL_BASE
);