@Test public void testLoadPostIdList() throws Exception { when(mDataManager.getPostList("test")).thenReturn(Observable.just(makePostIdList(5))); mPresenter.loadPostIdList("test"); verify(mPostView).hideSwipeRefresh(); }
public void loadPostIdList(String storyTypeUrl) { mCompositeSubscription.add(mDataManager.getPostList(storyTypeUrl) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Action1<List<Long>>() { @Override public void call(List<Long> longs) { mPostIdList.addAll(longs); loadPosts(mPostIdList.subList(0, Constants.NUM_LOADING_ITEMS), true); } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { mPostView.hideSwipeRefresh(); mPostView.showErrorLog("loadPostIdList", throwable.toString()); } })); }
PostPresenter extends BasePresenter { public void loadPostIdList(String storyTypeUrl) { mCompositeSubscription.add(mDataManager.getPostList(storyTypeUrl) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Action1<List<Long>>() { @Override public void call(List<Long> longs) { mPostIdList.addAll(longs); loadPosts(mPostIdList.subList(0, Constants.NUM_LOADING_ITEMS), true); } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { mPostView.hideSwipeRefresh(); mPostView.showErrorLog("loadPostIdList", throwable.toString()); } })); } }
PostPresenter extends BasePresenter { public void loadPostIdList(String storyTypeUrl) { mCompositeSubscription.add(mDataManager.getPostList(storyTypeUrl) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Action1<List<Long>>() { @Override public void call(List<Long> longs) { mPostIdList.addAll(longs); loadPosts(mPostIdList.subList(0, Constants.NUM_LOADING_ITEMS), true); } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { mPostView.hideSwipeRefresh(); mPostView.showErrorLog("loadPostIdList", throwable.toString()); } })); } PostPresenter();  PostPresenter(@NonNull PostView postView);  PostPresenter(@NonNull PostView postView, @NonNull DataManager dataManager,
                         @NonNull SharedPrefsContract prefsManager, @NonNull UtilsContract utils); }
PostPresenter extends BasePresenter { public void loadPostIdList(String storyTypeUrl) { mCompositeSubscription.add(mDataManager.getPostList(storyTypeUrl) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Action1<List<Long>>() { @Override public void call(List<Long> longs) { mPostIdList.addAll(longs); loadPosts(mPostIdList.subList(0, Constants.NUM_LOADING_ITEMS), true); } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { mPostView.hideSwipeRefresh(); mPostView.showErrorLog("loadPostIdList", throwable.toString()); } })); } PostPresenter();  PostPresenter(@NonNull PostView postView);  PostPresenter(@NonNull PostView postView, @NonNull DataManager dataManager,
                         @NonNull SharedPrefsContract prefsManager, @NonNull UtilsContract utils); void setView(PostView postView); void setDataManager(DataManager dataManager); void setPrefsManager(SharedPrefsContract sharedPrefsContract); void setUtils(UtilsContract utils); void setStoryType(String storyType); void setStoryTypeSpec(String storyTypeSpec); @Override void setup(); @Override void restoreState(Bundle savedInstanceState); @Override void saveState(Bundle outState); @Override void destroy(); @Override void unsubscribe(); void refresh(); void refresh(@NonNull String type, @NonNull String spec); void loadPostIdList(String storyTypeUrl); void loadPostIdListBySearch(String timeRangeCombine, int page); void loadPosts(List<Long> list, boolean updateObservable); void updateCachedPostList(); List<Post> getCachedPosts(); void updateLoadingState(int loadingState); void loadMore(); void reload(); void setShowPostSummaryPref(); void refreshPostSummaryPref(); }
PostPresenter extends BasePresenter { public void loadPostIdList(String storyTypeUrl) { mCompositeSubscription.add(mDataManager.getPostList(storyTypeUrl) .subscribeOn(Schedulers.io()) .observeOn(AndroidSchedulers.mainThread()) .subscribe(new Action1<List<Long>>() { @Override public void call(List<Long> longs) { mPostIdList.addAll(longs); loadPosts(mPostIdList.subList(0, Constants.NUM_LOADING_ITEMS), true); } }, new Action1<Throwable>() { @Override public void call(Throwable throwable) { mPostView.hideSwipeRefresh(); mPostView.showErrorLog("loadPostIdList", throwable.toString()); } })); } PostPresenter();  PostPresenter(@NonNull PostView postView);  PostPresenter(@NonNull PostView postView, @NonNull DataManager dataManager,
                         @NonNull SharedPrefsContract prefsManager, @NonNull UtilsContract utils); void setView(PostView postView); void setDataManager(DataManager dataManager); void setPrefsManager(SharedPrefsContract sharedPrefsContract); void setUtils(UtilsContract utils); void setStoryType(String storyType); void setStoryTypeSpec(String storyTypeSpec); @Override void setup(); @Override void restoreState(Bundle savedInstanceState); @Override void saveState(Bundle outState); @Override void destroy(); @Override void unsubscribe(); void refresh(); void refresh(@NonNull String type, @NonNull String spec); void loadPostIdList(String storyTypeUrl); void loadPostIdListBySearch(String timeRangeCombine, int page); void loadPosts(List<Long> list, boolean updateObservable); void updateCachedPostList(); List<Post> getCachedPosts(); void updateLoadingState(int loadingState); void loadMore(); void reload(); void setShowPostSummaryPref(); void refreshPostSummaryPref(); static final String TAG; }