Proxy and IP fixes

Fix dual display of IP addresses for static IP
Fix inputType for proxy and IP fields
Add hint texts for IP fields

Change-Id: I478c915b245592d4738c7d7da2ca1485a247ed39
diff --git a/res/layout/wifi_config_preference.xml b/res/layout/wifi_config_preference.xml
index f19a9ec..6103fb9 100644
--- a/res/layout/wifi_config_preference.xml
+++ b/res/layout/wifi_config_preference.xml
@@ -232,6 +232,7 @@
                     android:layout_width="fill_parent"
                     android:layout_height="wrap_content"
                     android:singleLine="true"
+                    android:inputType="textNoSuggestions"
                     android:hint="@string/proxy_hostname_hint" />
 
             <TextView android:layout_width="fill_parent"
@@ -242,6 +243,7 @@
                     android:layout_width="fill_parent"
                     android:layout_height="wrap_content"
                     android:singleLine="true"
+                    android:inputType="number"
                     android:hint="@string/proxy_port_hint" />
 
             <TextView android:layout_width="fill_parent"
@@ -252,6 +254,7 @@
                     android:layout_width="fill_parent"
                     android:layout_height="wrap_content"
                     android:singleLine="true"
+                    android:inputType="textNoSuggestions"
                     android:hint="@string/proxy_exclusionlist_hint" />
 
         </LinearLayout>
@@ -288,6 +291,7 @@
                 android:layout_width="fill_parent"
                 android:layout_height="wrap_content"
                 android:singleLine="true"
+                android:hint="wifi_ip_address_hint"
                 android:inputType="textNoSuggestions" />
 
             <TextView
@@ -299,6 +303,7 @@
                 android:layout_width="fill_parent"
                 android:layout_height="wrap_content"
                 android:singleLine="true"
+                android:hint="wifi_gateway_hint"
                 android:inputType="textNoSuggestions" />
 
             <TextView
@@ -310,7 +315,8 @@
                 android:layout_width="fill_parent"
                 android:layout_height="wrap_content"
                 android:singleLine="true"
-                android:inputType="textNoSuggestions" />
+                android:hint="wifi_network_prefix_length_hint"
+                android:inputType="number" />
 
             <TextView
                 android:layout_width="fill_parent"
@@ -321,6 +327,7 @@
                 android:layout_width="fill_parent"
                 android:layout_height="wrap_content"
                 android:singleLine="true"
+                android:hint="wifi_dns1_hint"
                 android:inputType="textNoSuggestions" />
 
             <TextView
@@ -332,6 +339,7 @@
                 android:layout_width="fill_parent"
                 android:layout_height="wrap_content"
                 android:singleLine="true"
+                android:hint="wifi_dns2_hint"
                 android:inputType="textNoSuggestions" />
     </LinearLayout>
 
diff --git a/res/layout/wifi_dialog.xml b/res/layout/wifi_dialog.xml
index 7d199bd..f502d6d 100644
--- a/res/layout/wifi_dialog.xml
+++ b/res/layout/wifi_dialog.xml
@@ -227,6 +227,7 @@
                 <EditText android:id="@+id/proxy_hostname"
                         style="@style/wifi_item_content"
                         android:hint="@string/proxy_hostname_hint"
+                        android:inputType="textNoSuggestions"
                         android:singleLine="true" />
             </LinearLayout>
             <LinearLayout style="@style/wifi_item">
@@ -237,6 +238,7 @@
                 <EditText android:id="@+id/proxy_port"
                         style="@style/wifi_item_content"
                         android:hint="@string/proxy_port_hint"
+                        android:inputType="number"
                         android:singleLine="true" />
             </LinearLayout>
             <LinearLayout style="@style/wifi_item">
@@ -247,6 +249,7 @@
                 <EditText android:id="@+id/proxy_exclusionlist"
                         style="@style/wifi_item_content"
                         android:hint="@string/proxy_exclusionlist_hint"
+                        android:inputType="textNoSuggestions"
                         android:singleLine="true" />
             </LinearLayout>
         </LinearLayout>
@@ -278,6 +281,7 @@
                 <EditText android:id="@+id/ipaddress"
                         style="@style/wifi_item_content"
                         android:singleLine="true"
+                        android:hint="@string/wifi_ip_address_hint"
                         android:inputType="textNoSuggestions" />
             </LinearLayout>
 
