Re-enable wifi proxy UI

- Add text to warn users about support
- Move proxy above IP settings based on UI recommendations

Bug: 3328410
Change-Id: I3b5aafd32b16adfcd2fadb572ebb2694afdeccbb
diff --git a/res/layout/wifi_config_preference.xml b/res/layout/wifi_config_preference.xml
index 9c1844b..913222f 100644
--- a/res/layout/wifi_config_preference.xml
+++ b/res/layout/wifi_config_preference.xml
@@ -184,84 +184,6 @@
                   android:text="@string/wifi_show_password" />
     </LinearLayout>  <!-- android:id="@+id/security_fields" -->
 
-    <LinearLayout android:id="@+id/ip_fields"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:orientation="vertical"
-                  android:visibility="gone">
-
-        <TextView
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/wifi_ip_settings" />
-
-        <Spinner android:id="@+id/ip_settings"
-                 android:layout_width="fill_parent"
-                 android:layout_height="wrap_content"
-                 android:prompt="@string/wifi_ip_settings"
-                 android:entries="@array/wifi_ip_settings" />
-    </LinearLayout>
-
-    <LinearLayout android:id="@+id/staticip"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:orientation="vertical"
-                  android:visibility="gone">
-        <TextView
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/wifi_ip_address" />
-
-        <EditText android:id="@+id/ipaddress"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:singleLine="true"
-                  android:inputType="textNoSuggestions" />
-
-        <TextView
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/wifi_gateway" />
-
-        <EditText android:id="@+id/gateway"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:singleLine="true"
-                  android:inputType="textNoSuggestions" />
-
-        <TextView
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/wifi_network_prefix_length" />
-
-        <EditText android:id="@+id/network_prefix_length"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:singleLine="true"
-                  android:inputType="textNoSuggestions" />
-
-        <TextView
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/wifi_dns1" />
-
-        <EditText android:id="@+id/dns1"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:singleLine="true"
-                  android:inputType="textNoSuggestions" />
-
-        <TextView
-            android:layout_width="fill_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/wifi_dns2" />
-
-        <EditText android:id="@+id/dns2"
-                  android:layout_width="fill_parent"
-                  android:layout_height="wrap_content"
-                  android:singleLine="true"
-                  android:inputType="textNoSuggestions" />
-
         <LinearLayout android:id="@+id/proxy_settings_fields"
                 android:layout_width="fill_parent"
                 android:layout_height="wrap_content"
@@ -279,6 +201,23 @@
                     android:entries="@array/wifi_proxy_settings" />
         </LinearLayout>
 
+        <LinearLayout android:id="@+id/proxy_warning_limited_support"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:orientation="vertical"
+                android:visibility="gone">
+
+            <!--  Dummy to enable right-justification of warning -->
+            <TextView
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content" />
+
+            <TextView
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/proxy_warning_limited_support" />
+        </LinearLayout>
+
         <LinearLayout android:id="@+id/proxy_fields"
                 android:layout_width="fill_parent"
                 android:layout_height="wrap_content"
@@ -315,6 +254,84 @@
                     android:inputType="textNoSuggestions" />
 
         </LinearLayout>
+
+        <LinearLayout android:id="@+id/ip_fields"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:orientation="vertical"
+                android:visibility="gone">
+
+            <TextView
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/wifi_ip_settings" />
+
+            <Spinner android:id="@+id/ip_settings"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:prompt="@string/wifi_ip_settings"
+                android:entries="@array/wifi_ip_settings" />
+        </LinearLayout>
+
+        <LinearLayout android:id="@+id/staticip"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:orientation="vertical"
+                android:visibility="gone">
+            <TextView
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/wifi_ip_address" />
+
+            <EditText android:id="@+id/ipaddress"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:singleLine="true"
+                android:inputType="textNoSuggestions" />
+
+            <TextView
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/wifi_gateway" />
+
+            <EditText android:id="@+id/gateway"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:singleLine="true"
+                android:inputType="textNoSuggestions" />
+
+            <TextView
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/wifi_network_prefix_length" />
+
+            <EditText android:id="@+id/network_prefix_length"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:singleLine="true"
+                android:inputType="textNoSuggestions" />
+
+            <TextView
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/wifi_dns1" />
+
+            <EditText android:id="@+id/dns1"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:singleLine="true"
+                android:inputType="textNoSuggestions" />
+
+            <TextView
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/wifi_dns2" />
+
+            <EditText android:id="@+id/dns2"
+                android:layout_width="fill_parent"
+                android:layout_height="wrap_content"
+                android:singleLine="true"
+                android:inputType="textNoSuggestions" />
     </LinearLayout>
 
 </LinearLayout>
