mirror of
https://github.com/mihonapp/mihon.git
synced 2024-11-11 13:07:45 +01:00
37 lines
929 B
Java
37 lines
929 B
Java
package eu.kanade.mangafeed.presenter;
|
|
|
|
import javax.inject.Inject;
|
|
|
|
import de.greenrobot.event.EventBus;
|
|
import eu.kanade.mangafeed.App;
|
|
import eu.kanade.mangafeed.data.helpers.DatabaseHelper;
|
|
import eu.kanade.mangafeed.data.models.Manga;
|
|
import eu.kanade.mangafeed.view.MangaDetailView;
|
|
|
|
public class MangaDetailPresenter extends BasePresenter {
|
|
|
|
private MangaDetailView view;
|
|
|
|
@Inject
|
|
DatabaseHelper db;
|
|
|
|
public MangaDetailPresenter(MangaDetailView view) {
|
|
this.view = view;
|
|
App.getComponent(view.getActivity()).inject(this);
|
|
}
|
|
|
|
public void onEventMainThread(Manga manga) {
|
|
view.loadManga(manga);
|
|
initializeChapters(manga);
|
|
}
|
|
|
|
public static void newIntent(Manga manga) {
|
|
EventBus.getDefault().postSticky(manga);
|
|
}
|
|
|
|
public void initializeChapters(Manga manga) {
|
|
db.getChapters(manga)
|
|
.subscribe(view::setChapters);
|
|
}
|
|
}
|