Check deleted only on threads

Disable out-of-order fix
captchafix
Florens Douwes 11 years ago
parent 49cfa2a20c
commit 3020275725
  1. 6
      Clover/app/src/main/java/org/floens/chan/core/net/ChanReaderRequest.java

@ -31,8 +31,6 @@ import org.floens.chan.core.model.Post;
import java.io.IOException; import java.io.IOException;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.Collections;
import java.util.Comparator;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -99,6 +97,7 @@ public class ChanReaderRequest extends JsonReaderRequest<List<Post>> {
totalList.addAll(cached); totalList.addAll(cached);
// If there's a cached post but it's not in the list received from the server, mark it as deleted // If there's a cached post but it's not in the list received from the server, mark it as deleted
if (loadable.isThreadMode()) {
boolean serverHas; boolean serverHas;
for (Post cache : cached) { for (Post cache : cached) {
serverHas = false; serverHas = false;
@ -111,6 +110,7 @@ public class ChanReaderRequest extends JsonReaderRequest<List<Post>> {
cache.deleted = !serverHas; cache.deleted = !serverHas;
} }
}
// If there's a post in the list from the server, that's not in the cached list, add it. // If there's a post in the list from the server, that's not in the cached list, add it.
boolean known; boolean known;
@ -131,12 +131,14 @@ public class ChanReaderRequest extends JsonReaderRequest<List<Post>> {
} }
// Sort if it got out of order due to posts disappearing/reappearing // Sort if it got out of order due to posts disappearing/reappearing
/*if (loadable.isThreadMode()) {
Collections.sort(totalList, new Comparator<Post>() { Collections.sort(totalList, new Comparator<Post>() {
@Override @Override
public int compare(Post lhs, Post rhs) { public int compare(Post lhs, Post rhs) {
return lhs.time == rhs.time ? 0 : (lhs.time < rhs.time ? -1 : 1); return lhs.time == rhs.time ? 0 : (lhs.time < rhs.time ? -1 : 1);
} }
}); });
}*/
} else { } else {
totalList.addAll(serverList); totalList.addAll(serverList);

Loading…
Cancel
Save