From 2f6d163a7acf4672fa39ecd225532a79bef770e1 Mon Sep 17 00:00:00 2001 From: inorichi Date: Tue, 29 Aug 2017 10:39:22 +0200 Subject: [PATCH] Simplify presenter delegate --- .../ui/base/presenter/NucleusConductorDelegate.java | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/app/src/main/java/eu/kanade/tachiyomi/ui/base/presenter/NucleusConductorDelegate.java b/app/src/main/java/eu/kanade/tachiyomi/ui/base/presenter/NucleusConductorDelegate.java index e495069f0..ddc4aba5a 100644 --- a/app/src/main/java/eu/kanade/tachiyomi/ui/base/presenter/NucleusConductorDelegate.java +++ b/app/src/main/java/eu/kanade/tachiyomi/ui/base/presenter/NucleusConductorDelegate.java @@ -10,7 +10,6 @@ public class NucleusConductorDelegate

{ @Nullable private P presenter; @Nullable private Bundle bundle; - private boolean presenterHasView = false; private PresenterFactory

factory; @@ -22,8 +21,8 @@ public class NucleusConductorDelegate

{ if (presenter == null) { presenter = factory.createPresenter(); presenter.create(bundle); + bundle = null; } - bundle = null; return presenter; } @@ -37,24 +36,20 @@ public class NucleusConductorDelegate

{ } 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; } }