Refactoring

This commit is contained in:
M66B 2015-10-31 21:28:32 +01:00
parent c769032b58
commit 72f2d683ef
1 changed files with 6 additions and 4 deletions

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