Add info about newer version of gallery
This commit is contained in:
6 files changed
+59
-6
No files matched your search
+4
-4
@@ -3,7 +3,7 @@ apply plugin: 'com.google.android.gms.oss-licenses-plugin'
|
||||
|
||||
android {
|
||||
compileSdkVersion 30
|
||||
buildToolsVersion "30.0.1"
|
||||
buildToolsVersion "30.0.2"
|
||||
ndkVersion "21.3.6528147"
|
||||
signingConfigs {
|
||||
def keystorePwd = null
|
||||
@@ -76,12 +76,12 @@ tasks.withType(JavaCompile) {
|
||||
|
||||
dependencies {
|
||||
implementation fileTree(include: ['*.jar'], dir: 'libs')
|
||||
implementation 'androidx.appcompat:appcompat:1.3.0-alpha01'
|
||||
implementation 'androidx.appcompat:appcompat:1.2.0'
|
||||
implementation 'androidx.biometric:biometric:1.0.1'
|
||||
implementation "androidx.browser:browser:1.2.0"
|
||||
implementation 'androidx.cardview:cardview:1.0.0'
|
||||
implementation 'com.google.android.gms:play-services-oss-licenses:17.0.0'
|
||||
implementation 'com.google.android.material:material:1.3.0-alpha02'
|
||||
implementation 'com.google.android.material:material:1.2.0'
|
||||
implementation 'com.getkeepsafe.relinker:relinker:1.4.1'
|
||||
implementation 'com.github.amlcurran.showcaseview:library:5.4.3'
|
||||
implementation 'com.github.seven332.a7zip:extract-lite:1b21783'
|
||||
@@ -102,7 +102,7 @@ dependencies {
|
||||
implementation 'com.github.seven332:yorozuya-thread:0.1.1'
|
||||
implementation 'com.github.seven332:yorozuya-collect:0.1.4'
|
||||
implementation 'com.h6ah4i.android.widget.advrecyclerview:advrecyclerview:1.0.0'
|
||||
def appCenterSdkVersion = '3.2.2'
|
||||
def appCenterSdkVersion = '3.3.0'
|
||||
implementation "com.microsoft.appcenter:appcenter-analytics:${appCenterSdkVersion}"
|
||||
implementation "com.microsoft.appcenter:appcenter-crashes:${appCenterSdkVersion}"
|
||||
implementation "com.microsoft.appcenter:appcenter-distribute:${appCenterSdkVersion}"
|
||||
|
||||
@@ -40,6 +40,9 @@ public class GalleryDetail extends GalleryInfo {
|
||||
public String torrentUrl;
|
||||
public String archiveUrl;
|
||||
public String parent;
|
||||
public String newerUrl;
|
||||
public String newerName;
|
||||
public String newerDate;
|
||||
public String visible;
|
||||
public String language;
|
||||
public String size;
|
||||
@@ -61,6 +64,9 @@ public class GalleryDetail extends GalleryInfo {
|
||||
this.torrentUrl = in.readString();
|
||||
this.archiveUrl = in.readString();
|
||||
this.parent = in.readString();
|
||||
this.newerUrl = in.readString();
|
||||
this.newerName = in.readString();
|
||||
this.newerDate = in.readString();
|
||||
this.visible = in.readString();
|
||||
this.language = in.readString();
|
||||
this.size = in.readString();
|
||||
@@ -91,6 +97,9 @@ public class GalleryDetail extends GalleryInfo {
|
||||
dest.writeString(this.torrentUrl);
|
||||
dest.writeString(this.archiveUrl);
|
||||
dest.writeString(this.parent);
|
||||
dest.writeString(this.newerUrl);
|
||||
dest.writeString(this.newerName);
|
||||
dest.writeString(this.newerDate);
|
||||
dest.writeString(this.visible);
|
||||
dest.writeString(this.language);
|
||||
dest.writeString(this.size);
|
||||
|
||||
@@ -62,7 +62,7 @@ public class GalleryDetailParser {
|
||||
|
||||
private static final Pattern PATTERN_ERROR = Pattern.compile("<div class=\"d\">\n<p>([^<]+)</p>");
|
||||
private static final Pattern PATTERN_DETAIL = Pattern.compile("var gid = (\\d+);.+?var token = \"([a-f0-9]+)\";.+?var apiuid = ([\\-\\d]+);.+?var apikey = \"([a-f0-9]+)\";", Pattern.DOTALL);
|
||||
private static final Pattern PATTERN_TORRENT = Pattern.compile("<a[^<>]*onclick=\"return popUp\\('([^']+)'[^)]+\\)\">Torrent Download \\((\\d+)\\)</a>");
|
||||
private static final Pattern PATTERN_TORRENT = Pattern.compile("<a[^<>]*onclick=\"return popUp\\('([^']+)'[^)]+\\)\">Torrent Download[^<]+(\\d+)[^<]+</a");
|
||||
private static final Pattern PATTERN_ARCHIVE = Pattern.compile("<a[^<>]*onclick=\"return popUp\\('([^']+)'[^)]+\\)\">Archive Download</a>");
|
||||
private static final Pattern PATTERN_COVER = Pattern.compile("width:(\\d+)px; height:(\\d+)px.+?url\\((.+?)\\)");
|
||||
private static final Pattern PATTERN_TAG_GROUP = Pattern.compile("<tr><td[^<>]+>([\\w\\s]+):</td><td>(?:<div[^<>]+><a[^<>]+>[\\w\\s]+</a></div>)+</td></tr>");
|
||||
@@ -72,6 +72,7 @@ public class GalleryDetailParser {
|
||||
private static final Pattern PATTERN_PREVIEW_PAGES = Pattern.compile("<td[^>]+><a[^>]+>([\\d,]+)</a></td><td[^>]+>(?:<a[^>]+>)?>(?:</a>)?</td>");
|
||||
private static final Pattern PATTERN_NORMAL_PREVIEW = Pattern.compile("<div class=\"gdtm\"[^<>]*><div[^<>]*width:(\\d+)[^<>]*height:(\\d+)[^<>]*\\((.+?)\\)[^<>]*-(\\d+)px[^<>]*><a[^<>]*href=\"(.+?)\"[^<>]*><img alt=\"([\\d,]+)\"");
|
||||
private static final Pattern PATTERN_LARGE_PREVIEW = Pattern.compile("<div class=\"gdtl\".+?<a href=\"(.+?)\"><img alt=\"([\\d,]+)\".+?src=\"(.+?)\"");
|
||||
private static final Pattern PATTERN_NEWER_VERSION = Pattern.compile("<div id=\"gnd\".+?<a href=\"([^<>]+)\">([^<>]+)</a>.+?added ([^<>]+)<br /></div>");
|
||||
|
||||
private static final GalleryTagGroup[] EMPTY_GALLERY_TAG_GROUP_ARRAY = new GalleryTagGroup[0];
|
||||
private static final GalleryCommentList EMPTY_GALLERY_COMMENT_ARRAY = new GalleryCommentList(new GalleryComment[0], false);
|
||||
@@ -135,6 +136,17 @@ public class GalleryDetailParser {
|
||||
gd.torrentUrl = "";
|
||||
}
|
||||
|
||||
matcher = PATTERN_NEWER_VERSION.matcher(body);
|
||||
if (matcher.find()) {
|
||||
gd.newerUrl = StringUtils.unescapeXml(StringUtils.trim(matcher.group(1)));
|
||||
gd.newerName = StringUtils.unescapeXml(StringUtils.trim(matcher.group(2)));
|
||||
gd.newerDate = StringUtils.unescapeXml(StringUtils.trim(matcher.group(3)));
|
||||
} else {
|
||||
gd.newerUrl = "";
|
||||
gd.newerName = "";
|
||||
gd.newerDate = "";
|
||||
}
|
||||
|
||||
matcher = PATTERN_ARCHIVE.matcher(body);
|
||||
if (matcher.find()) {
|
||||
gd.archiveUrl = StringUtils.unescapeXml(StringUtils.trim(matcher.group(1)));
|
||||
|
||||
@@ -84,6 +84,7 @@ import com.hippo.ehviewer.client.data.GalleryTagGroup;
|
||||
import com.hippo.ehviewer.client.data.ListUrlBuilder;
|
||||
import com.hippo.ehviewer.client.data.PreviewSet;
|
||||
import com.hippo.ehviewer.client.exception.NoHAtHClientException;
|
||||
import com.hippo.ehviewer.client.parser.GalleryDetailUrlParser;
|
||||
import com.hippo.ehviewer.client.parser.RateGalleryParser;
|
||||
import com.hippo.ehviewer.dao.DownloadInfo;
|
||||
import com.hippo.ehviewer.dao.Filter;
|
||||
@@ -189,6 +190,8 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
private TextView mPosted;
|
||||
@Nullable
|
||||
private TextView mFavoredTimes;
|
||||
@Nullable
|
||||
private TextView mNewerVersion;
|
||||
// Actions
|
||||
@Nullable
|
||||
private View mActions;
|
||||
@@ -542,6 +545,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
mInfo.setOnClickListener(this);
|
||||
|
||||
mActions = ViewUtils.$$(belowHeader, R.id.actions);
|
||||
mNewerVersion = (TextView) ViewUtils.$$(mActions, R.id.newerVersion);
|
||||
mRatingText = (TextView) ViewUtils.$$(mActions, R.id.rating_text);
|
||||
mRating = (RatingBar) ViewUtils.$$(mActions, R.id.rating);
|
||||
mHeartGroup = ViewUtils.$$(mActions, R.id.heart_group);
|
||||
@@ -553,6 +557,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
mRate = (TextView) ViewUtils.$$(mActions, R.id.rate);
|
||||
mSimilar = (TextView) ViewUtils.$$(mActions, R.id.similar);
|
||||
mSearchCover = (TextView) ViewUtils.$$(mActions, R.id.search_cover);
|
||||
mNewerVersion.setOnClickListener(this);
|
||||
mHeartGroup.setOnClickListener(this);
|
||||
mTorrent.setOnClickListener(this);
|
||||
mArchive.setOnClickListener(this);
|
||||
@@ -637,6 +642,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
mFavoredTimes = null;
|
||||
|
||||
mActions = null;
|
||||
mNewerVersion = null;
|
||||
mRatingText = null;
|
||||
mRating = null;
|
||||
mHeartGroup = null;
|
||||
@@ -861,7 +867,7 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
}
|
||||
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) {
|
||||
mFavoredTimes == null || mRatingText == null || mRating == null || mTorrent == null || mNewerVersion == null) {
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -881,6 +887,9 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
mSize.setText(gd.size);
|
||||
mPosted.setText(gd.posted);
|
||||
mFavoredTimes.setText(resources.getString(R.string.favored_times, gd.favoriteCount));
|
||||
if (!TextUtils.isEmpty(gd.newerUrl)) {
|
||||
mNewerVersion.setVisibility(View.VISIBLE);
|
||||
}
|
||||
|
||||
mRatingText.setText(getAllRatingText(gd.rating, gd.ratingCount));
|
||||
mRating.setRating(gd.rating);
|
||||
@@ -1199,6 +1208,17 @@ public class GalleryDetailScene extends BaseScene implements View.OnClickListene
|
||||
intent.putExtra(GalleryActivity.KEY_GALLERY_INFO, galleryInfo);
|
||||
startActivity(intent);
|
||||
}
|
||||
} else if (mNewerVersion == v) {
|
||||
if (mGalleryDetail != null) {
|
||||
GalleryDetailUrlParser.Result result = GalleryDetailUrlParser.parse(mGalleryDetail.newerUrl, false);
|
||||
if (result != null) {
|
||||
Bundle args = new Bundle();
|
||||
args.putString(GalleryDetailScene.KEY_ACTION, GalleryDetailScene.ACTION_GID_TOKEN);
|
||||
args.putLong(GalleryDetailScene.KEY_GID, result.gid);
|
||||
args.putString(GalleryDetailScene.KEY_TOKEN, result.token);
|
||||
startScene(new Announcer(GalleryDetailScene.class).setArgs(args));
|
||||
}
|
||||
}
|
||||
} else if (mInfo == v) {
|
||||
Bundle args = new Bundle();
|
||||
args.putParcelable(GalleryInfoScene.KEY_GALLERY_DETAIL, mGalleryDetail);
|
||||
|
||||
@@ -22,6 +22,17 @@
|
||||
android:paddingTop="@dimen/keyline_margin"
|
||||
android:paddingBottom="@dimen/keyline_margin">
|
||||
|
||||
<TextView
|
||||
android:id="@+id/newerVersion"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="wrap_content"
|
||||
android:background="?selectableItemBackground"
|
||||
android:gravity="center"
|
||||
android:padding="8dp"
|
||||
android:text="@string/newer_version_avaliable"
|
||||
android:textColor="?attr/textColorThemeAccent"
|
||||
android:visibility="gone" />
|
||||
|
||||
<HorizontalScrollView
|
||||
android:id="@+id/actions_scroll_view"
|
||||
android:layout_width="wrap_content"
|
||||
|
||||
@@ -282,6 +282,7 @@
|
||||
<string name="filter_the_uploader">Block the uploader \"%s\"?</string>
|
||||
<string name="filter_the_tag">Block the tag \"%s\"?</string>
|
||||
<string name="filter_added">Blocker added</string>
|
||||
<string name="newer_version_avaliable">There are newer versions of this gallery available.</string>
|
||||
|
||||
<!-- Rating -->
|
||||
<string name="rating10">MASTERPIECE</string>
|
||||
|
||||
Reference in new issue
Block a user