Skip to content

Commit

Permalink
Realized there was an issue incrementing the page on first load so ju…
Browse files Browse the repository at this point in the history
…st moved the increment into the scroll adapter and menu
  • Loading branch information
powerje authored and scottferg committed Mar 2, 2011
1 parent ed793d1 commit f45acc7
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/com/ferg/awful/ForumDisplayActivity.java
Original file line number Diff line number Diff line change
Expand Up @@ -194,7 +194,8 @@ public void onClick(View aView) {
break;
case R.id.next_page:
if (mForum.getCurrentPage() != mForum.getLastPage()) {
mFetchTask = new FetchThreadsTask(mForum.getCurrentPage() + 1);
mForum.setCurrentPage(mForum.getCurrentPage() + 1);
mFetchTask = new FetchThreadsTask(mForum.getCurrentPage());
mFetchTask.execute(mForum.getForumId());
}
break;
Expand Down Expand Up @@ -250,7 +251,6 @@ public ArrayList<AwfulThread> doInBackground(String... aParams) {

public void onPostExecute(ArrayList<AwfulThread> aResult) {
if (!isCancelled()) {
mForum.setCurrentPage(mForum.getCurrentPage() + 1);
mThreads.addAll(aResult);
mThreadAdapter.notifyDataSetChanged();
mThreadList.setOnItemClickListener(onThreadSelected);
Expand Down Expand Up @@ -343,7 +343,8 @@ public void onScroll(AbsListView view, int firstVisibleItem,
//load new items in background and add them
loading = true;
if (mForum.getCurrentPage() != mForum.getLastPage()) {
new FetchThreadsTask(mForum.getCurrentPage() + 1).execute(mForum.getForumId());
mForum.setCurrentPage(mForum.getCurrentPage() + 1);
new FetchThreadsTask(mForum.getCurrentPage()).execute(mForum.getForumId());
}
}
}
Expand Down

0 comments on commit f45acc7

Please sign in to comment.