use of com.hippo.ehviewer.client.data.GalleryDetail in project EhViewer by seven332.
the class GalleryDetailScene method bindViewSecond.
private void bindViewSecond() {
GalleryDetail gd = mGalleryDetail;
if (gd == null) {
return;
}
if (mThumb == null || mTitle == null || mUploader == null || mCategory == null || mLanguage == null || mPages == null || mSize == null || mPosted == null || mFavoredTimes == null || mRatingText == null || mRating == null || mTorrent == null) {
return;
}
Resources resources = getResources2();
Assert.assertNotNull(resources);
mThumb.load(EhCacheKeyFactory.getThumbKey(gd.gid), gd.thumb);
mTitle.setText(EhUtils.getSuitableTitle(gd));
mUploader.setText(gd.uploader);
mCategory.setText(EhUtils.getCategory(gd.category));
mCategory.setTextColor(EhUtils.getCategoryColor(gd.category));
updateDownloadText();
mLanguage.setText(gd.language);
mPages.setText(resources.getQuantityString(R.plurals.page_count, gd.pages, gd.pages));
mSize.setText(gd.size);
mPosted.setText(gd.posted);
mFavoredTimes.setText(resources.getString(R.string.favored_times, gd.favoriteCount));
mRatingText.setText(getAllRatingText(gd.rating, gd.ratingCount));
mRating.setRating(gd.rating);
updateFavoriteDrawable();
mTorrent.setText(resources.getString(R.string.torrent_count, gd.torrentCount));
bindTags(gd.tags);
bindComments(gd.comments);
bindPreviews(gd);
}
use of com.hippo.ehviewer.client.data.GalleryDetail in project EhViewer by seven332.
the class GalleryInfoScene method handlerArgs.
private void handlerArgs(Bundle args) {
if (args == null) {
return;
}
GalleryDetail gd = args.getParcelable(KEY_GALLERY_DETAIL);
if (gd == null) {
return;
}
if (mKeys == null || mValues == null) {
return;
}
Resources resources = getResources2();
Assert.assertNotNull(resources);
mKeys.add(resources.getString(R.string.header_key));
mValues.add(resources.getString(R.string.header_value));
mKeys.add(resources.getString(R.string.key_gid));
mValues.add(Long.toString(gd.gid));
mKeys.add(resources.getString(R.string.key_token));
mValues.add(gd.token);
mKeys.add(resources.getString(R.string.key_url));
mValues.add(EhUrl.getGalleryDetailUrl(gd.gid, gd.token));
mKeys.add(resources.getString(R.string.key_title));
mValues.add(gd.title);
mKeys.add(resources.getString(R.string.key_title_jpn));
mValues.add(gd.titleJpn);
mKeys.add(resources.getString(R.string.key_thumb));
mValues.add(gd.thumb);
mKeys.add(resources.getString(R.string.key_category));
mValues.add(EhUtils.getCategory(gd.category));
mKeys.add(resources.getString(R.string.key_uploader));
mValues.add(gd.uploader);
mKeys.add(resources.getString(R.string.key_posted));
mValues.add(gd.posted);
mKeys.add(resources.getString(R.string.key_parent));
mValues.add(gd.parent);
mKeys.add(resources.getString(R.string.key_visible));
mValues.add(gd.visible);
mKeys.add(resources.getString(R.string.key_language));
mValues.add(gd.language);
mKeys.add(resources.getString(R.string.key_pages));
mValues.add(Integer.toString(gd.pages));
mKeys.add(resources.getString(R.string.key_size));
mValues.add(gd.size);
mKeys.add(resources.getString(R.string.key_favorite_count));
mValues.add(Integer.toString(gd.favoriteCount));
mKeys.add(resources.getString(R.string.key_favorited));
mValues.add(Boolean.toString(gd.isFavorited));
mKeys.add(resources.getString(R.string.key_rating_count));
mValues.add(Integer.toString(gd.ratingCount));
mKeys.add(resources.getString(R.string.key_rating));
mValues.add(Float.toString(gd.rating));
mKeys.add(resources.getString(R.string.key_torrents));
mValues.add(Integer.toString(gd.torrentCount));
mKeys.add(resources.getString(R.string.key_torrent_url));
mValues.add(gd.torrentUrl);
}
use of com.hippo.ehviewer.client.data.GalleryDetail in project EhViewer by seven332.
the class GalleryDetailScene method updateFavoriteDrawable.
private void updateFavoriteDrawable() {
GalleryDetail gd = mGalleryDetail;
if (gd == null) {
return;
}
if (mHeart == null || mHeartOutline == null) {
return;
}
if (gd.isFavorited || EhDB.containLocalFavorites(gd.gid)) {
mHeart.setVisibility(View.VISIBLE);
mHeartOutline.setVisibility(View.GONE);
} else {
mHeart.setVisibility(View.GONE);
mHeartOutline.setVisibility(View.VISIBLE);
}
}
use of com.hippo.ehviewer.client.data.GalleryDetail in project EhViewer by seven332.
the class GalleryDetailScene method showSimilarGalleryList.
private void showSimilarGalleryList() {
GalleryDetail gd = mGalleryDetail;
if (null == gd) {
return;
}
String keyword = EhUtils.extractTitle(gd.title);
if (null != keyword) {
ListUrlBuilder lub = new ListUrlBuilder();
lub.setMode(ListUrlBuilder.MODE_NORMAL);
lub.setKeyword(keyword);
GalleryListScene.startScene(this, lub);
return;
}
String artist = getArtist(gd.tags);
if (null != artist) {
ListUrlBuilder lub = new ListUrlBuilder();
lub.setMode(ListUrlBuilder.MODE_TAG);
lub.setKeyword("artist:" + artist);
GalleryListScene.startScene(this, lub);
return;
}
if (null != gd.uploader) {
ListUrlBuilder lub = new ListUrlBuilder();
lub.setMode(ListUrlBuilder.MODE_UPLOADER);
lub.setKeyword(gd.uploader);
GalleryListScene.startScene(this, lub);
}
}
use of com.hippo.ehviewer.client.data.GalleryDetail in project EhViewer by seven332.
the class GalleryDetailParser method parse.
public static GalleryDetail parse(String body) throws EhException {
if (body.contains(OFFENSIVE_STRING)) {
throw new OffensiveException();
}
if (body.contains(PINING_STRING)) {
throw new PiningException();
}
// Error info
Matcher m = PATTERN_ERROR.matcher(body);
if (m.find()) {
throw new EhException(m.group(1));
}
GalleryDetail galleryDetail = new GalleryDetail();
Document document = Jsoup.parse(body);
parseDetail(galleryDetail, document, body);
galleryDetail.tags = parseTagGroups(document);
galleryDetail.comments = parseComments(document);
galleryDetail.previewPages = parsePreviewPages(document, body);
galleryDetail.previewSet = parsePreviewSet(document, body);
return galleryDetail;
}
Aggregations