@@ -290,6 +294,7 @@
                 <EditText android:id="@+id/gateway"
                         style="@style/wifi_item_content"
                         android:singleLine="true"
+                        android:hint="@string/wifi_gateway_hint"
                         android:inputType="textNoSuggestions" />
             </LinearLayout>
 
@@ -302,7 +307,8 @@
                 <EditText android:id="@+id/network_prefix_length"
                         style="@style/wifi_item_content"
                         android:singleLine="true"
-                        android:inputType="textNoSuggestions" />
+                        android:hint="@string/wifi_network_prefix_length_hint"
+                        android:inputType="number" />
             </LinearLayout>
             <LinearLayout
                     style="@style/wifi_item" >
@@ -313,6 +319,7 @@
                 <EditText android:id="@+id/dns1"
                         style="@style/wifi_item_content"
                         android:singleLine="true"
+                        android:hint="@string/wifi_dns1_hint"
                         android:inputType="textNoSuggestions" />
             </LinearLayout>
 
@@ -325,6 +332,7 @@
                 <EditText android:id="@+id/dns2"
                         style="@style/wifi_item_content"
                         android:singleLine="true"
+                        android:hint="@string/wifi_dns2_hint"
                         android:inputType="textNoSuggestions" />
             </LinearLayout>
         </LinearLayout>
diff --git a/res/values/strings.xml b/res/values/strings.xml
index 0b39a2c..374b8df 100644
--- a/res/values/strings.xml
+++ b/res/values/strings.xml
@@ -1092,6 +1092,8 @@
     <string name="wifi_speed">Link speed</string>
     <!-- Label for the IP address of the connection -->
     <string name="wifi_ip_address">IP address</string>
+    <!-- Hint text for the IP address [CHAR LIMIT=25]-->
+    <string name="wifi_ip_address_hint">192.168.1.128</string>
     <!-- Label for the EAP method of the network -->
     <string name="wifi_eap_method">EAP method</string>
     <!-- Label for the phase2 -->
@@ -1171,12 +1173,20 @@
     <string name="wifi_ip_settings_invalid_network_prefix_length">Please type a network prefix length between 0 and 32.</string>
     <!-- Label for the DNS (first one) -->
     <string name="wifi_dns1">DNS 1</string>
+    <!-- Hint text for DNS [CHAR LIMIT=25]-->
+    <string name="wifi_dns1_hint">8.8.8.8</string>
     <!-- Label for the DNS (second one)-->
     <string name="wifi_dns2">DNS 2</string>
+    <!-- Hint text for DNS [CHAR LIMIT=25]-->
+    <string name="wifi_dns2_hint">4.4.4.4</string>
     <!-- Label for the gateway of the network -->
     <string name="wifi_gateway">Gateway</string>
+    <!-- Hint text for the gateway [CHAR LIMIT=25]-->
+    <string name="wifi_gateway_hint">192.168.1.1</string>
     <!-- Label for the network prefix of the network [CHAR LIMIT=25]-->
     <string name="wifi_network_prefix_length">Network prefix length</string>
+    <!-- Hint text for network prefix length [CHAR LIMIT=25] -->
+    <string name="wifi_network_prefix_length_hint">24</string>
 
     <!-- Wifi AP settings-->
     <!-- Label for wifi tether checkbox. Toggles Access Point on/off -->
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index 3efedf6..0d24298 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -198,11 +198,6 @@
             WifiInfo info = mAccessPoint.getInfo();
             if (info != null) {
                 addRow(group, R.string.wifi_speed, info.getLinkSpeed() + WifiInfo.LINK_SPEED_UNITS);
-                // TODO: fix the ip address for IPv6.
-                int address = info.getIpAddress();
-                if (address != 0) {
-                    addRow(group, R.string.wifi_ip_address, Formatter.formatIpAddress(address));
-                }
             }
 
             if (mAccessPoint.networkId != INVALID_NETWORK_ID) {
@@ -211,6 +206,10 @@
                     mIpSettingsSpinner.setSelection(STATIC_IP);
                 } else {
                     mIpSettingsSpinner.setSelection(DHCP);
+                    //Display IP addresses
+                    for(InetAddress a : config.linkProperties.getAddresses()) {
+                        addRow(group, R.string.wifi_ip_address, a.getHostAddress());
+                    }
                 }
 
                 if (config.proxySettings == ProxySettings.STATIC) {