Update last chapter read in MAL when reaching the last page
This commit is contained in:
@@ -4,7 +4,7 @@ import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
import eu.kanade.mangafeed.App;
|
||||
import eu.kanade.mangafeed.ui.base.activity.BaseActivity;
|
||||
import eu.kanade.mangafeed.ui.base.presenter.BasePresenter;
|
||||
import nucleus.factory.PresenterFactory;
|
||||
import nucleus.factory.ReflectionPresenterFactory;
|
||||
import nucleus.presenter.Presenter;
|
||||
@@ -60,7 +60,9 @@ public abstract class BaseRxActivity<P extends Presenter> extends BaseActivity i
|
||||
final PresenterFactory<P> superFactory = getPresenterFactory();
|
||||
setPresenterFactory(() -> {
|
||||
P presenter = superFactory.createPresenter();
|
||||
((App)getApplication()).getComponentReflection().inject(presenter);
|
||||
App app = (App) getApplication();
|
||||
app.getComponentReflection().inject(presenter);
|
||||
((BasePresenter)presenter).setContext(app.getApplicationContext());
|
||||
return presenter;
|
||||
});
|
||||
|
||||
|
||||
@@ -3,7 +3,7 @@ package eu.kanade.mangafeed.ui.base.fragment;
|
||||
import android.os.Bundle;
|
||||
|
||||
import eu.kanade.mangafeed.App;
|
||||
import eu.kanade.mangafeed.ui.base.fragment.BaseFragment;
|
||||
import eu.kanade.mangafeed.ui.base.presenter.BasePresenter;
|
||||
import nucleus.factory.PresenterFactory;
|
||||
import nucleus.factory.ReflectionPresenterFactory;
|
||||
import nucleus.presenter.Presenter;
|
||||
@@ -57,7 +57,9 @@ public abstract class BaseRxFragment<P extends Presenter> extends BaseFragment i
|
||||
final PresenterFactory<P> superFactory = getPresenterFactory();
|
||||
setPresenterFactory(() -> {
|
||||
P presenter = superFactory.createPresenter();
|
||||
((App)getActivity().getApplication()).getComponentReflection().inject(presenter);
|
||||
App app = (App) getActivity().getApplication();
|
||||
app.getComponentReflection().inject(presenter);
|
||||
((BasePresenter)presenter).setContext(app.getApplicationContext());
|
||||
return presenter;
|
||||
});
|
||||
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
package eu.kanade.mangafeed.ui.base.presenter;
|
||||
|
||||
import android.content.Context;
|
||||
import android.os.Bundle;
|
||||
import android.support.annotation.NonNull;
|
||||
|
||||
@@ -10,6 +11,8 @@ import nucleus.view.ViewWithPresenter;
|
||||
|
||||
public class BasePresenter<V extends ViewWithPresenter> extends RxPresenter<V> {
|
||||
|
||||
private Context context;
|
||||
|
||||
@Override
|
||||
protected void onCreate(Bundle savedState) {
|
||||
super.onCreate(savedState);
|
||||
@@ -33,4 +36,13 @@ public class BasePresenter<V extends ViewWithPresenter> extends RxPresenter<V> {
|
||||
public void unregisterForEvents() {
|
||||
EventBus.getDefault().unregister(this);
|
||||
}
|
||||
|
||||
public void setContext(Context applicationContext) {
|
||||
context = applicationContext;
|
||||
}
|
||||
|
||||
public Context getContext() {
|
||||
return context;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user