diff options
author | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-07-06 04:50:51 +0200 |
---|---|---|
committer | Jason A. Donenfeld <Jason@zx2c4.com> | 2018-07-06 18:17:58 +0200 |
commit | 4451dd9efa6c8b5c7e61df04164fc4cd0236b0c2 (patch) | |
tree | 9be679db43c13c1e3120d0d4bcc0796a2b6af457 /app/src/main/java/com/wireguard | |
parent | 720771847c620950e6ebc00e50da82ca28d93230 (diff) |
AppListDialogFragment: add deselect all button
Diffstat (limited to 'app/src/main/java/com/wireguard')
-rw-r--r-- | app/src/main/java/com/wireguard/android/fragment/AppListDialogFragment.java | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/app/src/main/java/com/wireguard/android/fragment/AppListDialogFragment.java b/app/src/main/java/com/wireguard/android/fragment/AppListDialogFragment.java index 1c11bd41..15571297 100644 --- a/app/src/main/java/com/wireguard/android/fragment/AppListDialogFragment.java +++ b/app/src/main/java/com/wireguard/android/fragment/AppListDialogFragment.java @@ -9,6 +9,7 @@ package com.wireguard.android.fragment; import android.app.Activity; import android.app.Dialog; import android.content.Context; +import android.content.DialogInterface; import android.content.Intent; import android.content.pm.PackageManager; import android.content.pm.ResolveInfo; @@ -73,13 +74,19 @@ public class AppListDialogFragment extends DialogFragment { alertDialogBuilder.setPositiveButton(R.string.set_exclusions, (dialog, which) -> setExclusionsAndDismiss()); alertDialogBuilder.setNegativeButton(R.string.cancel, (dialog, which) -> dialog.dismiss()); + alertDialogBuilder.setNeutralButton(R.string.deselect_all, (dialog, which) -> { }); binding.setFragment(this); binding.setAppData(appData); 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() { |