Change click listener to checked state listener in magisk hide

This commit is contained in:
tonymanou 2017-01-08 15:52:53 +01:00 committed by topjohnwu
parent 61d43b118b
commit cc262d6595

View File

@ -55,15 +55,14 @@ public class ApplicationAdapter extends RecyclerView.Adapter<ApplicationAdapter.
holder.appIcon.setImageDrawable(info.loadIcon(packageManager));
holder.appName.setText(info.loadLabel(packageManager));
holder.appPackage.setText(info.packageName);
holder.checkBox.setChecked(mHideList.contains(info.packageName));
holder.checkBox.setOnClickListener(v -> {
CheckBox chkbox = (CheckBox) v;
if (chkbox.isChecked()) {
holder.checkBox.setOnCheckedChangeListener(null);
holder.checkBox.setChecked(mHideList.contains(info.packageName));
holder.checkBox.setOnCheckedChangeListener((v, isChecked) -> {
if (isChecked) {
new Async.MagiskHide().add(info.packageName);
mHideList.add(info.packageName);
}
else {
} else {
new Async.MagiskHide().rm(info.packageName);
mHideList.remove(info.packageName);
}