Added rule title

This commit is contained in:
M66B 2016-07-14 06:48:54 +02:00
parent 596b80c194
commit 79a39492c3
3 changed files with 40 additions and 29 deletions

View File

@ -127,9 +127,10 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
public TextView tvNoLog;
public TextView tvNoFilter;
public ListView lvAccess;
public ImageButton btnClearAccess;
public CheckBox cbNotify;
public CheckBox cbSubmit;
public ImageButton btnClearAccess;
public ViewHolder(View itemView) {
super(itemView);
@ -176,9 +177,10 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
tvNoLog = (TextView) itemView.findViewById(R.id.tvNoLog);
tvNoFilter = (TextView) itemView.findViewById(R.id.tvNoFilter);
lvAccess = (ListView) itemView.findViewById(R.id.lvAccess);
btnClearAccess = (ImageButton) itemView.findViewById(R.id.btnClearAccess);
cbNotify = (CheckBox) itemView.findViewById(R.id.cbNotify);
cbSubmit = (CheckBox) itemView.findViewById(R.id.cbSubmit);
btnClearAccess = (ImageButton) itemView.findViewById(R.id.btnClearAccess);
final View wifiParent = (View) cbWifi.getParent();
wifiParent.post(new Runnable() {
@ -638,6 +640,21 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
holder.lvAccess.setOnItemClickListener(null);
}
// Clear access log
holder.btnClearAccess.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Util.areYouSure(view.getContext(), R.string.msg_reset_access, new Util.DoubtListener() {
@Override
public void onSure() {
DatabaseHelper.getInstance(context).clearAccess(rule.info.applicationInfo.uid, true);
if (rv != null)
rv.scrollToPosition(position);
}
});
}
});
// Notify on access
holder.cbNotify.setEnabled(prefs.getBoolean("notify_access", false) && rule.apply);
holder.cbNotify.setOnCheckedChangeListener(null);
@ -661,21 +678,6 @@ public class AdapterRule extends RecyclerView.Adapter<AdapterRule.ViewHolder> im
updateRule(rule, true, listAll);
}
});
// Clear access log
holder.btnClearAccess.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Util.areYouSure(view.getContext(), R.string.msg_reset_access, new Util.DoubtListener() {
@Override
public void onSure() {
DatabaseHelper.getInstance(context).clearAccess(rule.info.applicationInfo.uid, true);
if (rv != null)
rv.scrollToPosition(position);
}
});
}
});
}
private void updateRule(Rule rule, boolean root, List<Rule> listAll) {

View File

@ -379,6 +379,21 @@
android:layout_height="wrap_content"
android:layout_marginTop="4dp" />
<ImageButton
android:id="@+id/btnClearAccess"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="4dp"
android:src="?attr/iconDelete" />
<TextView
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_marginTop="12dp"
android:text="@string/title_options"
android:textAppearance="@style/TextTitle" />
<CheckBox
android:id="@+id/cbNotify"
android:layout_width="wrap_content"
@ -394,13 +409,5 @@
android:layout_marginTop="4dp"
android:text="@string/title_submit"
android:textAppearance="@style/TextSmall" />
<ImageButton
android:id="@+id/btnClearAccess"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:layout_gravity="center_vertical"
android:layout_marginTop="4dp"
android:src="?attr/iconDelete" />
</LinearLayout>
</LinearLayout>

View File

@ -200,27 +200,29 @@ Your internet traffic is not being sent to a remote VPN server.</string>
<string name="title_roaming_blocked">Block when roaming</string>
<string name="title_metered">By default a Wi-Fi connection is considered to be unmetered and a mobile connection to be metered</string>
<string name="title_internet">has no internet permission</string>
<string name="title_disabled">is disabled</string>
<string name="title_apply">Apply rules and conditions</string>
<string name="title_conditions">Conditions</string>
<string name="title_screen_wifi">Allow Wi-Fi when screen is on</string>
<string name="title_screen_other">Allow mobile when screen is on</string>
<string name="title_roaming_symbol">R</string>
<string name="title_roaming">Block when roaming</string>
<string name="title_disabled">is disabled</string>
<string name="title_internet">has no internet permission</string>
<string name="title_related">Filter related</string>
<string name="title_access">Access attempts</string>
<string name="title_no_log"><u>Logging is not enabled</u></string>
<string name="title_no_filter"><u>Filtering is not enabled</u></string>
<string name="title_precedence">Access rules take precedence over other rules</string>
<string name="title_options">Options</string>
<string name="title_notify">Notify internet access attempts</string>
<string name="title_submit">Share anonymized usage data</string>
<string name="title_rate">Rate</string>
<string name="title_allow">Allow</string>
<string name="title_block">Block</string>
<string name="title_root">root</string>
<string name="title_mediaserver">mediaserver</string>
<string name="title_nobody">nobody</string>
<string name="title_notify">Notify internet access attempts</string>
<string name="title_submit">Share anonymized usage data</string>
<string name="title_dontask">Don\'t ask again</string>
<string name="title_log_whois">Whois %1$s</string>