From 8f899e9e41c74d9f4396d3b0c4099188539cc410 Mon Sep 17 00:00:00 2001 From: M66B Date: Sun, 21 Jul 2019 12:31:52 +0200 Subject: [PATCH] Disable apply rules and conditions when not filtering --- app/src/main/java/eu/faircode/netguard/AdapterRule.java | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/app/src/main/java/eu/faircode/netguard/AdapterRule.java b/app/src/main/java/eu/faircode/netguard/AdapterRule.java index 98db2310..978c9e5b 100644 --- a/app/src/main/java/eu/faircode/netguard/AdapterRule.java +++ b/app/src/main/java/eu/faircode/netguard/AdapterRule.java @@ -313,7 +313,11 @@ public class AdapterRule extends RecyclerView.Adapter im @Override public void onBindViewHolder(final ViewHolder holder, int position) { final Context context = holder.itemView.getContext(); + final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context); + final boolean log_app = prefs.getBoolean("log_app", false); + final boolean filter = prefs.getBoolean("filter", false); + final boolean notify_access = prefs.getBoolean("notify_access", false); // Get rule final Rule rule = listFiltered.get(position); @@ -486,7 +490,7 @@ public class AdapterRule extends RecyclerView.Adapter im holder.ibLaunch.setVisibility(View.GONE); // Apply - holder.cbApply.setEnabled(rule.pkg); + holder.cbApply.setEnabled(rule.pkg && filter); holder.cbApply.setOnCheckedChangeListener(null); holder.cbApply.setChecked(rule.apply); holder.cbApply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() { @@ -602,9 +606,6 @@ public class AdapterRule extends RecyclerView.Adapter im }); // Show logging/filtering is disabled - final boolean log_app = prefs.getBoolean("log_app", false); - final boolean filter = prefs.getBoolean("filter", false); - final boolean notify_access = prefs.getBoolean("notify_access", false); holder.tvLogging.setText(log_app && filter ? R.string.title_logging_enabled : R.string.title_logging_disabled); holder.btnLogging.setOnClickListener(new View.OnClickListener() { @Override