diff --git a/app/src/full/java/com/topjohnwu/magisk/components/SafetyNet.java b/app/src/full/java/com/topjohnwu/magisk/components/SafetyNet.java index bff0dbaee..2fb9b714b 100644 --- a/app/src/full/java/com/topjohnwu/magisk/components/SafetyNet.java +++ b/app/src/full/java/com/topjohnwu/magisk/components/SafetyNet.java @@ -24,6 +24,7 @@ import androidx.cardview.widget.CardView; import butterknife.BindColor; import butterknife.BindView; import butterknife.OnClick; +import butterknife.Unbinder; import dalvik.system.DexClassLoader; public class SafetyNet implements ISafetyNetHelper.Callback { @@ -44,10 +45,11 @@ public class SafetyNet implements ISafetyNetHelper.Callback { @BindColor(R.color.red500) int colorBad; @BindColor(R.color.green500) int colorOK; + public Unbinder unbinder; private ExpandableViewHolder expandable; public SafetyNet(View v) { - new SafetyNet_ViewBinding(this, v); + unbinder = new SafetyNet_ViewBinding(this, v); expandable = new ExpandableViewHolder(expandLayout); Context context = v.getContext(); safetyNetCard.setVisibility(hasGms(context) && Networking.checkNetworkStatus(context) ? diff --git a/app/src/full/java/com/topjohnwu/magisk/components/UpdateCardHolder.java b/app/src/full/java/com/topjohnwu/magisk/components/UpdateCardHolder.java index 38e432a41..7cdef7d8f 100644 --- a/app/src/full/java/com/topjohnwu/magisk/components/UpdateCardHolder.java +++ b/app/src/full/java/com/topjohnwu/magisk/components/UpdateCardHolder.java @@ -11,6 +11,7 @@ import android.widget.TextView; import com.topjohnwu.magisk.R; import butterknife.BindView; +import butterknife.Unbinder; public class UpdateCardHolder { @@ -23,10 +24,11 @@ public class UpdateCardHolder { @BindView(R.id.install) public Button install; public View itemView; + public Unbinder unbinder; public UpdateCardHolder(LayoutInflater inflater, ViewGroup root) { itemView = inflater.inflate(R.layout.update_card, root, false); - new UpdateCardHolder_ViewBinding(this, itemView); + unbinder = new UpdateCardHolder_ViewBinding(this, itemView); } public void setValid(boolean valid) { diff --git a/app/src/full/java/com/topjohnwu/magisk/fragments/MagiskFragment.java b/app/src/full/java/com/topjohnwu/magisk/fragments/MagiskFragment.java index f71d0dafd..ed7f0f0a6 100644 --- a/app/src/full/java/com/topjohnwu/magisk/fragments/MagiskFragment.java +++ b/app/src/full/java/com/topjohnwu/magisk/fragments/MagiskFragment.java @@ -126,6 +126,14 @@ public class MagiskFragment extends BaseFragment return v; } + @Override + public void onDestroyView() { + super.onDestroyView(); + safetyNet.unbinder.unbind(); + magisk.unbinder.unbind(); + manager.unbinder.unbind(); + } + @Override public void onRefresh() { mSwipeRefreshLayout.setRefreshing(false);