Check deleted only on threads

Disable out-of-order fix
captchafix
Florens Douwes 11 years ago
parent 49cfa2a20c
commit 3020275725
  1. 36
      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,17 +97,19 @@ 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
boolean serverHas; if (loadable.isThreadMode()) {
for (Post cache : cached) { boolean serverHas;
serverHas = false; for (Post cache : cached) {
for (Post b : serverList) { serverHas = false;
if (b.no == cache.no) { for (Post b : serverList) {
serverHas = true; if (b.no == cache.no) {
break; serverHas = true;
break;
}
} }
}
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.
@ -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
Collections.sort(totalList, new Comparator<Post>() { /*if (loadable.isThreadMode()) {
@Override Collections.sort(totalList, new Comparator<Post>() {
public int compare(Post lhs, Post rhs) { @Override
return lhs.time == rhs.time ? 0 : (lhs.time < rhs.time ? -1 : 1); public int compare(Post lhs, Post rhs) {
} return lhs.time == rhs.time ? 0 : (lhs.time < rhs.time ? -1 : 1);
}); }
});
}*/
} else { } else {
totalList.addAll(serverList); totalList.addAll(serverList);

Loading…
Cancel
Save