From b737da62dd48326aec37c0989f64665313f6fa86 Mon Sep 17 00:00:00 2001 From: Yuri Revich Date: Tue, 1 Dec 2015 22:56:24 +0300 Subject: [PATCH] No next chapter toast on play button --- .../ui/manga/chapter/ChaptersFragment.java | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 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 8478188a1..1cc848ea2 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 @@ -16,6 +16,7 @@ import android.view.View; import android.view.ViewGroup; import android.widget.CheckBox; import android.widget.ImageView; +import android.widget.Toast; import java.util.List; @@ -72,10 +73,15 @@ public class ChaptersFragment extends BaseRxFragment implemen setSwipeRefreshListener(); readCb.setOnCheckedChangeListener((arg, isCheked) -> getPresenter().setReadFilter(isCheked)); - sortBtn.setOnClickListener(v->getPresenter().revertSortOrder()); - nextUnreadBtn.setOnClickListener(v->{ - getPresenter().onChapterClicked(getPresenter().getNextUnreadChapter()); - startActivity(ReaderActivity.newIntent(getActivity())); + sortBtn.setOnClickListener(v -> getPresenter().revertSortOrder()); + nextUnreadBtn.setOnClickListener(v -> { + Chapter chapter = getPresenter().getNextUnreadChapter(); + if (chapter != null) { + getPresenter().onChapterClicked(getPresenter().getNextUnreadChapter()); + startActivity(ReaderActivity.newIntent(getActivity())); + } else { + Toast.makeText(getContext(), R.string.no_next_chapter, Toast.LENGTH_SHORT).show(); + } }); return view; }