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.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) ?

View File

@ -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) {

View File

@ -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);