Skip to content

Commit be29d86

Browse files
committed
Fix metrics and document ChapterRequest related classes
1 parent 84d6b2d commit be29d86

5 files changed

Lines changed: 101 additions & 10 deletions

File tree

library/src/androidTest/java/com/proxerme/library/connection/manga/request/ChapterRequestTest.java

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@
77
import com.proxerme.library.test.R;
88
import com.proxerme.library.util.RequestTest;
99

10-
import org.junit.Assert;
1110
import org.junit.Test;
1211
import org.junit.runner.RunWith;
1312

@@ -18,7 +17,7 @@
1817
import static junit.framework.Assert.assertEquals;
1918

2019
/**
21-
* TODO: Describe class
20+
* Tests for {@link ChapterRequest}.
2221
*
2322
* @author Ruben Gees
2423
*/
@@ -46,7 +45,7 @@ public void testUrl() throws Exception {
4645
new ChapterRequest("0", 1, GeneralLanguageParameter.ENGLISH)
4746
.withCustomHost(buildHostUrl(server.url(URL))));
4847

49-
Assert.assertEquals(URL, server.takeRequest().getPath());
48+
assertEquals(URL, server.takeRequest().getPath());
5049
}
5150

5251
private Chapter generateTestChapter() {
@@ -56,4 +55,4 @@ private Chapter generateTestChapter() {
5655
new String[]{"fairy-001-02-03.jpg", "641", "900",},
5756
});
5857
}
59-
}
58+
}

library/src/main/java/com/proxerme/library/connection/manga/entity/Chapter.java

Lines changed: 65 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313
import java.util.Arrays;
1414

