resolved conflicts for merge of 4d9f670b to stage-aosp-master

Change-Id: Ia5bb368dbbd857c6e201b821ae7c03a9f6f5006b
This commit is contained in:
Robert Greenwalt
2013-07-18 20:52:47 -07:00

View File

@@ -50,10 +50,10 @@ import android.widget.ArrayAdapter;
import android.widget.Button; import android.widget.Button;
import android.widget.CheckBox; import android.widget.CheckBox;
import android.widget.CompoundButton; import android.widget.CompoundButton;
import android.widget.CompoundButton.OnCheckedChangeListener;
import android.widget.EditText; import android.widget.EditText;
import android.widget.Spinner; import android.widget.Spinner;
import android.widget.TextView; import android.widget.TextView;
import android.widget.CompoundButton.OnCheckedChangeListener;
import com.android.settings.ProxySelector; import com.android.settings.ProxySelector;
import com.android.settings.R; import com.android.settings.R;
@@ -66,7 +66,7 @@ import java.util.Iterator;
* share the logic for controlling buttons, text fields, etc. * share the logic for controlling buttons, text fields, etc.
*/ */
public class WifiConfigController implements TextWatcher, public class WifiConfigController implements TextWatcher,
View.OnClickListener, AdapterView.OnItemSelectedListener { AdapterView.OnItemSelectedListener, OnCheckedChangeListener {
private final WifiConfigUiBase mConfigUi; private final WifiConfigUiBase mConfigUi;
private final View mView; private final View mView;
private final AccessPoint mAccessPoint; private final AccessPoint mAccessPoint;
@@ -78,7 +78,6 @@ public class WifiConfigController implements TextWatcher,
// e.g. AccessPoint.SECURITY_NONE // e.g. AccessPoint.SECURITY_NONE
private int mAccessPointSecurity; private int mAccessPointSecurity;
private TextView mPasswordView; private TextView mPasswordView;
private CheckBox mShowPassword;
private String unspecifiedCert = "unspecified"; private String unspecifiedCert = "unspecified";
private static final int unspecifiedCertIndex = 0; private static final int unspecifiedCertIndex = 0;
@@ -194,7 +193,9 @@ public class WifiConfigController implements TextWatcher,
showIpConfigFields(); showIpConfigFields();
showProxyFields(); showProxyFields();
mView.findViewById(R.id.wifi_advanced_toggle).setVisibility(View.VISIBLE); 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)); mConfigUi.setSubmitButton(context.getString(R.string.wifi_save));
} else { } else {
@@ -248,9 +249,10 @@ public class WifiConfigController implements TextWatcher,
showIpConfigFields(); showIpConfigFields();
showProxyFields(); showProxyFields();
mView.findViewById(R.id.wifi_advanced_toggle).setVisibility(View.VISIBLE); 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) { 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); mView.findViewById(R.id.wifi_advanced_fields).setVisibility(View.VISIBLE);
} }
} }
@@ -558,13 +560,9 @@ public class WifiConfigController implements TextWatcher,
if (mPasswordView == null) { if (mPasswordView == null) {
mPasswordView = (TextView) mView.findViewById(R.id.password); mPasswordView = (TextView) mView.findViewById(R.id.password);
mPasswordView.addTextChangedListener(this); mPasswordView.addTextChangedListener(this);
mShowPassword = (CheckBox) mView.findViewById(R.id.show_password); ((CheckBox) mView.findViewById(R.id.show_password))
mShowPassword.setOnClickListener(this); .setOnCheckedChangeListener(this);
mShowPassword.setOnCheckedChangeListener(new OnCheckedChangeListener() {
public void onCheckedChanged(CompoundButton buttonView, boolean isChecked) {
updatePasswordVisibility(isChecked);
}
});
if (mAccessPoint != null && mAccessPoint.networkId != INVALID_NETWORK_ID) { if (mAccessPoint != null && mAccessPoint.networkId != INVALID_NETWORK_ID) {
mPasswordView.setHint(R.string.wifi_unchanged); mPasswordView.setHint(R.string.wifi_unchanged);
} }
@@ -872,11 +870,18 @@ public class WifiConfigController implements TextWatcher,
} }
@Override @Override
public void onClick(View view) { public void onCheckedChanged(CompoundButton view, boolean isChecked) {
if (view.getId() == R.id.show_password) { if (view.getId() == R.id.show_password) {
updatePasswordVisibility(((CheckBox) view).isChecked()); int pos = mPasswordView.getSelectionEnd();
mPasswordView.setInputType(
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) { } 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); mView.findViewById(R.id.wifi_advanced_fields).setVisibility(View.VISIBLE);
} else { } else {
mView.findViewById(R.id.wifi_advanced_fields).setVisibility(View.GONE); mView.findViewById(R.id.wifi_advanced_fields).setVisibility(View.GONE);