Albirew/tachiyomi
Archivé
1
0
Bifurcation 0

Simplify presenter delegate

Cette révision appartient à :
inorichi 2017-08-29 10:39:22 +02:00
Parent ecfe72bcad
révision 2f6d163a7a

Voir le fichier

@ -10,7 +10,6 @@ public class NucleusConductorDelegate<P extends Presenter> {
@Nullable private P presenter;
@Nullable private Bundle bundle;
private boolean presenterHasView = false;
private PresenterFactory<P> factory;
@ -22,8 +21,8 @@ public class NucleusConductorDelegate<P extends Presenter> {
if (presenter == null) {
presenter = factory.createPresenter();
presenter.create(bundle);
bundle = null;
}
bundle = null;
return presenter;
}
@ -37,24 +36,20 @@ public class NucleusConductorDelegate<P extends Presenter> {
}
void onRestoreInstanceState(Bundle presenterState) {
if (presenter != null)
throw new IllegalArgumentException("onRestoreInstanceState() should be called before onResume()");
bundle = presenterState;
}
void onTakeView(Object view) {
getPresenter();
if (presenter != null && !presenterHasView) {
if (presenter != null) {
//noinspection unchecked
presenter.takeView(view);
presenterHasView = true;
}
}
void onDropView() {
if (presenter != null && presenterHasView) {
if (presenter != null) {
presenter.dropView();
presenterHasView = false;
}
}