Fix string usage for static IP UI
Static IP selection uses strings to match, use ids instead. Also, add CHAR LIMIT to the new strings added Change-Id: I7d632cfd672527be3a9676634b9ac4ea6983b626
This commit is contained in:
@@ -353,10 +353,11 @@
|
||||
</string-array>
|
||||
|
||||
<!-- Wi-Fi IP settings. -->
|
||||
<!-- Note that adding/removing/moving the items will need wifi settings code change. -->
|
||||
<string-array name="wifi_ip_settings">
|
||||
<!-- Do not translate. -->
|
||||
<!-- Use DHCP (Dynamic Host Configuration Protocol) for obtaining IP settings [CHAR LIMIT=25] -->
|
||||
<item>DHCP</item>
|
||||
<!-- Do not translate. -->
|
||||
<!-- Use statically defined IP settings [CHAR LIMIT=25]-->
|
||||
<item>Static</item>
|
||||
</string-array>
|
||||
|
||||
|
@@ -910,7 +910,7 @@
|
||||
<string name="wifi_password">Password</string>
|
||||
<!-- Label for the check box to show password -->
|
||||
<string name="wifi_show_password">Show password</string>
|
||||
<!-- Label for the spinner to show ip settings -->
|
||||
<!-- Label for the spinner to show ip settings [CHAR LIMIT=25] -->
|
||||
<string name="wifi_ip_settings">IP settings</string>
|
||||
<!-- Hint for unchanged fields -->
|
||||
<string name="wifi_unchanged">(unchanged)</string>
|
||||
|
@@ -73,7 +73,8 @@ public class WifiConfigController implements TextWatcher,
|
||||
private TextView mEapIdentityView;
|
||||
private TextView mEapAnonymousView;
|
||||
|
||||
private static final String STATIC_IP = "Static";
|
||||
/* This value comes from "wifi_ip_settings" resource array */
|
||||
private static final int STATIC_IP = 1;
|
||||
|
||||
/* These values come from "wifi_network_setup" resource array */
|
||||
public static final int MANUAL = 0;
|
||||
@@ -175,7 +176,7 @@ public class WifiConfigController implements TextWatcher,
|
||||
if (mAccessPoint != null && mAccessPoint.networkId != INVALID_NETWORK_ID) {
|
||||
WifiConfiguration config = mAccessPoint.getConfig();
|
||||
if (config.ipAssignment == IpAssignment.STATIC) {
|
||||
setSelection(mIpSettingsSpinner, STATIC_IP);
|
||||
mIpSettingsSpinner.setSelection(STATIC_IP);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -286,7 +287,7 @@ public class WifiConfigController implements TextWatcher,
|
||||
return null;
|
||||
}
|
||||
|
||||
config.ipAssignment = mIpSettingsSpinner.getSelectedItem().toString().equals(STATIC_IP) ?
|
||||
config.ipAssignment = (mIpSettingsSpinner.getSelectedItemPosition() == STATIC_IP) ?
|
||||
IpAssignment.STATIC : IpAssignment.DHCP;
|
||||
|
||||
if (config.ipAssignment == IpAssignment.STATIC) {
|
||||
@@ -414,7 +415,7 @@ public class WifiConfigController implements TextWatcher,
|
||||
config = mAccessPoint.getConfig();
|
||||
}
|
||||
|
||||
if (mIpSettingsSpinner.getSelectedItem().equals(STATIC_IP)) {
|
||||
if (mIpSettingsSpinner.getSelectedItemPosition() == STATIC_IP) {
|
||||
mView.findViewById(R.id.staticip).setVisibility(View.VISIBLE);
|
||||
if (mIpAddressView == null) {
|
||||
mIpAddressView = (TextView) mView.findViewById(R.id.ipaddress);
|
||||
|
Reference in New Issue
Block a user