mirror of
https://github.com/M66B/NetGuard.git
synced 2024-12-25 09:21:14 +00:00
Refactoring
This commit is contained in:
parent
c769032b58
commit
72f2d683ef
1 changed files with 6 additions and 4 deletions
|
@ -161,13 +161,15 @@ public class RuleAdapter extends RecyclerView.Adapter<RuleAdapter.ViewHolder> im
|
|||
holder.cbUsing.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
|
||||
// Update attribute
|
||||
// Update rule
|
||||
rule.unused = isChecked;
|
||||
SharedPreferences punused = context.getSharedPreferences("unused", Context.MODE_PRIVATE);
|
||||
|
||||
// Store rule
|
||||
SharedPreferences unused = context.getSharedPreferences("unused", Context.MODE_PRIVATE);
|
||||
if (rule.unused)
|
||||
punused.edit().putBoolean(rule.info.packageName, true).apply();
|
||||
unused.edit().putBoolean(rule.info.packageName, true).apply();
|
||||
else
|
||||
punused.edit().remove(rule.info.packageName).apply();
|
||||
unused.edit().remove(rule.info.packageName).apply();
|
||||
|
||||
// Update UI
|
||||
notifyItemChanged(position);
|
||||
|
|
Loading…
Reference in a new issue