mirror of https://github.com/M66B/NetGuard.git
Added quick config setting
This commit is contained in:
parent
55e35cacbb
commit
ecbfad3f8a
|
@ -590,6 +590,7 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> 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
|
||||
|
@ -599,17 +600,26 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
|
|||
|
||||
final CheckBox cbLogging = (CheckBox) view.findViewById(R.id.cbLogging);
|
||||
final CheckBox cbFiltering = (CheckBox) view.findViewById(R.id.cbFiltering);
|
||||
final CheckBox cbNotify = (CheckBox) view.findViewById(R.id.cbNotify);
|
||||
TextView tvFilter4 = (TextView) view.findViewById(R.id.tvFilter4);
|
||||
|
||||
cbLogging.setChecked(log_app);
|
||||
cbFiltering.setChecked(filter);
|
||||
cbFiltering.setEnabled(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP);
|
||||
tvFilter4.setVisibility(Build.VERSION.SDK_INT >= Build.VERSION_CODES.LOLLIPOP ? View.GONE : View.VISIBLE);
|
||||
cbNotify.setChecked(notify_access);
|
||||
cbNotify.setEnabled(log_app);
|
||||
|
||||
cbLogging.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("log_app", checked).apply();
|
||||
cbNotify.setEnabled(checked);
|
||||
if (!checked) {
|
||||
cbNotify.setChecked(false);
|
||||
prefs.edit().putBoolean("notify_access", false).apply();
|
||||
ServiceSinkhole.reload("changed notify", context, false);
|
||||
}
|
||||
AdapterRule.this.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
|
@ -625,6 +635,15 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
|
|||
}
|
||||
});
|
||||
|
||||
cbNotify.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
|
||||
@Override
|
||||
public void onCheckedChanged(CompoundButton compoundButton, boolean checked) {
|
||||
prefs.edit().putBoolean("notify_access", checked).apply();
|
||||
ServiceSinkhole.reload("changed notify", context, false);
|
||||
AdapterRule.this.notifyDataSetChanged();
|
||||
}
|
||||
});
|
||||
|
||||
AlertDialog dialog = new AlertDialog.Builder(context)
|
||||
.setView(view)
|
||||
.setCancelable(true)
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
android:layout_width="match_parent"
|
||||
android:layout_height="match_parent"
|
||||
android:orientation="vertical"
|
||||
android:padding="16dp">
|
||||
|
||||
<LinearLayout
|
||||
android:layout_width="match_parent"
|
||||
|
@ -14,7 +14,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_gravity="center_vertical"
|
||||
android:src="@mipmap/ic_launcher"/>
|
||||
android:src="@mipmap/ic_launcher" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
|
@ -24,7 +24,7 @@
|
|||
android:layout_marginStart="8dp"
|
||||
android:text="@string/app_name"
|
||||
android:textAppearance="@style/TextLarge"
|
||||
android:textStyle="bold"/>
|
||||
android:textStyle="bold" />
|
||||
</LinearLayout>
|
||||
|
||||
<ScrollView
|
||||
|
@ -43,7 +43,7 @@
|
|||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:text="@string/title_enable_logging"
|
||||
android:textAppearance="@style/TextMedium"/>
|
||||
android:textAppearance="@style/TextMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbFiltering"
|
||||
|
@ -51,7 +51,15 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/title_enable_filtering"
|
||||
android:textAppearance="@style/TextMedium"/>
|
||||
android:textAppearance="@style/TextMedium" />
|
||||
|
||||
<CheckBox
|
||||
android:id="@+id/cbNotify"
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/title_enable_notify"
|
||||
android:textAppearance="@style/TextMedium" />
|
||||
|
||||
<TextView
|
||||
android:id="@+id/tvFilter4"
|
||||
|
@ -59,35 +67,35 @@
|
|||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/msg_filter4"
|
||||
android:textAppearance="@style/TextMedium"/>
|
||||
android:textAppearance="@style/TextMedium" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/title_enable_help0"
|
||||
android:textAppearance="@style/TextMedium"/>
|
||||
android:textAppearance="@style/TextMedium" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/title_enable_help1"
|
||||
android:textAppearance="@style/TextMedium"/>
|
||||
android:textAppearance="@style/TextMedium" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/title_enable_help2"
|
||||
android:textAppearance="@style/TextMedium"/>
|
||||
android:textAppearance="@style/TextMedium" />
|
||||
|
||||
<TextView
|
||||
android:layout_width="wrap_content"
|
||||
android:layout_height="wrap_content"
|
||||
android:layout_marginTop="16dp"
|
||||
android:text="@string/msg_filter"
|
||||
android:textAppearance="@style/TextMedium"/>
|
||||
android:textAppearance="@style/TextMedium" />
|
||||
</LinearLayout>
|
||||
</ScrollView>
|
||||
</LinearLayout>
|
||||
|
|
|
@ -252,7 +252,8 @@ Your internet traffic is not being sent to a remote VPN server.</string>
|
|||
|
||||
<string name="title_enable_logging">Enable logging of blocked addresses only</string>
|
||||
<string name="title_enable_filtering">Enable filtering to log allowed addresses too</string>
|
||||
<string name="title_enable_help0">Logging and filtering are global settings that apply to all applications</string>
|
||||
<string name="title_enable_notify">Enable access notifications for newly logged addresses</string>
|
||||
<string name="title_enable_help0">These settings are global settings that apply to all applications</string>
|
||||
<string name="title_enable_help1">Filtering is also required to allow or block individual addresses</string>
|
||||
<string name="title_enable_help2">Enabling logging (less) or filtering (more) might increase battery usage and might affect network speed</string>
|
||||
|
||||
|
|
Loading…
Reference in New Issue