From 771f49fa3bd7a2633dc48da555789c3f87f02bb3 Mon Sep 17 00:00:00 2001 From: inorichi Date: Tue, 1 Dec 2015 22:01:41 +0100 Subject: [PATCH] Minor changes --- .../ui/manga/chapter/ChaptersFragment.java | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/app/src/main/java/eu/kanade/mangafeed/ui/manga/chapter/ChaptersFragment.java b/app/src/main/java/eu/kanade/mangafeed/ui/manga/chapter/ChaptersFragment.java index 1cc848ea2..95757542f 100644 --- a/app/src/main/java/eu/kanade/mangafeed/ui/manga/chapter/ChaptersFragment.java +++ b/app/src/main/java/eu/kanade/mangafeed/ui/manga/chapter/ChaptersFragment.java @@ -77,8 +77,7 @@ public class ChaptersFragment extends BaseRxFragment implemen nextUnreadBtn.setOnClickListener(v -> { Chapter chapter = getPresenter().getNextUnreadChapter(); if (chapter != null) { - getPresenter().onChapterClicked(getPresenter().getNextUnreadChapter()); - startActivity(ReaderActivity.newIntent(getActivity())); + openChapter(chapter); } else { Toast.makeText(getContext(), R.string.no_next_chapter, Toast.LENGTH_SHORT).show(); } @@ -131,6 +130,12 @@ public class ChaptersFragment extends BaseRxFragment implemen return ((MangaActivity) getActivity()).isOnlineManga(); } + protected void openChapter(Chapter chapter) { + getPresenter().onChapterClicked(chapter); + Intent intent = ReaderActivity.newIntent(getActivity()); + startActivity(intent); + } + @Override public boolean onCreateActionMode(ActionMode mode, Menu menu) { mode.getMenuInflater().inflate(R.menu.chapter_selection, menu); @@ -213,9 +218,7 @@ public class ChaptersFragment extends BaseRxFragment implemen toggleSelection(position); return true; } else { - getPresenter().onChapterClicked(adapter.getItem(position)); - Intent intent = ReaderActivity.newIntent(getActivity()); - startActivity(intent); + openChapter(adapter.getItem(position)); return false; } }