Donate to e Foundation | Murena handsets with /e/OS | Own a part of Murena! Learn more

Commit ee5d5bc3 authored by kaiyiz's avatar kaiyiz Committed by Xiaojing Zhang
Browse files

Settings: Fix password display not correct

Rotate the DUT,dialog will be created again.

After rotate the DUT,refresh password.

CRs-Fixed: 741078

Change-Id: Ib59aa1eca5debfc7098fc378e59c2081fb68c5ad
parent 20d057f3
Loading
Loading
Loading
Loading
+14 −1
Original line number Diff line number Diff line
@@ -53,6 +53,7 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener,
    private TextView mSsid;
    private int mSecurityTypeIndex = OPEN_INDEX;
    private EditText mPassword;
    private CheckBox mCheckBox;

    WifiConfiguration mWifiConfig;

@@ -117,6 +118,7 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener,
        mView.findViewById(R.id.type).setVisibility(View.VISIBLE);
        mSsid = (TextView) mView.findViewById(R.id.ssid);
        mPassword = (EditText) mView.findViewById(R.id.password);
        mCheckBox = (CheckBox) mView.findViewById(R.id.show_password);

        setButton(BUTTON_SUBMIT, context.getString(R.string.wifi_save), mListener);
        setButton(DialogInterface.BUTTON_NEGATIVE,
@@ -132,7 +134,7 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener,

        mSsid.addTextChangedListener(this);
        mPassword.addTextChangedListener(this);
        ((CheckBox) mView.findViewById(R.id.show_password)).setOnClickListener(this);
        mCheckBox.setOnClickListener(this);
        mSecurity.setOnItemSelectedListener(this);

        super.onCreate(savedInstanceState);
@@ -141,6 +143,17 @@ public class WifiApDialog extends AlertDialog implements View.OnClickListener,
        validate();
    }

    @Override
    public void onRestoreInstanceState(Bundle savedInstanceState) {
        super.onRestoreInstanceState(savedInstanceState);
        if (mPassword != null && mCheckBox != null) {
            mPassword.setInputType(
                InputType.TYPE_CLASS_TEXT | (mCheckBox.isChecked() ?
                InputType.TYPE_TEXT_VARIATION_VISIBLE_PASSWORD :
                InputType.TYPE_TEXT_VARIATION_PASSWORD));
        }
    }

    private void validate() {
        if ((mSsid != null && mSsid.length() == 0) ||
                   ((mSecurityTypeIndex == WPA2_INDEX)&&