Browse Source

Unread bug fix

pull/54/head
Ezerous 6 years ago
parent
commit
6a619ef878
No known key found for this signature in database GPG Key ID: 262B2954BBA319E3
  1. 42
      app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadFragment.java

42
app/src/main/java/gr/thmmy/mthmmy/activities/main/unread/UnreadFragment.java

@ -102,15 +102,12 @@ public class UnreadFragment extends BaseFragment {
if (rootView instanceof RelativeLayout) { if (rootView instanceof RelativeLayout) {
progressBar = rootView.findViewById(R.id.progressBar); progressBar = rootView.findViewById(R.id.progressBar);
unreadAdapter = new UnreadAdapter(topicSummaries, unreadAdapter = new UnreadAdapter(topicSummaries,
fragmentInteractionListener, new UnreadAdapter.MarkReadInteractionListener() { fragmentInteractionListener, markReadLinkUrl -> {
@Override if (markReadTask != null && markReadTask.getStatus() != AsyncTask.Status.RUNNING) {
public void onMarkReadInteraction(String markReadLinkUrl) { markReadTask = new MarkReadTask();
if (markReadTask != null && markReadTask.getStatus() != AsyncTask.Status.RUNNING) { markReadTask.execute(markReadLinkUrl);
markReadTask = new MarkReadTask(); }
markReadTask.execute(markReadLinkUrl); });
}
}
});
CustomRecyclerView recyclerView = rootView.findViewById(R.id.list); CustomRecyclerView recyclerView = rootView.findViewById(R.id.list);
LinearLayoutManager linearLayoutManager = new LinearLayoutManager(recyclerView.getContext()); LinearLayoutManager linearLayoutManager = new LinearLayoutManager(recyclerView.getContext());
@ -124,19 +121,15 @@ public class UnreadFragment extends BaseFragment {
swipeRefreshLayout.setProgressBackgroundColorSchemeResource(R.color.primary); swipeRefreshLayout.setProgressBackgroundColorSchemeResource(R.color.primary);
swipeRefreshLayout.setColorSchemeResources(R.color.accent); swipeRefreshLayout.setColorSchemeResources(R.color.accent);
swipeRefreshLayout.setOnRefreshListener( swipeRefreshLayout.setOnRefreshListener(
new SwipeRefreshLayout.OnRefreshListener() { () -> {
@Override if (unreadTask != null && unreadTask.getStatus() != AsyncTask.Status.RUNNING) {
public void onRefresh() { topicSummaries.clear();
if (unreadTask != null && unreadTask.getStatus() != AsyncTask.Status.RUNNING) { numberOfPages = 0;
topicSummaries.clear(); loadedPages = 0;
numberOfPages = 0; unreadTask = new UnreadTask();
loadedPages = 0; assert SessionManager.unreadUrl != null;
unreadTask = new UnreadTask(); unreadTask.execute(SessionManager.unreadUrl.toString());
assert SessionManager.unreadUrl != null;
unreadTask.execute(SessionManager.unreadUrl.toString());
}
} }
} }
); );
} }
@ -237,7 +230,12 @@ public class UnreadFragment extends BaseFragment {
assert SessionManager.unreadUrl != null; assert SessionManager.unreadUrl != null;
unreadTask.execute(SessionManager.unreadUrl.toString() + ";start=" + loadedPages * 20); unreadTask.execute(SessionManager.unreadUrl.toString() + ";start=" + loadedPages * 20);
} }
else {
progressBar.setVisibility(ProgressBar.INVISIBLE);
swipeRefreshLayout.setRefreshing(false);
}
}
else{
progressBar.setVisibility(ProgressBar.INVISIBLE); progressBar.setVisibility(ProgressBar.INVISIBLE);
swipeRefreshLayout.setRefreshing(false); swipeRefreshLayout.setRefreshing(false);
} }

Loading…
Cancel
Save