Add unbinder

This commit is contained in:
topjohnwu 2019-01-30 17:41:12 -05:00
parent da9d00be7d
commit 262185046a
3 changed files with 14 additions and 2 deletions

View File

@ -24,6 +24,7 @@ import androidx.cardview.widget.CardView;
import butterknife.BindColor; import butterknife.BindColor;
import butterknife.BindView; import butterknife.BindView;
import butterknife.OnClick; import butterknife.OnClick;
import butterknife.Unbinder;
import dalvik.system.DexClassLoader; import dalvik.system.DexClassLoader;
public class SafetyNet implements ISafetyNetHelper.Callback { 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.red500) int colorBad;
@BindColor(R.color.green500) int colorOK; @BindColor(R.color.green500) int colorOK;
public Unbinder unbinder;
private ExpandableViewHolder expandable; private ExpandableViewHolder expandable;
public SafetyNet(View v) { public SafetyNet(View v) {
new SafetyNet_ViewBinding(this, v); unbinder = new SafetyNet_ViewBinding(this, v);
expandable = new ExpandableViewHolder(expandLayout); expandable = new ExpandableViewHolder(expandLayout);
Context context = v.getContext(); Context context = v.getContext();
safetyNetCard.setVisibility(hasGms(context) && Networking.checkNetworkStatus(context) ? safetyNetCard.setVisibility(hasGms(context) && Networking.checkNetworkStatus(context) ?

View File

@ -11,6 +11,7 @@ import android.widget.TextView;
import com.topjohnwu.magisk.R; import com.topjohnwu.magisk.R;
import butterknife.BindView; import butterknife.BindView;
import butterknife.Unbinder;
public class UpdateCardHolder { public class UpdateCardHolder {
@ -23,10 +24,11 @@ public class UpdateCardHolder {
@BindView(R.id.install) public Button install; @BindView(R.id.install) public Button install;
public View itemView; public View itemView;
public Unbinder unbinder;
public UpdateCardHolder(LayoutInflater inflater, ViewGroup root) { public UpdateCardHolder(LayoutInflater inflater, ViewGroup root) {
itemView = inflater.inflate(R.layout.update_card, root, false); 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) { public void setValid(boolean valid) {

View File

@ -126,6 +126,14 @@ public class MagiskFragment extends BaseFragment
return v; return v;
} }
@Override
public void onDestroyView() {
super.onDestroyView();
safetyNet.unbinder.unbind();
magisk.unbinder.unbind();
manager.unbinder.unbind();
}
@Override @Override
public void onRefresh() { public void onRefresh() {
mSwipeRefreshLayout.setRefreshing(false); mSwipeRefreshLayout.setRefreshing(false);