mirror of
https://github.com/tachiyomiorg/tachiyomi.git
synced 2024-11-19 22:39:18 +01:00
Hold the same manga instance (allowing to refresh manga state from the catalogue). Other minor changes.
This commit is contained in:
parent
e1aa460106
commit
07ed2e2ebb
12
app/src/main/java/eu/kanade/tachiyomi/event/MangaEvent.java
Normal file
12
app/src/main/java/eu/kanade/tachiyomi/event/MangaEvent.java
Normal file
@ -0,0 +1,12 @@
|
|||||||
|
package eu.kanade.tachiyomi.event;
|
||||||
|
|
||||||
|
import eu.kanade.tachiyomi.data.database.models.Manga;
|
||||||
|
|
||||||
|
public class MangaEvent {
|
||||||
|
|
||||||
|
public final Manga manga;
|
||||||
|
|
||||||
|
public MangaEvent(Manga manga) {
|
||||||
|
this.manga = manga;
|
||||||
|
}
|
||||||
|
}
|
@ -107,14 +107,14 @@ public class RxPresenter<View> extends Presenter<View> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Checks if a restartable is subscribed.
|
* Checks if a restartable is unsubscribed.
|
||||||
*
|
*
|
||||||
* @param restartableId id of a restartable.
|
* @param restartableId id of the restartable.
|
||||||
* @return True if the restartable is subscribed, false otherwise.
|
* @return true if the subscription is null or unsubscribed, false otherwise.
|
||||||
*/
|
*/
|
||||||
public boolean isSubscribed(int restartableId) {
|
public boolean isUnsubscribed(int restartableId) {
|
||||||
Subscription s = restartableSubscriptions.get(restartableId);
|
Subscription subscription = restartableSubscriptions.get(restartableId);
|
||||||
return s != null && !s.isUnsubscribed();
|
return subscription == null || subscription.isUnsubscribed();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -243,7 +243,8 @@ public class CatalogueFragment extends BaseRxFragment<CataloguePresenter>
|
|||||||
|
|
||||||
private void restartRequest(String newQuery) {
|
private void restartRequest(String newQuery) {
|
||||||
// If text didn't change, do nothing
|
// If text didn't change, do nothing
|
||||||
if (query.equals(newQuery)) return;
|
if (query.equals(newQuery) || getPresenter().getSource() == null)
|
||||||
|
return;
|
||||||
|
|
||||||
query = newQuery;
|
query = newQuery;
|
||||||
showProgressBar();
|
showProgressBar();
|
||||||
@ -325,9 +326,8 @@ public class CatalogueFragment extends BaseRxFragment<CataloguePresenter>
|
|||||||
@Override
|
@Override
|
||||||
public void onListItemLongClick(int position) {
|
public void onListItemLongClick(int position) {
|
||||||
final Manga selectedManga = adapter.getItem(position);
|
final Manga selectedManga = adapter.getItem(position);
|
||||||
final Manga dbManga = getPresenter().getDbManga(selectedManga.id);
|
|
||||||
|
|
||||||
int textRes = dbManga.favorite ? R.string.remove_from_library : R.string.add_to_library;
|
int textRes = selectedManga.favorite ? R.string.remove_from_library : R.string.add_to_library;
|
||||||
|
|
||||||
new MaterialDialog.Builder(getActivity())
|
new MaterialDialog.Builder(getActivity())
|
||||||
.items(getString(textRes))
|
.items(getString(textRes))
|
||||||
@ -335,6 +335,7 @@ public class CatalogueFragment extends BaseRxFragment<CataloguePresenter>
|
|||||||
switch (which) {
|
switch (which) {
|
||||||
case 0:
|
case 0:
|
||||||
getPresenter().changeMangaFavorite(selectedManga);
|
getPresenter().changeMangaFavorite(selectedManga);
|
||||||
|
adapter.notifyItemChanged(position);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
@ -1,5 +1,6 @@
|
|||||||
package eu.kanade.tachiyomi.ui.catalogue;
|
package eu.kanade.tachiyomi.ui.catalogue;
|
||||||
|
|
||||||
|
import android.support.v4.content.ContextCompat;
|
||||||
import android.view.View;
|
import android.view.View;
|
||||||
import android.widget.TextView;
|
import android.widget.TextView;
|
||||||
|
|
||||||
@ -12,13 +13,20 @@ public class CatalogueListHolder extends CatalogueHolder {
|
|||||||
|
|
||||||
@Bind(R.id.title) TextView title;
|
@Bind(R.id.title) TextView title;
|
||||||
|
|
||||||
|
private final int favoriteColor;
|
||||||
|
private final int unfavoriteColor;
|
||||||
|
|
||||||
public CatalogueListHolder(View view, CatalogueAdapter adapter, OnListItemClickListener listener) {
|
public CatalogueListHolder(View view, CatalogueAdapter adapter, OnListItemClickListener listener) {
|
||||||
super(view, adapter, listener);
|
super(view, adapter, listener);
|
||||||
ButterKnife.bind(this, view);
|
ButterKnife.bind(this, view);
|
||||||
|
|
||||||
|
favoriteColor = ContextCompat.getColor(view.getContext(), R.color.hint_text);
|
||||||
|
unfavoriteColor = ContextCompat.getColor(view.getContext(), R.color.primary_text);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public void onSetValues(Manga manga, CataloguePresenter presenter) {
|
public void onSetValues(Manga manga, CataloguePresenter presenter) {
|
||||||
title.setText(manga.title);
|
title.setText(manga.title);
|
||||||
|
title.setTextColor(manga.favorite ? favoriteColor : unfavoriteColor);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -167,10 +167,6 @@ public class CataloguePresenter extends BasePresenter<CatalogueFragment> {
|
|||||||
.onErrorResumeNext(error -> Observable.just(manga));
|
.onErrorResumeNext(error -> Observable.just(manga));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Manga getDbManga(long id) {
|
|
||||||
return db.getManga(id).executeAsBlocking();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Source getSource() {
|
public Source getSource() {
|
||||||
return source;
|
return source;
|
||||||
}
|
}
|
||||||
|
@ -58,7 +58,7 @@ public class LibraryPresenter extends BasePresenter<LibraryFragment> {
|
|||||||
@Override
|
@Override
|
||||||
protected void onTakeView(LibraryFragment libraryFragment) {
|
protected void onTakeView(LibraryFragment libraryFragment) {
|
||||||
super.onTakeView(libraryFragment);
|
super.onTakeView(libraryFragment);
|
||||||
if (!isSubscribed(GET_LIBRARY)) {
|
if (isUnsubscribed(GET_LIBRARY)) {
|
||||||
start(GET_LIBRARY);
|
start(GET_LIBRARY);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -14,6 +14,7 @@ import javax.inject.Inject;
|
|||||||
|
|
||||||
import butterknife.Bind;
|
import butterknife.Bind;
|
||||||
import butterknife.ButterKnife;
|
import butterknife.ButterKnife;
|
||||||
|
import de.greenrobot.event.EventBus;
|
||||||
import eu.kanade.tachiyomi.App;
|
import eu.kanade.tachiyomi.App;
|
||||||
import eu.kanade.tachiyomi.R;
|
import eu.kanade.tachiyomi.R;
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga;
|
import eu.kanade.tachiyomi.data.database.models.Manga;
|
||||||
@ -30,21 +31,21 @@ public class MangaActivity extends BaseRxActivity<MangaPresenter> {
|
|||||||
|
|
||||||
@Bind(R.id.toolbar) Toolbar toolbar;
|
@Bind(R.id.toolbar) Toolbar toolbar;
|
||||||
@Bind(R.id.tabs) TabLayout tabs;
|
@Bind(R.id.tabs) TabLayout tabs;
|
||||||
@Bind(R.id.view_pager) ViewPager view_pager;
|
@Bind(R.id.view_pager) ViewPager viewPager;
|
||||||
|
|
||||||
@Inject PreferencesHelper preferences;
|
@Inject PreferencesHelper preferences;
|
||||||
@Inject MangaSyncManager mangaSyncManager;
|
@Inject MangaSyncManager mangaSyncManager;
|
||||||
|
|
||||||
private MangaDetailAdapter adapter;
|
private MangaDetailAdapter adapter;
|
||||||
private long manga_id;
|
private boolean isOnline;
|
||||||
private boolean is_online;
|
|
||||||
|
|
||||||
public final static String MANGA_ID = "manga_id";
|
|
||||||
public final static String MANGA_ONLINE = "manga_online";
|
public final static String MANGA_ONLINE = "manga_online";
|
||||||
|
|
||||||
public static Intent newIntent(Context context, Manga manga) {
|
public static Intent newIntent(Context context, Manga manga) {
|
||||||
Intent intent = new Intent(context, MangaActivity.class);
|
Intent intent = new Intent(context, MangaActivity.class);
|
||||||
intent.putExtra(MANGA_ID, manga.id);
|
if (manga != null) {
|
||||||
|
EventBus.getDefault().postSticky(manga);
|
||||||
|
}
|
||||||
return intent;
|
return intent;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -59,23 +60,19 @@ public class MangaActivity extends BaseRxActivity<MangaPresenter> {
|
|||||||
|
|
||||||
Intent intent = getIntent();
|
Intent intent = getIntent();
|
||||||
|
|
||||||
manga_id = intent.getLongExtra(MANGA_ID, -1);
|
isOnline = intent.getBooleanExtra(MANGA_ONLINE, false);
|
||||||
is_online = intent.getBooleanExtra(MANGA_ONLINE, false);
|
|
||||||
|
|
||||||
setupViewPager();
|
setupViewPager();
|
||||||
|
|
||||||
if (savedState == null)
|
|
||||||
getPresenter().queryManga(manga_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
private void setupViewPager() {
|
private void setupViewPager() {
|
||||||
adapter = new MangaDetailAdapter(getSupportFragmentManager(), this);
|
adapter = new MangaDetailAdapter(getSupportFragmentManager(), this);
|
||||||
|
|
||||||
view_pager.setAdapter(adapter);
|
viewPager.setAdapter(adapter);
|
||||||
tabs.setupWithViewPager(view_pager);
|
tabs.setupWithViewPager(viewPager);
|
||||||
|
|
||||||
if (!is_online)
|
if (!isOnline)
|
||||||
view_pager.setCurrentItem(MangaDetailAdapter.CHAPTERS_FRAGMENT);
|
viewPager.setCurrentItem(MangaDetailAdapter.CHAPTERS_FRAGMENT);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setManga(Manga manga) {
|
public void setManga(Manga manga) {
|
||||||
@ -83,7 +80,7 @@ public class MangaActivity extends BaseRxActivity<MangaPresenter> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public boolean isCatalogueManga() {
|
public boolean isCatalogueManga() {
|
||||||
return is_online;
|
return isOnline;
|
||||||
}
|
}
|
||||||
|
|
||||||
class MangaDetailAdapter extends FragmentPagerAdapter {
|
class MangaDetailAdapter extends FragmentPagerAdapter {
|
||||||
@ -104,7 +101,7 @@ public class MangaActivity extends BaseRxActivity<MangaPresenter> {
|
|||||||
};
|
};
|
||||||
|
|
||||||
pageCount = 2;
|
pageCount = 2;
|
||||||
if (!is_online && mangaSyncManager.getMyAnimeList().isLogged())
|
if (!isOnline && mangaSyncManager.getMyAnimeList().isLogged())
|
||||||
pageCount++;
|
pageCount++;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,17 +7,17 @@ import javax.inject.Inject;
|
|||||||
import de.greenrobot.event.EventBus;
|
import de.greenrobot.event.EventBus;
|
||||||
import eu.kanade.tachiyomi.data.database.DatabaseHelper;
|
import eu.kanade.tachiyomi.data.database.DatabaseHelper;
|
||||||
import eu.kanade.tachiyomi.data.database.models.Manga;
|
import eu.kanade.tachiyomi.data.database.models.Manga;
|
||||||
|
import eu.kanade.tachiyomi.event.MangaEvent;
|
||||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter;
|
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter;
|
||||||
|
import eu.kanade.tachiyomi.util.EventBusHook;
|
||||||
import icepick.State;
|
import icepick.State;
|
||||||
import rx.Observable;
|
import rx.Observable;
|
||||||
import rx.android.schedulers.AndroidSchedulers;
|
|
||||||
import rx.schedulers.Schedulers;
|
|
||||||
|
|
||||||
public class MangaPresenter extends BasePresenter<MangaActivity> {
|
public class MangaPresenter extends BasePresenter<MangaActivity> {
|
||||||
|
|
||||||
@Inject DatabaseHelper db;
|
@Inject DatabaseHelper db;
|
||||||
|
|
||||||
@State long mangaId;
|
@State Manga manga;
|
||||||
|
|
||||||
private static final int DB_MANGA = 1;
|
private static final int DB_MANGA = 1;
|
||||||
|
|
||||||
@ -26,24 +26,28 @@ public class MangaPresenter extends BasePresenter<MangaActivity> {
|
|||||||
super.onCreate(savedState);
|
super.onCreate(savedState);
|
||||||
|
|
||||||
restartableLatestCache(DB_MANGA, this::getDbMangaObservable, MangaActivity::setManga);
|
restartableLatestCache(DB_MANGA, this::getDbMangaObservable, MangaActivity::setManga);
|
||||||
|
|
||||||
|
if (savedState == null)
|
||||||
|
registerForStickyEvents();
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
protected void onDestroy() {
|
protected void onDestroy() {
|
||||||
super.onDestroy();
|
super.onDestroy();
|
||||||
// Avoid new instances receiving wrong manga
|
// Avoid new instances receiving wrong manga
|
||||||
EventBus.getDefault().removeStickyEvent(Manga.class);
|
EventBus.getDefault().removeStickyEvent(MangaEvent.class);
|
||||||
}
|
}
|
||||||
|
|
||||||
private Observable<Manga> getDbMangaObservable() {
|
private Observable<Manga> getDbMangaObservable() {
|
||||||
return db.getManga(mangaId).asRxObservable()
|
return Observable.just(manga)
|
||||||
.subscribeOn(Schedulers.io())
|
.doOnNext(manga -> EventBus.getDefault().postSticky(new MangaEvent(manga)));
|
||||||
.observeOn(AndroidSchedulers.mainThread())
|
|
||||||
.doOnNext(manga -> EventBus.getDefault().postSticky(manga));
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public void queryManga(long mangaId) {
|
@EventBusHook
|
||||||
this.mangaId = mangaId;
|
public void onEventMainThread(Manga manga) {
|
||||||
|
EventBus.getDefault().removeStickyEvent(manga);
|
||||||
|
unregisterForEvents();
|
||||||
|
this.manga = manga;
|
||||||
start(DB_MANGA);
|
start(DB_MANGA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -31,23 +31,24 @@ public class ChaptersHolder extends FlexibleViewHolder {
|
|||||||
|
|
||||||
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
SimpleDateFormat sdf = new SimpleDateFormat("dd/MM/yyyy");
|
||||||
|
|
||||||
|
private final int readColor;
|
||||||
|
private final int unreadColor;
|
||||||
|
|
||||||
public ChaptersHolder(View view, ChaptersAdapter adapter, OnListItemClickListener listener) {
|
public ChaptersHolder(View view, ChaptersAdapter adapter, OnListItemClickListener listener) {
|
||||||
super(view, adapter, listener);
|
super(view, adapter, listener);
|
||||||
this.adapter = adapter;
|
this.adapter = adapter;
|
||||||
ButterKnife.bind(this, view);
|
ButterKnife.bind(this, view);
|
||||||
|
|
||||||
|
readColor = ContextCompat.getColor(view.getContext(), R.color.hint_text);
|
||||||
|
unreadColor = ContextCompat.getColor(view.getContext(), R.color.primary_text);
|
||||||
|
|
||||||
chapterMenu.setOnClickListener(v -> v.post(() -> showPopupMenu(v)));
|
chapterMenu.setOnClickListener(v -> v.post(() -> showPopupMenu(v)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public void onSetValues(Context context, Chapter chapter) {
|
public void onSetValues(Context context, Chapter chapter) {
|
||||||
this.item = chapter;
|
this.item = chapter;
|
||||||
title.setText(chapter.name);
|
title.setText(chapter.name);
|
||||||
|
title.setTextColor(chapter.read ? readColor : unreadColor);
|
||||||
if (chapter.read) {
|
|
||||||
title.setTextColor(ContextCompat.getColor(context, R.color.hint_text));
|
|
||||||
} else {
|
|
||||||
title.setTextColor(ContextCompat.getColor(context, R.color.primary_text));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!chapter.read && chapter.last_page_read > 0) {
|
if (!chapter.read && chapter.last_page_read > 0) {
|
||||||
pages.setText(context.getString(R.string.chapter_progress, chapter.last_page_read + 1));
|
pages.setText(context.getString(R.string.chapter_progress, chapter.last_page_read + 1));
|
||||||
|
@ -18,6 +18,7 @@ import eu.kanade.tachiyomi.data.source.SourceManager;
|
|||||||
import eu.kanade.tachiyomi.data.source.base.Source;
|
import eu.kanade.tachiyomi.data.source.base.Source;
|
||||||
import eu.kanade.tachiyomi.event.ChapterCountEvent;
|
import eu.kanade.tachiyomi.event.ChapterCountEvent;
|
||||||
import eu.kanade.tachiyomi.event.DownloadChaptersEvent;
|
import eu.kanade.tachiyomi.event.DownloadChaptersEvent;
|
||||||
|
import eu.kanade.tachiyomi.event.MangaEvent;
|
||||||
import eu.kanade.tachiyomi.event.ReaderEvent;
|
import eu.kanade.tachiyomi.event.ReaderEvent;
|
||||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter;
|
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter;
|
||||||
import eu.kanade.tachiyomi.util.EventBusHook;
|
import eu.kanade.tachiyomi.util.EventBusHook;
|
||||||
@ -90,10 +91,10 @@ public class ChaptersPresenter extends BasePresenter<ChaptersFragment> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventBusHook
|
@EventBusHook
|
||||||
public void onEventMainThread(Manga manga) {
|
public void onEventMainThread(MangaEvent event) {
|
||||||
this.manga = manga;
|
this.manga = event.manga;
|
||||||
|
|
||||||
if (!isSubscribed(DB_CHAPTERS)) {
|
if (isUnsubscribed(DB_CHAPTERS)) {
|
||||||
source = sourceManager.get(manga.source);
|
source = sourceManager.get(manga.source);
|
||||||
start(DB_CHAPTERS);
|
start(DB_CHAPTERS);
|
||||||
|
|
||||||
|
@ -10,6 +10,7 @@ import eu.kanade.tachiyomi.data.database.models.Manga;
|
|||||||
import eu.kanade.tachiyomi.data.source.SourceManager;
|
import eu.kanade.tachiyomi.data.source.SourceManager;
|
||||||
import eu.kanade.tachiyomi.data.source.base.Source;
|
import eu.kanade.tachiyomi.data.source.base.Source;
|
||||||
import eu.kanade.tachiyomi.event.ChapterCountEvent;
|
import eu.kanade.tachiyomi.event.ChapterCountEvent;
|
||||||
|
import eu.kanade.tachiyomi.event.MangaEvent;
|
||||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter;
|
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter;
|
||||||
import eu.kanade.tachiyomi.util.EventBusHook;
|
import eu.kanade.tachiyomi.util.EventBusHook;
|
||||||
import rx.Observable;
|
import rx.Observable;
|
||||||
@ -26,8 +27,6 @@ public class MangaInfoPresenter extends BasePresenter<MangaInfoFragment> {
|
|||||||
protected Source source;
|
protected Source source;
|
||||||
private int count = -1;
|
private int count = -1;
|
||||||
|
|
||||||
private boolean isFetching;
|
|
||||||
|
|
||||||
private static final int GET_MANGA = 1;
|
private static final int GET_MANGA = 1;
|
||||||
private static final int GET_CHAPTER_COUNT = 2;
|
private static final int GET_CHAPTER_COUNT = 2;
|
||||||
private static final int FETCH_MANGA_INFO = 3;
|
private static final int FETCH_MANGA_INFO = 3;
|
||||||
@ -69,10 +68,10 @@ public class MangaInfoPresenter extends BasePresenter<MangaInfoFragment> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventBusHook
|
@EventBusHook
|
||||||
public void onEventMainThread(Manga manga) {
|
public void onEventMainThread(MangaEvent event) {
|
||||||
this.manga = manga;
|
this.manga = event.manga;
|
||||||
source = sourceManager.get(manga.source);
|
source = sourceManager.get(manga.source);
|
||||||
start(GET_MANGA);
|
refreshManga();
|
||||||
}
|
}
|
||||||
|
|
||||||
@EventBusHook
|
@EventBusHook
|
||||||
@ -84,8 +83,7 @@ public class MangaInfoPresenter extends BasePresenter<MangaInfoFragment> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void fetchMangaFromSource() {
|
public void fetchMangaFromSource() {
|
||||||
if (!isFetching) {
|
if (isUnsubscribed(FETCH_MANGA_INFO)) {
|
||||||
isFetching = true;
|
|
||||||
start(FETCH_MANGA_INFO);
|
start(FETCH_MANGA_INFO);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -97,15 +95,16 @@ public class MangaInfoPresenter extends BasePresenter<MangaInfoFragment> {
|
|||||||
db.insertManga(manga).executeAsBlocking();
|
db.insertManga(manga).executeAsBlocking();
|
||||||
return Observable.just(manga);
|
return Observable.just(manga);
|
||||||
})
|
})
|
||||||
.finallyDo(() -> isFetching = false)
|
|
||||||
.subscribeOn(Schedulers.io())
|
.subscribeOn(Schedulers.io())
|
||||||
.observeOn(AndroidSchedulers.mainThread());
|
.observeOn(AndroidSchedulers.mainThread())
|
||||||
|
.doOnCompleted(this::refreshManga);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void toggleFavorite() {
|
public void toggleFavorite() {
|
||||||
manga.favorite = !manga.favorite;
|
manga.favorite = !manga.favorite;
|
||||||
onMangaFavoriteChange(manga.favorite);
|
onMangaFavoriteChange(manga.favorite);
|
||||||
db.insertManga(manga).executeAsBlocking();
|
db.insertManga(manga).executeAsBlocking();
|
||||||
|
refreshManga();
|
||||||
}
|
}
|
||||||
|
|
||||||
private void onMangaFavoriteChange(boolean isFavorite) {
|
private void onMangaFavoriteChange(boolean isFavorite) {
|
||||||
@ -116,4 +115,9 @@ public class MangaInfoPresenter extends BasePresenter<MangaInfoFragment> {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Used to refresh the view
|
||||||
|
private void refreshManga() {
|
||||||
|
start(GET_MANGA);
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
@ -12,6 +12,7 @@ import eu.kanade.tachiyomi.data.database.models.Manga;
|
|||||||
import eu.kanade.tachiyomi.data.database.models.MangaSync;
|
import eu.kanade.tachiyomi.data.database.models.MangaSync;
|
||||||
import eu.kanade.tachiyomi.data.mangasync.MangaSyncManager;
|
import eu.kanade.tachiyomi.data.mangasync.MangaSyncManager;
|
||||||
import eu.kanade.tachiyomi.data.mangasync.services.MyAnimeList;
|
import eu.kanade.tachiyomi.data.mangasync.services.MyAnimeList;
|
||||||
|
import eu.kanade.tachiyomi.event.MangaEvent;
|
||||||
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter;
|
import eu.kanade.tachiyomi.ui.base.presenter.BasePresenter;
|
||||||
import eu.kanade.tachiyomi.util.EventBusHook;
|
import eu.kanade.tachiyomi.util.EventBusHook;
|
||||||
import eu.kanade.tachiyomi.util.ToastUtil;
|
import eu.kanade.tachiyomi.util.ToastUtil;
|
||||||
@ -102,8 +103,8 @@ public class MyAnimeListPresenter extends BasePresenter<MyAnimeListFragment> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
@EventBusHook
|
@EventBusHook
|
||||||
public void onEventMainThread(Manga manga) {
|
public void onEventMainThread(MangaEvent event) {
|
||||||
this.manga = manga;
|
this.manga = event.manga;
|
||||||
start(GET_MANGA_SYNC);
|
start(GET_MANGA_SYNC);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -342,7 +342,7 @@ public class ReaderPresenter extends BasePresenter<ReaderActivity> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
private void stopPreloadingNextChapter() {
|
private void stopPreloadingNextChapter() {
|
||||||
if (isSubscribed(PRELOAD_NEXT_CHAPTER)) {
|
if (!isUnsubscribed(PRELOAD_NEXT_CHAPTER)) {
|
||||||
stop(PRELOAD_NEXT_CHAPTER);
|
stop(PRELOAD_NEXT_CHAPTER);
|
||||||
if (nextChapterPageList != null)
|
if (nextChapterPageList != null)
|
||||||
source.savePageList(nextChapter.url, nextChapterPageList);
|
source.savePageList(nextChapter.url, nextChapterPageList);
|
||||||
|
@ -23,6 +23,7 @@
|
|||||||
android:layout_gravity="bottom|right"
|
android:layout_gravity="bottom|right"
|
||||||
android:layout_margin="@dimen/fab_margin"
|
android:layout_margin="@dimen/fab_margin"
|
||||||
android:src="@drawable/ic_action_add_18dp"
|
android:src="@drawable/ic_action_add_18dp"
|
||||||
|
app:backgroundTint="@color/colorPrimary"
|
||||||
app:layout_anchor="@id/categories_list"
|
app:layout_anchor="@id/categories_list"
|
||||||
app:layout_anchorGravity="bottom|right|end"
|
app:layout_anchorGravity="bottom|right|end"
|
||||||
app:layout_behavior="eu.kanade.tachiyomi.ui.base.fab.ScrollAwareFABBehavior"/>
|
app:layout_behavior="eu.kanade.tachiyomi.ui.base.fab.ScrollAwareFABBehavior"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user