From 7269b5f125ded4eb3d7b9565c03ae34133fb7bf2 Mon Sep 17 00:00:00 2001 From: mkoslacz Date: Thu, 27 Jul 2017 17:04:43 +0200 Subject: [PATCH] [butterknife-fragments] fix: add missing unbinding --- .../butterknife/ViperButterKnifeFragment.java | 11 ++++++++++- .../butterknife/ViperButterKnifeLceFragment.java | 11 ++++++++++- .../ViperButterKnifeLcePassiveFragment.java | 11 ++++++++++- .../butterknife/ViperButterKnifePassiveFragment.java | 11 ++++++++++- 4 files changed, 40 insertions(+), 4 deletions(-) diff --git a/moviper-butterknife/src/main/java/com/mateuszkoslacz/moviper/base/view/fragment/autoinject/butterknife/ViperButterKnifeFragment.java b/moviper-butterknife/src/main/java/com/mateuszkoslacz/moviper/base/view/fragment/autoinject/butterknife/ViperButterKnifeFragment.java index b21b334..df39dd2 100644 --- a/moviper-butterknife/src/main/java/com/mateuszkoslacz/moviper/base/view/fragment/autoinject/butterknife/ViperButterKnifeFragment.java +++ b/moviper-butterknife/src/main/java/com/mateuszkoslacz/moviper/base/view/fragment/autoinject/butterknife/ViperButterKnifeFragment.java @@ -9,6 +9,7 @@ import com.mateuszkoslacz.moviper.iface.view.ViperView; import butterknife.ButterKnife; +import butterknife.Unbinder; /** * Created by mateuszkoslacz on 14.12.2016. @@ -20,9 +21,17 @@ public abstract class ViperButterKnifeFragment extends ViperAiFragment implements ViperView { + private Unbinder unbinder; + @Override protected void injectViews(View view) { super.injectViews(view); - ButterKnife.bind(this, view); + unbinder = ButterKnife.bind(this, view); + } + + @Override + public void onDestroyView() { + super.onDestroyView(); + unbinder.unbind(); } } diff --git a/moviper-butterknife/src/main/java/com/mateuszkoslacz/moviper/base/view/fragment/autoinject/butterknife/ViperButterKnifeLceFragment.java b/moviper-butterknife/src/main/java/com/mateuszkoslacz/moviper/base/view/fragment/autoinject/butterknife/ViperButterKnifeLceFragment.java index d574523..013e912 100644 --- a/moviper-butterknife/src/main/java/com/mateuszkoslacz/moviper/base/view/fragment/autoinject/butterknife/ViperButterKnifeLceFragment.java +++ b/moviper-butterknife/src/main/java/com/mateuszkoslacz/moviper/base/view/fragment/autoinject/butterknife/ViperButterKnifeLceFragment.java @@ -9,6 +9,7 @@ import com.mateuszkoslacz.moviper.iface.view.ViperView; import butterknife.ButterKnife; +import butterknife.Unbinder; /** * Created by mateuszkoslacz on 14.12.2016. @@ -22,9 +23,17 @@ public abstract class ViperButterKnifeLceFragment extends ViperLceAiFragment implements ViperLceView { + private Unbinder unbinder; + @Override protected void injectViews(View view) { super.injectViews(view); - ButterKnife.bind(this, view); + unbinder = ButterKnife.bind(this, view); + } + + @Override + public void onDestroyView() { + super.onDestroyView(); + unbinder.unbind(); } } diff --git a/moviper-butterknife/src/main/java/com/mateuszkoslacz/moviper/base/view/fragment/autoinject/passive/butterknife/ViperButterKnifeLcePassiveFragment.java b/moviper-butterknife/src/main/java/com/mateuszkoslacz/moviper/base/view/fragment/autoinject/passive/butterknife/ViperButterKnifeLcePassiveFragment.java index c8d08f6..0158aa3 100644 --- a/moviper-butterknife/src/main/java/com/mateuszkoslacz/moviper/base/view/fragment/autoinject/passive/butterknife/ViperButterKnifeLcePassiveFragment.java +++ b/moviper-butterknife/src/main/java/com/mateuszkoslacz/moviper/base/view/fragment/autoinject/passive/butterknife/ViperButterKnifeLcePassiveFragment.java @@ -7,6 +7,7 @@ import com.mateuszkoslacz.moviper.iface.view.ViperLceView; import butterknife.ButterKnife; +import butterknife.Unbinder; /** * Created by mateuszkoslacz on 14.12.2016. @@ -19,9 +20,17 @@ public abstract class ViperButterKnifeLcePassiveFragment extends ViperLceAiPassiveFragment implements ViperLceView { + private Unbinder unbinder; + @Override protected void injectViews(View view) { super.injectViews(view); - ButterKnife.bind(this, view); + unbinder = ButterKnife.bind(this, view); + } + + @Override + public void onDestroyView() { + super.onDestroyView(); + unbinder.unbind(); } } diff --git a/moviper-butterknife/src/main/java/com/mateuszkoslacz/moviper/base/view/fragment/autoinject/passive/butterknife/ViperButterKnifePassiveFragment.java b/moviper-butterknife/src/main/java/com/mateuszkoslacz/moviper/base/view/fragment/autoinject/passive/butterknife/ViperButterKnifePassiveFragment.java index 33fca3a..4b3c8e8 100644 --- a/moviper-butterknife/src/main/java/com/mateuszkoslacz/moviper/base/view/fragment/autoinject/passive/butterknife/ViperButterKnifePassiveFragment.java +++ b/moviper-butterknife/src/main/java/com/mateuszkoslacz/moviper/base/view/fragment/autoinject/passive/butterknife/ViperButterKnifePassiveFragment.java @@ -7,6 +7,7 @@ import com.mateuszkoslacz.moviper.iface.view.ViperView; import butterknife.ButterKnife; +import butterknife.Unbinder; /** * Created by mateuszkoslacz on 14.12.2016. @@ -17,9 +18,17 @@ public abstract class ViperButterKnifePassiveFragment extends ViperAiPassiveFragment implements ViperView { + private Unbinder unbinder; + @Override protected void injectViews(View view) { super.injectViews(view); - ButterKnife.bind(this, view); + unbinder = ButterKnife.bind(this, view); + } + + @Override + public void onDestroyView() { + super.onDestroyView(); + unbinder.unbind(); } }