|
@@ -24,6 +24,7 @@ import butterknife.Bind;
|
|
|
import butterknife.ButterKnife;
|
|
|
import eu.kanade.tachiyomi.R;
|
|
|
import eu.kanade.tachiyomi.data.database.models.Chapter;
|
|
|
+import eu.kanade.tachiyomi.data.database.models.Manga;
|
|
|
import eu.kanade.tachiyomi.data.download.DownloadService;
|
|
|
import eu.kanade.tachiyomi.data.download.model.Download;
|
|
|
import eu.kanade.tachiyomi.ui.base.adapter.FlexibleViewHolder;
|
|
@@ -71,18 +72,38 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
|
|
|
// Init RecyclerView and adapter
|
|
|
linearLayout = new LinearLayoutManager(getActivity());
|
|
|
recyclerView.setLayoutManager(linearLayout);
|
|
|
- recyclerView.addItemDecoration(new DividerItemDecoration(ContextCompat.getDrawable(getContext(), R.drawable.line_divider)));
|
|
|
+ recyclerView.addItemDecoration(new DividerItemDecoration(
|
|
|
+ ContextCompat.getDrawable(getContext(), R.drawable.line_divider)));
|
|
|
recyclerView.setHasFixedSize(true);
|
|
|
adapter = new ChaptersAdapter(this);
|
|
|
recyclerView.setAdapter(adapter);
|
|
|
|
|
|
+ swipeRefresh.setOnRefreshListener(this::fetchChapters);
|
|
|
+
|
|
|
+ nextUnreadBtn.setOnClickListener(v -> {
|
|
|
+ Chapter chapter = getPresenter().getNextUnreadChapter();
|
|
|
+ if (chapter != null) {
|
|
|
+ openChapter(chapter);
|
|
|
+ } else {
|
|
|
+ ToastUtil.showShort(getContext(), R.string.no_next_chapter);
|
|
|
+ }
|
|
|
+ });
|
|
|
+
|
|
|
+ return view;
|
|
|
+ }
|
|
|
+
|
|
|
+ public void onNextManga(Manga manga) {
|
|
|
+ // Remove listeners before setting the values
|
|
|
+ readCb.setOnCheckedChangeListener(null);
|
|
|
+ downloadedCb.setOnCheckedChangeListener(null);
|
|
|
+ sortBtn.setOnClickListener(null);
|
|
|
+
|
|
|
// Set initial values
|
|
|
setReadFilter();
|
|
|
setDownloadedFilter();
|
|
|
setSortIcon();
|
|
|
|
|
|
// Init listeners
|
|
|
- swipeRefresh.setOnRefreshListener(this::fetchChapters);
|
|
|
readCb.setOnCheckedChangeListener((arg, isChecked) ->
|
|
|
getPresenter().setReadFilter(isChecked));
|
|
|
downloadedCb.setOnCheckedChangeListener((v, isChecked) ->
|
|
@@ -91,16 +112,6 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
|
|
|
getPresenter().revertSortOrder();
|
|
|
setSortIcon();
|
|
|
});
|
|
|
- nextUnreadBtn.setOnClickListener(v -> {
|
|
|
- Chapter chapter = getPresenter().getNextUnreadChapter();
|
|
|
- if (chapter != null) {
|
|
|
- openChapter(chapter);
|
|
|
- } else {
|
|
|
- ToastUtil.showShort(getContext(), R.string.no_next_chapter);
|
|
|
- }
|
|
|
- });
|
|
|
-
|
|
|
- return view;
|
|
|
}
|
|
|
|
|
|
public void onNextChapters(List<Chapter> chapters) {
|