|
@ -158,19 +158,24 @@ public class ForumFragment extends BaseFragment { |
|
|
@Override |
|
|
@Override |
|
|
public void onDestroy() { |
|
|
public void onDestroy() { |
|
|
super.onDestroy(); |
|
|
super.onDestroy(); |
|
|
if (forumTask != null && forumTask.getStatus() != AsyncTask.Status.RUNNING) |
|
|
if (forumTask!=null){ |
|
|
forumTask.cancel(true); |
|
|
try{ |
|
|
|
|
|
if(forumTask.isRunning()) |
|
|
|
|
|
forumTask.cancel(true); |
|
|
|
|
|
} // Yes, it happens even though we checked
|
|
|
|
|
|
catch (NullPointerException ignored){ } |
|
|
|
|
|
} |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public interface ForumFragmentInteractionListener extends FragmentInteractionListener { |
|
|
public interface ForumFragmentInteractionListener extends FragmentInteractionListener { |
|
|
void onForumFragmentInteraction(Board board); |
|
|
void onForumFragmentInteraction(Board board); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void onForumTaskStarted() { |
|
|
private void onForumTaskStarted() { |
|
|
progressBar.setVisibility(ProgressBar.VISIBLE); |
|
|
progressBar.setVisibility(ProgressBar.VISIBLE); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
public void onForumTaskFinished(int resultCode, ArrayList<Category> fetchedCategories) { |
|
|
private void onForumTaskFinished(int resultCode, ArrayList<Category> fetchedCategories) { |
|
|
if (resultCode == NetworkResultCodes.SUCCESSFUL) { |
|
|
if (resultCode == NetworkResultCodes.SUCCESSFUL) { |
|
|
categories.clear(); |
|
|
categories.clear(); |
|
|
categories.addAll(fetchedCategories); |
|
|
categories.addAll(fetchedCategories); |
|
@ -191,8 +196,8 @@ public class ForumFragment extends BaseFragment { |
|
|
private class ForumTask extends NewParseTask<ArrayList<Category>> { |
|
|
private class ForumTask extends NewParseTask<ArrayList<Category>> { |
|
|
private HttpUrl forumUrl = SessionManager.forumUrl; //may change upon collapse/expand
|
|
|
private HttpUrl forumUrl = SessionManager.forumUrl; //may change upon collapse/expand
|
|
|
|
|
|
|
|
|
public ForumTask(OnTaskStartedListener onTaskStartedListener, |
|
|
ForumTask(OnTaskStartedListener onTaskStartedListener, |
|
|
OnNetworkTaskFinishedListener<ArrayList<Category>> onParseTaskFinishedListener) { |
|
|
OnNetworkTaskFinishedListener<ArrayList<Category>> onParseTaskFinishedListener) { |
|
|
super(onTaskStartedListener, onParseTaskFinishedListener); |
|
|
super(onTaskStartedListener, onParseTaskFinishedListener); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|