1515
/**
16-
* TODO: Describe class
16+
* Entity representing a single chapter of a maga.
1717
*
1818
* @author Ruben Gees
1919
*/
@@ -52,6 +52,20 @@ public Chapter[] newArray(int size) {
5252
@Json(name = "pages")
5353
private String[][] pages;
5454

55+
/**
56+
* The constructor.
57+
*
58+
* @param id The id.
59+
* @param entryId The id of the associated entry.
60+
* @param title The title.
61+
* @param uploaderId The id of the uploader.
62+
* @param uploader The username of the uploader.
63+
* @param time The time this chapter was uploaded as an unix timestamp.
64+
* @param scangroupId The id of the scangroup.
65+
* @param scangroup The name of the scangroup.
66+
* @param server The server this chapter is uploaded to.
67+
* @param pages The pages this chapter has.
68+
*/
5569
public Chapter(@NonNull String id, @NonNull String entryId, @NonNull String title,
5670
@NonNull String uploaderId, @NonNull String uploader, long time,
5771
@Nullable String scangroupId, @Nullable String scangroup, @NonNull String server,
@@ -81,52 +95,102 @@ protected Chapter(Parcel in) {
8195
this.pages = Utils.toTwoDimensions(3, in.createStringArray());
8296
}
8397

98+
/**
99+
* Returns the id.
100+
*
101+
* @return The id.
102+
*/
84103
@Override
85104
@NonNull
86105
public String getId() {
87106
return id;
88107
}
89108

109+
/**
110+
* Returns the id of the entry.
111+
*
112+
* @return The id of the entry.
113+
*/
90114
@NonNull
91115
public String getEntryId() {
92116
return entryId;
93117
}
94118

119+
/**
120+
* Returns the title.
121+
*
122+
* @return The title.
123+
*/
95124
@NonNull
96125
public String getTitle() {
97126
return title;
98127
}
99128

129+
/**
130+
* Returns the id of the uploader.
131+
*
132+
* @return The id of the uploader.
133+
*/
100134
@NonNull
101135
public String getUploaderId() {
102136
return uploaderId;
103137
}
104138

139+
/**
140+
* Returns the name of the uploader.
141+
*
142+
* @return The name of the uploader.
143+
*/
105144
@NonNull
106145
public String getUploader() {
107146
return uploader;
108147
}
109148

149+
/**
150+
* Returns the upload time.
151+
*
152+
* @return The upload time.
153+
*/
110154
@Override
111155
public long getTime() {
112156
return time;
113157
}
114158

159+
/**
160+
* Returns the id of the scangroup.
161+
*
162+
* @return The id of the scangroup.
163+
*/
115164
@Nullable
116165
public String getScangroupId() {
117166
return scangroupId;
118167
}
119168

169+
/**
170+
* Returns the name of the scangroup.
171+
*
172+
* @return The scangroup.
173+
*/
120174
@Nullable
121175
public String getScangroup() {
122176
return scangroup;
123177
}
124178

179+
/**
180+
* Returns the server for this chapter.
181+
*
182+
* @return The server.
183+
*/
125184
@NonNull
126185
public String getServer() {
127186
return server;
128187
}
129188

189+
/**
190+
* Returns an array of pages this chapter has.
191+
*
192+
* @return The pages.
193+
*/
130194
@NonNull
131195
public Page[] getPages() {
132196
Page[] result = new Page[pages.length];

library/src/main/java/com/proxerme/library/connection/manga/entity/Page.java

Lines changed: 23 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
import android.support.annotation.NonNull;
77

88
/**
9-
* TODO: Describe class
9+
* Entity representing a single page from a {@link Chapter}.
1010
*
1111
* @author Ruben Gees
1212
*/
@@ -28,6 +28,13 @@ public Page[] newArray(int size) {
2828
private int height;
2929
private int width;
3030

31+
/**
32+
* The constructor.
33+
*
34+
* @param name The name of the file.
35+
* @param height The height of the image.
36+
* @param width The width of the image.
37+
*/
3138
public Page(@NonNull String name, @IntRange(from = 0) int height,
3239
@IntRange(from = 0) int width) {
3340
this.name = name;
@@ -41,16 +48,31 @@ protected Page(Parcel in) {
4148
this.width = in.readInt();
4249
}
4350

51+
/**
52+
* Returns the filename.
53+
*
54+
* @return The filename.
55+
*/
4456
@NonNull
4557
public String getName() {
4658
return name;
4759
}
4860

61+
/**
62+
* Returns the height.
63+
*
64+
* @return The height.
65+
*/
4966
@IntRange(from = 0)
5067
public int getHeight() {
5168
return height;
5269
}
5370

71+
/**
72+
* Returns the width.
73+
*
74+
* @return The width.
75+
*/
5476
@IntRange(from = 0)
5577
public int getWidth() {
5678
return width;

library/src/main/java/com/proxerme/library/connection/manga/request/ChapterRequest.java

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,8 @@
1717
import okhttp3.ResponseBody;
1818

1919
/**
20-
* TODO: Describe class
20+
* Request for retrieving information on a single chapter of the specified manga. A user must be
21+
* logged in to earn points.
2122
*
2223
* @author Ruben Gees
2324
*/
@@ -33,6 +34,13 @@ public class ChapterRequest extends MangaRequest<Chapter> {
3334
private int episode;
3435
private String language;
3536

37+
/**
38+
* The constructor.
39+
*
40+
* @param id The id of the manga.
41+
* @param episode The episode.
42+
* @param language The selected language.
43+
*/
3644
public ChapterRequest(@NonNull String id, @IntRange(from = 1) int episode,
3745
@NonNull @GeneralLanguage String language) {
3846
this.id = id;

library/src/main/java/com/proxerme/library/connection/manga/result/ChapterResult.java

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,9 +5,7 @@
55
import com.squareup.moshi.Json;
66

77
/**
8-
* TODO: Describe class
9-
*
10-
* @author Ruben Gees
8+
* {@inheritDoc}
119
*/
1210
public final class ChapterResult extends ProxerResult<Chapter> {
1311

0 commit comments

Comments
 (0)