From ad828f155154dc36989c07825642ee5f3074b882 Mon Sep 17 00:00:00 2001 From: Charles He Date: Mon, 20 Mar 2017 14:00:06 +0000 Subject: [PATCH] VPN settings: gray out always-on checkbox dynamically In the ConfigDialog for legacy VPNs, many configurations do not support Always-on VPN. Previously, when a user entered an unsupported set of settings, the Always-on VPN checkbox could still be ticked, and the Save or Connect action buttons would be disabled. This was not intuitive as the user could not easily figure out which part of the settings was incompatible that grayed out the action buttons. With this change, we disable the Always-on VPN checkbox immediately as the user enters any incompatible setting. We also display the reason why Always-on VPN is disabled. This will make it more straightforward for the users to understand which setting is conflicting with the Always-on feature. This change is also the first step towards refactoring the ConfigDialog for legacy VPNs with PreferenceFragment. Test: manual Bug: 29208008 Bug: 28072644 Change-Id: I1e6d32a1069ca0b936513f4985ffb9a9412b249c --- res/layout/vpn_dialog.xml | 6 +- res/values/strings.xml | 10 ++++ res/values/styles.xml | 7 +++ .../android/settings/vpn2/ConfigDialog.java | 59 +++++++++++++++---- 4 files changed, 68 insertions(+), 14 deletions(-) diff --git a/res/layout/vpn_dialog.xml b/res/layout/vpn_dialog.xml index 61b08615eb6..7731e6dce93 100644 --- a/res/layout/vpn_dialog.xml +++ b/res/layout/vpn_dialog.xml @@ -119,7 +119,8 @@ + android:orientation="vertical" + android:animateLayoutChanges="true"> @@ -134,6 +135,9 @@ + diff --git a/res/values/strings.xml b/res/values/strings.xml index e7a05350101..fab3a8e7b86 100644 --- a/res/values/strings.xml +++ b/res/values/strings.xml @@ -5375,6 +5375,16 @@ (don\u2019t verify server) (received from server) + + The selected VPN type can\u2019t be always on + + Always-on VPN only supports numeric server addresses + + A DNS server must be specified for always-on VPN + + DNS server addresses must be numeric for always-on VPN + + The information entered doesn\u2019t support always-on VPN Cancel diff --git a/res/values/styles.xml b/res/values/styles.xml index 269250841d8..b63f0daeacb 100644 --- a/res/values/styles.xml +++ b/res/values/styles.xml @@ -284,6 +284,13 @@ true + +