Merge remote-tracking branch 'inorichi/master'

This commit is contained in:
Yuri Revich 2015-12-02 09:00:39 +03:00
commit e5e3fa5e0b

View File

@ -77,8 +77,7 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
nextUnreadBtn.setOnClickListener(v -> { nextUnreadBtn.setOnClickListener(v -> {
Chapter chapter = getPresenter().getNextUnreadChapter(); Chapter chapter = getPresenter().getNextUnreadChapter();
if (chapter != null) { if (chapter != null) {
getPresenter().onChapterClicked(getPresenter().getNextUnreadChapter()); openChapter(chapter);
startActivity(ReaderActivity.newIntent(getActivity()));
} else { } else {
Toast.makeText(getContext(), R.string.no_next_chapter, Toast.LENGTH_SHORT).show(); Toast.makeText(getContext(), R.string.no_next_chapter, Toast.LENGTH_SHORT).show();
} }
@ -131,6 +130,12 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
return ((MangaActivity) getActivity()).isOnlineManga(); return ((MangaActivity) getActivity()).isOnlineManga();
} }
protected void openChapter(Chapter chapter) {
getPresenter().onChapterClicked(chapter);
Intent intent = ReaderActivity.newIntent(getActivity());
startActivity(intent);
}
@Override @Override
public boolean onCreateActionMode(ActionMode mode, Menu menu) { public boolean onCreateActionMode(ActionMode mode, Menu menu) {
mode.getMenuInflater().inflate(R.menu.chapter_selection, menu); mode.getMenuInflater().inflate(R.menu.chapter_selection, menu);
@ -213,9 +218,7 @@ public class ChaptersFragment extends BaseRxFragment<ChaptersPresenter> implemen
toggleSelection(position); toggleSelection(position);
return true; return true;
} else { } else {
getPresenter().onChapterClicked(adapter.getItem(position)); openChapter(adapter.getItem(position));
Intent intent = ReaderActivity.newIntent(getActivity());
startActivity(intent);
return false; return false;
} }
} }