diff --git a/res/layout/wifi_config_ui_for_setup_wizard.xml b/res/layout/wifi_config_ui_for_setup_wizard.xml
index 15778ef..ed5f9c2 100644
--- a/res/layout/wifi_config_ui_for_setup_wizard.xml
+++ b/res/layout/wifi_config_ui_for_setup_wizard.xml
@@ -322,84 +322,6 @@
                   android:text="@string/wifi_show_password" /> -->
     </LinearLayout>  <!-- android:id="@+id/security_fields" -->
 
-    <LinearLayout android:id="@+id/ip_fields"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:orientation="vertical"
-                  android:visibility="gone">
-
-        <TextView
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/wifi_ip_settings" />
-
-        <Spinner android:id="@+id/ip_settings"
-                 android:layout_width="match_parent"
-                 android:layout_height="wrap_content"
-                 android:prompt="@string/wifi_ip_settings"
-                 android:entries="@array/wifi_ip_settings" />
-    </LinearLayout>
-
-    <LinearLayout android:id="@+id/staticip"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:orientation="vertical"
-                  android:visibility="gone">
-        <TextView
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/wifi_ip_address" />
-
-        <EditText android:id="@+id/ipaddress"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:singleLine="true"
-                  android:inputType="textNoSuggestions" />
-
-        <TextView
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/wifi_gateway" />
-
-        <EditText android:id="@+id/gateway"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:singleLine="true"
-                  android:inputType="textNoSuggestions" />
-
-        <TextView
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/wifi_network_prefix_length" />
-
-        <EditText android:id="@+id/network_prefix_length"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:singleLine="true"
-                  android:inputType="textNoSuggestions" />
-
-        <TextView
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/wifi_dns1" />
-
-        <EditText android:id="@+id/dns1"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:singleLine="true"
-                  android:inputType="textNoSuggestions" />
-
-        <TextView
-            android:layout_width="match_parent"
-            android:layout_height="wrap_content"
-            android:text="@string/wifi_dns2" />
-
-        <EditText android:id="@+id/dns2"
-                  android:layout_width="match_parent"
-                  android:layout_height="wrap_content"
-                  android:singleLine="true"
-                  android:inputType="textNoSuggestions" />
-
         <LinearLayout android:id="@+id/proxy_settings_fields"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
@@ -418,6 +340,23 @@
                     android:entries="@array/wifi_proxy_settings" />
         </LinearLayout>
 
+        <LinearLayout android:id="@+id/proxy_warning_limited_support"
+                  android:layout_width="match_parent"
+                  android:layout_height="wrap_content"
+                  android:orientation="vertical"
+                  android:visibility="gone">
+
+                <!--  Dummy to enable right-justification of warning -->
+                <TextView
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content" />
+
+                <TextView
+                    android:layout_width="match_parent"
+                    android:layout_height="wrap_content"
+                    android:text="@string/proxy_warning_limited_support" />
+        </LinearLayout>
+
         <LinearLayout android:id="@+id/proxy_fields"
                 android:layout_width="match_parent"
                 android:layout_height="wrap_content"
@@ -454,7 +393,85 @@
                     android:inputType="textNoSuggestions" />
 
         </LinearLayout>
-    </LinearLayout>
 
+        <LinearLayout android:id="@+id/ip_fields"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="vertical"
+                android:visibility="gone">
+
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/wifi_ip_settings" />
+
+            <Spinner android:id="@+id/ip_settings"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:prompt="@string/wifi_ip_settings"
+                android:entries="@array/wifi_ip_settings" />
+        </LinearLayout>
+
+        <LinearLayout android:id="@+id/staticip"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:orientation="vertical"
+                android:visibility="gone">
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/wifi_ip_address" />
+
+            <EditText android:id="@+id/ipaddress"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:singleLine="true"
+                android:inputType="textNoSuggestions" />
+
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/wifi_gateway" />
+
+            <EditText android:id="@+id/gateway"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:singleLine="true"
+                android:inputType="textNoSuggestions" />
+
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/wifi_network_prefix_length" />
+
+            <EditText android:id="@+id/network_prefix_length"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:singleLine="true"
+                android:inputType="textNoSuggestions" />
+
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/wifi_dns1" />
+
+            <EditText android:id="@+id/dns1"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:singleLine="true"
+                android:inputType="textNoSuggestions" />
+
+            <TextView
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:text="@string/wifi_dns2" />
+
+            <EditText android:id="@+id/dns2"
+                android:layout_width="match_parent"
+                android:layout_height="wrap_content"
+                android:singleLine="true"
+                android:inputType="textNoSuggestions" />
+
+        </LinearLayout>
     </LinearLayout>
 </LinearLayout>
