mirror of
https://github.com/seven332/EhViewer
synced 2026-12-03 20:39:02 +08:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
be0c394de1 | ||
|
|
a739300260 | ||
|
|
da9940d581 | ||
|
|
a2523aae75 | ||
|
|
3ae3602671 | ||
|
|
6350fc1ece | ||
|
|
29a27cbe00 |
No files matched your search
+2
-2
@@ -12,8 +12,8 @@ android {
|
||||
applicationId "com.hippo.ehviewer"
|
||||
minSdkVersion 14
|
||||
targetSdkVersion 28
|
||||
versionCode 97
|
||||
versionName "1.6.0"
|
||||
versionCode 98
|
||||
versionName "1.6.1"
|
||||
vectorDrawables.useSupportLibrary = true
|
||||
resConfigs "zh", "zh-rCN", "zh-rHK", "zh-rTW",
|
||||
"es", "ja", "ko", "fr", "de", "th"
|
||||
|
||||
@@ -343,7 +343,7 @@ public class EhApplication extends RecordingApplication {
|
||||
if (application.mGalleryDetailCache == null) {
|
||||
// Max size 25, 3 min timeout
|
||||
application.mGalleryDetailCache = new LruCache<>(25);
|
||||
application.mFavouriteStatusRouter.addListener((gid, slot) -> {
|
||||
getFavouriteStatusRouter().addListener((gid, slot) -> {
|
||||
GalleryDetail gd = application.mGalleryDetailCache.get(gid);
|
||||
if (gd != null) {
|
||||
gd.favoriteSlot = slot;
|
||||
|
||||
@@ -271,10 +271,13 @@ public class GalleryListParser {
|
||||
|
||||
Element e = es.get(es.size() - 1);
|
||||
if (e != null) {
|
||||
String href = e.child(0).attr("href");
|
||||
Matcher matcher = PATTERN_NEXT_PAGE.matcher(href);
|
||||
if (matcher.find()) {
|
||||
result.nextPage = Integer.parseInt(matcher.group(1));
|
||||
e = e.children().first();
|
||||
if (e != null) {
|
||||
String href = e.attr("href");
|
||||
Matcher matcher = PATTERN_NEXT_PAGE.matcher(href);
|
||||
if (matcher.find()) {
|
||||
result.nextPage = NumberUtils.parseIntSafely(matcher.group(1), 0);
|
||||
}
|
||||
}
|
||||
}
|
||||
} catch (Throwable e) {
|
||||
|
||||
@@ -880,8 +880,7 @@ public class FavoritesScene extends BaseScene implements
|
||||
}
|
||||
|
||||
updateSearchBar();
|
||||
mHelper.setPages(taskId, result.pages);
|
||||
mHelper.onGetPageData(taskId, result.nextPage, result.galleryInfoList);
|
||||
mHelper.onGetPageData(taskId, result.pages, result.nextPage, result.galleryInfoList);
|
||||
|
||||
if (mDrawerAdapter != null) {
|
||||
mDrawerAdapter.notifyDataSetChanged();
|
||||
@@ -907,11 +906,9 @@ public class FavoritesScene extends BaseScene implements
|
||||
}
|
||||
|
||||
if (list.size() == 0) {
|
||||
mHelper.setPages(taskId, 0);
|
||||
mHelper.onGetPageData(taskId, 0, Collections.EMPTY_LIST);
|
||||
mHelper.onGetPageData(taskId, 0, 0, Collections.EMPTY_LIST);
|
||||
} else {
|
||||
mHelper.setPages(taskId, 1);
|
||||
mHelper.onGetPageData(taskId, 0, list);
|
||||
mHelper.onGetPageData(taskId, 1, 0, list);
|
||||
}
|
||||
|
||||
if (TextUtils.isEmpty(keyword)) {
|
||||
|
||||
@@ -1569,8 +1569,7 @@ public final class GalleryListScene extends BaseScene
|
||||
? R.string.gallery_list_empty_hit_subscription
|
||||
: R.string.gallery_list_empty_hit);
|
||||
mHelper.setEmptyString(emptyString);
|
||||
mHelper.setPages(taskId, result.pages);
|
||||
mHelper.onGetPageData(taskId, result.nextPage, result.galleryInfoList);
|
||||
mHelper.onGetPageData(taskId, result.pages, result.nextPage, result.galleryInfoList);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -346,8 +346,7 @@ public class GalleryPreviewsScene extends ToolbarScene implements EasyRecyclerVi
|
||||
list.add(previewSet.getGalleryPreview(mGalleryInfo.gid, i));
|
||||
}
|
||||
|
||||
mHelper.setPages(taskId, result.second);
|
||||
mHelper.onGetPageData(taskId, 0, list);
|
||||
mHelper.onGetPageData(taskId, result.second, 0, list);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -275,11 +275,11 @@ public class ContentLayout extends FrameLayout {
|
||||
if (mEndPage < mPages) {
|
||||
// Get next page
|
||||
// Fill pages before NextPage with empty list
|
||||
while (mNextPage > mEndPage) {
|
||||
while (mNextPage > mEndPage && mEndPage < mPages) {
|
||||
mCurrentTaskId = mIdGenerator.nextId();
|
||||
mCurrentTaskType = TYPE_NEXT_PAGE_KEEP_POS;
|
||||
mCurrentTaskPage = mEndPage;
|
||||
onGetPageData(mCurrentTaskId, mNextPage, Collections.emptyList());
|
||||
onGetPageData(mCurrentTaskId, mPages, mNextPage, Collections.emptyList());
|
||||
}
|
||||
mCurrentTaskId = mIdGenerator.nextId();
|
||||
mCurrentTaskType = TYPE_NEXT_PAGE_KEEP_POS;
|
||||
@@ -293,6 +293,7 @@ public class ContentLayout extends FrameLayout {
|
||||
getPageData(mCurrentTaskId, mCurrentTaskType, mCurrentTaskPage);
|
||||
} else {
|
||||
Log.e(TAG, "Try to footer refresh, but mEndPage = " + mEndPage + ", mPages = " + mPages);
|
||||
mRefreshLayout.setFooterRefreshing(false);
|
||||
}
|
||||
}
|
||||
};
|
||||
@@ -334,7 +335,7 @@ public class ContentLayout extends FrameLayout {
|
||||
}
|
||||
|
||||
/**
|
||||
* Call {@link #onGetPageData(int, int, List)} when get data
|
||||
* Call {@link #onGetPageData(int, int, int, List)} when get data
|
||||
*
|
||||
* @param taskId task id
|
||||
* @param page the page to get
|
||||
@@ -399,13 +400,6 @@ public class ContentLayout extends FrameLayout {
|
||||
return mCurrentTaskId == taskId;
|
||||
}
|
||||
|
||||
public void setPages(int taskId, int pages) {
|
||||
// TODO what it pages > mEndPage
|
||||
if (mCurrentTaskId == taskId) {
|
||||
mPages = pages;
|
||||
}
|
||||
}
|
||||
|
||||
public int getPages() {
|
||||
return mPages;
|
||||
}
|
||||
@@ -464,7 +458,7 @@ public class ContentLayout extends FrameLayout {
|
||||
|
||||
protected void onClearData() { }
|
||||
|
||||
public void onGetPageData(int taskId, int nextPage, List<E> data) {
|
||||
public void onGetPageData(int taskId, int pages, int nextPage, List<E> data) {
|
||||
if (mCurrentTaskId == taskId) {
|
||||
int dataSize;
|
||||
|
||||
@@ -472,6 +466,7 @@ public class ContentLayout extends FrameLayout {
|
||||
case TYPE_REFRESH:
|
||||
mStartPage = 0;
|
||||
mEndPage = 1;
|
||||
mPages = pages;
|
||||
mNextPage = nextPage;
|
||||
mPageDivider.clear();
|
||||
mPageDivider.add(data.size());
|
||||
@@ -527,6 +522,7 @@ public class ContentLayout extends FrameLayout {
|
||||
}
|
||||
mPageDivider.add(0, dataSize);
|
||||
mStartPage--;
|
||||
mPages = Math.max(mEndPage, pages);
|
||||
// assert mStartPage >= 0
|
||||
|
||||
if (data.isEmpty()) {
|
||||
@@ -590,6 +586,7 @@ public class ContentLayout extends FrameLayout {
|
||||
mPageDivider.add(oldDataSize + dataSize);
|
||||
mEndPage++;
|
||||
mNextPage = nextPage;
|
||||
mPages = Math.max(mEndPage, pages);
|
||||
|
||||
if (data.isEmpty()) {
|
||||
if (true || mEndPage >= mPages) { // OK, that's all
|
||||
@@ -646,6 +643,7 @@ public class ContentLayout extends FrameLayout {
|
||||
mStartPage = mCurrentTaskPage;
|
||||
mEndPage = mCurrentTaskPage + 1;
|
||||
mNextPage = nextPage;
|
||||
mPages = pages;
|
||||
mPageDivider.clear();
|
||||
mPageDivider.add(data.size());
|
||||
|
||||
@@ -702,6 +700,8 @@ public class ContentLayout extends FrameLayout {
|
||||
mNextPage = nextPage;
|
||||
}
|
||||
|
||||
mPages = Math.max(mEndPage, pages);
|
||||
|
||||
int oldIndexStart = mCurrentTaskPage == mStartPage ? 0 : mPageDivider.get(mCurrentTaskPage - mStartPage - 1);
|
||||
int oldIndexEnd = mPageDivider.get(mCurrentTaskPage - mStartPage);
|
||||
List<E> toRemove = mData.subList(oldIndexStart, oldIndexEnd);
|
||||
|
||||
Reference in new issue
Block a user