|
|
|
@ -65,7 +65,7 @@ public class ThreadManager implements Loader.LoaderListener { |
|
|
|
|
|
|
|
|
|
public void onStart() { |
|
|
|
|
if (loader != null) { |
|
|
|
|
if (loader.getLoadable().isThreadMode()) { |
|
|
|
|
if (shouldWatch()) { |
|
|
|
|
loader.setAutoLoadMore(true); |
|
|
|
|
loader.requestMoreDataAndResetTimer(); |
|
|
|
|
} |
|
|
|
@ -84,7 +84,7 @@ public class ThreadManager implements Loader.LoaderListener { |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
loader = LoaderPool.getInstance().obtain(loadable, this); |
|
|
|
|
if (loadable.isThreadMode()) { |
|
|
|
|
if (shouldWatch()) { |
|
|
|
|
loader.setAutoLoadMore(true); |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
@ -110,6 +110,11 @@ public class ThreadManager implements Loader.LoaderListener { |
|
|
|
|
} |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public boolean shouldWatch() { |
|
|
|
|
boolean closed = loader.getCachedPosts().size() > 0 && loader.getCachedPosts().get(0).closed; |
|
|
|
|
return loader.getLoadable().isThreadMode() && !closed; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public void requestData() { |
|
|
|
|
if (loader != null) { |
|
|
|
|
loader.requestData(); |
|
|
|
@ -136,6 +141,10 @@ public class ThreadManager implements Loader.LoaderListener { |
|
|
|
|
|
|
|
|
|
@Override |
|
|
|
|
public void onData(List<Post> result, boolean append) { |
|
|
|
|
if (!shouldWatch()) { |
|
|
|
|
loader.setAutoLoadMore(false); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
threadManagerListener.onThreadLoaded(result, append); |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|