diff --git a/res/layout/wifi_dialog.xml b/res/layout/wifi_dialog.xml
index 35ca6f0..a530a84 100644
--- a/res/layout/wifi_dialog.xml
+++ b/res/layout/wifi_dialog.xml
@@ -189,6 +189,67 @@
             </LinearLayout>
         </LinearLayout>
 
+        <LinearLayout android:id="@+id/proxy_settings_fields"
+                style="@style/wifi_item"
+                android:visibility="gone">
+
+            <TextView android:id="@+id/proxy_settings_title"
+                    style="@style/wifi_item_label"
+                    android:text="@string/proxy_settings_title" />
+
+            <Spinner android:id="@+id/proxy_settings"
+                    style="@style/wifi_item_content"
+                    android:prompt="@string/proxy_settings_title"
+                    android:entries="@array/wifi_proxy_settings" />
+        </LinearLayout>
+
+        <LinearLayout android:id="@+id/proxy_warning_limited_support"
+                    style="@style/wifi_item"
+                    android:visibility="gone">
+                <!--  Dummy to enable right-justification of warning -->
+                <TextView
+                    style="@style/wifi_item_label" />
+
+                <TextView
+                    style="@style/wifi_item_content"
+                    android:text="@string/proxy_warning_limited_support" />
+        </LinearLayout>
+
+        <LinearLayout android:id="@+id/proxy_fields"
+                style="@style/wifi_section"
+                android:visibility="gone">
+            <LinearLayout style="@style/wifi_item">
+                <TextView
+                        style="@style/wifi_item_label"
+                        android:text="@string/proxy_hostname_label" />
+
+                <EditText android:id="@+id/proxy_hostname"
+                        style="@style/wifi_item_content"
+                        android:singleLine="true"
+                        android:inputType="textNoSuggestions" />
+            </LinearLayout>
+            <LinearLayout style="@style/wifi_item">
+                <TextView
+                        style="@style/wifi_item_label"
+                        android:text="@string/proxy_port_label" />
+
+                <EditText android:id="@+id/proxy_port"
+                        style="@style/wifi_item_content"
+                        android:singleLine="true"
+                        android:inputType="textNoSuggestions" />
+            </LinearLayout>
+            <LinearLayout style="@style/wifi_item">
+                <TextView
+                        style="@style/wifi_item_label"
+                        android:text="@string/proxy_exclusionlist_label" />
+
+                <EditText android:id="@+id/proxy_exclusionlist"
+                        style="@style/wifi_item_content"
+                        android:singleLine="true"
+                        android:inputType="textNoSuggestions" />
+            </LinearLayout>
+        </LinearLayout>
+
         <LinearLayout android:id="@+id/ip_fields"
                 style="@style/wifi_item"
                 android:visibility="gone">
@@ -218,7 +279,7 @@
                         android:singleLine="true"
                         android:inputType="textNoSuggestions" />
             </LinearLayout>
-            
+
             <LinearLayout
                     style="@style/wifi_item" >
                 <TextView
@@ -267,54 +328,5 @@
             </LinearLayout>
         </LinearLayout>
 
-        <LinearLayout android:id="@+id/proxy_settings_fields"
-                style="@style/wifi_item"
-                android:visibility="gone">
-
-            <TextView android:id="@+id/proxy_settings_title"
-                    style="@style/wifi_item_label"
-                    android:text="@string/proxy_settings_title" />
-
-            <Spinner android:id="@+id/proxy_settings"
-                    style="@style/wifi_item_content"
-                    android:prompt="@string/proxy_settings_title"
-                    android:entries="@array/wifi_proxy_settings" />
-        </LinearLayout>
-
-        <LinearLayout android:id="@+id/proxy_fields"
-                style="@style/wifi_section"
-                android:visibility="gone">
-            <LinearLayout style="@style/wifi_item">
-                <TextView
-                        style="@style/wifi_item_label"
-                        android:text="@string/proxy_hostname_label" />
-
-                <EditText android:id="@+id/proxy_hostname"
-                        style="@style/wifi_item_content"
-                        android:singleLine="true"
-                        android:inputType="textNoSuggestions" />
-            </LinearLayout>
-            <LinearLayout style="@style/wifi_item">
-                <TextView
-                        style="@style/wifi_item_label"
-                        android:text="@string/proxy_port_label" />
-
-                <EditText android:id="@+id/proxy_port"
-                        style="@style/wifi_item_content"
-                        android:singleLine="true"
-                        android:inputType="textNoSuggestions" />
-            </LinearLayout>
-            <LinearLayout style="@style/wifi_item">
-                <TextView
-                        style="@style/wifi_item_label"
-                        android:text="@string/proxy_exclusionlist_label" />
-
-                <EditText android:id="@+id/proxy_exclusionlist"
-                        style="@style/wifi_item_content"
-                        android:singleLine="true"
-                        android:inputType="textNoSuggestions" />
-            </LinearLayout>
-        </LinearLayout>
-
     </LinearLayout>
 </ScrollView>
