From 62e4eacb583b74553a1b241bc58f2884f9e21b50 Mon Sep 17 00:00:00 2001 From: PureDark Date: Wed, 29 Mar 2017 07:23:22 +0800 Subject: [PATCH] fixed comment not showing with preloadGallery; updated to v0.10.4 --- app/build.gradle | 8 +++----- .../ml/puredark/hviewer/HViewerApplication.java | 2 +- .../ml/puredark/hviewer/beans/Collection.java | 15 +++++++++++++++ .../java/ml/puredark/hviewer/core/RuleParser.java | 3 +-- .../hviewer/ui/activities/CollectionActivity.java | 4 +++- gradle.properties | 11 ++++++----- 6 files changed, 29 insertions(+), 14 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 1efc168..e07c6da 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -16,8 +16,8 @@ android { resValue "string", "app_name", "H-Viewer" minSdkVersion 17 targetSdkVersion 25 - versionCode 80 - versionName "0.10.3" + versionCode 81 + versionName "0.10.4" testInstrumentationRunner "android.support.test.runner.AndroidJUnitRunner" vectorDrawables.useSupportLibrary = true renderscriptTargetApi 25 @@ -33,15 +33,13 @@ android { } buildTypes { debug { - //applicationIdSuffix '.debug' + applicationIdSuffix '.debug' resValue "string", "app_name", "H-Viewer-debug" - resValue "string", "app_package", "ml.puredark.hviewer.debug" ndk{ abiFilters 'armeabi', 'armeabi-v7a', 'x86' } } release { - resValue "string", "app_package", "ml.puredark.hviewer" minifyEnabled false proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro', 'proguard-fresco.pro' zipAlignEnabled true diff --git a/app/src/main/java/ml/puredark/hviewer/HViewerApplication.java b/app/src/main/java/ml/puredark/hviewer/HViewerApplication.java index 39a5067..d53d751 100644 --- a/app/src/main/java/ml/puredark/hviewer/HViewerApplication.java +++ b/app/src/main/java/ml/puredark/hviewer/HViewerApplication.java @@ -55,7 +55,7 @@ public class HViewerApplication extends SwipeBackApplication { public final static String INTENT_SHORTCUT = "ml.puredark.hviewer.intent.action.SHORTCUT"; public final static String INTENT_FROM_DOWNLOAD = "ml.puredark.hviewer.intent.action.FROMDOWNLOAD"; - public final static String INTENT_FROM_FAVOURITE = "ml.puredark.hviewer.intent.action.FROMFAVOURITE"; + public final static String INTENT_FROM_FAVOURITE = "ml.puredark.hviewer.intent.action.FROMFAVOURITE"; static { AppCompatDelegate.setCompatVectorFromResourcesEnabled(true); diff --git a/app/src/main/java/ml/puredark/hviewer/beans/Collection.java b/app/src/main/java/ml/puredark/hviewer/beans/Collection.java index 4e1f269..99823d2 100644 --- a/app/src/main/java/ml/puredark/hviewer/beans/Collection.java +++ b/app/src/main/java/ml/puredark/hviewer/beans/Collection.java @@ -63,6 +63,21 @@ public void fillEmpty(Collection collection) { } } + public void replace(Collection collection) { + Field[] fs = Collection.class.getDeclaredFields(); + try { + for (Field f : fs) { + f.setAccessible(true); + Object v1 = f.get(this); + Object v2 = f.get(collection); + if (v2 != null && !"".equals(v2)) + f.set(this, v2); + } + } catch (IllegalAccessException e) { + e.printStackTrace(); + } + } + @Override public boolean equals(Object obj) { if ((obj instanceof Collection)) { diff --git a/app/src/main/java/ml/puredark/hviewer/core/RuleParser.java b/app/src/main/java/ml/puredark/hviewer/core/RuleParser.java index fbb1996..603df66 100644 --- a/app/src/main/java/ml/puredark/hviewer/core/RuleParser.java +++ b/app/src/main/java/ml/puredark/hviewer/core/RuleParser.java @@ -286,8 +286,7 @@ public static Collection getCollectionDetail(Collection collection, String text, if (rule.item != null && rule.pictureRule != null && rule.pictureRule.item != null) { List collections = new ArrayList<>(); Collection newCollection = getCollections(collections, text, rule, sourceUrl).get(0); - newCollection.fillEmpty(collection); - collection = newCollection; + collection.replace(newCollection); } else { if (!isJson(text)) { Document element = Jsoup.parse(text); diff --git a/app/src/main/java/ml/puredark/hviewer/ui/activities/CollectionActivity.java b/app/src/main/java/ml/puredark/hviewer/ui/activities/CollectionActivity.java index 81b239d..b56646b 100644 --- a/app/src/main/java/ml/puredark/hviewer/ui/activities/CollectionActivity.java +++ b/app/src/main/java/ml/puredark/hviewer/ui/activities/CollectionActivity.java @@ -339,6 +339,8 @@ public void onLoadMore() { //初始化评论列表 rvComment = (RecyclerView) viewComment.findViewById(R.id.rv_comment); List comments = new ArrayList<>(); + if (collection.comments != null) + comments.addAll(collection.comments); commentAdapter = new CommentAdapter(this, new ListDataProvider(comments)); commentAdapter.setCookie(site.cookie); rvComment.setAdapter(commentAdapter); @@ -503,7 +505,7 @@ public void onResultGot(String html, String url, int page) { } else { Logger.d("CollectionActivity", "myCollection.videos.size(): 0"); } - Logger.d("CollectionActivity", "myCollection.comments:" + ((myCollection.comments != null) ? myCollection.comments.size() : myCollection.comments)); + Logger.d("CollectionActivity", "myCollection.comments:" + ((myCollection.comments != null) ? myCollection.comments.size() : 0)); if (myCollection.tags != null) { for (Tag tag : myCollection.tags) { diff --git a/gradle.properties b/gradle.properties index bec31ca..ccc71d4 100644 --- a/gradle.properties +++ b/gradle.properties @@ -11,10 +11,11 @@ # When configured, Gradle will run in incubating parallel mode. # This option should only be used with decoupled projects. More details, visit # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects -#Tue Nov 15 11:33:26 CST 2016 -org.gradle.parallel=true +# org.gradle.parallel=true +#Wed Mar 29 05:29:41 CST 2017 +systemProp.https.proxyPort=1080 +systemProp.http.proxyHost=localhost org.gradle.jvmargs=-Xmx2048m -systemProp.http.proxyHost=127.0.0.1 +systemProp.https.proxyHost=localhost +org.gradle.parallel=true systemProp.http.proxyPort=1080 -systemProp.https.proxyHost=127.0.0.1 -systemProp.https.proxyPort=1080