AppListDialogFragment: add deselect all button

Signed-off-by: Jason A. Donenfeld <Jason@zx2c4.com>
This commit is contained in:
Jason A. Donenfeld 2018-07-06 04:50:51 +02:00
parent 2742b09b5a
commit 7078162c69
2 changed files with 9 additions and 1 deletions

View File

@ -9,6 +9,7 @@ package com.wireguard.android.fragment;
import android.app.Activity; import android.app.Activity;
import android.app.Dialog; import android.app.Dialog;
import android.content.Context; import android.content.Context;
import android.content.DialogInterface;
import android.content.Intent; import android.content.Intent;
import android.content.pm.PackageManager; import android.content.pm.PackageManager;
import android.content.pm.ResolveInfo; import android.content.pm.ResolveInfo;
@ -73,13 +74,19 @@ public class AppListDialogFragment extends DialogFragment {
alertDialogBuilder.setPositiveButton(R.string.set_exclusions, (dialog, which) -> setExclusionsAndDismiss()); alertDialogBuilder.setPositiveButton(R.string.set_exclusions, (dialog, which) -> setExclusionsAndDismiss());
alertDialogBuilder.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss()); alertDialogBuilder.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss());
alertDialogBuilder.setNeutralButton(R.string.deselect_all, (dialog, which) -> { });
binding.setFragment(this); binding.setFragment(this);
binding.setAppData(appData); binding.setAppData(appData);
loadData(); loadData();
return alertDialogBuilder.create(); final AlertDialog dialog = alertDialogBuilder.create();
dialog.setOnShowListener(d -> dialog.getButton(DialogInterface.BUTTON_NEUTRAL).setOnClickListener(view -> {
for (final ApplicationData app : appData)
app.setExcludedFromTunnel(false);
}));
return dialog;
} }
private void loadData() { private void loadData() {

View File

@ -34,6 +34,7 @@
<string name="dark_theme_summary_on">Currently using dark night theme</string> <string name="dark_theme_summary_on">Currently using dark night theme</string>
<string name="dark_theme_summary_off">Currently using light day theme</string> <string name="dark_theme_summary_off">Currently using light day theme</string>
<string name="delete">Delete</string> <string name="delete">Delete</string>
<string name="deselect_all">Deselect All</string>
<string name="select_all">Select all</string> <string name="select_all">Select all</string>
<string name="dns_servers">DNS servers</string> <string name="dns_servers">DNS servers</string>
<string name="edit">Edit</string> <string name="edit">Edit</string>