diff --git a/res/values/arrays.xml b/res/values/arrays.xml
index 6d55264..8f5f16a 100644
--- a/res/values/arrays.xml
+++ b/res/values/arrays.xml
@@ -414,8 +414,8 @@
     <string-array name="wifi_proxy_settings">
         <!-- No HTTP proxy is used for the current wifi network [CHAR LIMIT=25] -->
         <item>None</item>
-        <!-- Static HTTP proxy settings are used for the current wifi network [CHAR LIMIT=25] -->
-        <item>Static</item>
+        <!-- Manual HTTP proxy settings are used for the current wifi network [CHAR LIMIT=25] -->
+        <item>Manual</item>
     </string-array>
 
     <!-- Sound settings for emergency tone. -->
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 5cc4d73..b8bd7b1 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -312,7 +312,7 @@
     <!-- HTTP proxy settings. Button to clear the proxy box. -->
     <string name="proxy_clear_text">Clear</string>
     <!-- HTTP proxy settings. The port number label. -->
-    <string name="proxy_port_label">Port</string>
+    <string name="proxy_port_label">Proxy port</string>
     <!-- HTTP proxy settings. The exclusion list label. -->
     <string name="proxy_exclusionlist_label">No Proxy for</string>
     <!-- HTTP proxy settings. The button to restore the defaults. -->
@@ -320,7 +320,7 @@
     <!-- HTTP proxy settings. The button to save. -->
     <string name="proxy_action_text">Done</string>
     <!-- HTTP proxy settings. The text field for the hostname -->
-    <string name="proxy_hostname_label">Hostname</string>
+    <string name="proxy_hostname_label">Proxy hostname</string>
     <!-- HTTP proxy settings. Title if there is an error-->
     <string name="proxy_error">Attention</string>
     <!-- HTTP proxy settings. Button to get rid of error box-->
@@ -335,6 +335,8 @@
     <string name="proxy_error_empty_host_set_port">The port field must be empty if the host field is empty.</string>
     <!-- HTTP proxy settings. Error msg -->
     <string name="proxy_error_invalid_port">The port you typed is not valid.</string>
+    <!-- HTTP proxy settings. Warning message about limited application support [CHAR LIMIT=100]-->
+    <string name="proxy_warning_limited_support">The HTTP proxy is used by the browser but may not be used by the other applications</string>
 
     <!-- Radio Info screen. Label for a status item.  Used for diagnostic info screens, precise translation isn't needed -->
     <string name="radio_info_signal_location_label">Location:</string>
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index 750e168..9643220 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -173,9 +173,6 @@
             mIpSettingsSpinner = (Spinner) mView.findViewById(R.id.ip_settings);
             mIpSettingsSpinner.setOnItemSelectedListener(this);
             mProxySettingsSpinner = (Spinner) mView.findViewById(R.id.proxy_settings);
-            // disable proxy UI until we have better app support
-            mProxySettingsSpinner.setVisibility(View.GONE);
-            mView.findViewById(R.id.proxy_settings_title).setVisibility(View.GONE);
             mProxySettingsSpinner.setOnItemSelectedListener(this);
 
             ViewGroup group = (ViewGroup) mView.findViewById(R.id.info);
@@ -621,6 +618,7 @@
         }
 
         if (mProxySettingsSpinner.getSelectedItemPosition() == PROXY_STATIC) {
+            mView.findViewById(R.id.proxy_warning_limited_support).setVisibility(View.VISIBLE);
             mView.findViewById(R.id.proxy_fields).setVisibility(View.VISIBLE);
             if (mProxyHostView == null) {
                 mProxyHostView = (TextView) mView.findViewById(R.id.proxy_hostname);
@@ -636,6 +634,7 @@
                 }
             }
         } else {
+            mView.findViewById(R.id.proxy_warning_limited_support).setVisibility(View.GONE);
             mView.findViewById(R.id.proxy_fields).setVisibility(View.GONE);
         }
     }