Add gallery favorite status parse

This commit is contained in:
seven332 committed 2015-04-14 17:26:36 +08:00
1 parent 68d17c3ca8
commit 85ea7550f4
8 files changed
+19 -7

No files matched your search

@@ -39,6 +39,8 @@ public class GalleryDetail extends GalleryInfo
*/
public LinkedHashMap<String, LinkedList<String>> tags;
public boolean isFavorite;
// For Preview
public int previewSum;
public int previewPerPage;
@@ -63,6 +63,7 @@ public class DetailParser {
public String language;
public int people;
public float rating;
public boolean isFavorite;
public String firstPage;
public int previewPerPage;
public int previewSum;
@@ -135,12 +136,12 @@ public class DetailParser {
+ "<h1 id=\"gn\">([^<>]+)</h1>" // title
+ "<h1 id=\"gj\">([^<>]*)</h1>" // title_jpn might be empty string
+ "</div>"
+ ".+"
+ ".+?"
+ "<a[^<>]*onclick=\"return popUp\\('([^']+)'[^)]+\\)\">Torrent Download \\( (\\d+) \\)</a>"
+ ".+"
+ ".+?"
+ "<div id=\"gdc\"><a[^<>]+><[^<>]*alt=\"([\\w|\\-]+)\"[^<>]*></a></div>" // category
+ "<div id=\"gdn\"><a[^<>]+>([^<>]+)</a>" // uploader
+ ".+"
+ ".+?"
+ "<tr><td[^<>]*>Posted:</td><td[^<>]*>([\\w|\\-|\\s|:]+)</td></tr>" // posted
//+ "<tr><td[^<>]*>Images:</td><td[^<>]*>([\\d]+) @ ([\\w|\\.|\\s]+)</td></tr>" // pages and size
//+ "<tr><td[^<>]*>Resized:</td><td[^<>]*>([^<>]+)</td></tr>" // resized
@@ -150,11 +151,13 @@ public class DetailParser {
+ "<tr><td[^<>]*>File Size:</td><td[^<>]*>([^<>]+)(?:<span[^<>]*>([^<>]+)</span>)?</td></tr>" // File size and resize
+ "<tr><td[^<>]*>Length:</td><td[^<>]*>([\\d|,]+) pages</td></tr>" // pages
+ "<tr><td[^<>]*>Favorited:</td><[^<>]*>([^<>]+)</td></tr>" // Favorite times ([\d|,]+) times or Never
+ ".+"
+ ".+?"
+ "<td id=\"grt3\"><span id=\"rating_count\">([\\d|,]+)</span></td>" // people
+ "</tr>"
+ "<tr><td[^<>]*>([^<>]+)</td>" // rating
+ ".+"
+ ".+?"
+ "<a id=\"favoritelink\"[^<>]*>(.+?)</a>"
+ ".+?"
+ "<div id=\"gdt\"><div[^<>]*>(?:<div[^<>]*>)?<a[^<>]*href=\"([^<>\"]+)\"[^<>]*>"); // get firstPage
m = p.matcher(body);
if (m.find()) {
@@ -184,7 +187,9 @@ public class DetailParser {
else
rating = Float.NaN;
firstPage = m.group(18);
isFavorite = "Favorite Gallery".equals(m.group(18));
firstPage = m.group(19);
}
}
// Get tag
@@ -719,6 +719,7 @@ public class EhClient {
md.firstPage = parser.firstPage;
md.previewPerPage = parser.previewPerPage;
md.previewSum = parser.previewSum;
md.isFavorite = parser.isFavorite;
md.tags = parser.tags;
md.previewLists = new PreviewList[md.previewSum];
@@ -84,13 +84,14 @@ import com.hippo.ehviewer.drawable.OvalDrawable;
import com.hippo.ehviewer.effect.ripple.RippleSalon;
import com.hippo.ehviewer.ehclient.DetailUrlParser;
import com.hippo.ehviewer.ehclient.EhClient;
import com.hippo.ehviewer.miscellaneous.ActivityHelper;
import com.hippo.ehviewer.miscellaneous.Downloader;
import com.hippo.ehviewer.service.DownloadService;
import com.hippo.ehviewer.util.AppConfig;
import com.hippo.ehviewer.miscellaneous.ActivityHelper;
import com.hippo.ehviewer.util.Config;
import com.hippo.ehviewer.util.Constants;
import com.hippo.ehviewer.util.Favorite;
import com.hippo.ehviewer.util.Log;
import com.hippo.ehviewer.util.Ui;
import com.hippo.ehviewer.util.ViewUtils;
import com.hippo.ehviewer.widget.AutoWrapLayout;
@@ -665,6 +666,9 @@ public class GalleryDetailActivity extends AbsTranslucentActivity
if (mGalleryInfo instanceof GalleryDetail) {
GalleryDetail galleryDetail = (GalleryDetail)mGalleryInfo;
// TODO handle favorite
Log.d("TAG", "favorite " + galleryDetail.isFavorite);
if (galleryDetail.torrents.length > 0) {
mTorrent.setVisibility(View.VISIBLE);
}
Binary file not shown.

After

Width:  |  Height:  |  Size: 1.3 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 886 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 1.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 2.5 KiB