summaryrefslogtreecommitdiffstats
path: root/src/com/android/settings/wifi/WifiConfigController.java
diff options
context:
space:
mode:
authorChen Hong <hong.chen@tieto.com>2013-07-10 17:00:10 +0800
committerChen Hong <hong.chen@tieto.com>2013-07-11 11:19:00 +0800
commit3f9e2aec2e53fb025f0bd6160c7e403f9f8e22e3 (patch)
tree9b922de000a02de679c1348433fd8e3e4a296c42 /src/com/android/settings/wifi/WifiConfigController.java
parenta1454529c3eb6d0e87b254888abfea3bb714f7fe (diff)
downloadpackages_apps_Settings-3f9e2aec2e53fb025f0bd6160c7e403f9f8e22e3.tar.gz
packages_apps_Settings-3f9e2aec2e53fb025f0bd6160c7e403f9f8e22e3.tar.bz2
packages_apps_Settings-3f9e2aec2e53fb025f0bd6160c7e403f9f8e22e3.zip
Fix issue 52986: Wifi settings abnormal when screen rotation
When checked "Show Advanced settings" in wifi setup wifi setup wizard, and rotate the phone to landscape, the advanced settings are gone, but the checkbox is still checked. It's because of checkbox is set click listener but not checked changed listener, it can't handle checkbox's status properly. Change-Id: I2930cab4d0878c3d91db46560f837ca21d45da4d
Diffstat (limited to 'src/com/android/settings/wifi/WifiConfigController.java')
-rw-r--r--src/com/android/settings/wifi/WifiConfigController.java22
1 files changed, 14 insertions, 8 deletions
diff --git a/src/com/android/settings/wifi/WifiConfigController.java b/src/com/android/settings/wifi/WifiConfigController.java
index 60ab1ca3a..a2b76e442 100644
--- a/src/com/android/settings/wifi/WifiConfigController.java
+++ b/src/com/android/settings/wifi/WifiConfigController.java
@@ -52,6 +52,8 @@ import android.widget.CheckBox;
import android.widget.EditText;
import android.widget.Spinner;
import android.widget.TextView;
+import android.widget.CompoundButton;
+import android.widget.CompoundButton.OnCheckedChangeListener;
import com.android.settings.ProxySelector;
import com.android.settings.R;
@@ -64,7 +66,7 @@ import java.util.Iterator;
* share the logic for controlling buttons, text fields, etc.
*/
public class WifiConfigController implements TextWatcher,
- View.OnClickListener, AdapterView.OnItemSelectedListener {
+ AdapterView.OnItemSelectedListener, OnCheckedChangeListener {
private final WifiConfigUiBase mConfigUi;
private final View mView;
private final AccessPoint mAccessPoint;
@@ -191,7 +193,9 @@ public class WifiConfigController implements TextWatcher,
showIpConfigFields();
showProxyFields();
mView.findViewById(R.id.wifi_advanced_toggle).setVisibility(View.VISIBLE);
- mView.findViewById(R.id.wifi_advanced_togglebox).setOnClickListener(this);
+ ((CheckBox)mView.findViewById(R.id.wifi_advanced_togglebox))
+ .setOnCheckedChangeListener(this);
+
mConfigUi.setSubmitButton(context.getString(R.string.wifi_save));
} else {
@@ -245,9 +249,10 @@ public class WifiConfigController implements TextWatcher,
showIpConfigFields();
showProxyFields();
mView.findViewById(R.id.wifi_advanced_toggle).setVisibility(View.VISIBLE);
- mView.findViewById(R.id.wifi_advanced_togglebox).setOnClickListener(this);
+ ((CheckBox)mView.findViewById(R.id.wifi_advanced_togglebox))
+ .setOnCheckedChangeListener(this);
if (showAdvancedFields) {
- ((CheckBox) mView.findViewById(R.id.wifi_advanced_togglebox)).setChecked(true);
+ ((CheckBox)mView.findViewById(R.id.wifi_advanced_togglebox)).setChecked(true);
mView.findViewById(R.id.wifi_advanced_fields).setVisibility(View.VISIBLE);
}
}
@@ -555,7 +560,8 @@ public class WifiConfigController implements TextWatcher,
if (mPasswordView == null) {
mPasswordView = (TextView) mView.findViewById(R.id.password);
mPasswordView.addTextChangedListener(this);
- ((CheckBox) mView.findViewById(R.id.show_password)).setOnClickListener(this);
+ ((CheckBox) mView.findViewById(R.id.show_password))
+ .setOnCheckedChangeListener(this);
if (mAccessPoint != null && mAccessPoint.networkId != INVALID_NETWORK_ID) {
mPasswordView.setHint(R.string.wifi_unchanged);
@@ -864,18 +870,18 @@ public class WifiConfigController implements TextWatcher,
}
@Override
- public void onClick(View view) {
+ public void onCheckedChanged(CompoundButton view, boolean isChecked) {
if (view.getId() == R.id.show_password) {
int pos = mPasswordView.getSelectionEnd();
mPasswordView.setInputType(
- InputType.TYPE_CLASS_TEXT | (((CheckBox) view).isChecked() ?
+ InputType.TYPE_CLASS_TEXT | (isChecked ?
InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD :
InputType.TYPE_TEXT_VARIATION_PASSWORD));
if (pos >= 0) {
((EditText)mPasswordView).setSelection(pos);
}
} else if (view.getId() == R.id.wifi_advanced_togglebox) {
- if (((CheckBox) view).isChecked()) {
+ if (isChecked) {
mView.findViewById(R.id.wifi_advanced_fields).setVisibility(View.VISIBLE);
} else {
mView.findViewById(R.id.wifi_advanced_fields).setVisibility(View.GONE);