Show password field when authentication failed.

- add onAuthenticationFailure() method to prepare
  appropriate UIs.
- set "edit" boolean to true so that users can modify
  password when re-seleting a network.
- keep mStatusText shown for simplicity. It has been hidden
  during "editing" phase, but we don't need to do that any more
- modify Connect button handling so that the button
  hides/appears at appropriate time
- manage visibility state of some fields so that
  we can "reset" the status when authentication failed
- show keyboard again when password field re-appears

Bug: 3330109
Change-Id: I1cdf0573280ab46882117e21501a43a447e50b40
This commit is contained in:
Daisuke Miyakawa
2011-01-09 11:55:45 -08:00
parent e43bc7ee22
commit cde3083fb5
3 changed files with 134 additions and 28 deletions

View File

@@ -75,21 +75,28 @@ public class WifiConfigUiForSetupWizardXL implements WifiConfigUiBase, OnFocusCh
// R.id.security_fields is the only parent for possible EditTexts. Possibly we need to
// check parentand detect visibility manually.
if (mView.findViewById(R.id.security_fields).getVisibility() == View.VISIBLE) {
// Set Focus to password View.
final View viewToBeFocused = mView.findViewById(R.id.password);
if (viewToBeFocused == null) {
Log.w(TAG, "password field to be focused not found.");
} else if (!(viewToBeFocused instanceof EditText)) {
Log.w(TAG, "password field is not EditText");
} else {
// After acquiring the focus, we show software keyboard.
viewToBeFocused.setOnFocusChangeListener(this);
final boolean requestFocusResult = viewToBeFocused.requestFocus();
Log.i(TAG, String.format("Focus request %s.",
(requestFocusResult ? "successful" : "failed")));
if (!requestFocusResult) {
viewToBeFocused.setOnFocusChangeListener(null);
}
requestFocusAndShowKeyboard(R.id.password);
}
}
/**
* @param editViewId must be EditView
*/
public void requestFocusAndShowKeyboard(int editViewId) {
// Set Focus to password View.
final View viewToBeFocused = mView.findViewById(editViewId);
if (viewToBeFocused == null) {
Log.w(TAG, "password field to be focused not found.");
} else if (!(viewToBeFocused instanceof EditText)) {
Log.w(TAG, "password field is not EditText");
} else {
// After acquiring the focus, we show software keyboard.
viewToBeFocused.setOnFocusChangeListener(this);
final boolean requestFocusResult = viewToBeFocused.requestFocus();
Log.i(TAG, String.format("Focus request %s.",
(requestFocusResult ? "successful" : "failed")));
if (!requestFocusResult) {
viewToBeFocused.setOnFocusChangeListener(null);
}
}
}