1
0
Fork 0
mirror of https://github.com/M66B/NetGuard.git synced 2024-12-25 01:07:52 +00:00

Refactoring

This commit is contained in:
M66B 2015-10-31 21:28:32 +01:00
parent c769032b58
commit 72f2d683ef

View file

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