Skip to content

Commit

Permalink
fixed comment not showing with preloadGallery; updated to v0.10.4
Browse files Browse the repository at this point in the history
  • Loading branch information
PureDark committed Mar 28, 2017
1 parent 13eba50 commit 62e4eac
Show file tree
Hide file tree
Showing 6 changed files with 29 additions and 14 deletions.
8 changes: 3 additions & 5 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
15 changes: 15 additions & 0 deletions app/src/main/java/ml/puredark/hviewer/beans/Collection.java
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down
3 changes: 1 addition & 2 deletions app/src/main/java/ml/puredark/hviewer/core/RuleParser.java
Original file line number Diff line number Diff line change
Expand Up @@ -286,8 +286,7 @@ public static Collection getCollectionDetail(Collection collection, String text,
if (rule.item != null && rule.pictureRule != null && rule.pictureRule.item != null) {
List<Collection> 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);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -339,6 +339,8 @@ public void onLoadMore() {
//初始化评论列表
rvComment = (RecyclerView) viewComment.findViewById(R.id.rv_comment);
List<Comment> 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);
Expand Down Expand Up @@ -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) {
Expand Down
11 changes: 6 additions & 5 deletions gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -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

0 comments on commit 62e4eac

Please sign in to comment.