mirror of
https://github.com/M66B/NetGuard.git
synced 2025-03-10 06:03:10 +00:00
Disable apply rules and conditions when not filtering
This commit is contained in:
parent
c652f3e90b
commit
8f899e9e41
1 changed files with 5 additions and 4 deletions
|
@ -313,7 +313,11 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
|
||||||
@Override
|
@Override
|
||||||
public void onBindViewHolder(final ViewHolder holder, int position) {
|
public void onBindViewHolder(final ViewHolder holder, int position) {
|
||||||
final Context context = holder.itemView.getContext();
|
final Context context = holder.itemView.getContext();
|
||||||
|
|
||||||
final SharedPreferences prefs = PreferenceManager.getDefaultSharedPreferences(context);
|
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
|
// Get rule
|
||||||
final Rule rule = listFiltered.get(position);
|
final Rule rule = listFiltered.get(position);
|
||||||
|
@ -486,7 +490,7 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
|
||||||
holder.ibLaunch.setVisibility(View.GONE);
|
holder.ibLaunch.setVisibility(View.GONE);
|
||||||
|
|
||||||
// Apply
|
// Apply
|
||||||
holder.cbApply.setEnabled(rule.pkg);
|
holder.cbApply.setEnabled(rule.pkg && filter);
|
||||||
holder.cbApply.setOnCheckedChangeListener(null);
|
holder.cbApply.setOnCheckedChangeListener(null);
|
||||||
holder.cbApply.setChecked(rule.apply);
|
holder.cbApply.setChecked(rule.apply);
|
||||||
holder.cbApply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
holder.cbApply.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||||
|
@ -602,9 +606,6 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
|
||||||
});
|
});
|
||||||
|
|
||||||
// Show logging/filtering is disabled
|
// 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.tvLogging.setText(log_app && filter ? R.string.title_logging_enabled : R.string.title_logging_disabled);
|
||||||
holder.btnLogging.setOnClickListener(new View.OnClickListener() {
|
holder.btnLogging.setOnClickListener(new View.OnClickListener() {
|
||||||
@Override
|
@Override
|
||||||
|
|
Loading…
Add table
Reference in a new issue